[wgsl-out] Update entry point stage attributes

This commit is contained in:
Igor Shaposhnik
2022-04-15 12:55:38 +03:00
committed by João Capucho
parent fbb77aa0dc
commit 1720725014
57 changed files with 75 additions and 75 deletions

View File

@@ -347,7 +347,7 @@ impl<W: Write> Writer<W> {
ShaderStage::Fragment => "fragment",
ShaderStage::Compute => "compute",
};
write!(self.out, "@stage({}) ", stage_str)?;
write!(self.out, "@{} ", stage_str)?;
}
Attribute::WorkGroupSize(size) => {
write!(

View File

@@ -21,7 +21,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@location(0) v_Uv: vec2<f32>) -> FragmentOutput {
v_Uv_1 = v_Uv;
main_1();

View File

@@ -42,7 +42,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main(@location(0) Vertex_Position: vec3<f32>, @location(1) Vertex_Normal: vec3<f32>, @location(2) Vertex_Uv: vec2<f32>) -> VertexOutput {
Vertex_Position_1 = Vertex_Position;
Vertex_Normal_1 = Vertex_Normal;

View File

@@ -43,7 +43,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main(@location(0) Vertex_Position: vec3<f32>, @location(1) Vertex_Normal: vec3<f32>, @location(2) Vertex_Uv: vec2<f32>) -> VertexOutput {
Vertex_Position_1 = Vertex_Position;
Vertex_Normal_1 = Vertex_Normal;

View File

@@ -51,7 +51,7 @@ fn main_1() {
return;
}
@stage(compute) @workgroup_size(1, 1, 1)
@compute @workgroup_size(1, 1, 1)
fn main(@builtin(global_invocation_id) param: vec3<u32>) {
gl_GlobalInvocationID = param;
main_1();

View File

@@ -3,7 +3,7 @@ fn main_1() {
}
@stage(vertex)
@vertex
fn main() {
main_1();
return;

View File

@@ -4,7 +4,7 @@ fn main_1() {
let _e1 = f32(1);
}
@stage(vertex)
@vertex
fn main() {
main_1();
return;

View File

@@ -2,7 +2,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main() {
main_1();
return;

View File

@@ -32,7 +32,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main(@location(0) position: vec2<f32>, @location(1) color: vec4<f32>) -> VertexOutput {
position_1 = position;
color_1 = color;

View File

@@ -8,7 +8,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main() {
main_1();
return;

View File

@@ -61,7 +61,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main() {
main_1();
return;

View File

@@ -5,7 +5,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main() {
main_1();
return;

View File

@@ -6,7 +6,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main() {
main_1();
return;

View File

@@ -16,7 +16,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main() {
main_1();
return;

View File

@@ -78,7 +78,7 @@ fn test_arr_as_arg(a: array<array<f32,10>,5>) -> f32 {
return a[4][9];
}
@stage(vertex)
@vertex
fn foo_vert(@builtin(vertex_index) vi: u32) -> @builtin(position) vec4<f32> {
var foo: f32 = 0.0;
var c: array<i32,5>;
@@ -101,7 +101,7 @@ fn foo_vert(@builtin(vertex_index) vi: u32) -> @builtin(position) vec4<f32> {
return vec4<f32>((matrix * vec4<f32>(vec4<i32>(value))), 2.0);
}
@stage(fragment)
@fragment
fn foo_frag() -> @location(0) vec4<f32> {
bar.matrix[1][2] = 1.0;
bar.matrix = mat4x3<f32>(vec3<f32>(0.0), vec3<f32>(1.0), vec3<f32>(2.0), vec3<f32>(3.0));
@@ -110,7 +110,7 @@ fn foo_frag() -> @location(0) vec4<f32> {
return vec4<f32>(0.0);
}
@stage(compute) @workgroup_size(1, 1, 1)
@compute @workgroup_size(1, 1, 1)
fn atomics() {
var tmp: i32;

View File

@@ -895,7 +895,7 @@ fn main_1() {
return;
}
@stage(fragment)
@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 {
v_WorldPosition_1 = v_WorldPosition;
v_WorldNormal_1 = v_WorldNormal;

View File

@@ -52,7 +52,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main(@location(0) Vertex_Position: vec3<f32>, @location(1) Vertex_Normal: vec3<f32>, @location(2) Vertex_Uv: vec2<f32>, @location(3) Vertex_Tangent: vec4<f32>) -> VertexOutput {
Vertex_Position_1 = Vertex_Position;
Vertex_Normal_1 = Vertex_Normal;

View File

@@ -180,7 +180,7 @@ fn main1() {
return;
}
@stage(fragment)
@fragment
fn main() {
main1();
return;

View File

@@ -1,4 +1,4 @@
@stage(compute) @workgroup_size(1, 1, 1)
@compute @workgroup_size(1, 1, 1)
fn main() {
var i: i32 = 0;
var i2_: vec2<i32>;

View File

@@ -105,7 +105,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main() {
main_1();
return;

View File

@@ -26,7 +26,7 @@ var<storage> particlesSrc: Particles;
@group(0) @binding(2)
var<storage, read_write> particlesDst: Particles;
@stage(compute) @workgroup_size(64, 1, 1)
@compute @workgroup_size(64, 1, 1)
fn main(@builtin(global_invocation_id) global_invocation_id: vec3<u32>) {
var vPos: vec2<f32>;
var vVel: vec2<f32>;

View File

@@ -37,7 +37,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main() -> FragmentOutput {
main_1();
let _e3 = o_color;

View File

@@ -30,7 +30,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main() {
main_1();
return;

View File

@@ -12,7 +12,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main(@location(0) a_pos: vec2<f32>) -> VertexOutput {
a_pos_1 = a_pos;
main_1();

View File

@@ -31,7 +31,7 @@ fn collatz_iterations(n_base: u32) -> u32 {
return _e24;
}
@stage(compute) @workgroup_size(1, 1, 1)
@compute @workgroup_size(1, 1, 1)
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
let _e8 = v_indices.data[global_id.x];
let _e9 = collatz_iterations(_e8);

View File

@@ -33,7 +33,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main() {
main_1();
return;

View File

@@ -30,7 +30,7 @@ fn loop_switch_continue(x: i32) {
return;
}
@stage(compute) @workgroup_size(1, 1, 1)
@compute @workgroup_size(1, 1, 1)
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
var pos: i32;

View File

@@ -44,7 +44,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main(@location(0) position: vec2<f32>, @location(1) a: vec2<f32>, @location(2) in_array: vec4<f32>, @location(3) in_array_1: vec4<f32>) -> VertexOutput {
vert.position = position;
vert.a = a;

View File

@@ -11,7 +11,7 @@ fn function_() {
return;
}
@stage(compute) @workgroup_size(64, 1, 1)
@compute @workgroup_size(64, 1, 1)
fn main() {
function_();
}

View File

@@ -1,4 +1,4 @@
@stage(compute) @workgroup_size(1, 1, 1)
@compute @workgroup_size(1, 1, 1)
fn main() {
return;
}

View File

@@ -316,7 +316,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main() -> FragmentOutput {
main_1();
let _e5 = o_color;

View File

@@ -10,7 +10,7 @@ struct FragmentIn {
var<push_constant> pc: PushConstants;
@stage(fragment)
@fragment
fn main(in: FragmentIn) -> @location(0) vec4<f32> {
let _e4 = pc.index;
if (in.primitive_index == _e4) {

View File

@@ -41,7 +41,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main() -> FragmentOutput {
main_1();
let _e3 = o_color;

View File

@@ -16,7 +16,7 @@ fn test_integer_dot_product() -> i32 {
return c_4_;
}
@stage(compute) @workgroup_size(1, 1, 1)
@compute @workgroup_size(1, 1, 1)
fn main() {
let _e0 = test_fma();
let _e1 = test_integer_dot_product();

View File

@@ -6,7 +6,7 @@ fn main_1() {
let _e2 = i;
}
@stage(vertex)
@vertex
fn main() {
main_1();
return;

View File

@@ -40,7 +40,7 @@ fn test_msl_packed_vec3_() {
let unnamed_5 = (2.0 * data.v3_);
}
@stage(compute) @workgroup_size(1, 1, 1)
@compute @workgroup_size(1, 1, 1)
fn main() {
var Foo_1: f32 = 1.0;
var at: bool = true;

View File

@@ -37,7 +37,7 @@ var image_2d_depth: texture_depth_2d;
@group(1) @binding(3)
var image_cube_depth: texture_depth_cube;
@stage(compute) @workgroup_size(16, 1, 1)
@compute @workgroup_size(16, 1, 1)
fn main(@builtin(local_invocation_id) local_id: vec3<u32>) {
let dim = textureDimensions(image_storage_src);
let itc = ((dim * vec2<i32>(local_id.xy)) % vec2<i32>(10, 20));
@@ -50,7 +50,7 @@ fn main(@builtin(local_invocation_id) local_id: vec3<u32>) {
return;
}
@stage(compute) @workgroup_size(16, 1, 1)
@compute @workgroup_size(16, 1, 1)
fn depth_load(@builtin(local_invocation_id) local_id_1: vec3<u32>) {
let dim_1 = textureDimensions(image_storage_src);
let itc_1 = ((dim_1 * vec2<i32>(local_id_1.xy)) % vec2<i32>(10, 20));
@@ -59,7 +59,7 @@ fn depth_load(@builtin(local_invocation_id) local_id_1: vec3<u32>) {
return;
}
@stage(vertex)
@vertex
fn queries() -> @builtin(position) vec4<f32> {
let dim_1d = textureDimensions(image_1d);
let dim_1d_lod = textureDimensions(image_1d, i32(dim_1d));
@@ -78,7 +78,7 @@ fn queries() -> @builtin(position) vec4<f32> {
return vec4<f32>(f32(sum));
}
@stage(vertex)
@vertex
fn levels_queries() -> @builtin(position) vec4<f32> {
let num_levels_2d = textureNumLevels(image_2d);
let num_levels_2d_array = textureNumLevels(image_2d_array);
@@ -92,7 +92,7 @@ fn levels_queries() -> @builtin(position) vec4<f32> {
return vec4<f32>(f32(sum_1));
}
@stage(fragment)
@fragment
fn sample() -> @location(0) vec4<f32> {
let tc = vec2<f32>(0.5);
let s1d = textureSample(image_1d, sampler_reg, tc.x);
@@ -104,7 +104,7 @@ fn sample() -> @location(0) vec4<f32> {
return ((((s1d + s2d) + s2d_offset) + s2d_level) + s2d_level_offset);
}
@stage(fragment)
@fragment
fn sample_comparison() -> @location(0) f32 {
let tc_1 = vec2<f32>(0.5);
let s2d_depth = textureSampleCompare(image_2d_depth, sampler_cmp, tc_1, 0.5);
@@ -113,7 +113,7 @@ fn sample_comparison() -> @location(0) f32 {
return (s2d_depth + s2d_depth_level);
}
@stage(fragment)
@fragment
fn gather() -> @location(0) vec4<f32> {
let tc_2 = vec2<f32>(0.5);
let s2d_1 = textureGather(1, image_2d, sampler_reg, tc_2);
@@ -123,7 +123,7 @@ fn gather() -> @location(0) vec4<f32> {
return (((s2d_1 + s2d_offset_1) + s2d_depth_1) + s2d_depth_offset);
}
@stage(fragment)
@fragment
fn depth_no_comparison() -> @location(0) vec4<f32> {
let tc_3 = vec2<f32>(0.5);
let s2d_2 = textureSample(image_2d_depth, sampler_reg, tc_3);

View File

@@ -137,7 +137,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main() {
main_1();
return;

View File

@@ -19,26 +19,26 @@ struct Input2_ {
var<workgroup> output: array<u32,1>;
@stage(vertex)
@vertex
fn vertex(@builtin(vertex_index) vertex_index: u32, @builtin(instance_index) instance_index: u32, @location(10) color: u32) -> VertexOutput {
let tmp: u32 = ((vertex_index + instance_index) + color);
return VertexOutput(vec4<f32>(1.0), f32(tmp));
}
@stage(fragment)
@fragment
fn fragment(in: VertexOutput, @builtin(front_facing) front_facing: bool, @builtin(sample_index) sample_index: u32, @builtin(sample_mask) sample_mask: u32) -> FragmentOutput {
let mask: u32 = (sample_mask & (1u << sample_index));
let color_1: f32 = select(0.0, 1.0, front_facing);
return FragmentOutput(in.varying, mask, color_1);
}
@stage(compute) @workgroup_size(1, 1, 1)
@compute @workgroup_size(1, 1, 1)
fn compute(@builtin(global_invocation_id) global_id: vec3<u32>, @builtin(local_invocation_id) local_id: vec3<u32>, @builtin(local_invocation_index) local_index: u32, @builtin(workgroup_id) wg_id: vec3<u32>, @builtin(num_workgroups) num_wgs: vec3<u32>) {
output[0] = ((((global_id.x + local_id.x) + local_index) + wg_id.x) + num_wgs.x);
return;
}
@stage(vertex)
@vertex
fn vertex_two_structs(in1_: Input1_, in2_: Input2_) -> @builtin(position) @invariant vec4<f32> {
var index: u32 = 2u;

View File

@@ -9,7 +9,7 @@ struct FragmentInput {
@location(6) @interpolate(perspective, sample) perspective_sample: f32,
}
@stage(vertex)
@vertex
fn vert_main() -> FragmentInput {
var out: FragmentInput;
@@ -25,7 +25,7 @@ fn vert_main() -> FragmentInput {
return _e30;
}
@stage(fragment)
@fragment
fn frag_main(val: FragmentInput) {
return;
}

View File

@@ -14,7 +14,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main() {
main_1();
}

View File

@@ -25,7 +25,7 @@ fn main_1() {
let _e129 = vec4<f32>(f32(1));
}
@stage(vertex)
@vertex
fn main() {
main_1();
return;

View File

@@ -154,7 +154,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main() {
main_1();
return;

View File

@@ -1,4 +1,4 @@
@stage(vertex)
@vertex
fn main() {
let v = vec4<f32>(0.0);
let a = degrees(1.0);

View File

@@ -235,7 +235,7 @@ fn assignment() {
return;
}
@stage(compute) @workgroup_size(1, 1, 1)
@compute @workgroup_size(1, 1, 1)
fn main() {
let _e4 = builtins();
let _e5 = splat();

View File

@@ -24,7 +24,7 @@ var<uniform> input2_: Test2_;
@group(0) @binding(2)
var<uniform> input3_: Test3_;
@stage(vertex)
@vertex
fn vertex() -> @builtin(position) vec4<f32> {
let _e6 = input.b;
let _e9 = input2_.b;

View File

@@ -33,7 +33,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main() {
main_1();
return;

View File

@@ -20,7 +20,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main(@location(1) a_uv: vec2<f32>, @location(0) a_pos: vec2<f32>) -> VertexOutput {
a_uv_1 = a_uv;
a_pos_1 = a_pos;

View File

@@ -10,12 +10,12 @@ var u_texture: texture_2d<f32>;
@group(0) @binding(1)
var u_sampler: sampler;
@stage(vertex)
@vertex
fn vert_main(@location(0) pos: vec2<f32>, @location(1) uv: vec2<f32>) -> VertexOutput {
return VertexOutput(uv, vec4<f32>((c_scale * pos), 0.0, 1.0));
}
@stage(fragment)
@fragment
fn frag_main(@location(0) uv_1: vec2<f32>) -> @location(0) vec4<f32> {
let color = textureSample(u_texture, u_sampler, uv_1);
if (color.w == 0.0) {
@@ -25,7 +25,7 @@ fn frag_main(@location(0) uv_1: vec2<f32>) -> @location(0) vec4<f32> {
return premultiplied;
}
@stage(fragment)
@fragment
fn fs_extra() -> @location(0) vec4<f32> {
return vec4<f32>(0.0, 0.5, 0.0, 0.5);
}

View File

@@ -10,7 +10,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main(@location(0) v_uv: vec2<f32>) -> FragmentOutput {
v_uv_1 = v_uv;
main_1();

View File

@@ -17,7 +17,7 @@ fn main_1() {
return;
}
@stage(vertex)
@vertex
fn main(@location(0) a_pos: vec2<f32>, @location(1) a_uv: vec2<f32>) -> VertexOutput {
a_pos_1 = a_pos;
a_uv_1 = a_uv;

View File

@@ -680,7 +680,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main() {
main_1();
return;

View File

@@ -47,7 +47,7 @@ fn fetch_shadow(light_id: u32, homogeneous_coords: vec4<f32>) -> f32 {
return _e28;
}
@stage(vertex)
@vertex
fn vs_main(@location(0) position: vec4<i32>, @location(1) normal: vec4<i32>) -> VertexOutput {
var out: VertexOutput;
@@ -62,7 +62,7 @@ fn vs_main(@location(0) position: vec4<i32>, @location(1) normal: vec4<i32>) ->
return _e27;
}
@stage(fragment)
@fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
var color: vec3<f32> = vec3<f32>(0.05000000074505806, 0.05000000074505806, 0.05000000074505806);
var i: u32 = 0u;
@@ -93,7 +93,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
return (vec4<f32>(_e46, 1.0) * _e50);
}
@stage(fragment)
@fragment
fn fs_main_without_storage(in_1: VertexOutput) -> @location(0) vec4<f32> {
var color_1: vec3<f32> = vec3<f32>(0.05000000074505806, 0.05000000074505806, 0.05000000074505806);
var i_1: u32 = 0u;

View File

@@ -15,7 +15,7 @@ var r_texture: texture_cube<f32>;
@group(0) @binding(2)
var r_sampler: sampler;
@stage(vertex)
@vertex
fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput {
var tmp1_: i32;
var tmp2_: i32;
@@ -34,7 +34,7 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput {
return VertexOutput(pos, (inv_model_view * unprojected.xyz));
}
@stage(fragment)
@fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
let _e5 = textureSample(r_texture, r_sampler, in.uv);
return _e5;

View File

@@ -1,4 +1,4 @@
@stage(fragment)
@fragment
fn derivatives(@builtin(position) foo: vec4<f32>) -> @location(0) vec4<f32> {
let x = dpdx(foo);
let y = dpdy(foo);

View File

@@ -30,7 +30,7 @@ fn main_1() {
return;
}
@stage(fragment)
@fragment
fn main() {
main_1();
return;

View File

@@ -8,7 +8,7 @@ fn test(Passed_Texture: texture_2d<f32>, Passed_Sampler: sampler) -> vec4<f32> {
return _e7;
}
@stage(fragment)
@fragment
fn main() -> @location(0) vec4<f32> {
let _e2 = test(Texture, Sampler);
return _e2;