Skip to content

Commit

Permalink
wgpu: Do not use 'packed' as variable name in WGSL shaders
Browse files Browse the repository at this point in the history
Turns out that 'packed' is a keyword in some GLSL shaders,
and naga currently preserves it, producing a syntax error.

As a workaround, this patch renames the variable to something else.
  • Loading branch information
kjarosh committed Jun 21, 2024
1 parent 036839f commit c8cce84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions render/wgpu/shaders/filter/displacement_map.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ fn main_vertex(in: VertexInput) -> VertexOutput {
return VertexOutput(pos, in.uv);
}

fn unpack_components(packed: u32) -> vec2<u32> {
return vec2<u32>(packed >> 8u, packed & 15u);
fn unpack_components(packed_components: u32) -> vec2<u32> {
return vec2<u32>(packed_components >> 8u, packed_components & 15u);
}

fn get_component(map: vec4<f32>, component: u32) -> f32 {
Expand Down

0 comments on commit c8cce84

Please sign in to comment.