Reassign attribute locations for image shader

This commit is contained in:
Jim Eckerlein 2023-09-24 15:26:10 +02:00
parent 5fb877ab59
commit 41dec5bd20
2 changed files with 12 additions and 7 deletions

View file

@ -218,11 +218,16 @@ impl Pipeline {
array_stride: mem::size_of::<Instance>() as u64, array_stride: mem::size_of::<Instance>() as u64,
step_mode: wgpu::VertexStepMode::Instance, step_mode: wgpu::VertexStepMode::Instance,
attributes: &wgpu::vertex_attr_array!( attributes: &wgpu::vertex_attr_array!(
// Position
0 => Float32x2,
// Scale
1 => Float32x2, 1 => Float32x2,
// Atlas position
2 => Float32x2, 2 => Float32x2,
// Atlas scale
3 => Float32x2, 3 => Float32x2,
4 => Float32x2, // Layer
5 => Sint32, 4 => Sint32,
), ),
}], }],
}, },

View file

@ -8,11 +8,11 @@ struct Globals {
struct VertexInput { struct VertexInput {
@builtin(vertex_index) vertex_index: u32, @builtin(vertex_index) vertex_index: u32,
@location(1) pos: vec2<f32>, @location(0) pos: vec2<f32>,
@location(2) scale: vec2<f32>, @location(1) scale: vec2<f32>,
@location(3) atlas_pos: vec2<f32>, @location(2) atlas_pos: vec2<f32>,
@location(4) atlas_scale: vec2<f32>, @location(3) atlas_scale: vec2<f32>,
@location(5) layer: i32, @location(4) layer: i32,
} }
struct VertexOutput { struct VertexOutput {