This commit is contained in:
Quaternions 2024-07-22 12:29:20 -07:00
parent ec7ba16f25
commit f788b0e924
2 changed files with 4 additions and 2 deletions

View File

@ -463,7 +463,9 @@ impl GraphicsState{
instance_count+=model.instances.len(); instance_count+=model.instances.len();
for instances_chunk in model.instances.rchunks(chunk_size){ for instances_chunk in model.instances.rchunks(chunk_size){
model_count+=1; model_count+=1;
let model_uniforms=get_instances_buffer_data(instances_chunk); let mut model_uniforms=get_instances_buffer_data(instances_chunk);
//TEMP: fill with zeroes to pass validation
model_uniforms.resize(MODEL_BUFFER_SIZE*512,0.0f32);
let model_buf=device.create_buffer_init(&wgpu::util::BufferInitDescriptor{ let model_buf=device.create_buffer_init(&wgpu::util::BufferInitDescriptor{
label:Some(format!("Model{} Buf",model_count).as_str()), label:Some(format!("Model{} Buf",model_count).as_str()),
contents:bytemuck::cast_slice(&model_uniforms), contents:bytemuck::cast_slice(&model_uniforms),

View File

@ -48,7 +48,7 @@ struct ModelInstance{
//my fancy idea is to create a megatexture for each model that includes all the textures each intance will need //my fancy idea is to create a megatexture for each model that includes all the textures each intance will need
//the texture transform then maps the texture coordinates to the location of the specific texture //the texture transform then maps the texture coordinates to the location of the specific texture
//group 1 is the model //group 1 is the model
const MAX_MODEL_INSTANCES=4096; const MAX_MODEL_INSTANCES=512;
@group(2) @group(2)
@binding(0) @binding(0)
var<uniform> model_instances: array<ModelInstance, MAX_MODEL_INSTANCES>; var<uniform> model_instances: array<ModelInstance, MAX_MODEL_INSTANCES>;