From 0f4839c46627437006f6cb6f2f4f804eb5b5cd2d Mon Sep 17 00:00:00 2001 From: Christian Legnitto Date: Thu, 28 Mar 2024 13:19:51 -0400 Subject: [PATCH] Include the glsl global name in entrypoint arguments. (#5418) --- naga/src/front/glsl/variables.rs | 2 +- naga/tests/out/wgsl/210-bevy-2d-shader.vert.wgsl | 2 +- naga/tests/out/wgsl/210-bevy-shader.vert.wgsl | 2 +- naga/tests/out/wgsl/246-collatz.comp.wgsl | 8 ++++---- .../tests/out/wgsl/800-out-of-bounds-panic.vert.wgsl | 2 +- naga/tests/out/wgsl/bevy-pbr.frag.wgsl | 12 ++++++------ naga/tests/out/wgsl/bevy-pbr.vert.wgsl | 2 +- naga/tests/out/wgsl/clamp-splat.vert.wgsl | 2 +- naga/tests/out/wgsl/quad_glsl.vert.wgsl | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/naga/src/front/glsl/variables.rs b/naga/src/front/glsl/variables.rs index 5af2b228f0..9d2e7a0e7b 100644 --- a/naga/src/front/glsl/variables.rs +++ b/naga/src/front/glsl/variables.rs @@ -65,7 +65,7 @@ impl Frontend { let idx = self.entry_args.len(); self.entry_args.push(EntryArg { - name: None, + name: Some(name.into()), binding: Binding::BuiltIn(data.builtin), handle, storage: data.storage, diff --git a/naga/tests/out/wgsl/210-bevy-2d-shader.vert.wgsl b/naga/tests/out/wgsl/210-bevy-2d-shader.vert.wgsl index 5a8e54159a..52355cd404 100644 --- a/naga/tests/out/wgsl/210-bevy-2d-shader.vert.wgsl +++ b/naga/tests/out/wgsl/210-bevy-2d-shader.vert.wgsl @@ -12,7 +12,7 @@ struct Sprite_size { struct VertexOutput { @location(0) v_Uv: vec2, - @builtin(position) member: vec4, + @builtin(position) gl_Position: vec4, } var Vertex_Position_1: vec3; diff --git a/naga/tests/out/wgsl/210-bevy-shader.vert.wgsl b/naga/tests/out/wgsl/210-bevy-shader.vert.wgsl index f929543ebf..223538e4e0 100644 --- a/naga/tests/out/wgsl/210-bevy-shader.vert.wgsl +++ b/naga/tests/out/wgsl/210-bevy-shader.vert.wgsl @@ -10,7 +10,7 @@ struct VertexOutput { @location(0) v_Position: vec3, @location(1) v_Normal: vec3, @location(2) v_Uv: vec2, - @builtin(position) member: vec4, + @builtin(position) gl_Position: vec4, } var Vertex_Position_1: vec3; diff --git a/naga/tests/out/wgsl/246-collatz.comp.wgsl b/naga/tests/out/wgsl/246-collatz.comp.wgsl index cd89fd831a..916bb4ae4d 100644 --- a/naga/tests/out/wgsl/246-collatz.comp.wgsl +++ b/naga/tests/out/wgsl/246-collatz.comp.wgsl @@ -4,7 +4,7 @@ struct PrimeIndices { @group(0) @binding(0) var global: PrimeIndices; -var gl_GlobalInvocationID: vec3; +var gl_GlobalInvocationID_1: vec3; fn collatz_iterations(n: u32) -> u32 { var n_1: u32; @@ -41,7 +41,7 @@ fn collatz_iterations(n: u32) -> u32 { fn main_1() { var index: u32; - let _e3 = gl_GlobalInvocationID; + let _e3 = gl_GlobalInvocationID_1; index = _e3.x; let _e6 = index; let _e8 = index; @@ -53,8 +53,8 @@ fn main_1() { } @compute @workgroup_size(1, 1, 1) -fn main(@builtin(global_invocation_id) param: vec3) { - gl_GlobalInvocationID = param; +fn main(@builtin(global_invocation_id) gl_GlobalInvocationID: vec3) { + gl_GlobalInvocationID_1 = gl_GlobalInvocationID; main_1(); return; } diff --git a/naga/tests/out/wgsl/800-out-of-bounds-panic.vert.wgsl b/naga/tests/out/wgsl/800-out-of-bounds-panic.vert.wgsl index 820ab6194c..8d6bc50af0 100644 --- a/naga/tests/out/wgsl/800-out-of-bounds-panic.vert.wgsl +++ b/naga/tests/out/wgsl/800-out-of-bounds-panic.vert.wgsl @@ -8,7 +8,7 @@ struct VertexPushConstants { struct VertexOutput { @location(0) frag_color: vec4, - @builtin(position) member: vec4, + @builtin(position) gl_Position: vec4, } @group(0) @binding(0) diff --git a/naga/tests/out/wgsl/bevy-pbr.frag.wgsl b/naga/tests/out/wgsl/bevy-pbr.frag.wgsl index 81d69d0736..012077791e 100644 --- a/naga/tests/out/wgsl/bevy-pbr.frag.wgsl +++ b/naga/tests/out/wgsl/bevy-pbr.frag.wgsl @@ -93,7 +93,7 @@ var global_7: StandardMaterial_emissive; var StandardMaterial_emissive_texture: texture_2d; @group(3) @binding(14) var StandardMaterial_emissive_texture_sampler: sampler; -var gl_FrontFacing: bool; +var gl_FrontFacing_1: bool; fn pow5_(x: f32) -> f32 { var x_1: f32; @@ -746,7 +746,7 @@ fn main_1() { let _e78 = T; let _e80 = v_WorldTangent_1; B = (cross(_e77, _e78) * _e80.w); - let _e85 = gl_FrontFacing; + let _e85 = gl_FrontFacing_1; if _e85 { let _e86 = N_2; local = _e86; @@ -756,7 +756,7 @@ fn main_1() { } let _e90 = local; N_2 = _e90; - let _e91 = gl_FrontFacing; + let _e91 = gl_FrontFacing_1; if _e91 { let _e92 = T; local_1 = _e92; @@ -766,7 +766,7 @@ fn main_1() { } let _e96 = local_1; T = _e96; - let _e97 = gl_FrontFacing; + let _e97 = gl_FrontFacing_1; if _e97 { let _e98 = B; local_2 = _e98; @@ -921,12 +921,12 @@ fn main_1() { } @fragment -fn main(@location(0) v_WorldPosition: vec3, @location(1) v_WorldNormal: vec3, @location(2) v_Uv: vec2, @location(3) v_WorldTangent: vec4, @builtin(front_facing) param: bool) -> FragmentOutput { +fn main(@location(0) v_WorldPosition: vec3, @location(1) v_WorldNormal: vec3, @location(2) v_Uv: vec2, @location(3) v_WorldTangent: vec4, @builtin(front_facing) gl_FrontFacing: bool) -> FragmentOutput { v_WorldPosition_1 = v_WorldPosition; v_WorldNormal_1 = v_WorldNormal; v_Uv_1 = v_Uv; v_WorldTangent_1 = v_WorldTangent; - gl_FrontFacing = param; + gl_FrontFacing_1 = gl_FrontFacing; main_1(); let _e69 = o_Target; return FragmentOutput(_e69); diff --git a/naga/tests/out/wgsl/bevy-pbr.vert.wgsl b/naga/tests/out/wgsl/bevy-pbr.vert.wgsl index 71cf8d2fe6..1524b9e469 100644 --- a/naga/tests/out/wgsl/bevy-pbr.vert.wgsl +++ b/naga/tests/out/wgsl/bevy-pbr.vert.wgsl @@ -11,7 +11,7 @@ struct VertexOutput { @location(1) v_WorldNormal: vec3, @location(2) v_Uv: vec2, @location(3) v_WorldTangent: vec4, - @builtin(position) member: vec4, + @builtin(position) gl_Position: vec4, } var Vertex_Position_1: vec3; diff --git a/naga/tests/out/wgsl/clamp-splat.vert.wgsl b/naga/tests/out/wgsl/clamp-splat.vert.wgsl index 5dcc28e979..3425e57588 100644 --- a/naga/tests/out/wgsl/clamp-splat.vert.wgsl +++ b/naga/tests/out/wgsl/clamp-splat.vert.wgsl @@ -1,5 +1,5 @@ struct VertexOutput { - @builtin(position) member: vec4, + @builtin(position) gl_Position: vec4, } var a_pos_1: vec2; diff --git a/naga/tests/out/wgsl/quad_glsl.vert.wgsl b/naga/tests/out/wgsl/quad_glsl.vert.wgsl index 5c5ee71041..8942e4c72f 100644 --- a/naga/tests/out/wgsl/quad_glsl.vert.wgsl +++ b/naga/tests/out/wgsl/quad_glsl.vert.wgsl @@ -1,6 +1,6 @@ struct VertexOutput { @location(0) v_uv: vec2, - @builtin(position) member: vec4, + @builtin(position) gl_Position: vec4, } const c_scale: f32 = 1.2f;