spirv-reader: switch to HLSL-style pipeline IO
- When storing to sample_mask output, write to the 0th element
- Only make a return struct if it has members
- Adjust type signedness coercion when loading special builtins.
- Adapt tests
- Update expectations for end-to-end tests
- Handle sample_mask with stride
Input variables normally don't have layout. But they can have it
up through SPIR-V 1.4.
Handle this case in the SPIR-V reader, by seeing through the
intermediate alias type created for the strided array type.
Bug: tint:508
Change-Id: I0f19dc1305d3f250dbbc0698a602288c34245274
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54743
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/test/ptr_ref/access/matrix.spvasm.expected.hlsl b/test/ptr_ref/access/matrix.spvasm.expected.hlsl
index 0b1e541..0dfd7df 100644
--- a/test/ptr_ref/access/matrix.spvasm.expected.hlsl
+++ b/test/ptr_ref/access/matrix.spvasm.expected.hlsl
@@ -1,7 +1,12 @@
-[numthreads(1, 1, 1)]
-void main() {
+void main_1() {
float3x3 m = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
m[1] = float3(5.0f, 5.0f, 5.0f);
return;
}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/ptr_ref/access/matrix.spvasm.expected.msl b/test/ptr_ref/access/matrix.spvasm.expected.msl
index beac5b5..355f903 100644
--- a/test/ptr_ref/access/matrix.spvasm.expected.msl
+++ b/test/ptr_ref/access/matrix.spvasm.expected.msl
@@ -1,10 +1,15 @@
#include <metal_stdlib>
using namespace metal;
-kernel void tint_symbol() {
+void main_1() {
float3x3 m = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
m[1] = float3(5.0f, 5.0f, 5.0f);
return;
}
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/ptr_ref/access/matrix.spvasm.expected.spvasm b/test/ptr_ref/access/matrix.spvasm.expected.spvasm
index 762777b..7f83834 100644
--- a/test/ptr_ref/access/matrix.spvasm.expected.spvasm
+++ b/test/ptr_ref/access/matrix.spvasm.expected.spvasm
@@ -1,14 +1,15 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 32
+; Bound: 35
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
- OpName %main "main"
+ OpName %main_1 "main_1"
OpName %m "m"
+ OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
@@ -36,7 +37,7 @@
%int_1 = OpConstant %int 1
%_ptr_Function_v3float = OpTypePointer Function %v3float
%31 = OpConstantComposite %v3float %float_5 %float_5 %float_5
- %main = OpFunction %void None %1
+ %main_1 = OpFunction %void None %1
%4 = OpLabel
%m = OpVariable %_ptr_Function_mat3v3float Function %13
OpStore %m %10
@@ -45,3 +46,8 @@
OpStore %30 %31
OpReturn
OpFunctionEnd
+ %main = OpFunction %void None %1
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/ptr_ref/access/matrix.spvasm.expected.wgsl b/test/ptr_ref/access/matrix.spvasm.expected.wgsl
index dabe5d4..9318800 100644
--- a/test/ptr_ref/access/matrix.spvasm.expected.wgsl
+++ b/test/ptr_ref/access/matrix.spvasm.expected.wgsl
@@ -1,7 +1,11 @@
-[[stage(compute)]]
-fn main() {
+fn main_1() {
var m : mat3x3<f32> = mat3x3<f32>(vec3<f32>(0.0, 0.0, 0.0), vec3<f32>(0.0, 0.0, 0.0), vec3<f32>(0.0, 0.0, 0.0));
m = mat3x3<f32>(vec3<f32>(1.0, 2.0, 3.0), vec3<f32>(4.0, 5.0, 6.0), vec3<f32>(7.0, 8.0, 9.0));
m[1] = vec3<f32>(5.0, 5.0, 5.0);
return;
}
+
+[[stage(compute)]]
+fn main() {
+ main_1();
+}
diff --git a/test/ptr_ref/access/vector.spvasm.expected.hlsl b/test/ptr_ref/access/vector.spvasm.expected.hlsl
index d1fb5ff..1249175 100644
--- a/test/ptr_ref/access/vector.spvasm.expected.hlsl
+++ b/test/ptr_ref/access/vector.spvasm.expected.hlsl
@@ -1,7 +1,12 @@
-[numthreads(1, 1, 1)]
-void main() {
+void main_1() {
float3 v = float3(0.0f, 0.0f, 0.0f);
v = float3(1.0f, 2.0f, 3.0f);
v.y = 5.0f;
return;
}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/ptr_ref/access/vector.spvasm.expected.msl b/test/ptr_ref/access/vector.spvasm.expected.msl
index 650c752..2d93596 100644
--- a/test/ptr_ref/access/vector.spvasm.expected.msl
+++ b/test/ptr_ref/access/vector.spvasm.expected.msl
@@ -1,10 +1,15 @@
#include <metal_stdlib>
using namespace metal;
-kernel void tint_symbol() {
+void main_1() {
float3 v = float3(0.0f, 0.0f, 0.0f);
v = float3(1.0f, 2.0f, 3.0f);
v.y = 5.0f;
return;
}
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/ptr_ref/access/vector.spvasm.expected.spvasm b/test/ptr_ref/access/vector.spvasm.expected.spvasm
index 5d2c915..bfedf84 100644
--- a/test/ptr_ref/access/vector.spvasm.expected.spvasm
+++ b/test/ptr_ref/access/vector.spvasm.expected.spvasm
@@ -1,14 +1,15 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 24
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
- OpName %main "main"
+ OpName %main_1 "main_1"
OpName %v "v"
+ OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
@@ -25,7 +26,7 @@
%uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float
%float_5 = OpConstant %float 5
- %main = OpFunction %void None %1
+ %main_1 = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function_v3float Function %11
OpStore %v %8
@@ -34,3 +35,8 @@
OpStore %19 %float_5
OpReturn
OpFunctionEnd
+ %main = OpFunction %void None %1
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/ptr_ref/access/vector.spvasm.expected.wgsl b/test/ptr_ref/access/vector.spvasm.expected.wgsl
index dce7b8f..1c01974 100644
--- a/test/ptr_ref/access/vector.spvasm.expected.wgsl
+++ b/test/ptr_ref/access/vector.spvasm.expected.wgsl
@@ -1,7 +1,11 @@
-[[stage(compute)]]
-fn main() {
+fn main_1() {
var v : vec3<f32> = vec3<f32>(0.0, 0.0, 0.0);
v = vec3<f32>(1.0, 2.0, 3.0);
v.y = 5.0;
return;
}
+
+[[stage(compute)]]
+fn main() {
+ main_1();
+}
diff --git a/test/ptr_ref/copy/ptr_copy.spvasm.expected.hlsl b/test/ptr_ref/copy/ptr_copy.spvasm.expected.hlsl
index cd118a7..0bc2907 100644
--- a/test/ptr_ref/copy/ptr_copy.spvasm.expected.hlsl
+++ b/test/ptr_ref/copy/ptr_copy.spvasm.expected.hlsl
@@ -1,5 +1,10 @@
+void main_1() {
+ uint x_10 = 0u;
+ return;
+}
+
[numthreads(1, 1, 1)]
void main() {
- uint x_10 = 0u;
+ main_1();
return;
}
diff --git a/test/ptr_ref/copy/ptr_copy.spvasm.expected.msl b/test/ptr_ref/copy/ptr_copy.spvasm.expected.msl
index 6577255..5495c63 100644
--- a/test/ptr_ref/copy/ptr_copy.spvasm.expected.msl
+++ b/test/ptr_ref/copy/ptr_copy.spvasm.expected.msl
@@ -1,10 +1,15 @@
#include <metal_stdlib>
using namespace metal;
-kernel void tint_symbol() {
+void main_1() {
uint x_10 = 0u;
thread uint* const x_1 = &(x_10);
thread uint* const x_2 = x_1;
return;
}
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/ptr_ref/copy/ptr_copy.spvasm.expected.spvasm b/test/ptr_ref/copy/ptr_copy.spvasm.expected.spvasm
index 2ced51c..bf3b294 100644
--- a/test/ptr_ref/copy/ptr_copy.spvasm.expected.spvasm
+++ b/test/ptr_ref/copy/ptr_copy.spvasm.expected.spvasm
@@ -1,21 +1,27 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 9
+; Bound: 12
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
- OpName %main "main"
+ OpName %main_1 "main_1"
OpName %x_10 "x_10"
+ OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%_ptr_Function_uint = OpTypePointer Function %uint
%8 = OpConstantNull %uint
- %main = OpFunction %void None %1
+ %main_1 = OpFunction %void None %1
%4 = OpLabel
%x_10 = OpVariable %_ptr_Function_uint Function %8
OpReturn
OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/ptr_ref/copy/ptr_copy.spvasm.expected.wgsl b/test/ptr_ref/copy/ptr_copy.spvasm.expected.wgsl
index ef4c546..360caf4 100644
--- a/test/ptr_ref/copy/ptr_copy.spvasm.expected.wgsl
+++ b/test/ptr_ref/copy/ptr_copy.spvasm.expected.wgsl
@@ -1,7 +1,11 @@
-[[stage(compute)]]
-fn main() {
+fn main_1() {
var x_10 : u32;
let x_1 : ptr<function, u32> = &(x_10);
let x_2 : ptr<function, u32> = x_1;
return;
}
+
+[[stage(compute)]]
+fn main() {
+ main_1();
+}
diff --git a/test/ptr_ref/load/global/i32.spvasm.expected.hlsl b/test/ptr_ref/load/global/i32.spvasm.expected.hlsl
index c105145..949fd0b 100644
--- a/test/ptr_ref/load/global/i32.spvasm.expected.hlsl
+++ b/test/ptr_ref/load/global/i32.spvasm.expected.hlsl
@@ -1,8 +1,13 @@
static int I = 0;
-[numthreads(1, 1, 1)]
-void main() {
+void main_1() {
const int x_9 = I;
const int x_11 = (x_9 + 1);
return;
}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/ptr_ref/load/global/i32.spvasm.expected.msl b/test/ptr_ref/load/global/i32.spvasm.expected.msl
index b12f809..58c70f5 100644
--- a/test/ptr_ref/load/global/i32.spvasm.expected.msl
+++ b/test/ptr_ref/load/global/i32.spvasm.expected.msl
@@ -1,10 +1,15 @@
#include <metal_stdlib>
using namespace metal;
-kernel void tint_symbol() {
- thread int tint_symbol_1 = 0;
- int const x_9 = tint_symbol_1;
+void main_1(thread int* const tint_symbol_1) {
+ int const x_9 = *(tint_symbol_1);
int const x_11 = (x_9 + 1);
return;
}
+kernel void tint_symbol() {
+ thread int tint_symbol_2 = 0;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/ptr_ref/load/global/i32.spvasm.expected.spvasm b/test/ptr_ref/load/global/i32.spvasm.expected.spvasm
index df45400..c105555 100644
--- a/test/ptr_ref/load/global/i32.spvasm.expected.spvasm
+++ b/test/ptr_ref/load/global/i32.spvasm.expected.spvasm
@@ -1,13 +1,14 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 12
+; Bound: 15
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %I "I"
+ OpName %main_1 "main_1"
OpName %main "main"
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
@@ -16,9 +17,14 @@
%void = OpTypeVoid
%5 = OpTypeFunction %void
%int_1 = OpConstant %int 1
- %main = OpFunction %void None %5
+ %main_1 = OpFunction %void None %5
%8 = OpLabel
%9 = OpLoad %int %I
%11 = OpIAdd %int %9 %int_1
OpReturn
OpFunctionEnd
+ %main = OpFunction %void None %5
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/ptr_ref/load/global/i32.spvasm.expected.wgsl b/test/ptr_ref/load/global/i32.spvasm.expected.wgsl
index ba8f551..f9147e4 100644
--- a/test/ptr_ref/load/global/i32.spvasm.expected.wgsl
+++ b/test/ptr_ref/load/global/i32.spvasm.expected.wgsl
@@ -1,8 +1,12 @@
var<private> I : i32 = 0;
-[[stage(compute)]]
-fn main() {
+fn main_1() {
let x_9 : i32 = I;
let x_11 : i32 = (x_9 + 1);
return;
}
+
+[[stage(compute)]]
+fn main() {
+ main_1();
+}
diff --git a/test/ptr_ref/load/global/struct_field.spvasm.expected.hlsl b/test/ptr_ref/load/global/struct_field.spvasm.expected.hlsl
index f966e8b..038d7fc 100644
--- a/test/ptr_ref/load/global/struct_field.spvasm.expected.hlsl
+++ b/test/ptr_ref/load/global/struct_field.spvasm.expected.hlsl
@@ -4,10 +4,15 @@
static S V;
-[numthreads(1, 1, 1)]
-void main() {
+void main_1() {
int i = 0;
const int x_15 = V.i;
i = x_15;
return;
}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/ptr_ref/load/global/struct_field.spvasm.expected.msl b/test/ptr_ref/load/global/struct_field.spvasm.expected.msl
index e1c1520..5ac3552 100644
--- a/test/ptr_ref/load/global/struct_field.spvasm.expected.msl
+++ b/test/ptr_ref/load/global/struct_field.spvasm.expected.msl
@@ -5,11 +5,16 @@
int i;
};
-kernel void tint_symbol() {
- thread S tint_symbol_1 = {};
+void main_1(thread S* const tint_symbol_1) {
int i = 0;
- int const x_15 = tint_symbol_1.i;
+ int const x_15 = (*(tint_symbol_1)).i;
i = x_15;
return;
}
+kernel void tint_symbol() {
+ thread S tint_symbol_2 = {};
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/ptr_ref/load/global/struct_field.spvasm.expected.spvasm b/test/ptr_ref/load/global/struct_field.spvasm.expected.spvasm
index 2a1da68..a6960ac 100644
--- a/test/ptr_ref/load/global/struct_field.spvasm.expected.spvasm
+++ b/test/ptr_ref/load/global/struct_field.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 18
+; Bound: 21
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -10,8 +10,9 @@
OpName %S "S"
OpMemberName %S 0 "i"
OpName %V "V"
- OpName %main "main"
+ OpName %main_1 "main_1"
OpName %i "i"
+ OpName %main "main"
OpMemberDecorate %S 0 Offset 0
%int = OpTypeInt 32 1
%S = OpTypeStruct %int
@@ -25,7 +26,7 @@
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Private_int = OpTypePointer Private %int
- %main = OpFunction %void None %6
+ %main_1 = OpFunction %void None %6
%9 = OpLabel
%i = OpVariable %_ptr_Function_int Function %12
%16 = OpAccessChain %_ptr_Private_int %V %uint_0
@@ -33,3 +34,8 @@
OpStore %i %17
OpReturn
OpFunctionEnd
+ %main = OpFunction %void None %6
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/ptr_ref/load/global/struct_field.spvasm.expected.wgsl b/test/ptr_ref/load/global/struct_field.spvasm.expected.wgsl
index e3f4540..c423f77 100644
--- a/test/ptr_ref/load/global/struct_field.spvasm.expected.wgsl
+++ b/test/ptr_ref/load/global/struct_field.spvasm.expected.wgsl
@@ -4,10 +4,14 @@
var<private> V : S;
-[[stage(compute)]]
-fn main() {
+fn main_1() {
var i : i32;
let x_15 : i32 = V.i;
i = x_15;
return;
}
+
+[[stage(compute)]]
+fn main() {
+ main_1();
+}
diff --git a/test/ptr_ref/load/local/i32.spvasm.expected.hlsl b/test/ptr_ref/load/local/i32.spvasm.expected.hlsl
index fc4a24b..e93814c 100644
--- a/test/ptr_ref/load/local/i32.spvasm.expected.hlsl
+++ b/test/ptr_ref/load/local/i32.spvasm.expected.hlsl
@@ -1,8 +1,13 @@
-[numthreads(1, 1, 1)]
-void main() {
+void main_1() {
int i = 0;
i = 123;
const int x_10 = i;
const int x_12 = (x_10 + 1);
return;
}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/ptr_ref/load/local/i32.spvasm.expected.msl b/test/ptr_ref/load/local/i32.spvasm.expected.msl
index 738dfea..bfbd8e5 100644
--- a/test/ptr_ref/load/local/i32.spvasm.expected.msl
+++ b/test/ptr_ref/load/local/i32.spvasm.expected.msl
@@ -1,7 +1,7 @@
#include <metal_stdlib>
using namespace metal;
-kernel void tint_symbol() {
+void main_1() {
int i = 0;
i = 123;
int const x_10 = i;
@@ -9,3 +9,8 @@
return;
}
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/ptr_ref/load/local/i32.spvasm.expected.spvasm b/test/ptr_ref/load/local/i32.spvasm.expected.spvasm
index bc6f467..f5dfd09 100644
--- a/test/ptr_ref/load/local/i32.spvasm.expected.spvasm
+++ b/test/ptr_ref/load/local/i32.spvasm.expected.spvasm
@@ -1,14 +1,15 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 14
+; Bound: 17
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
- OpName %main "main"
+ OpName %main_1 "main_1"
OpName %i "i"
+ OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
@@ -17,7 +18,7 @@
%9 = OpConstantNull %int
%int_123 = OpConstant %int 123
%int_1 = OpConstant %int 1
- %main = OpFunction %void None %1
+ %main_1 = OpFunction %void None %1
%4 = OpLabel
%i = OpVariable %_ptr_Function_int Function %9
OpStore %i %int_0
@@ -26,3 +27,8 @@
%13 = OpIAdd %int %11 %int_1
OpReturn
OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/ptr_ref/load/local/i32.spvasm.expected.wgsl b/test/ptr_ref/load/local/i32.spvasm.expected.wgsl
index 60551cd..8a47e29 100644
--- a/test/ptr_ref/load/local/i32.spvasm.expected.wgsl
+++ b/test/ptr_ref/load/local/i32.spvasm.expected.wgsl
@@ -1,8 +1,12 @@
-[[stage(compute)]]
-fn main() {
+fn main_1() {
var i : i32 = 0;
i = 123;
let x_10 : i32 = i;
let x_12 : i32 = (x_10 + 1);
return;
}
+
+[[stage(compute)]]
+fn main() {
+ main_1();
+}
diff --git a/test/ptr_ref/load/local/struct_field.spvasm.expected.hlsl b/test/ptr_ref/load/local/struct_field.spvasm.expected.hlsl
index 0f93795..33da9c4 100644
--- a/test/ptr_ref/load/local/struct_field.spvasm.expected.hlsl
+++ b/test/ptr_ref/load/local/struct_field.spvasm.expected.hlsl
@@ -2,11 +2,16 @@
int i;
};
-[numthreads(1, 1, 1)]
-void main() {
+void main_1() {
int i = 0;
S V = {0};
const int x_14 = V.i;
i = x_14;
return;
}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/ptr_ref/load/local/struct_field.spvasm.expected.msl b/test/ptr_ref/load/local/struct_field.spvasm.expected.msl
index 185bd72..686dc6e 100644
--- a/test/ptr_ref/load/local/struct_field.spvasm.expected.msl
+++ b/test/ptr_ref/load/local/struct_field.spvasm.expected.msl
@@ -5,7 +5,7 @@
int i;
};
-kernel void tint_symbol() {
+void main_1() {
int i = 0;
S V = {};
int const x_14 = V.i;
@@ -13,3 +13,8 @@
return;
}
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/ptr_ref/load/local/struct_field.spvasm.expected.spvasm b/test/ptr_ref/load/local/struct_field.spvasm.expected.spvasm
index 814dd1b..14bc4f7 100644
--- a/test/ptr_ref/load/local/struct_field.spvasm.expected.spvasm
+++ b/test/ptr_ref/load/local/struct_field.spvasm.expected.spvasm
@@ -1,17 +1,18 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 17
+; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
- OpName %main "main"
+ OpName %main_1 "main_1"
OpName %i "i"
OpName %S "S"
OpMemberName %S 0 "i"
OpName %V "V"
+ OpName %main "main"
OpMemberDecorate %S 0 Offset 0
%void = OpTypeVoid
%1 = OpTypeFunction %void
@@ -23,7 +24,7 @@
%12 = OpConstantNull %S
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
- %main = OpFunction %void None %1
+ %main_1 = OpFunction %void None %1
%4 = OpLabel
%i = OpVariable %_ptr_Function_int Function %8
%V = OpVariable %_ptr_Function_S Function %12
@@ -32,3 +33,8 @@
OpStore %i %16
OpReturn
OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/ptr_ref/load/local/struct_field.spvasm.expected.wgsl b/test/ptr_ref/load/local/struct_field.spvasm.expected.wgsl
index ae1c95e..8ddaccf 100644
--- a/test/ptr_ref/load/local/struct_field.spvasm.expected.wgsl
+++ b/test/ptr_ref/load/local/struct_field.spvasm.expected.wgsl
@@ -2,11 +2,15 @@
i : i32;
};
-[[stage(compute)]]
-fn main() {
+fn main_1() {
var i : i32;
var V : S;
let x_14 : i32 = V.i;
i = x_14;
return;
}
+
+[[stage(compute)]]
+fn main() {
+ main_1();
+}
diff --git a/test/ptr_ref/load/param/ptr.spvasm.expected.hlsl b/test/ptr_ref/load/param/ptr.spvasm.expected.hlsl
index 102d13e..abdb81c 100644
--- a/test/ptr_ref/load/param/ptr.spvasm.expected.hlsl
+++ b/test/ptr_ref/load/param/ptr.spvasm.expected.hlsl
@@ -3,11 +3,16 @@
return (value + x_9);
}
-[numthreads(1, 1, 1)]
-void main() {
+void main_1() {
int i = 0;
i = 123;
const int x_19 = i;
const int x_18 = func(x_19, i);
return;
}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/ptr_ref/load/param/ptr.spvasm.expected.msl b/test/ptr_ref/load/param/ptr.spvasm.expected.msl
index 1999858..9c1e7cb 100644
--- a/test/ptr_ref/load/param/ptr.spvasm.expected.msl
+++ b/test/ptr_ref/load/param/ptr.spvasm.expected.msl
@@ -6,7 +6,7 @@
return (value + x_9);
}
-kernel void tint_symbol() {
+void main_1() {
int i = 0;
i = 123;
int const x_19 = i;
@@ -14,3 +14,8 @@
return;
}
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/ptr_ref/load/param/ptr.spvasm.expected.spvasm b/test/ptr_ref/load/param/ptr.spvasm.expected.spvasm
index 967e2a6..c487a58 100644
--- a/test/ptr_ref/load/param/ptr.spvasm.expected.spvasm
+++ b/test/ptr_ref/load/param/ptr.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 22
+; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -10,8 +10,9 @@
OpName %func "func"
OpName %value "value"
OpName %pointer "pointer"
- OpName %main "main"
+ OpName %main_1 "main_1"
OpName %i "i"
+ OpName %main "main"
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%1 = OpTypeFunction %int %int %_ptr_Function_int
@@ -28,7 +29,7 @@
%10 = OpIAdd %int %value %9
OpReturnValue %10
OpFunctionEnd
- %main = OpFunction %void None %11
+ %main_1 = OpFunction %void None %11
%14 = OpLabel
%i = OpVariable %_ptr_Function_int Function %17
OpStore %i %int_0
@@ -37,3 +38,8 @@
%20 = OpFunctionCall %int %func %19 %i
OpReturn
OpFunctionEnd
+ %main = OpFunction %void None %11
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/ptr_ref/load/param/ptr.spvasm.expected.wgsl b/test/ptr_ref/load/param/ptr.spvasm.expected.wgsl
index e74bd4e..97ca0e7 100644
--- a/test/ptr_ref/load/param/ptr.spvasm.expected.wgsl
+++ b/test/ptr_ref/load/param/ptr.spvasm.expected.wgsl
@@ -3,11 +3,15 @@
return (value + x_9);
}
-[[stage(compute)]]
-fn main() {
+fn main_1() {
var i : i32 = 0;
i = 123;
let x_19 : i32 = i;
let x_18 : i32 = func(x_19, &(i));
return;
}
+
+[[stage(compute)]]
+fn main() {
+ main_1();
+}
diff --git a/test/ptr_ref/store/global/i32.spvasm.expected.hlsl b/test/ptr_ref/store/global/i32.spvasm.expected.hlsl
index cb1bb3d..ffe0633 100644
--- a/test/ptr_ref/store/global/i32.spvasm.expected.hlsl
+++ b/test/ptr_ref/store/global/i32.spvasm.expected.hlsl
@@ -1,8 +1,13 @@
static int I = 0;
-[numthreads(1, 1, 1)]
-void main() {
+void main_1() {
I = 123;
I = ((100 + 20) + 3);
return;
}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/ptr_ref/store/global/i32.spvasm.expected.msl b/test/ptr_ref/store/global/i32.spvasm.expected.msl
index 7eaf2d6..6451fe4 100644
--- a/test/ptr_ref/store/global/i32.spvasm.expected.msl
+++ b/test/ptr_ref/store/global/i32.spvasm.expected.msl
@@ -1,10 +1,15 @@
#include <metal_stdlib>
using namespace metal;
+void main_1(thread int* const tint_symbol_1) {
+ *(tint_symbol_1) = 123;
+ *(tint_symbol_1) = ((100 + 20) + 3);
+ return;
+}
+
kernel void tint_symbol() {
- thread int tint_symbol_1 = 0;
- tint_symbol_1 = 123;
- tint_symbol_1 = ((100 + 20) + 3);
+ thread int tint_symbol_2 = 0;
+ main_1(&(tint_symbol_2));
return;
}
diff --git a/test/ptr_ref/store/global/i32.spvasm.expected.spvasm b/test/ptr_ref/store/global/i32.spvasm.expected.spvasm
index 786fc8a..dc2e271 100644
--- a/test/ptr_ref/store/global/i32.spvasm.expected.spvasm
+++ b/test/ptr_ref/store/global/i32.spvasm.expected.spvasm
@@ -1,13 +1,14 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 18
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %I "I"
+ OpName %main_1 "main_1"
OpName %main "main"
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
@@ -19,7 +20,7 @@
%int_100 = OpConstant %int 100
%int_20 = OpConstant %int 20
%int_3 = OpConstant %int 3
- %main = OpFunction %void None %5
+ %main_1 = OpFunction %void None %5
%8 = OpLabel
OpStore %I %int_123
%12 = OpIAdd %int %int_100 %int_20
@@ -27,3 +28,8 @@
OpStore %I %14
OpReturn
OpFunctionEnd
+ %main = OpFunction %void None %5
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/ptr_ref/store/global/i32.spvasm.expected.wgsl b/test/ptr_ref/store/global/i32.spvasm.expected.wgsl
index 9d7722f..ffd907a 100644
--- a/test/ptr_ref/store/global/i32.spvasm.expected.wgsl
+++ b/test/ptr_ref/store/global/i32.spvasm.expected.wgsl
@@ -1,8 +1,12 @@
var<private> I : i32 = 0;
-[[stage(compute)]]
-fn main() {
+fn main_1() {
I = 123;
I = ((100 + 20) + 3);
return;
}
+
+[[stage(compute)]]
+fn main() {
+ main_1();
+}
diff --git a/test/ptr_ref/store/global/struct_field.spvasm.expected.hlsl b/test/ptr_ref/store/global/struct_field.spvasm.expected.hlsl
index 0d55494..0ce7881 100644
--- a/test/ptr_ref/store/global/struct_field.spvasm.expected.hlsl
+++ b/test/ptr_ref/store/global/struct_field.spvasm.expected.hlsl
@@ -4,8 +4,13 @@
static S V;
+void main_1() {
+ V.i = 5;
+ return;
+}
+
[numthreads(1, 1, 1)]
void main() {
- V.i = 5;
+ main_1();
return;
}
diff --git a/test/ptr_ref/store/global/struct_field.spvasm.expected.msl b/test/ptr_ref/store/global/struct_field.spvasm.expected.msl
index 243f1d6..451a322 100644
--- a/test/ptr_ref/store/global/struct_field.spvasm.expected.msl
+++ b/test/ptr_ref/store/global/struct_field.spvasm.expected.msl
@@ -5,9 +5,14 @@
int i;
};
+void main_1(thread S* const tint_symbol_1) {
+ (*(tint_symbol_1)).i = 5;
+ return;
+}
+
kernel void tint_symbol() {
- thread S tint_symbol_1 = {};
- tint_symbol_1.i = 5;
+ thread S tint_symbol_2 = {};
+ main_1(&(tint_symbol_2));
return;
}
diff --git a/test/ptr_ref/store/global/struct_field.spvasm.expected.spvasm b/test/ptr_ref/store/global/struct_field.spvasm.expected.spvasm
index e63c070..7a712bc 100644
--- a/test/ptr_ref/store/global/struct_field.spvasm.expected.spvasm
+++ b/test/ptr_ref/store/global/struct_field.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 18
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -10,6 +10,7 @@
OpName %S "S"
OpMemberName %S 0 "i"
OpName %V "V"
+ OpName %main_1 "main_1"
OpName %main "main"
OpMemberDecorate %S 0 Offset 0
%int = OpTypeInt 32 1
@@ -23,9 +24,14 @@
%uint_0 = OpConstant %uint 0
%_ptr_Private_int = OpTypePointer Private %int
%int_5 = OpConstant %int 5
- %main = OpFunction %void None %6
+ %main_1 = OpFunction %void None %6
%9 = OpLabel
%13 = OpAccessChain %_ptr_Private_int %V %uint_0
OpStore %13 %int_5
OpReturn
OpFunctionEnd
+ %main = OpFunction %void None %6
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/ptr_ref/store/global/struct_field.spvasm.expected.wgsl b/test/ptr_ref/store/global/struct_field.spvasm.expected.wgsl
index 50cb6f4..7362392 100644
--- a/test/ptr_ref/store/global/struct_field.spvasm.expected.wgsl
+++ b/test/ptr_ref/store/global/struct_field.spvasm.expected.wgsl
@@ -4,8 +4,12 @@
var<private> V : S;
-[[stage(compute)]]
-fn main() {
+fn main_1() {
V.i = 5;
return;
}
+
+[[stage(compute)]]
+fn main() {
+ main_1();
+}
diff --git a/test/ptr_ref/store/local/i32.spvasm.expected.hlsl b/test/ptr_ref/store/local/i32.spvasm.expected.hlsl
index d9ec3d2..5a9d251 100644
--- a/test/ptr_ref/store/local/i32.spvasm.expected.hlsl
+++ b/test/ptr_ref/store/local/i32.spvasm.expected.hlsl
@@ -1,8 +1,13 @@
-[numthreads(1, 1, 1)]
-void main() {
+void main_1() {
int i = 0;
i = 123;
i = 123;
i = ((100 + 20) + 3);
return;
}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/ptr_ref/store/local/i32.spvasm.expected.msl b/test/ptr_ref/store/local/i32.spvasm.expected.msl
index 21174ae..dd05e5c 100644
--- a/test/ptr_ref/store/local/i32.spvasm.expected.msl
+++ b/test/ptr_ref/store/local/i32.spvasm.expected.msl
@@ -1,7 +1,7 @@
#include <metal_stdlib>
using namespace metal;
-kernel void tint_symbol() {
+void main_1() {
int i = 0;
i = 123;
i = 123;
@@ -9,3 +9,8 @@
return;
}
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/ptr_ref/store/local/i32.spvasm.expected.spvasm b/test/ptr_ref/store/local/i32.spvasm.expected.spvasm
index 5a05b5e..85a187a 100644
--- a/test/ptr_ref/store/local/i32.spvasm.expected.spvasm
+++ b/test/ptr_ref/store/local/i32.spvasm.expected.spvasm
@@ -1,14 +1,15 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 16
+; Bound: 19
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
- OpName %main "main"
+ OpName %main_1 "main_1"
OpName %i "i"
+ OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
@@ -19,7 +20,7 @@
%int_100 = OpConstant %int 100
%int_20 = OpConstant %int 20
%int_3 = OpConstant %int 3
- %main = OpFunction %void None %1
+ %main_1 = OpFunction %void None %1
%4 = OpLabel
%i = OpVariable %_ptr_Function_int Function %9
OpStore %i %int_0
@@ -30,3 +31,8 @@
OpStore %i %15
OpReturn
OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/ptr_ref/store/local/i32.spvasm.expected.wgsl b/test/ptr_ref/store/local/i32.spvasm.expected.wgsl
index ebc870a..f1695d1 100644
--- a/test/ptr_ref/store/local/i32.spvasm.expected.wgsl
+++ b/test/ptr_ref/store/local/i32.spvasm.expected.wgsl
@@ -1,8 +1,12 @@
-[[stage(compute)]]
-fn main() {
+fn main_1() {
var i : i32 = 0;
i = 123;
i = 123;
i = ((100 + 20) + 3);
return;
}
+
+[[stage(compute)]]
+fn main() {
+ main_1();
+}
diff --git a/test/ptr_ref/store/local/struct_field.spvasm.expected.hlsl b/test/ptr_ref/store/local/struct_field.spvasm.expected.hlsl
index 9f99f65..f28389b 100644
--- a/test/ptr_ref/store/local/struct_field.spvasm.expected.hlsl
+++ b/test/ptr_ref/store/local/struct_field.spvasm.expected.hlsl
@@ -2,9 +2,14 @@
int i;
};
-[numthreads(1, 1, 1)]
-void main() {
+void main_1() {
S V = {0};
V.i = 5;
return;
}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/ptr_ref/store/local/struct_field.spvasm.expected.msl b/test/ptr_ref/store/local/struct_field.spvasm.expected.msl
index 2e6989d..8be5378 100644
--- a/test/ptr_ref/store/local/struct_field.spvasm.expected.msl
+++ b/test/ptr_ref/store/local/struct_field.spvasm.expected.msl
@@ -5,9 +5,14 @@
int i;
};
-kernel void tint_symbol() {
+void main_1() {
S V = {};
V.i = 5;
return;
}
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/ptr_ref/store/local/struct_field.spvasm.expected.spvasm b/test/ptr_ref/store/local/struct_field.spvasm.expected.spvasm
index 255c691..1724b729 100644
--- a/test/ptr_ref/store/local/struct_field.spvasm.expected.spvasm
+++ b/test/ptr_ref/store/local/struct_field.spvasm.expected.spvasm
@@ -1,16 +1,17 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 15
+; Bound: 18
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
- OpName %main "main"
+ OpName %main_1 "main_1"
OpName %S "S"
OpMemberName %S 0 "i"
OpName %V "V"
+ OpName %main "main"
OpMemberDecorate %S 0 Offset 0
%void = OpTypeVoid
%1 = OpTypeFunction %void
@@ -22,10 +23,15 @@
%uint_0 = OpConstant %uint 0
%_ptr_Function_int = OpTypePointer Function %int
%int_5 = OpConstant %int 5
- %main = OpFunction %void None %1
+ %main_1 = OpFunction %void None %1
%4 = OpLabel
%V = OpVariable %_ptr_Function_S Function %9
%13 = OpAccessChain %_ptr_Function_int %V %uint_0
OpStore %13 %int_5
OpReturn
OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/ptr_ref/store/local/struct_field.spvasm.expected.wgsl b/test/ptr_ref/store/local/struct_field.spvasm.expected.wgsl
index 77d7681..d9c0e1f 100644
--- a/test/ptr_ref/store/local/struct_field.spvasm.expected.wgsl
+++ b/test/ptr_ref/store/local/struct_field.spvasm.expected.wgsl
@@ -2,9 +2,13 @@
i : i32;
};
-[[stage(compute)]]
-fn main() {
+fn main_1() {
var V : S;
V.i = 5;
return;
}
+
+[[stage(compute)]]
+fn main() {
+ main_1();
+}
diff --git a/test/ptr_ref/store/param/ptr.spvasm.expected.hlsl b/test/ptr_ref/store/param/ptr.spvasm.expected.hlsl
index 7caf2f1..3191118 100644
--- a/test/ptr_ref/store/param/ptr.spvasm.expected.hlsl
+++ b/test/ptr_ref/store/param/ptr.spvasm.expected.hlsl
@@ -3,10 +3,15 @@
return;
}
-[numthreads(1, 1, 1)]
-void main() {
+void main_1() {
int i = 0;
i = 123;
func(123, i);
return;
}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/ptr_ref/store/param/ptr.spvasm.expected.msl b/test/ptr_ref/store/param/ptr.spvasm.expected.msl
index 98cc63c..e689f47 100644
--- a/test/ptr_ref/store/param/ptr.spvasm.expected.msl
+++ b/test/ptr_ref/store/param/ptr.spvasm.expected.msl
@@ -6,10 +6,15 @@
return;
}
-kernel void tint_symbol() {
+void main_1() {
int i = 0;
i = 123;
func(123, &(i));
return;
}
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/ptr_ref/store/param/ptr.spvasm.expected.spvasm b/test/ptr_ref/store/param/ptr.spvasm.expected.spvasm
index 8126ab6..c4a8e19 100644
--- a/test/ptr_ref/store/param/ptr.spvasm.expected.spvasm
+++ b/test/ptr_ref/store/param/ptr.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 19
+; Bound: 22
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -10,8 +10,9 @@
OpName %func "func"
OpName %value "value"
OpName %pointer "pointer"
- OpName %main "main"
+ OpName %main_1 "main_1"
OpName %i "i"
+ OpName %main "main"
%void = OpTypeVoid
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
@@ -27,7 +28,7 @@
OpStore %pointer %value
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %10
+ %main_1 = OpFunction %void None %10
%12 = OpLabel
%i = OpVariable %_ptr_Function_int Function %15
OpStore %i %int_0
@@ -35,3 +36,8 @@
%17 = OpFunctionCall %void %func %int_123 %i
OpReturn
OpFunctionEnd
+ %main = OpFunction %void None %10
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/ptr_ref/store/param/ptr.spvasm.expected.wgsl b/test/ptr_ref/store/param/ptr.spvasm.expected.wgsl
index b3de2eb..d56ff4c 100644
--- a/test/ptr_ref/store/param/ptr.spvasm.expected.wgsl
+++ b/test/ptr_ref/store/param/ptr.spvasm.expected.wgsl
@@ -3,10 +3,14 @@
return;
}
-[[stage(compute)]]
-fn main() {
+fn main_1() {
var i : i32 = 0;
i = 123;
func(123, &(i));
return;
}
+
+[[stage(compute)]]
+fn main() {
+ main_1();
+}