revert storage buffers: no igpus support

This commit is contained in:
Quaternions 2023-09-25 19:20:36 -07:00
parent b513e4037d
commit c868a91a06
2 changed files with 4 additions and 6 deletions

View File

@ -222,7 +222,7 @@ impl GraphicsData {
let model_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { let model_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: Some(format!("ModelGraphics{}",i).as_str()), label: Some(format!("ModelGraphics{}",i).as_str()),
contents: bytemuck::cast_slice(&model_uniforms), contents: bytemuck::cast_slice(&model_uniforms),
usage: wgpu::BufferUsages::STORAGE | wgpu::BufferUsages::COPY_DST, usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST,
}); });
let model_bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor { let model_bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
layout: &self.bind_group_layouts.model, layout: &self.bind_group_layouts.model,
@ -331,9 +331,6 @@ impl framework::Example for GraphicsData {
| wgpu::Features::TEXTURE_COMPRESSION_ETC2 | wgpu::Features::TEXTURE_COMPRESSION_ETC2
| wgpu::Features::TEXTURE_COMPRESSION_BC | wgpu::Features::TEXTURE_COMPRESSION_BC
} }
fn required_features() -> wgpu::Features {
wgpu::Features::STORAGE_RESOURCE_BINDING_ARRAY
}
fn required_limits() -> wgpu::Limits { fn required_limits() -> wgpu::Limits {
wgpu::Limits::default() //framework.rs was using goofy limits that caused me a multi-day headache wgpu::Limits::default() //framework.rs was using goofy limits that caused me a multi-day headache
} }
@ -498,7 +495,7 @@ impl framework::Example for GraphicsData {
binding: 0, binding: 0,
visibility: wgpu::ShaderStages::VERTEX, visibility: wgpu::ShaderStages::VERTEX,
ty: wgpu::BindingType::Buffer { ty: wgpu::BindingType::Buffer {
ty: wgpu::BufferBindingType::Storage { read_only: true }, ty: wgpu::BufferBindingType::Uniform,
has_dynamic_offset: false, has_dynamic_offset: false,
min_binding_size: None, min_binding_size: None,
}, },

View File

@ -49,9 +49,10 @@ 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;
@group(1) @group(1)
@binding(0) @binding(0)
var<storage> model_instances: array<ModelInstance>; var<uniform> model_instances: array<ModelInstance, MAX_MODEL_INSTANCES>;
@group(1) @group(1)
@binding(1) @binding(1)
var model_texture: texture_2d<f32>; var model_texture: texture_2d<f32>;