Skip to content

Commit

Permalink
Include the glsl global name in entrypoint arguments. (#5418)
Browse files Browse the repository at this point in the history
  • Loading branch information
LegNeato authored Mar 28, 2024
1 parent c613fbb commit 0f4839c
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion naga/src/front/glsl/variables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion naga/tests/out/wgsl/210-bevy-2d-shader.vert.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct Sprite_size {

struct VertexOutput {
@location(0) v_Uv: vec2<f32>,
@builtin(position) member: vec4<f32>,
@builtin(position) gl_Position: vec4<f32>,
}

var<private> Vertex_Position_1: vec3<f32>;
Expand Down
2 changes: 1 addition & 1 deletion naga/tests/out/wgsl/210-bevy-shader.vert.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct VertexOutput {
@location(0) v_Position: vec3<f32>,
@location(1) v_Normal: vec3<f32>,
@location(2) v_Uv: vec2<f32>,
@builtin(position) member: vec4<f32>,
@builtin(position) gl_Position: vec4<f32>,
}

var<private> Vertex_Position_1: vec3<f32>;
Expand Down
8 changes: 4 additions & 4 deletions naga/tests/out/wgsl/246-collatz.comp.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ struct PrimeIndices {

@group(0) @binding(0)
var<storage, read_write> global: PrimeIndices;
var<private> gl_GlobalInvocationID: vec3<u32>;
var<private> gl_GlobalInvocationID_1: vec3<u32>;

fn collatz_iterations(n: u32) -> u32 {
var n_1: u32;
Expand Down Expand Up @@ -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;
Expand All @@ -53,8 +53,8 @@ fn main_1() {
}

@compute @workgroup_size(1, 1, 1)
fn main(@builtin(global_invocation_id) param: vec3<u32>) {
gl_GlobalInvocationID = param;
fn main(@builtin(global_invocation_id) gl_GlobalInvocationID: vec3<u32>) {
gl_GlobalInvocationID_1 = gl_GlobalInvocationID;
main_1();
return;
}
2 changes: 1 addition & 1 deletion naga/tests/out/wgsl/800-out-of-bounds-panic.vert.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ struct VertexPushConstants {

struct VertexOutput {
@location(0) frag_color: vec4<f32>,
@builtin(position) member: vec4<f32>,
@builtin(position) gl_Position: vec4<f32>,
}

@group(0) @binding(0)
Expand Down
12 changes: 6 additions & 6 deletions naga/tests/out/wgsl/bevy-pbr.frag.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ var<uniform> global_7: StandardMaterial_emissive;
var StandardMaterial_emissive_texture: texture_2d<f32>;
@group(3) @binding(14)
var StandardMaterial_emissive_texture_sampler: sampler;
var<private> gl_FrontFacing: bool;
var<private> gl_FrontFacing_1: bool;

fn pow5_(x: f32) -> f32 {
var x_1: f32;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -921,12 +921,12 @@ fn main_1() {
}

@fragment
fn main(@location(0) v_WorldPosition: vec3<f32>, @location(1) v_WorldNormal: vec3<f32>, @location(2) v_Uv: vec2<f32>, @location(3) v_WorldTangent: vec4<f32>, @builtin(front_facing) param: bool) -> FragmentOutput {
fn main(@location(0) v_WorldPosition: vec3<f32>, @location(1) v_WorldNormal: vec3<f32>, @location(2) v_Uv: vec2<f32>, @location(3) v_WorldTangent: vec4<f32>, @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);
Expand Down
2 changes: 1 addition & 1 deletion naga/tests/out/wgsl/bevy-pbr.vert.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct VertexOutput {
@location(1) v_WorldNormal: vec3<f32>,
@location(2) v_Uv: vec2<f32>,
@location(3) v_WorldTangent: vec4<f32>,
@builtin(position) member: vec4<f32>,
@builtin(position) gl_Position: vec4<f32>,
}

var<private> Vertex_Position_1: vec3<f32>;
Expand Down
2 changes: 1 addition & 1 deletion naga/tests/out/wgsl/clamp-splat.vert.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct VertexOutput {
@builtin(position) member: vec4<f32>,
@builtin(position) gl_Position: vec4<f32>,
}

var<private> a_pos_1: vec2<f32>;
Expand Down
2 changes: 1 addition & 1 deletion naga/tests/out/wgsl/quad_glsl.vert.wgsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
struct VertexOutput {
@location(0) v_uv: vec2<f32>,
@builtin(position) member: vec4<f32>,
@builtin(position) gl_Position: vec4<f32>,
}

const c_scale: f32 = 1.2f;
Expand Down

0 comments on commit 0f4839c

Please sign in to comment.