From 8fc87a59ce45ea029f9978130906646e05ae57f7 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 26 Sep 2023 17:54:52 -0700 Subject: [PATCH] chunk instances according to limits --- src/main.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index b554710f..779b9f9d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -215,11 +215,14 @@ impl GraphicsData { } //drain the modeldata vec so entities can be /moved/ to models.entities let mut instance_count=0; + let uniform_buffer_binding_size=::required_limits().max_uniform_buffer_binding_size as usize; + let chunk_size=uniform_buffer_binding_size/MODEL_BUFFER_SIZE_BYTES; self.models.reserve(modeldatas.len()); for (i,modeldata) in modeldatas.drain(..).enumerate() { let n_instances=modeldata.instances.len(); - if 0(); +const MODEL_BUFFER_SIZE_BYTES:usize=MODEL_BUFFER_SIZE*4; fn get_instances_buffer_data(instances:&[ModelInstance]) -> Vec { let mut raw = Vec::with_capacity(MODEL_BUFFER_SIZE*instances.len()); for (i,mi) in instances.iter().enumerate(){