Skip to content

Commit

Permalink
Permit non-struct, non-array types as buffers.
Browse files Browse the repository at this point in the history
Fixes #2583.
  • Loading branch information
jimblandy committed Apr 7, 2022
1 parent 988990c commit 41a2f03
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
10 changes: 3 additions & 7 deletions wgpu-core/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -868,9 +868,6 @@ impl Interface {
_ => continue,
};
let ty = match module.types[var.ty].inner {
naga::TypeInner::Struct { members: _, span } => ResourceType::Buffer {
size: wgt::BufferSize::new(span as u64).unwrap(),
},
naga::TypeInner::Image {
dim,
arrayed,
Expand All @@ -884,10 +881,9 @@ impl Interface {
naga::TypeInner::Array { stride, .. } => ResourceType::Buffer {
size: wgt::BufferSize::new(stride as u64).unwrap(),
},
ref other => {
log::error!("Unexpected resource type: {:?}", other);
continue;
}
ref other => ResourceType::Buffer {
size: wgt::BufferSize::new(other.size(&module.constants) as u64).unwrap(),
},
};
let handle = resources.append(
Resource {
Expand Down
7 changes: 2 additions & 5 deletions wgpu/examples/cube/shader.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ struct VertexOutput {
@builtin(position) position: vec4<f32>,
};

struct Locals {
transform: mat4x4<f32>
};
@group(0)
@binding(0)
var<uniform> r_locals: Locals;
var<uniform> transform: mat4x4<f32>;

@stage(vertex)
fn vs_main(
Expand All @@ -17,7 +14,7 @@ fn vs_main(
) -> VertexOutput {
var out: VertexOutput;
out.tex_coord = tex_coord;
out.position = r_locals.transform * position;
out.position = transform * position;
return out;
}

Expand Down

0 comments on commit 41a2f03

Please sign in to comment.