test: Add missing stage attributes to IO test
Change-Id: I7f69de9c3b6fe226e0688f56a8d076dc6ec4a81f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55281
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/test/shader_io/shared_struct_helper_function.wgsl b/test/shader_io/shared_struct_helper_function.wgsl
index 6527653..44cf24d 100644
--- a/test/shader_io/shared_struct_helper_function.wgsl
+++ b/test/shader_io/shared_struct_helper_function.wgsl
@@ -7,10 +7,12 @@
return VertexOutput(vec4<f32>(x, x, x, 1.0), 42);
}
+[[stage(vertex)]]
fn vert_main1() -> VertexOutput {
return foo(0.5);
}
+[[stage(vertex)]]
fn vert_main2() -> VertexOutput {
return foo(0.25);
}
diff --git a/test/shader_io/shared_struct_helper_function.wgsl.expected.hlsl b/test/shader_io/shared_struct_helper_function.wgsl.expected.hlsl
index 85ca948..8e85183 100644
--- a/test/shader_io/shared_struct_helper_function.wgsl.expected.hlsl
+++ b/test/shader_io/shared_struct_helper_function.wgsl.expected.hlsl
@@ -1,22 +1,31 @@
-[numthreads(1, 1, 1)]
-void unused_entry_point() {
- return;
-}
-
struct VertexOutput {
float4 pos;
int loc0;
};
VertexOutput foo(float x) {
- const VertexOutput tint_symbol = {float4(x, x, x, 1.0f), 42};
- return tint_symbol;
+ const VertexOutput tint_symbol_4 = {float4(x, x, x, 1.0f), 42};
+ return tint_symbol_4;
}
-VertexOutput vert_main1() {
- return foo(0.5f);
+struct tint_symbol {
+ int loc0 : TEXCOORD0;
+ float4 pos : SV_Position;
+};
+
+tint_symbol vert_main1() {
+ const VertexOutput tint_symbol_1 = foo(0.5f);
+ const tint_symbol tint_symbol_5 = {tint_symbol_1.loc0, tint_symbol_1.pos};
+ return tint_symbol_5;
}
-VertexOutput vert_main2() {
- return foo(0.25f);
+struct tint_symbol_2 {
+ int loc0 : TEXCOORD0;
+ float4 pos : SV_Position;
+};
+
+tint_symbol_2 vert_main2() {
+ const VertexOutput tint_symbol_3 = foo(0.25f);
+ const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.loc0, tint_symbol_3.pos};
+ return tint_symbol_6;
}
diff --git a/test/shader_io/shared_struct_helper_function.wgsl.expected.msl b/test/shader_io/shared_struct_helper_function.wgsl.expected.msl
index 5cec366..8131dfe 100644
--- a/test/shader_io/shared_struct_helper_function.wgsl.expected.msl
+++ b/test/shader_io/shared_struct_helper_function.wgsl.expected.msl
@@ -5,17 +5,29 @@
float4 pos;
int loc0;
};
+struct tint_symbol {
+ int loc0 [[user(locn0)]];
+ float4 pos [[position]];
+};
+struct tint_symbol_2 {
+ int loc0 [[user(locn0)]];
+ float4 pos [[position]];
+};
VertexOutput foo(float x) {
- VertexOutput const tint_symbol = {.pos=float4(x, x, x, 1.0f), .loc0=42};
- return tint_symbol;
+ VertexOutput const tint_symbol_4 = {.pos=float4(x, x, x, 1.0f), .loc0=42};
+ return tint_symbol_4;
}
-VertexOutput vert_main1() {
- return foo(0.5f);
+vertex tint_symbol vert_main1() {
+ VertexOutput const tint_symbol_1 = foo(0.5f);
+ tint_symbol const tint_symbol_5 = {.loc0=tint_symbol_1.loc0, .pos=tint_symbol_1.pos};
+ return tint_symbol_5;
}
-VertexOutput vert_main2() {
- return foo(0.25f);
+vertex tint_symbol_2 vert_main2() {
+ VertexOutput const tint_symbol_3 = foo(0.25f);
+ tint_symbol_2 const tint_symbol_6 = {.loc0=tint_symbol_3.loc0, .pos=tint_symbol_3.pos};
+ return tint_symbol_6;
}
diff --git a/test/shader_io/shared_struct_helper_function.wgsl.expected.spvasm b/test/shader_io/shared_struct_helper_function.wgsl.expected.spvasm
index ee3e97b..f92b786 100644
--- a/test/shader_io/shared_struct_helper_function.wgsl.expected.spvasm
+++ b/test/shader_io/shared_struct_helper_function.wgsl.expected.spvasm
@@ -1,52 +1,94 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 47
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
- OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %unused_entry_point "unused_entry_point"
+ OpEntryPoint Vertex %vert_main1 "vert_main1" %tint_pointsize %tint_symbol_1 %tint_symbol_2
+ OpEntryPoint Vertex %vert_main2 "vert_main2" %tint_pointsize %tint_symbol_5 %tint_symbol_6
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol_5 "tint_symbol_5"
+ OpName %tint_symbol_6 "tint_symbol_6"
OpName %VertexOutput "VertexOutput"
OpMemberName %VertexOutput 0 "pos"
OpMemberName %VertexOutput 1 "loc0"
OpName %foo "foo"
OpName %x "x"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol "tint_symbol"
OpName %vert_main1 "vert_main1"
+ OpName %tint_symbol_7 "tint_symbol_7"
+ OpName %tint_symbol_4 "tint_symbol_4"
OpName %vert_main2 "vert_main2"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ OpDecorate %tint_symbol_2 Location 0
+ OpDecorate %tint_symbol_5 BuiltIn Position
+ OpDecorate %tint_symbol_6 Location 0
OpMemberDecorate %VertexOutput 0 Offset 0
OpMemberDecorate %VertexOutput 1 Offset 16
- %void = OpTypeVoid
- %1 = OpTypeFunction %void
%float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
%v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %8 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%int = OpTypeInt 32 1
+%_ptr_Output_int = OpTypePointer Output %int
+ %12 = OpConstantNull %int
+%tint_symbol_2 = OpVariable %_ptr_Output_int Output %12
+%tint_symbol_5 = OpVariable %_ptr_Output_v4float Output %8
+%tint_symbol_6 = OpVariable %_ptr_Output_int Output %12
%VertexOutput = OpTypeStruct %v4float %int
- %5 = OpTypeFunction %VertexOutput %float
+ %15 = OpTypeFunction %VertexOutput %float
%float_1 = OpConstant %float 1
%int_42 = OpConstant %int 42
- %17 = OpTypeFunction %VertexOutput
+ %void = OpTypeVoid
+ %24 = OpTypeFunction %void %VertexOutput
+ %31 = OpTypeFunction %void
%float_0_5 = OpConstant %float 0.5
%float_0_25 = OpConstant %float 0.25
-%unused_entry_point = OpFunction %void None %1
- %4 = OpLabel
+ %foo = OpFunction %VertexOutput None %15
+ %x = OpFunctionParameter %float
+ %19 = OpLabel
+ %21 = OpCompositeConstruct %v4float %x %x %x %float_1
+ %23 = OpCompositeConstruct %VertexOutput %21 %int_42
+ OpReturnValue %23
+ OpFunctionEnd
+%tint_symbol_3 = OpFunction %void None %24
+%tint_symbol = OpFunctionParameter %VertexOutput
+ %28 = OpLabel
+ %29 = OpCompositeExtract %v4float %tint_symbol 0
+ OpStore %tint_symbol_1 %29
+ %30 = OpCompositeExtract %int %tint_symbol 1
+ OpStore %tint_symbol_2 %30
OpReturn
OpFunctionEnd
- %foo = OpFunction %VertexOutput None %5
- %x = OpFunctionParameter %float
- %12 = OpLabel
- %14 = OpCompositeConstruct %v4float %x %x %x %float_1
- %16 = OpCompositeConstruct %VertexOutput %14 %int_42
- OpReturnValue %16
+ %vert_main1 = OpFunction %void None %31
+ %33 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %35 = OpFunctionCall %VertexOutput %foo %float_0_5
+ %34 = OpFunctionCall %void %tint_symbol_3 %35
+ OpReturn
OpFunctionEnd
- %vert_main1 = OpFunction %VertexOutput None %17
- %19 = OpLabel
- %20 = OpFunctionCall %VertexOutput %foo %float_0_5
- OpReturnValue %20
+%tint_symbol_7 = OpFunction %void None %24
+%tint_symbol_4 = OpFunctionParameter %VertexOutput
+ %39 = OpLabel
+ %40 = OpCompositeExtract %v4float %tint_symbol_4 0
+ OpStore %tint_symbol_5 %40
+ %41 = OpCompositeExtract %int %tint_symbol_4 1
+ OpStore %tint_symbol_6 %41
+ OpReturn
OpFunctionEnd
- %vert_main2 = OpFunction %VertexOutput None %17
- %23 = OpLabel
- %24 = OpFunctionCall %VertexOutput %foo %float_0_25
- OpReturnValue %24
+ %vert_main2 = OpFunction %void None %31
+ %43 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %45 = OpFunctionCall %VertexOutput %foo %float_0_25
+ %44 = OpFunctionCall %void %tint_symbol_7 %45
+ OpReturn
OpFunctionEnd
diff --git a/test/shader_io/shared_struct_helper_function.wgsl.expected.wgsl b/test/shader_io/shared_struct_helper_function.wgsl.expected.wgsl
index e7a0978..5511e93 100644
--- a/test/shader_io/shared_struct_helper_function.wgsl.expected.wgsl
+++ b/test/shader_io/shared_struct_helper_function.wgsl.expected.wgsl
@@ -9,10 +9,12 @@
return VertexOutput(vec4<f32>(x, x, x, 1.0), 42);
}
+[[stage(vertex)]]
fn vert_main1() -> VertexOutput {
return foo(0.5);
}
+[[stage(vertex)]]
fn vert_main2() -> VertexOutput {
return foo(0.25);
}