Update `types/functions/parameters.wgsl` to call `foo`
This CL updates `test/tint/types/functions/parameters.wgsl` to call the
`foo` method. If `foo` is not called from the entry point then it's
possible for a backend using `SingleEntryPoint` to strip the `foo`
method.
Bug: 364029445
Change-Id: I945031cba97db4ef19a8b40f8b1b9a0dfb7ae61c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/205256
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
diff --git a/test/tint/types/functions/parameters.wgsl b/test/tint/types/functions/parameters.wgsl
index d2fcf29..9869b18 100644
--- a/test/tint/types/functions/parameters.wgsl
+++ b/test/tint/types/functions/parameters.wgsl
@@ -20,4 +20,10 @@
@compute @workgroup_size(1)
fn main() {
+ let a = array<f32, 4>();
+ var b = 1.f;
+ var c = vec4f();
+ var d = array<f32, 4>();
+
+ foo(true, 1i, 1u, 1f, vec2i(3), vec3u(4), vec4f(5), mat2x3f(), a, S(), &b, &c, &d);
}
diff --git a/test/tint/types/functions/parameters.wgsl.expected.dxc.hlsl b/test/tint/types/functions/parameters.wgsl.expected.dxc.hlsl
index 10704a7..982f16e 100644
--- a/test/tint/types/functions/parameters.wgsl.expected.dxc.hlsl
+++ b/test/tint/types/functions/parameters.wgsl.expected.dxc.hlsl
@@ -7,5 +7,11 @@
[numthreads(1, 1, 1)]
void main() {
+ float a[4] = (float[4])0;
+ float b = 1.0f;
+ float4 c = (0.0f).xxxx;
+ float d[4] = (float[4])0;
+ S tint_symbol = (S)0;
+ foo(true, 1, 1u, 1.0f, (3).xx, (4u).xxx, (5.0f).xxxx, float2x3((0.0f).xxx, (0.0f).xxx), a, tint_symbol, b, c, d);
return;
}
diff --git a/test/tint/types/functions/parameters.wgsl.expected.fxc.hlsl b/test/tint/types/functions/parameters.wgsl.expected.fxc.hlsl
index 10704a7..982f16e 100644
--- a/test/tint/types/functions/parameters.wgsl.expected.fxc.hlsl
+++ b/test/tint/types/functions/parameters.wgsl.expected.fxc.hlsl
@@ -7,5 +7,11 @@
[numthreads(1, 1, 1)]
void main() {
+ float a[4] = (float[4])0;
+ float b = 1.0f;
+ float4 c = (0.0f).xxxx;
+ float d[4] = (float[4])0;
+ S tint_symbol = (S)0;
+ foo(true, 1, 1u, 1.0f, (3).xx, (4u).xxx, (5.0f).xxxx, float2x3((0.0f).xxx, (0.0f).xxx), a, tint_symbol, b, c, d);
return;
}
diff --git a/test/tint/types/functions/parameters.wgsl.expected.glsl b/test/tint/types/functions/parameters.wgsl.expected.glsl
index 966cd2a..5572be5 100644
--- a/test/tint/types/functions/parameters.wgsl.expected.glsl
+++ b/test/tint/types/functions/parameters.wgsl.expected.glsl
@@ -4,7 +4,16 @@
float a;
};
+void foo(bool param_bool, int param_i32, uint param_u32, float param_f32, ivec2 param_v2i32, uvec3 param_v3u32, vec4 param_v4f32, mat2x3 param_m2x3, float param_arr[4], S param_struct, inout float param_ptr_f32, inout vec4 param_ptr_vec, inout float param_ptr_arr[4]) {
+}
+
void tint_symbol() {
+ float a[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
+ float b = 1.0f;
+ vec4 c = vec4(0.0f);
+ float d[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
+ S tint_symbol_1 = S(0.0f);
+ foo(true, 1, 1u, 1.0f, ivec2(3), uvec3(4u), vec4(5.0f), mat2x3(vec3(0.0f), vec3(0.0f)), a, tint_symbol_1, b, c, d);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
diff --git a/test/tint/types/functions/parameters.wgsl.expected.ir.dxc.hlsl b/test/tint/types/functions/parameters.wgsl.expected.ir.dxc.hlsl
index 556d8ab..5658ebf 100644
--- a/test/tint/types/functions/parameters.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/types/functions/parameters.wgsl.expected.ir.dxc.hlsl
@@ -8,5 +8,12 @@
[numthreads(1, 1, 1)]
void main() {
+ float v[4] = (float[4])0;
+ float b = 1.0f;
+ float4 c = (0.0f).xxxx;
+ float d[4] = (float[4])0;
+ float a[4] = v;
+ S v_1 = (S)0;
+ foo(true, 1, 1u, 1.0f, (3).xx, (4u).xxx, (5.0f).xxxx, float2x3((0.0f).xxx, (0.0f).xxx), a, v_1, b, c, d);
}
diff --git a/test/tint/types/functions/parameters.wgsl.expected.ir.fxc.hlsl b/test/tint/types/functions/parameters.wgsl.expected.ir.fxc.hlsl
index 556d8ab..5658ebf 100644
--- a/test/tint/types/functions/parameters.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/types/functions/parameters.wgsl.expected.ir.fxc.hlsl
@@ -8,5 +8,12 @@
[numthreads(1, 1, 1)]
void main() {
+ float v[4] = (float[4])0;
+ float b = 1.0f;
+ float4 c = (0.0f).xxxx;
+ float d[4] = (float[4])0;
+ float a[4] = v;
+ S v_1 = (S)0;
+ foo(true, 1, 1u, 1.0f, (3).xx, (4u).xxx, (5.0f).xxxx, float2x3((0.0f).xxx, (0.0f).xxx), a, v_1, b, c, d);
}
diff --git a/test/tint/types/functions/parameters.wgsl.expected.ir.glsl b/test/tint/types/functions/parameters.wgsl.expected.ir.glsl
index f83bcf2..e71cc72 100644
--- a/test/tint/types/functions/parameters.wgsl.expected.ir.glsl
+++ b/test/tint/types/functions/parameters.wgsl.expected.ir.glsl
@@ -1,5 +1,16 @@
#version 310 es
+struct S {
+ float a;
+};
+
+void foo(bool param_bool, int param_i32, uint param_u32, float param_f32, ivec2 param_v2i32, uvec3 param_v3u32, vec4 param_v4f32, mat2x3 param_m2x3, float param_arr[4], S param_struct, inout float param_ptr_f32, inout vec4 param_ptr_vec, inout float param_ptr_arr[4]) {
+}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
+ float a[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
+ float b = 1.0f;
+ vec4 c = vec4(0.0f);
+ float d[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
+ foo(true, 1, 1u, 1.0f, ivec2(3), uvec3(4u), vec4(5.0f), mat2x3(vec3(0.0f), vec3(0.0f)), a, S(0.0f), b, c, d);
}
diff --git a/test/tint/types/functions/parameters.wgsl.expected.ir.msl b/test/tint/types/functions/parameters.wgsl.expected.ir.msl
index 40ea574..b3d269e 100644
--- a/test/tint/types/functions/parameters.wgsl.expected.ir.msl
+++ b/test/tint/types/functions/parameters.wgsl.expected.ir.msl
@@ -21,4 +21,9 @@
}
kernel void tint_symbol() {
+ tint_array<float, 4> const a = tint_array<float, 4>{};
+ float b = 1.0f;
+ float4 c = float4(0.0f);
+ tint_array<float, 4> d = tint_array<float, 4>{};
+ foo(true, 1, 1u, 1.0f, int2(3), uint3(4u), float4(5.0f), float2x3(float3(0.0f), float3(0.0f)), a, S{}, (&b), (&c), (&d));
}
diff --git a/test/tint/types/functions/parameters.wgsl.expected.msl b/test/tint/types/functions/parameters.wgsl.expected.msl
index 54ad948..88f597b 100644
--- a/test/tint/types/functions/parameters.wgsl.expected.msl
+++ b/test/tint/types/functions/parameters.wgsl.expected.msl
@@ -22,6 +22,12 @@
}
kernel void tint_symbol() {
+ tint_array<float, 4> const a = tint_array<float, 4>{};
+ float b = 1.0f;
+ float4 c = float4(0.0f);
+ tint_array<float, 4> d = tint_array<float, 4>{};
+ S const tint_symbol_1 = S{};
+ foo(true, 1, 1u, 1.0f, int2(3), uint3(4u), float4(5.0f), float2x3(float3(0.0f), float3(0.0f)), a, tint_symbol_1, &(b), &(c), &(d));
return;
}
diff --git a/test/tint/types/functions/parameters.wgsl.expected.spvasm b/test/tint/types/functions/parameters.wgsl.expected.spvasm
index 631de9a..f57677c 100644
--- a/test/tint/types/functions/parameters.wgsl.expected.spvasm
+++ b/test/tint/types/functions/parameters.wgsl.expected.spvasm
@@ -1,16 +1,91 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 5
+; Bound: 53
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
+ OpName %foo "foo"
+ OpName %param_bool "param_bool"
+ OpName %param_i32 "param_i32"
+ OpName %param_u32 "param_u32"
+ OpName %param_f32 "param_f32"
+ OpName %param_v2i32 "param_v2i32"
+ OpName %param_v3u32 "param_v3u32"
+ OpName %param_v4f32 "param_v4f32"
+ OpName %param_m2x3 "param_m2x3"
+ OpName %param_arr "param_arr"
+ OpMemberName %S 0 "a"
+ OpName %S "S"
+ OpName %param_struct "param_struct"
+ OpName %param_ptr_f32_root "param_ptr_f32_root"
+ OpName %param_ptr_vec_root "param_ptr_vec_root"
+ OpName %param_ptr_arr_root "param_ptr_arr_root"
OpName %main "main"
+ OpName %a "a"
+ OpName %b "b"
+ OpName %c "c"
+ OpName %d "d"
+ OpDecorate %_arr_float_uint_4 ArrayStride 4
+ OpMemberDecorate %S 0 Offset 0
%void = OpTypeVoid
- %3 = OpTypeFunction %void
- %main = OpFunction %void None %3
- %4 = OpLabel
+ %bool = OpTypeBool
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %float = OpTypeFloat 32
+ %v2int = OpTypeVector %int 2
+ %v3uint = OpTypeVector %uint 3
+ %v4float = OpTypeVector %float 4
+ %v3float = OpTypeVector %float 3
+%mat2v3float = OpTypeMatrix %v3float 2
+ %uint_4 = OpConstant %uint 4
+%_arr_float_uint_4 = OpTypeArray %float %uint_4
+ %S = OpTypeStruct %float
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%_ptr_Function__arr_float_uint_4 = OpTypePointer Function %_arr_float_uint_4
+ %31 = OpTypeFunction %void %bool %int %uint %float %v2int %v3uint %v4float %mat2v3float %_arr_float_uint_4 %S %_ptr_Function_float %_ptr_Function_v4float %_ptr_Function__arr_float_uint_4
+ %34 = OpTypeFunction %void
+ %a = OpConstantNull %_arr_float_uint_4
+ %float_1 = OpConstant %float 1
+ %40 = OpConstantNull %v4float
+ %true = OpConstantTrue %bool
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %int_3 = OpConstant %int 3
+ %46 = OpConstantComposite %v2int %int_3 %int_3
+ %48 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4
+ %float_5 = OpConstant %float 5
+ %49 = OpConstantComposite %v4float %float_5 %float_5 %float_5 %float_5
+ %51 = OpConstantNull %mat2v3float
+ %52 = OpConstantNull %S
+ %foo = OpFunction %void None %31
+ %param_bool = OpFunctionParameter %bool
+ %param_i32 = OpFunctionParameter %int
+ %param_u32 = OpFunctionParameter %uint
+ %param_f32 = OpFunctionParameter %float
+%param_v2i32 = OpFunctionParameter %v2int
+%param_v3u32 = OpFunctionParameter %v3uint
+%param_v4f32 = OpFunctionParameter %v4float
+ %param_m2x3 = OpFunctionParameter %mat2v3float
+ %param_arr = OpFunctionParameter %_arr_float_uint_4
+%param_struct = OpFunctionParameter %S
+%param_ptr_f32_root = OpFunctionParameter %_ptr_Function_float
+%param_ptr_vec_root = OpFunctionParameter %_ptr_Function_v4float
+%param_ptr_arr_root = OpFunctionParameter %_ptr_Function__arr_float_uint_4
+ %32 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %34
+ %35 = OpLabel
+ %b = OpVariable %_ptr_Function_float Function
+ %c = OpVariable %_ptr_Function_v4float Function
+ %d = OpVariable %_ptr_Function__arr_float_uint_4 Function
+ OpStore %b %float_1
+ OpStore %c %40
+ OpStore %d %a
+ %42 = OpFunctionCall %void %foo %true %int_1 %uint_1 %float_1 %46 %48 %49 %51 %a %52 %b %c %d
OpReturn
OpFunctionEnd
diff --git a/test/tint/types/functions/parameters.wgsl.expected.wgsl b/test/tint/types/functions/parameters.wgsl.expected.wgsl
index cc80dc2..916e77a 100644
--- a/test/tint/types/functions/parameters.wgsl.expected.wgsl
+++ b/test/tint/types/functions/parameters.wgsl.expected.wgsl
@@ -7,4 +7,9 @@
@compute @workgroup_size(1)
fn main() {
+ let a = array<f32, 4>();
+ var b = 1.0f;
+ var c = vec4f();
+ var d = array<f32, 4>();
+ foo(true, 1i, 1u, 1.0f, vec2i(3), vec3u(4), vec4f(5), mat2x3f(), a, S(), &(b), &(c), &(d));
}