diff --git a/src/main.rs b/src/main.rs index 564f948..6dc4c84 100644 --- a/src/main.rs +++ b/src/main.rs @@ -218,7 +218,7 @@ impl GraphicsData { let model_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { label: Some(format!("ModelGraphics{}",i).as_str()), contents: bytemuck::cast_slice(&model_uniforms), - usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST, + usage: wgpu::BufferUsages::STORAGE | wgpu::BufferUsages::COPY_DST, }); let model_bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor { layout: &self.bind_group_layouts.model, @@ -321,7 +321,12 @@ impl strafe_client::framework::Example for GraphicsData { | wgpu::Features::TEXTURE_COMPRESSION_ETC2 | wgpu::Features::TEXTURE_COMPRESSION_BC } - + fn required_features() -> wgpu::Features { + wgpu::Features::STORAGE_RESOURCE_BINDING_ARRAY + } + fn required_limits() -> wgpu::Limits { + wgpu::Limits::default() //framework.rs was using goofy limits that caused me a multi-day headache + } fn init( config: &wgpu::SurfaceConfiguration, _adapter: &wgpu::Adapter, @@ -462,7 +467,7 @@ impl strafe_client::framework::Example for GraphicsData { binding: 0, visibility: wgpu::ShaderStages::VERTEX, ty: wgpu::BindingType::Buffer { - ty: wgpu::BufferBindingType::Uniform, + ty: wgpu::BufferBindingType::Storage { read_only: true }, has_dynamic_offset: false, min_binding_size: None, }, diff --git a/src/shader.wgsl b/src/shader.wgsl index a2f1fe7..0126080 100644 --- a/src/shader.wgsl +++ b/src/shader.wgsl @@ -41,12 +41,11 @@ fn vs_sky(@builtin(vertex_index) vertex_index: u32) -> SkyOutput { return result; } -const MAX_ENTITY_INSTANCES=1024; //group 1 is the model @group(1) @binding(0) -var entity_transforms: array,MAX_ENTITY_INSTANCES>; -//var entity_texture_transforms: array,MAX_ENTITY_INSTANCES>; +var entity_transforms: array>; +//entity_texture_transforms: mat3x3; //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 //how to do no texture?