tint: Deprecated module-scope 'let' for 'const'
Enable the parsing of 'const'.
Warn on use of module-scope 'let', and automatically replace with 'const'.
Fixed: tint:1580
Change-Id: I214aabca80686dc6b60ae21a7a57fbfb4898ea83
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93786
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/test/tint/access/let/matrix.wgsl.expected.glsl b/test/tint/access/let/matrix.wgsl.expected.glsl
index 6f4717b..0add115 100644
--- a/test/tint/access/let/matrix.wgsl.expected.glsl
+++ b/test/tint/access/let/matrix.wgsl.expected.glsl
@@ -2,8 +2,8 @@
void tint_symbol() {
mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f));
- vec3 v = vec3(4.0f, 5.0f, 6.0f);
- float f = 5.0f;
+ vec3 v = m[1];
+ float f = v[1];
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
diff --git a/test/tint/access/let/matrix.wgsl.expected.hlsl b/test/tint/access/let/matrix.wgsl.expected.hlsl
index 4dcc54e..38129cf 100644
--- a/test/tint/access/let/matrix.wgsl.expected.hlsl
+++ b/test/tint/access/let/matrix.wgsl.expected.hlsl
@@ -1,7 +1,7 @@
[numthreads(1, 1, 1)]
void main() {
const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
- const float3 v = float3(4.0f, 5.0f, 6.0f);
- const float f = 5.0f;
+ const float3 v = m[1];
+ const float f = v[1];
return;
}
diff --git a/test/tint/access/let/matrix.wgsl.expected.msl b/test/tint/access/let/matrix.wgsl.expected.msl
index a1b3e45..f8f945d 100644
--- a/test/tint/access/let/matrix.wgsl.expected.msl
+++ b/test/tint/access/let/matrix.wgsl.expected.msl
@@ -3,8 +3,8 @@
using namespace metal;
kernel void tint_symbol() {
float3x3 const m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
- float3 const v = float3(4.0f, 5.0f, 6.0f);
- float const f = 5.0f;
+ float3 const v = m[1];
+ float const f = v[1];
return;
}
diff --git a/test/tint/access/let/matrix.wgsl.expected.spvasm b/test/tint/access/let/matrix.wgsl.expected.spvasm
index 47263bf..cbc5aca 100644
--- a/test/tint/access/let/matrix.wgsl.expected.spvasm
+++ b/test/tint/access/let/matrix.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -26,7 +26,11 @@
%float_9 = OpConstant %float 9
%19 = OpConstantComposite %v3float %float_7 %float_8 %float_9
%20 = OpConstantComposite %mat3v3float %11 %15 %19
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
%main = OpFunction %void None %1
%4 = OpLabel
+ %23 = OpCompositeExtract %v3float %20 1
+ %24 = OpCompositeExtract %float %23 1
OpReturn
OpFunctionEnd
diff --git a/test/tint/array/size.wgsl b/test/tint/array/size.wgsl
index f9135ad..4b2ec37 100644
--- a/test/tint/array/size.wgsl
+++ b/test/tint/array/size.wgsl
@@ -1,5 +1,5 @@
-let slen = 4;
-let ulen = 4u;
+const slen = 4;
+const ulen = 4u;
@fragment
fn main() {
diff --git a/test/tint/array/size.wgsl.expected.glsl b/test/tint/array/size.wgsl.expected.glsl
index 762d5c8..132511d 100644
--- a/test/tint/array/size.wgsl.expected.glsl
+++ b/test/tint/array/size.wgsl.expected.glsl
@@ -1,8 +1,6 @@
#version 310 es
precision mediump float;
-const int slen = 4;
-const uint ulen = 4u;
void tint_symbol() {
float signed_literal[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
float unsigned_literal[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
diff --git a/test/tint/array/size.wgsl.expected.hlsl b/test/tint/array/size.wgsl.expected.hlsl
index e5fdbd3..4753dde 100644
--- a/test/tint/array/size.wgsl.expected.hlsl
+++ b/test/tint/array/size.wgsl.expected.hlsl
@@ -1,6 +1,3 @@
-static const int slen = 4;
-static const uint ulen = 4u;
-
void main() {
float signed_literal[4] = (float[4])0;
float unsigned_literal[4] = (float[4])0;
diff --git a/test/tint/array/size.wgsl.expected.msl b/test/tint/array/size.wgsl.expected.msl
index 27994b2..f72c5aa 100644
--- a/test/tint/array/size.wgsl.expected.msl
+++ b/test/tint/array/size.wgsl.expected.msl
@@ -14,10 +14,6 @@
T elements[N];
};
-constant int slen = 4;
-
-constant uint ulen = 4u;
-
fragment void tint_symbol() {
tint_array<float, 4> signed_literal = {};
tint_array<float, 4> unsigned_literal = {};
diff --git a/test/tint/array/size.wgsl.expected.spvasm b/test/tint/array/size.wgsl.expected.spvasm
index ada562b..ac1a0c9 100644
--- a/test/tint/array/size.wgsl.expected.spvasm
+++ b/test/tint/array/size.wgsl.expected.spvasm
@@ -1,39 +1,35 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 19
+; Bound: 17
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main"
OpExecutionMode %main OriginUpperLeft
- OpName %slen "slen"
- OpName %ulen "ulen"
OpName %main "main"
OpName %signed_literal "signed_literal"
OpName %unsigned_literal "unsigned_literal"
OpName %signed_constant "signed_constant"
OpName %unsigned_constant "unsigned_constant"
- OpDecorate %_arr_float_ulen ArrayStride 4
- %int = OpTypeInt 32 1
- %slen = OpConstant %int 4
- %uint = OpTypeInt 32 0
- %ulen = OpConstant %uint 4
+ OpDecorate %_arr_float_uint_4 ArrayStride 4
%void = OpTypeVoid
- %5 = OpTypeFunction %void
+ %1 = OpTypeFunction %void
%float = OpTypeFloat 32
-%_arr_float_ulen = OpTypeArray %float %ulen
-%_ptr_Function__arr_float_ulen = OpTypePointer Function %_arr_float_ulen
- %13 = OpConstantNull %_arr_float_ulen
- %main = OpFunction %void None %5
- %8 = OpLabel
-%signed_literal = OpVariable %_ptr_Function__arr_float_ulen Function %13
-%unsigned_literal = OpVariable %_ptr_Function__arr_float_ulen Function %13
-%signed_constant = OpVariable %_ptr_Function__arr_float_ulen Function %13
-%unsigned_constant = OpVariable %_ptr_Function__arr_float_ulen Function %13
- %17 = OpLoad %_arr_float_ulen %unsigned_constant
- OpStore %signed_literal %17
- %18 = OpLoad %_arr_float_ulen %unsigned_literal
- OpStore %signed_constant %18
+ %uint = OpTypeInt 32 0
+ %uint_4 = OpConstant %uint 4
+%_arr_float_uint_4 = OpTypeArray %float %uint_4
+%_ptr_Function__arr_float_uint_4 = OpTypePointer Function %_arr_float_uint_4
+ %11 = OpConstantNull %_arr_float_uint_4
+ %main = OpFunction %void None %1
+ %4 = OpLabel
+%signed_literal = OpVariable %_ptr_Function__arr_float_uint_4 Function %11
+%unsigned_literal = OpVariable %_ptr_Function__arr_float_uint_4 Function %11
+%signed_constant = OpVariable %_ptr_Function__arr_float_uint_4 Function %11
+%unsigned_constant = OpVariable %_ptr_Function__arr_float_uint_4 Function %11
+ %15 = OpLoad %_arr_float_uint_4 %unsigned_constant
+ OpStore %signed_literal %15
+ %16 = OpLoad %_arr_float_uint_4 %unsigned_literal
+ OpStore %signed_constant %16
OpReturn
OpFunctionEnd
diff --git a/test/tint/array/size.wgsl.expected.wgsl b/test/tint/array/size.wgsl.expected.wgsl
index 7b6efc6..a82c377 100644
--- a/test/tint/array/size.wgsl.expected.wgsl
+++ b/test/tint/array/size.wgsl.expected.wgsl
@@ -1,6 +1,6 @@
-let slen = 4;
+const slen = 4;
-let ulen = 4u;
+const ulen = 4u;
@fragment
fn main() {
diff --git a/test/tint/array/type_constructor.wgsl.expected.glsl b/test/tint/array/type_constructor.wgsl.expected.glsl
index a9c5edf..82b9843 100644
--- a/test/tint/array/type_constructor.wgsl.expected.glsl
+++ b/test/tint/array/type_constructor.wgsl.expected.glsl
@@ -4,35 +4,35 @@
int x = 42;
int empty[4] = int[4](0, 0, 0, 0);
int nonempty[4] = int[4](1, 2, 3, 4);
- int nonempty_with_expr[4] = int[4](1, x, (x + 1), 4);
+ int nonempty_with_expr[4] = int[4](1, x, (x + 1), nonempty[3]);
int nested_empty[2][3][4] = int[2][3][4](int[3][4](int[4](0, 0, 0, 0), int[4](0, 0, 0, 0), int[4](0, 0, 0, 0)), int[3][4](int[4](0, 0, 0, 0), int[4](0, 0, 0, 0), int[4](0, 0, 0, 0)));
int tint_symbol_1[4] = int[4](1, 2, 3, 4);
int tint_symbol_2[4] = int[4](5, 6, 7, 8);
int tint_symbol_3[4] = int[4](9, 10, 11, 12);
- int tint_symbol_4[3][4] = int[3][4](int[4](1, 2, 3, 4), int[4](5, 6, 7, 8), int[4](9, 10, 11, 12));
+ int tint_symbol_4[3][4] = int[3][4](tint_symbol_1, tint_symbol_2, tint_symbol_3);
int tint_symbol_5[4] = int[4](13, 14, 15, 16);
int tint_symbol_6[4] = int[4](17, 18, 19, 20);
int tint_symbol_7[4] = int[4](21, 22, 23, 24);
- int tint_symbol_8[3][4] = int[3][4](int[4](13, 14, 15, 16), int[4](17, 18, 19, 20), int[4](21, 22, 23, 24));
- int nested_nonempty[2][3][4] = int[2][3][4](int[3][4](int[4](1, 2, 3, 4), int[4](5, 6, 7, 8), int[4](9, 10, 11, 12)), int[3][4](int[4](13, 14, 15, 16), int[4](17, 18, 19, 20), int[4](21, 22, 23, 24)));
+ int tint_symbol_8[3][4] = int[3][4](tint_symbol_5, tint_symbol_6, tint_symbol_7);
+ int nested_nonempty[2][3][4] = int[2][3][4](tint_symbol_4, tint_symbol_8);
int tint_symbol_9[4] = int[4](1, 2, x, (x + 1));
- int tint_symbol_10[4] = int[4](5, 6, 3, (4 + 1));
+ int tint_symbol_10[4] = int[4](5, 6, nonempty[2], (nonempty[3] + 1));
int tint_symbol_11[3][4] = int[3][4](tint_symbol_9, tint_symbol_10, nonempty);
- int nested_nonempty_with_expr[2][3][4] = int[2][3][4](tint_symbol_11, int[3][4](int[4](13, 14, 15, 16), int[4](17, 18, 19, 20), int[4](21, 22, 23, 24)));
+ int nested_nonempty_with_expr[2][3][4] = int[2][3][4](tint_symbol_11, nested_nonempty[1]);
int tint_symbol_12[4] = int[4](0, 0, 0, 0);
- int subexpr_empty = 0;
+ int subexpr_empty = tint_symbol_12[1];
int tint_symbol_13[4] = int[4](1, 2, 3, 4);
- int subexpr_nonempty = 3;
- int tint_symbol_14[4] = int[4](1, x, (x + 1), 4);
+ int subexpr_nonempty = tint_symbol_13[2];
+ int tint_symbol_14[4] = int[4](1, x, (x + 1), nonempty[3]);
int subexpr_nonempty_with_expr = tint_symbol_14[2];
int tint_symbol_15[2][4] = int[2][4](int[4](0, 0, 0, 0), int[4](0, 0, 0, 0));
- int subexpr_nested_empty[4] = int[4](0, 0, 0, 0);
+ int subexpr_nested_empty[4] = tint_symbol_15[1];
int tint_symbol_16[4] = int[4](1, 2, 3, 4);
int tint_symbol_17[4] = int[4](5, 6, 7, 8);
- int tint_symbol_18[2][4] = int[2][4](int[4](1, 2, 3, 4), int[4](5, 6, 7, 8));
- int subexpr_nested_nonempty[4] = int[4](5, 6, 7, 8);
- int tint_symbol_19[4] = int[4](1, x, (x + 1), 4);
- int tint_symbol_20[2][4] = int[2][4](tint_symbol_19, int[4](21, 22, 23, 24));
+ int tint_symbol_18[2][4] = int[2][4](tint_symbol_16, tint_symbol_17);
+ int subexpr_nested_nonempty[4] = tint_symbol_18[1];
+ int tint_symbol_19[4] = int[4](1, x, (x + 1), nonempty[3]);
+ int tint_symbol_20[2][4] = int[2][4](tint_symbol_19, nested_nonempty[1][2]);
int subexpr_nested_nonempty_with_expr[4] = tint_symbol_20[1];
}
diff --git a/test/tint/array/type_constructor.wgsl.expected.hlsl b/test/tint/array/type_constructor.wgsl.expected.hlsl
index 64829e1..8640324 100644
--- a/test/tint/array/type_constructor.wgsl.expected.hlsl
+++ b/test/tint/array/type_constructor.wgsl.expected.hlsl
@@ -3,35 +3,35 @@
const int x = 42;
const int empty[4] = (int[4])0;
const int nonempty[4] = {1, 2, 3, 4};
- const int nonempty_with_expr[4] = {1, x, (x + 1), 4};
+ const int nonempty_with_expr[4] = {1, x, (x + 1), nonempty[3]};
const int nested_empty[2][3][4] = (int[2][3][4])0;
const int tint_symbol[4] = {1, 2, 3, 4};
const int tint_symbol_1[4] = {5, 6, 7, 8};
const int tint_symbol_2[4] = {9, 10, 11, 12};
- const int tint_symbol_3[3][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
+ const int tint_symbol_3[3][4] = {tint_symbol, tint_symbol_1, tint_symbol_2};
const int tint_symbol_4[4] = {13, 14, 15, 16};
const int tint_symbol_5[4] = {17, 18, 19, 20};
const int tint_symbol_6[4] = {21, 22, 23, 24};
- const int tint_symbol_7[3][4] = {{13, 14, 15, 16}, {17, 18, 19, 20}, {21, 22, 23, 24}};
- const int nested_nonempty[2][3][4] = {{{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}}, {{13, 14, 15, 16}, {17, 18, 19, 20}, {21, 22, 23, 24}}};
+ const int tint_symbol_7[3][4] = {tint_symbol_4, tint_symbol_5, tint_symbol_6};
+ const int nested_nonempty[2][3][4] = {tint_symbol_3, tint_symbol_7};
const int tint_symbol_8[4] = {1, 2, x, (x + 1)};
- const int tint_symbol_9[4] = {5, 6, 3, (4 + 1)};
+ const int tint_symbol_9[4] = {5, 6, nonempty[2], (nonempty[3] + 1)};
const int tint_symbol_10[3][4] = {tint_symbol_8, tint_symbol_9, nonempty};
- const int nested_nonempty_with_expr[2][3][4] = {tint_symbol_10, {{13, 14, 15, 16}, {17, 18, 19, 20}, {21, 22, 23, 24}}};
+ const int nested_nonempty_with_expr[2][3][4] = {tint_symbol_10, nested_nonempty[1]};
const int tint_symbol_11[4] = (int[4])0;
- const int subexpr_empty = 0;
+ const int subexpr_empty = tint_symbol_11[1];
const int tint_symbol_12[4] = {1, 2, 3, 4};
- const int subexpr_nonempty = 3;
- const int tint_symbol_13[4] = {1, x, (x + 1), 4};
+ const int subexpr_nonempty = tint_symbol_12[2];
+ const int tint_symbol_13[4] = {1, x, (x + 1), nonempty[3]};
const int subexpr_nonempty_with_expr = tint_symbol_13[2];
const int tint_symbol_14[2][4] = (int[2][4])0;
- const int subexpr_nested_empty[4] = (int[4])0;
+ const int subexpr_nested_empty[4] = tint_symbol_14[1];
const int tint_symbol_15[4] = {1, 2, 3, 4};
const int tint_symbol_16[4] = {5, 6, 7, 8};
- const int tint_symbol_17[2][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}};
- const int subexpr_nested_nonempty[4] = {5, 6, 7, 8};
- const int tint_symbol_18[4] = {1, x, (x + 1), 4};
- const int tint_symbol_19[2][4] = {tint_symbol_18, {21, 22, 23, 24}};
+ const int tint_symbol_17[2][4] = {tint_symbol_15, tint_symbol_16};
+ const int subexpr_nested_nonempty[4] = tint_symbol_17[1];
+ const int tint_symbol_18[4] = {1, x, (x + 1), nonempty[3]};
+ const int tint_symbol_19[2][4] = {tint_symbol_18, nested_nonempty[1][2]};
const int subexpr_nested_nonempty_with_expr[4] = tint_symbol_19[1];
return;
}
diff --git a/test/tint/array/type_constructor.wgsl.expected.msl b/test/tint/array/type_constructor.wgsl.expected.msl
index 54c3dfd..d2ca398 100644
--- a/test/tint/array/type_constructor.wgsl.expected.msl
+++ b/test/tint/array/type_constructor.wgsl.expected.msl
@@ -18,35 +18,35 @@
int const x = 42;
tint_array<int, 4> const empty = tint_array<int, 4>{};
tint_array<int, 4> const nonempty = tint_array<int, 4>{1, 2, 3, 4};
- tint_array<int, 4> const nonempty_with_expr = tint_array<int, 4>{1, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1))), 4};
+ tint_array<int, 4> const nonempty_with_expr = tint_array<int, 4>{1, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1))), nonempty[3]};
tint_array<tint_array<tint_array<int, 4>, 3>, 2> const nested_empty = tint_array<tint_array<tint_array<int, 4>, 3>, 2>{};
tint_array<int, 4> const tint_symbol_1 = tint_array<int, 4>{1, 2, 3, 4};
tint_array<int, 4> const tint_symbol_2 = tint_array<int, 4>{5, 6, 7, 8};
tint_array<int, 4> const tint_symbol_3 = tint_array<int, 4>{9, 10, 11, 12};
- tint_array<tint_array<int, 4>, 3> const tint_symbol_4 = tint_array<tint_array<int, 4>, 3>{tint_array<int, 4>{1, 2, 3, 4}, tint_array<int, 4>{5, 6, 7, 8}, tint_array<int, 4>{9, 10, 11, 12}};
+ tint_array<tint_array<int, 4>, 3> const tint_symbol_4 = tint_array<tint_array<int, 4>, 3>{tint_symbol_1, tint_symbol_2, tint_symbol_3};
tint_array<int, 4> const tint_symbol_5 = tint_array<int, 4>{13, 14, 15, 16};
tint_array<int, 4> const tint_symbol_6 = tint_array<int, 4>{17, 18, 19, 20};
tint_array<int, 4> const tint_symbol_7 = tint_array<int, 4>{21, 22, 23, 24};
- tint_array<tint_array<int, 4>, 3> const tint_symbol_8 = tint_array<tint_array<int, 4>, 3>{tint_array<int, 4>{13, 14, 15, 16}, tint_array<int, 4>{17, 18, 19, 20}, tint_array<int, 4>{21, 22, 23, 24}};
- tint_array<tint_array<tint_array<int, 4>, 3>, 2> const nested_nonempty = tint_array<tint_array<tint_array<int, 4>, 3>, 2>{tint_array<tint_array<int, 4>, 3>{tint_array<int, 4>{1, 2, 3, 4}, tint_array<int, 4>{5, 6, 7, 8}, tint_array<int, 4>{9, 10, 11, 12}}, tint_array<tint_array<int, 4>, 3>{tint_array<int, 4>{13, 14, 15, 16}, tint_array<int, 4>{17, 18, 19, 20}, tint_array<int, 4>{21, 22, 23, 24}}};
+ tint_array<tint_array<int, 4>, 3> const tint_symbol_8 = tint_array<tint_array<int, 4>, 3>{tint_symbol_5, tint_symbol_6, tint_symbol_7};
+ tint_array<tint_array<tint_array<int, 4>, 3>, 2> const nested_nonempty = tint_array<tint_array<tint_array<int, 4>, 3>, 2>{tint_symbol_4, tint_symbol_8};
tint_array<int, 4> const tint_symbol_9 = tint_array<int, 4>{1, 2, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1)))};
- tint_array<int, 4> const tint_symbol_10 = tint_array<int, 4>{5, 6, 3, as_type<int>((as_type<uint>(4) + as_type<uint>(1)))};
+ tint_array<int, 4> const tint_symbol_10 = tint_array<int, 4>{5, 6, nonempty[2], as_type<int>((as_type<uint>(nonempty[3]) + as_type<uint>(1)))};
tint_array<tint_array<int, 4>, 3> const tint_symbol_11 = tint_array<tint_array<int, 4>, 3>{tint_symbol_9, tint_symbol_10, nonempty};
- tint_array<tint_array<tint_array<int, 4>, 3>, 2> const nested_nonempty_with_expr = tint_array<tint_array<tint_array<int, 4>, 3>, 2>{tint_symbol_11, tint_array<tint_array<int, 4>, 3>{tint_array<int, 4>{13, 14, 15, 16}, tint_array<int, 4>{17, 18, 19, 20}, tint_array<int, 4>{21, 22, 23, 24}}};
+ tint_array<tint_array<tint_array<int, 4>, 3>, 2> const nested_nonempty_with_expr = tint_array<tint_array<tint_array<int, 4>, 3>, 2>{tint_symbol_11, nested_nonempty[1]};
tint_array<int, 4> const tint_symbol_12 = tint_array<int, 4>{};
- int const subexpr_empty = 0;
+ int const subexpr_empty = tint_symbol_12[1];
tint_array<int, 4> const tint_symbol_13 = tint_array<int, 4>{1, 2, 3, 4};
- int const subexpr_nonempty = 3;
- tint_array<int, 4> const tint_symbol_14 = tint_array<int, 4>{1, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1))), 4};
+ int const subexpr_nonempty = tint_symbol_13[2];
+ tint_array<int, 4> const tint_symbol_14 = tint_array<int, 4>{1, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1))), nonempty[3]};
int const subexpr_nonempty_with_expr = tint_symbol_14[2];
tint_array<tint_array<int, 4>, 2> const tint_symbol_15 = tint_array<tint_array<int, 4>, 2>{};
- tint_array<int, 4> const subexpr_nested_empty = tint_array<int, 4>{};
+ tint_array<int, 4> const subexpr_nested_empty = tint_symbol_15[1];
tint_array<int, 4> const tint_symbol_16 = tint_array<int, 4>{1, 2, 3, 4};
tint_array<int, 4> const tint_symbol_17 = tint_array<int, 4>{5, 6, 7, 8};
- tint_array<tint_array<int, 4>, 2> const tint_symbol_18 = tint_array<tint_array<int, 4>, 2>{tint_array<int, 4>{1, 2, 3, 4}, tint_array<int, 4>{5, 6, 7, 8}};
- tint_array<int, 4> const subexpr_nested_nonempty = tint_array<int, 4>{5, 6, 7, 8};
- tint_array<int, 4> const tint_symbol_19 = tint_array<int, 4>{1, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1))), 4};
- tint_array<tint_array<int, 4>, 2> const tint_symbol_20 = tint_array<tint_array<int, 4>, 2>{tint_symbol_19, tint_array<int, 4>{21, 22, 23, 24}};
+ tint_array<tint_array<int, 4>, 2> const tint_symbol_18 = tint_array<tint_array<int, 4>, 2>{tint_symbol_16, tint_symbol_17};
+ tint_array<int, 4> const subexpr_nested_nonempty = tint_symbol_18[1];
+ tint_array<int, 4> const tint_symbol_19 = tint_array<int, 4>{1, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1))), nonempty[3]};
+ tint_array<tint_array<int, 4>, 2> const tint_symbol_20 = tint_array<tint_array<int, 4>, 2>{tint_symbol_19, nested_nonempty[1][2]};
tint_array<int, 4> const subexpr_nested_nonempty_with_expr = tint_symbol_20[1];
return;
}
diff --git a/test/tint/array/type_constructor.wgsl.expected.spvasm b/test/tint/array/type_constructor.wgsl.expected.spvasm
index 7c39af8..5d4084d 100644
--- a/test/tint/array/type_constructor.wgsl.expected.spvasm
+++ b/test/tint/array/type_constructor.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 66
+; Bound: 74
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -29,53 +29,61 @@
%_arr__arr_int_uint_4_uint_3 = OpTypeArray %_arr_int_uint_4 %uint_3
%uint_2 = OpConstant %uint 2
%_arr__arr__arr_int_uint_4_uint_3_uint_2 = OpTypeArray %_arr__arr_int_uint_4_uint_3 %uint_2
- %22 = OpConstantNull %_arr__arr__arr_int_uint_4_uint_3_uint_2
+ %23 = OpConstantNull %_arr__arr__arr_int_uint_4_uint_3_uint_2
%int_5 = OpConstant %int 5
%int_6 = OpConstant %int 6
%int_7 = OpConstant %int 7
%int_8 = OpConstant %int 8
- %27 = OpConstantComposite %_arr_int_uint_4 %int_5 %int_6 %int_7 %int_8
+ %28 = OpConstantComposite %_arr_int_uint_4 %int_5 %int_6 %int_7 %int_8
%int_9 = OpConstant %int 9
%int_10 = OpConstant %int 10
%int_11 = OpConstant %int 11
%int_12 = OpConstant %int 12
- %32 = OpConstantComposite %_arr_int_uint_4 %int_9 %int_10 %int_11 %int_12
- %33 = OpConstantComposite %_arr__arr_int_uint_4_uint_3 %15 %27 %32
+ %33 = OpConstantComposite %_arr_int_uint_4 %int_9 %int_10 %int_11 %int_12
+ %34 = OpConstantComposite %_arr__arr_int_uint_4_uint_3 %15 %28 %33
%int_13 = OpConstant %int 13
%int_14 = OpConstant %int 14
%int_15 = OpConstant %int 15
%int_16 = OpConstant %int 16
- %38 = OpConstantComposite %_arr_int_uint_4 %int_13 %int_14 %int_15 %int_16
+ %39 = OpConstantComposite %_arr_int_uint_4 %int_13 %int_14 %int_15 %int_16
%int_17 = OpConstant %int 17
%int_18 = OpConstant %int 18
%int_19 = OpConstant %int 19
%int_20 = OpConstant %int 20
- %43 = OpConstantComposite %_arr_int_uint_4 %int_17 %int_18 %int_19 %int_20
+ %44 = OpConstantComposite %_arr_int_uint_4 %int_17 %int_18 %int_19 %int_20
%int_21 = OpConstant %int 21
%int_22 = OpConstant %int 22
%int_23 = OpConstant %int 23
%int_24 = OpConstant %int 24
- %48 = OpConstantComposite %_arr_int_uint_4 %int_21 %int_22 %int_23 %int_24
- %49 = OpConstantComposite %_arr__arr_int_uint_4_uint_3 %38 %43 %48
- %50 = OpConstantComposite %_arr__arr__arr_int_uint_4_uint_3_uint_2 %33 %49
- %57 = OpConstantNull %int
+ %49 = OpConstantComposite %_arr_int_uint_4 %int_21 %int_22 %int_23 %int_24
+ %50 = OpConstantComposite %_arr__arr_int_uint_4_uint_3 %39 %44 %49
+ %51 = OpConstantComposite %_arr__arr__arr_int_uint_4_uint_3_uint_2 %34 %50
+ %61 = OpConstantNull %int
%_arr__arr_int_uint_4_uint_2 = OpTypeArray %_arr_int_uint_4 %uint_2
%main = OpFunction %void None %1
%4 = OpLabel
%16 = OpIAdd %int %int_42 %int_1
- %17 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %16 %int_4
- %51 = OpIAdd %int %int_42 %int_1
- %52 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_2 %int_42 %51
- %53 = OpIAdd %int %int_4 %int_1
- %54 = OpCompositeConstruct %_arr_int_uint_4 %int_5 %int_6 %int_3 %53
- %55 = OpCompositeConstruct %_arr__arr_int_uint_4_uint_3 %52 %54 %15
- %56 = OpCompositeConstruct %_arr__arr__arr_int_uint_4_uint_3_uint_2 %55 %49
- %58 = OpIAdd %int %int_42 %int_1
- %59 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %58 %int_4
- %60 = OpCompositeExtract %int %59 2
+ %17 = OpCompositeExtract %int %15 3
+ %18 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %16 %17
+ %52 = OpIAdd %int %int_42 %int_1
+ %53 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_2 %int_42 %52
+ %54 = OpCompositeExtract %int %15 2
+ %55 = OpCompositeExtract %int %15 3
+ %56 = OpIAdd %int %55 %int_1
+ %57 = OpCompositeConstruct %_arr_int_uint_4 %int_5 %int_6 %54 %56
+ %58 = OpCompositeConstruct %_arr__arr_int_uint_4_uint_3 %53 %57 %15
+ %59 = OpCompositeExtract %_arr__arr_int_uint_4_uint_3 %51 1
+ %60 = OpCompositeConstruct %_arr__arr__arr_int_uint_4_uint_3_uint_2 %58 %59
%62 = OpIAdd %int %int_42 %int_1
- %63 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %62 %int_4
- %64 = OpCompositeConstruct %_arr__arr_int_uint_4_uint_2 %63 %48
- %65 = OpCompositeExtract %_arr_int_uint_4 %64 1
+ %63 = OpCompositeExtract %int %15 3
+ %64 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %62 %63
+ %65 = OpCompositeExtract %int %64 2
+ %67 = OpIAdd %int %int_42 %int_1
+ %68 = OpCompositeExtract %int %15 3
+ %69 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %67 %68
+ %70 = OpCompositeExtract %_arr__arr_int_uint_4_uint_3 %51 1
+ %71 = OpCompositeExtract %_arr_int_uint_4 %70 2
+ %72 = OpCompositeConstruct %_arr__arr_int_uint_4_uint_2 %69 %71
+ %73 = OpCompositeExtract %_arr_int_uint_4 %72 1
OpReturn
OpFunctionEnd
diff --git a/test/tint/benchmark/bloom-vertical-blur.wgsl b/test/tint/benchmark/bloom-vertical-blur.wgsl
index 3754c10..f95264b 100644
--- a/test/tint/benchmark/bloom-vertical-blur.wgsl
+++ b/test/tint/benchmark/bloom-vertical-blur.wgsl
@@ -1,4 +1,4 @@
-let bloomDir = vec2(0.0, 1.0);
+const bloomDir = vec2(0.0, 1.0);
var<private> offsets : array<f32, 3> = array<f32, 3>(0.0, 1.384615421, 3.230769157);
diff --git a/test/tint/benchmark/cluster-lights.wgsl b/test/tint/benchmark/cluster-lights.wgsl
index c6eacc4..d29aab3 100644
--- a/test/tint/benchmark/cluster-lights.wgsl
+++ b/test/tint/benchmark/cluster-lights.wgsl
@@ -53,7 +53,7 @@
@group(0) @binding(3) var<storage, read> globalLights : GlobalLights;
-let tileCount = vec3(32u, 18u, 48u);
+const tileCount = vec3(32u, 18u, 48u);
fn linearDepth(depthSample : f32) -> f32 {
return ((camera.zFar * camera.zNear) / fma(depthSample, (camera.zNear - camera.zFar), camera.zFar));
diff --git a/test/tint/benchmark/shadow-fragment.wgsl b/test/tint/benchmark/shadow-fragment.wgsl
index 29eee86..c2da838 100644
--- a/test/tint/benchmark/shadow-fragment.wgsl
+++ b/test/tint/benchmark/shadow-fragment.wgsl
@@ -21,9 +21,9 @@
fragNorm : vec3<f32>,
}
-let albedo : vec3<f32> = vec3<f32>(0.899999976, 0.899999976, 0.899999976);
+const albedo : vec3<f32> = vec3<f32>(0.899999976, 0.899999976, 0.899999976);
-let ambientFactor : f32 = 0.200000003;
+const ambientFactor : f32 = 0.200000003;
@fragment
fn main(input : FragmentInput) -> @location(0) vec4<f32> {
diff --git a/test/tint/benchmark/skinned-shadowed-pbr-fragment.wgsl b/test/tint/benchmark/skinned-shadowed-pbr-fragment.wgsl
index eb1c0b0..d0f8354 100644
--- a/test/tint/benchmark/skinned-shadowed-pbr-fragment.wgsl
+++ b/test/tint/benchmark/skinned-shadowed-pbr-fragment.wgsl
@@ -1,4 +1,4 @@
-let GAMMA = 2.200000048;
+const GAMMA = 2.200000048;
fn linearTosRGB(linear : vec3<f32>) -> vec3<f32> {
let INV_GAMMA = (1.0 / GAMMA);
@@ -53,7 +53,7 @@
@binding(2) @group(0) var<storage, read> globalLights : GlobalLights;
-let tileCount = vec3(32u, 18u, 48u);
+const tileCount = vec3(32u, 18u, 48u);
fn linearDepth(depthSample : f32) -> f32 {
return ((camera.zFar * camera.zNear) / fma(depthSample, (camera.zNear - camera.zFar), camera.zFar));
@@ -85,7 +85,7 @@
var<private> shadowSampleOffsets : array<vec2<f32>, 16> = array<vec2<f32>, 16>(vec2(-1.5, -1.5), vec2(-1.5, -0.5), vec2(-1.5, 0.5), vec2(-1.5, 1.5), vec2(-0.5, -1.5), vec2(-0.5, -0.5), vec2(-0.5, 0.5), vec2(-0.5, 1.5), vec2(0.5, -1.5), vec2(0.5, -0.5), vec2(0.5, 0.5), vec2(0.5, 1.5), vec2(1.5, -1.5), vec2(1.5, -0.5), vec2(1.5, 0.5), vec2(1.5, 1.5));
-let shadowSampleCount = 16u;
+const shadowSampleCount = 16u;
struct ShadowProperties {
viewport : vec4<f32>,
@@ -249,13 +249,13 @@
return surface;
}
-let PI = 3.141592741;
+const PI = 3.141592741;
-let LightType_Point = 0u;
+const LightType_Point = 0u;
-let LightType_Spot = 1u;
+const LightType_Spot = 1u;
-let LightType_Directional = 2u;
+const LightType_Directional = 2u;
struct PuctualLight {
lightType : u32,
diff --git a/test/tint/bug/chromium/1221120.wgsl b/test/tint/bug/chromium/1221120.wgsl
index d36adc1..1781a8c1 100644
--- a/test/tint/bug/chromium/1221120.wgsl
+++ b/test/tint/bug/chromium/1221120.wgsl
@@ -1,2 +1,2 @@
-let
+const
H=1;
diff --git a/test/tint/bug/chromium/1221120.wgsl.expected.glsl b/test/tint/bug/chromium/1221120.wgsl.expected.glsl
index 5274814..6473d30 100644
--- a/test/tint/bug/chromium/1221120.wgsl.expected.glsl
+++ b/test/tint/bug/chromium/1221120.wgsl.expected.glsl
@@ -4,4 +4,3 @@
void unused_entry_point() {
return;
}
-const int H = 1;
diff --git a/test/tint/bug/chromium/1221120.wgsl.expected.hlsl b/test/tint/bug/chromium/1221120.wgsl.expected.hlsl
index d79e95b..051e8c3 100644
--- a/test/tint/bug/chromium/1221120.wgsl.expected.hlsl
+++ b/test/tint/bug/chromium/1221120.wgsl.expected.hlsl
@@ -3,4 +3,3 @@
return;
}
-static const int H = 1;
diff --git a/test/tint/bug/chromium/1221120.wgsl.expected.msl b/test/tint/bug/chromium/1221120.wgsl.expected.msl
index 0c40f2b..466ceaa 100644
--- a/test/tint/bug/chromium/1221120.wgsl.expected.msl
+++ b/test/tint/bug/chromium/1221120.wgsl.expected.msl
@@ -1,5 +1,3 @@
#include <metal_stdlib>
using namespace metal;
-constant int H = 1;
-
diff --git a/test/tint/bug/chromium/1221120.wgsl.expected.spvasm b/test/tint/bug/chromium/1221120.wgsl.expected.spvasm
index 2ab63a4..65bef94 100644
--- a/test/tint/bug/chromium/1221120.wgsl.expected.spvasm
+++ b/test/tint/bug/chromium/1221120.wgsl.expected.spvasm
@@ -1,19 +1,16 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 7
+; Bound: 5
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %H "H"
OpName %unused_entry_point "unused_entry_point"
- %int = OpTypeInt 32 1
- %H = OpConstant %int 1
%void = OpTypeVoid
- %3 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %3
- %6 = OpLabel
+ %1 = OpTypeFunction %void
+%unused_entry_point = OpFunction %void None %1
+ %4 = OpLabel
OpReturn
OpFunctionEnd
diff --git a/test/tint/bug/chromium/1221120.wgsl.expected.wgsl b/test/tint/bug/chromium/1221120.wgsl.expected.wgsl
index 2e0a5a5..2b66778 100644
--- a/test/tint/bug/chromium/1221120.wgsl.expected.wgsl
+++ b/test/tint/bug/chromium/1221120.wgsl.expected.wgsl
@@ -1 +1 @@
-let H = 1;
+const H = 1;
diff --git a/test/tint/bug/tint/1121.wgsl.expected.glsl b/test/tint/bug/tint/1121.wgsl.expected.glsl
index 5133c72..da9bf0f 100644
--- a/test/tint/bug/tint/1121.wgsl.expected.glsl
+++ b/test/tint/bug/tint/1121.wgsl.expected.glsl
@@ -84,7 +84,7 @@
for(int x_1 = 0; (x_1 < TILE_COUNT_X); x_1 = (x_1 + 1)) {
ivec2 tilePixel0Idx = ivec2((x_1 * TILE_SIZE), (y_1 * TILE_SIZE));
vec2 floorCoord = (((2.0f * vec2(tilePixel0Idx)) / uniforms.fullScreenSize.xy) - vec2(1.0f));
- vec2 ceilCoord = (((2.0f * vec2((tilePixel0Idx + ivec2(16)))) / uniforms.fullScreenSize.xy) - vec2(1.0f));
+ vec2 ceilCoord = (((2.0f * vec2((tilePixel0Idx + ivec2(TILE_SIZE)))) / uniforms.fullScreenSize.xy) - vec2(1.0f));
vec2 viewFloorCoord = vec2((((-(viewNear) * floorCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * floorCoord.y) - (M[2][1] * viewNear)) / M[1][1]));
vec2 viewCeilCoord = vec2((((-(viewNear) * ceilCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * ceilCoord.y) - (M[2][1] * viewNear)) / M[1][1]));
frustumPlanes[0] = vec4(1.0f, 0.0f, (-(viewFloorCoord.x) / viewNear), 0.0f);
diff --git a/test/tint/bug/tint/1121.wgsl.expected.hlsl b/test/tint/bug/tint/1121.wgsl.expected.hlsl
index 6f609be..bfff463 100644
--- a/test/tint/bug/tint/1121.wgsl.expected.hlsl
+++ b/test/tint/bug/tint/1121.wgsl.expected.hlsl
@@ -58,7 +58,7 @@
[loop] for(int x_1 = 0; (x_1 < TILE_COUNT_X); x_1 = (x_1 + 1)) {
int2 tilePixel0Idx = int2((x_1 * TILE_SIZE), (y_1 * TILE_SIZE));
float2 floorCoord = (((2.0f * float2(tilePixel0Idx)) / asfloat(uniforms[10]).xy) - (1.0f).xx);
- float2 ceilCoord = (((2.0f * float2((tilePixel0Idx + (16).xx))) / asfloat(uniforms[10]).xy) - (1.0f).xx);
+ float2 ceilCoord = (((2.0f * float2((tilePixel0Idx + int2((TILE_SIZE).xx)))) / asfloat(uniforms[10]).xy) - (1.0f).xx);
float2 viewFloorCoord = float2((((-(viewNear) * floorCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * floorCoord.y) - (M[2][1] * viewNear)) / M[1][1]));
float2 viewCeilCoord = float2((((-(viewNear) * ceilCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * ceilCoord.y) - (M[2][1] * viewNear)) / M[1][1]));
frustumPlanes[0] = float4(1.0f, 0.0f, (-(viewFloorCoord.x) / viewNear), 0.0f);
diff --git a/test/tint/bug/tint/1121.wgsl.expected.msl b/test/tint/bug/tint/1121.wgsl.expected.msl
index 8e2584d..ca262ff 100644
--- a/test/tint/bug/tint/1121.wgsl.expected.msl
+++ b/test/tint/bug/tint/1121.wgsl.expected.msl
@@ -88,7 +88,7 @@
for(int x_1 = 0; (x_1 < TILE_COUNT_X); x_1 = as_type<int>((as_type<uint>(x_1) + as_type<uint>(1)))) {
int2 tilePixel0Idx = int2(as_type<int>((as_type<uint>(x_1) * as_type<uint>(TILE_SIZE))), as_type<int>((as_type<uint>(y_1) * as_type<uint>(TILE_SIZE))));
float2 floorCoord = (((2.0f * float2(tilePixel0Idx)) / float4((*(tint_symbol_3)).fullScreenSize).xy) - float2(1.0f));
- float2 ceilCoord = (((2.0f * float2(as_type<int2>((as_type<uint2>(tilePixel0Idx) + as_type<uint2>(int2(16)))))) / float4((*(tint_symbol_3)).fullScreenSize).xy) - float2(1.0f));
+ float2 ceilCoord = (((2.0f * float2(as_type<int2>((as_type<uint2>(tilePixel0Idx) + as_type<uint2>(int2(TILE_SIZE)))))) / float4((*(tint_symbol_3)).fullScreenSize).xy) - float2(1.0f));
float2 viewFloorCoord = float2((((-(viewNear) * floorCoord[0]) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * floorCoord[1]) - (M[2][1] * viewNear)) / M[1][1]));
float2 viewCeilCoord = float2((((-(viewNear) * ceilCoord[0]) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * ceilCoord[1]) - (M[2][1] * viewNear)) / M[1][1]));
frustumPlanes[0] = float4(1.0f, 0.0f, (-(viewFloorCoord[0]) / viewNear), 0.0f);
diff --git a/test/tint/bug/tint/1121.wgsl.expected.spvasm b/test/tint/bug/tint/1121.wgsl.expected.spvasm
index 97e8eb5..5dc7f31 100644
--- a/test/tint/bug/tint/1121.wgsl.expected.spvasm
+++ b/test/tint/bug/tint/1121.wgsl.expected.spvasm
@@ -175,7 +175,6 @@
%207 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_v2float = OpTypePointer Function %v2float
%211 = OpConstantNull %v2float
- %214 = OpConstantComposite %v2int %int_16 %int_16
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint
@@ -358,6 +357,7 @@
%208 = OpFSub %v2float %206 %207
OpStore %floorCoord %208
%213 = OpLoad %v2int %tilePixel0Idx
+ %214 = OpCompositeConstruct %v2int %int_16 %int_16
%215 = OpIAdd %v2int %213 %214
%212 = OpConvertSToF %v2float %215
%216 = OpVectorTimesScalar %v2float %212 %float_2
diff --git a/test/tint/bug/tint/764.wgsl.expected.glsl b/test/tint/bug/tint/764.wgsl.expected.glsl
index 347d829..02dcf2f 100644
--- a/test/tint/bug/tint/764.wgsl.expected.glsl
+++ b/test/tint/bug/tint/764.wgsl.expected.glsl
@@ -6,7 +6,7 @@
}
void f() {
mat4 m = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f));
- vec4 v1 = vec4(1.0f);
- float a = 1.0f;
+ vec4 v1 = m[0];
+ float a = v1[0];
}
diff --git a/test/tint/bug/tint/764.wgsl.expected.hlsl b/test/tint/bug/tint/764.wgsl.expected.hlsl
index e4e19f7..b67a7dc 100644
--- a/test/tint/bug/tint/764.wgsl.expected.hlsl
+++ b/test/tint/bug/tint/764.wgsl.expected.hlsl
@@ -5,6 +5,6 @@
void f() {
const float4x4 m = float4x4((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx);
- const float4 v1 = (1.0f).xxxx;
- const float a = 1.0f;
+ const float4 v1 = m[0];
+ const float a = v1[0];
}
diff --git a/test/tint/bug/tint/764.wgsl.expected.msl b/test/tint/bug/tint/764.wgsl.expected.msl
index aa71892..4dae82f 100644
--- a/test/tint/bug/tint/764.wgsl.expected.msl
+++ b/test/tint/bug/tint/764.wgsl.expected.msl
@@ -3,7 +3,7 @@
using namespace metal;
void f() {
float4x4 const m = float4x4(float4(1.0f), float4(1.0f), float4(1.0f), float4(1.0f));
- float4 const v1 = float4(1.0f);
- float const a = 1.0f;
+ float4 const v1 = m[0];
+ float const a = v1[0];
}
diff --git a/test/tint/bug/tint/764.wgsl.expected.spvasm b/test/tint/bug/tint/764.wgsl.expected.spvasm
index f5a8869..329c64e 100644
--- a/test/tint/bug/tint/764.wgsl.expected.spvasm
+++ b/test/tint/bug/tint/764.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 13
+; Bound: 17
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -17,11 +17,15 @@
%float_1 = OpConstant %float 1
%11 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%12 = OpConstantComposite %mat4v4float %11 %11 %11 %11
+ %int = OpTypeInt 32 1
+ %14 = OpConstantNull %int
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %1
%6 = OpLabel
+ %15 = OpCompositeExtract %v4float %12 0
+ %16 = OpCompositeExtract %float %15 0
OpReturn
OpFunctionEnd
diff --git a/test/tint/bug/tint/827.wgsl b/test/tint/bug/tint/827.wgsl
index 761b3d8..1e1b4ad 100644
--- a/test/tint/bug/tint/827.wgsl
+++ b/test/tint/bug/tint/827.wgsl
@@ -2,7 +2,7 @@
values : array<f32>,
};
-let width : u32 = 128u;
+const width : u32 = 128u;
@group(0) @binding(0) var tex : texture_depth_2d;
@group(0) @binding(1) var<storage, read_write> result : Result;
diff --git a/test/tint/bug/tint/827.wgsl.expected.glsl b/test/tint/bug/tint/827.wgsl.expected.glsl
index 482c7d3..4098e55 100644
--- a/test/tint/bug/tint/827.wgsl.expected.glsl
+++ b/test/tint/bug/tint/827.wgsl.expected.glsl
@@ -1,12 +1,11 @@
#version 310 es
-const uint width = 128u;
layout(binding = 1, std430) buffer Result_1 {
float values[];
} result;
uniform highp sampler2D tex_1;
void tint_symbol(uvec3 GlobalInvocationId) {
- result.values[((GlobalInvocationId.y * width) + GlobalInvocationId.x)] = texelFetch(tex_1, ivec2(int(GlobalInvocationId.x), int(GlobalInvocationId.y)), 0).x;
+ result.values[((GlobalInvocationId.y * 128u) + GlobalInvocationId.x)] = texelFetch(tex_1, ivec2(int(GlobalInvocationId.x), int(GlobalInvocationId.y)), 0).x;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
diff --git a/test/tint/bug/tint/827.wgsl.expected.hlsl b/test/tint/bug/tint/827.wgsl.expected.hlsl
index bd8458c..f1c9fa5 100644
--- a/test/tint/bug/tint/827.wgsl.expected.hlsl
+++ b/test/tint/bug/tint/827.wgsl.expected.hlsl
@@ -1,5 +1,3 @@
-static const uint width = 128u;
-
Texture2D tex : register(t0, space0);
RWByteAddressBuffer result : register(u1, space0);
@@ -8,7 +6,7 @@
};
void main_inner(uint3 GlobalInvocationId) {
- result.Store((4u * ((GlobalInvocationId.y * width) + GlobalInvocationId.x)), asuint(tex.Load(int3(int(GlobalInvocationId.x), int(GlobalInvocationId.y), 0)).x));
+ result.Store((4u * ((GlobalInvocationId.y * 128u) + GlobalInvocationId.x)), asuint(tex.Load(int3(int(GlobalInvocationId.x), int(GlobalInvocationId.y), 0)).x));
}
[numthreads(1, 1, 1)]
diff --git a/test/tint/bug/tint/827.wgsl.expected.msl b/test/tint/bug/tint/827.wgsl.expected.msl
index d915798..b230160 100644
--- a/test/tint/bug/tint/827.wgsl.expected.msl
+++ b/test/tint/bug/tint/827.wgsl.expected.msl
@@ -18,10 +18,8 @@
/* 0x0000 */ tint_array<float, 1> values;
};
-constant uint width = 128u;
-
void tint_symbol_inner(uint3 GlobalInvocationId, device Result* const tint_symbol_1, depth2d<float, access::sample> tint_symbol_2) {
- (*(tint_symbol_1)).values[((GlobalInvocationId[1] * width) + GlobalInvocationId[0])] = tint_symbol_2.read(uint2(int2(int(GlobalInvocationId[0]), int(GlobalInvocationId[1]))), 0);
+ (*(tint_symbol_1)).values[((GlobalInvocationId[1] * 128u) + GlobalInvocationId[0])] = tint_symbol_2.read(uint2(int2(int(GlobalInvocationId[0]), int(GlobalInvocationId[1]))), 0);
}
kernel void tint_symbol(device Result* tint_symbol_3 [[buffer(0)]], depth2d<float, access::sample> tint_symbol_4 [[texture(0)]], uint3 GlobalInvocationId [[thread_position_in_grid]]) {
diff --git a/test/tint/bug/tint/827.wgsl.expected.spvasm b/test/tint/bug/tint/827.wgsl.expected.spvasm
index 29e60f6..de11b1b 100644
--- a/test/tint/bug/tint/827.wgsl.expected.spvasm
+++ b/test/tint/bug/tint/827.wgsl.expected.spvasm
@@ -8,7 +8,6 @@
OpEntryPoint GLCompute %main "main" %GlobalInvocationId_1
OpExecutionMode %main LocalSize 1 1 1
OpName %GlobalInvocationId_1 "GlobalInvocationId_1"
- OpName %width "width"
OpName %tex "tex"
OpName %Result "Result"
OpMemberName %Result 0 "values"
@@ -28,33 +27,33 @@
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%GlobalInvocationId_1 = OpVariable %_ptr_Input_v3uint Input
- %width = OpConstant %uint 128
%float = OpTypeFloat 32
- %8 = OpTypeImage %float 2D 0 0 0 1 Unknown
-%_ptr_UniformConstant_8 = OpTypePointer UniformConstant %8
- %tex = OpVariable %_ptr_UniformConstant_8 UniformConstant
+ %7 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %tex = OpVariable %_ptr_UniformConstant_7 UniformConstant
%_runtimearr_float = OpTypeRuntimeArray %float
%Result = OpTypeStruct %_runtimearr_float
%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result
%result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer
%void = OpTypeVoid
- %14 = OpTypeFunction %void %v3uint
+ %13 = OpTypeFunction %void %v3uint
%uint_0 = OpConstant %uint 0
+ %uint_128 = OpConstant %uint 128
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%v4float = OpTypeVector %float 4
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%37 = OpConstantNull %int
%38 = OpTypeFunction %void
- %main_inner = OpFunction %void None %14
+ %main_inner = OpFunction %void None %13
%GlobalInvocationId = OpFunctionParameter %v3uint
- %18 = OpLabel
- %20 = OpCompositeExtract %uint %GlobalInvocationId 1
- %21 = OpIMul %uint %20 %width
+ %17 = OpLabel
+ %19 = OpCompositeExtract %uint %GlobalInvocationId 1
+ %21 = OpIMul %uint %19 %uint_128
%22 = OpCompositeExtract %uint %GlobalInvocationId 0
%23 = OpIAdd %uint %21 %22
%25 = OpAccessChain %_ptr_StorageBuffer_float %result %uint_0 %23
- %29 = OpLoad %8 %tex
+ %29 = OpLoad %7 %tex
%33 = OpCompositeExtract %uint %GlobalInvocationId 0
%32 = OpBitcast %int %33
%35 = OpCompositeExtract %uint %GlobalInvocationId 1
diff --git a/test/tint/bug/tint/827.wgsl.expected.wgsl b/test/tint/bug/tint/827.wgsl.expected.wgsl
index c54420e..e026916 100644
--- a/test/tint/bug/tint/827.wgsl.expected.wgsl
+++ b/test/tint/bug/tint/827.wgsl.expected.wgsl
@@ -2,7 +2,7 @@
values : array<f32>,
}
-let width : u32 = 128u;
+const width : u32 = 128u;
@group(0) @binding(0) var tex : texture_depth_2d;
diff --git a/test/tint/bug/tint/914.wgsl b/test/tint/bug/tint/914.wgsl
index 9493b2b..6c0d6c3 100644
--- a/test/tint/bug/tint/914.wgsl
+++ b/test/tint/bug/tint/914.wgsl
@@ -38,11 +38,11 @@
}
}
-let RowPerThread : u32 = 4u;
-let ColPerThread : u32 = 4u;
-let TileAOuter : u32 = 64u;
-let TileBOuter : u32 = 64u;
-let TileInner : u32 = 64u;
+const RowPerThread : u32 = 4u;
+const ColPerThread : u32 = 4u;
+const TileAOuter : u32 = 64u;
+const TileBOuter : u32 = 64u;
+const TileInner : u32 = 64u;
var<workgroup> mm_Asub : array<array<f32, 64>, 64>;
var<workgroup> mm_Bsub : array<array<f32, 64>, 64>;
@compute @workgroup_size(16, 16, 1)
diff --git a/test/tint/bug/tint/914.wgsl.expected.glsl b/test/tint/bug/tint/914.wgsl.expected.glsl
index 5ec38c1..a40e5ce 100644
--- a/test/tint/bug/tint/914.wgsl.expected.glsl
+++ b/test/tint/bug/tint/914.wgsl.expected.glsl
@@ -56,9 +56,6 @@
}
}
-const uint RowPerThread = 4u;
-const uint ColPerThread = 4u;
-const uint TileInner = 64u;
shared float mm_Asub[64][64];
shared float mm_Bsub[64][64];
void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) {
@@ -71,32 +68,32 @@
}
}
barrier();
- uint tileRow = (local_id.y * RowPerThread);
- uint tileCol = (local_id.x * ColPerThread);
- uint globalRow = (global_id.y * RowPerThread);
- uint globalCol = (global_id.x * ColPerThread);
- uint numTiles = (((uniforms.dimInner - 1u) / TileInner) + 1u);
+ uint tileRow = (local_id.y * 4u);
+ uint tileCol = (local_id.x * 4u);
+ uint globalRow = (global_id.y * 4u);
+ uint globalCol = (global_id.x * 4u);
+ uint numTiles = (((uniforms.dimInner - 1u) / 64u) + 1u);
float acc[16] = float[16](0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
float ACached = 0.0f;
float BCached[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
{
- for(uint index = 0u; (index < (RowPerThread * ColPerThread)); index = (index + 1u)) {
+ for(uint index = 0u; (index < (4u * 4u)); index = (index + 1u)) {
acc[index] = 0.0f;
}
}
- uint ColPerThreadA = (TileInner / 16u);
+ uint ColPerThreadA = (64u / 16u);
uint tileColA = (local_id.x * ColPerThreadA);
- uint RowPerThreadB = (TileInner / 16u);
+ uint RowPerThreadB = (64u / 16u);
uint tileRowB = (local_id.y * RowPerThreadB);
{
for(uint t = 0u; (t < numTiles); t = (t + 1u)) {
{
- for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
+ for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
{
for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) {
uint inputRow = (tileRow + innerRow);
uint inputCol = (tileColA + innerCol);
- float tint_symbol_1 = mm_readA((globalRow + innerRow), ((t * TileInner) + inputCol));
+ float tint_symbol_1 = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol));
mm_Asub[inputRow][inputCol] = tint_symbol_1;
}
}
@@ -105,10 +102,10 @@
{
for(uint innerRow = 0u; (innerRow < RowPerThreadB); innerRow = (innerRow + 1u)) {
{
- for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
+ for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
uint inputRow = (tileRowB + innerRow);
uint inputCol = (tileCol + innerCol);
- float tint_symbol_2 = mm_readB(((t * TileInner) + inputRow), (globalCol + innerCol));
+ float tint_symbol_2 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol));
mm_Bsub[innerCol][inputCol] = tint_symbol_2;
}
}
@@ -116,18 +113,18 @@
}
barrier();
{
- for(uint k = 0u; (k < TileInner); k = (k + 1u)) {
+ for(uint k = 0u; (k < 64u); k = (k + 1u)) {
{
- for(uint inner = 0u; (inner < ColPerThread); inner = (inner + 1u)) {
+ for(uint inner = 0u; (inner < 4u); inner = (inner + 1u)) {
BCached[inner] = mm_Bsub[k][(tileCol + inner)];
}
}
{
- for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
+ for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
ACached = mm_Asub[(tileRow + innerRow)][k];
{
- for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
- uint index = ((innerRow * ColPerThread) + innerCol);
+ for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
+ uint index = ((innerRow * 4u) + innerCol);
acc[index] = (acc[index] + (ACached * BCached[innerCol]));
}
}
@@ -139,10 +136,10 @@
}
}
{
- for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
+ for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
{
- for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
- uint index = ((innerRow * ColPerThread) + innerCol);
+ for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
+ uint index = ((innerRow * 4u) + innerCol);
mm_write((globalRow + innerRow), (globalCol + innerCol), acc[index]);
}
}
diff --git a/test/tint/bug/tint/914.wgsl.expected.hlsl b/test/tint/bug/tint/914.wgsl.expected.hlsl
index 5dbfaa1..a9ca8f8 100644
--- a/test/tint/bug/tint/914.wgsl.expected.hlsl
+++ b/test/tint/bug/tint/914.wgsl.expected.hlsl
@@ -40,12 +40,6 @@
}
}
-static const uint RowPerThread = 4u;
-static const uint ColPerThread = 4u;
-static const uint TileAOuter = 64u;
-static const uint TileBOuter = 64u;
-static const uint TileInner = 64u;
-
groupshared float mm_Asub[64][64];
groupshared float mm_Bsub[64][64];
@@ -65,32 +59,32 @@
}
}
GroupMemoryBarrierWithGroupSync();
- const uint tileRow = (local_id.y * RowPerThread);
- const uint tileCol = (local_id.x * ColPerThread);
- const uint globalRow = (global_id.y * RowPerThread);
- const uint globalCol = (global_id.x * ColPerThread);
- const uint numTiles = (((uniforms[0].y - 1u) / TileInner) + 1u);
+ const uint tileRow = (local_id.y * 4u);
+ const uint tileCol = (local_id.x * 4u);
+ const uint globalRow = (global_id.y * 4u);
+ const uint globalCol = (global_id.x * 4u);
+ const uint numTiles = (((uniforms[0].y - 1u) / 64u) + 1u);
float acc[16] = (float[16])0;
float ACached = 0.0f;
float BCached[4] = (float[4])0;
{
- [loop] for(uint index = 0u; (index < (RowPerThread * ColPerThread)); index = (index + 1u)) {
+ [loop] for(uint index = 0u; (index < (4u * 4u)); index = (index + 1u)) {
acc[index] = 0.0f;
}
}
- const uint ColPerThreadA = (TileInner / 16u);
+ const uint ColPerThreadA = (64u / 16u);
const uint tileColA = (local_id.x * ColPerThreadA);
- const uint RowPerThreadB = (TileInner / 16u);
+ const uint RowPerThreadB = (64u / 16u);
const uint tileRowB = (local_id.y * RowPerThreadB);
{
[loop] for(uint t = 0u; (t < numTiles); t = (t + 1u)) {
{
- [loop] for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
+ [loop] for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
{
[loop] for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) {
const uint inputRow = (tileRow + innerRow);
const uint inputCol = (tileColA + innerCol);
- const float tint_symbol_2 = mm_readA((globalRow + innerRow), ((t * TileInner) + inputCol));
+ const float tint_symbol_2 = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol));
mm_Asub[inputRow][inputCol] = tint_symbol_2;
}
}
@@ -99,10 +93,10 @@
{
[loop] for(uint innerRow = 0u; (innerRow < RowPerThreadB); innerRow = (innerRow + 1u)) {
{
- [loop] for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
+ [loop] for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
const uint inputRow = (tileRowB + innerRow);
const uint inputCol = (tileCol + innerCol);
- const float tint_symbol_3 = mm_readB(((t * TileInner) + inputRow), (globalCol + innerCol));
+ const float tint_symbol_3 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol));
mm_Bsub[innerCol][inputCol] = tint_symbol_3;
}
}
@@ -110,18 +104,18 @@
}
GroupMemoryBarrierWithGroupSync();
{
- [loop] for(uint k = 0u; (k < TileInner); k = (k + 1u)) {
+ [loop] for(uint k = 0u; (k < 64u); k = (k + 1u)) {
{
- [loop] for(uint inner = 0u; (inner < ColPerThread); inner = (inner + 1u)) {
+ [loop] for(uint inner = 0u; (inner < 4u); inner = (inner + 1u)) {
BCached[inner] = mm_Bsub[k][(tileCol + inner)];
}
}
{
- [loop] for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
+ [loop] for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
ACached = mm_Asub[(tileRow + innerRow)][k];
{
- [loop] for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
- const uint index = ((innerRow * ColPerThread) + innerCol);
+ [loop] for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
+ const uint index = ((innerRow * 4u) + innerCol);
acc[index] = (acc[index] + (ACached * BCached[innerCol]));
}
}
@@ -133,10 +127,10 @@
}
}
{
- [loop] for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
+ [loop] for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
{
- [loop] for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
- const uint index = ((innerRow * ColPerThread) + innerCol);
+ [loop] for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
+ const uint index = ((innerRow * 4u) + innerCol);
mm_write((globalRow + innerRow), (globalCol + innerCol), acc[index]);
}
}
diff --git a/test/tint/bug/tint/914.wgsl.expected.msl b/test/tint/bug/tint/914.wgsl.expected.msl
index 94c3891..d70dc36 100644
--- a/test/tint/bug/tint/914.wgsl.expected.msl
+++ b/test/tint/bug/tint/914.wgsl.expected.msl
@@ -47,16 +47,6 @@
}
}
-constant uint RowPerThread = 4u;
-
-constant uint ColPerThread = 4u;
-
-constant uint TileAOuter = 64u;
-
-constant uint TileBOuter = 64u;
-
-constant uint TileInner = 64u;
-
void tint_symbol_inner(uint3 local_id, uint3 global_id, uint local_invocation_index, threadgroup tint_array<tint_array<float, 64>, 64>* const tint_symbol_9, threadgroup tint_array<tint_array<float, 64>, 64>* const tint_symbol_10, const constant Uniforms* const tint_symbol_11, const device Matrix* const tint_symbol_12, const device Matrix* const tint_symbol_13, device Matrix* const tint_symbol_14) {
for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 256u)) {
uint const i = (idx / 64u);
@@ -65,56 +55,56 @@
(*(tint_symbol_10))[i][i_1] = 0.0f;
}
threadgroup_barrier(mem_flags::mem_threadgroup);
- uint const tileRow = (local_id[1] * RowPerThread);
- uint const tileCol = (local_id[0] * ColPerThread);
- uint const globalRow = (global_id[1] * RowPerThread);
- uint const globalCol = (global_id[0] * ColPerThread);
- uint const numTiles = ((((*(tint_symbol_11)).dimInner - 1u) / TileInner) + 1u);
+ uint const tileRow = (local_id[1] * 4u);
+ uint const tileCol = (local_id[0] * 4u);
+ uint const globalRow = (global_id[1] * 4u);
+ uint const globalCol = (global_id[0] * 4u);
+ uint const numTiles = ((((*(tint_symbol_11)).dimInner - 1u) / 64u) + 1u);
tint_array<float, 16> acc = {};
float ACached = 0.0f;
tint_array<float, 4> BCached = {};
- for(uint index = 0u; (index < (RowPerThread * ColPerThread)); index = (index + 1u)) {
+ for(uint index = 0u; (index < (4u * 4u)); index = (index + 1u)) {
acc[index] = 0.0f;
}
- uint const ColPerThreadA = (TileInner / 16u);
+ uint const ColPerThreadA = (64u / 16u);
uint const tileColA = (local_id[0] * ColPerThreadA);
- uint const RowPerThreadB = (TileInner / 16u);
+ uint const RowPerThreadB = (64u / 16u);
uint const tileRowB = (local_id[1] * RowPerThreadB);
for(uint t = 0u; (t < numTiles); t = (t + 1u)) {
- for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
+ for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) {
uint const inputRow = (tileRow + innerRow);
uint const inputCol = (tileColA + innerCol);
- float const tint_symbol_1 = mm_readA((globalRow + innerRow), ((t * TileInner) + inputCol), tint_symbol_11, tint_symbol_12);
+ float const tint_symbol_1 = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol), tint_symbol_11, tint_symbol_12);
(*(tint_symbol_9))[inputRow][inputCol] = tint_symbol_1;
}
}
for(uint innerRow = 0u; (innerRow < RowPerThreadB); innerRow = (innerRow + 1u)) {
- for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
+ for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
uint const inputRow = (tileRowB + innerRow);
uint const inputCol = (tileCol + innerCol);
- float const tint_symbol_2 = mm_readB(((t * TileInner) + inputRow), (globalCol + innerCol), tint_symbol_11, tint_symbol_13);
+ float const tint_symbol_2 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol), tint_symbol_11, tint_symbol_13);
(*(tint_symbol_10))[innerCol][inputCol] = tint_symbol_2;
}
}
threadgroup_barrier(mem_flags::mem_threadgroup);
- for(uint k = 0u; (k < TileInner); k = (k + 1u)) {
- for(uint inner = 0u; (inner < ColPerThread); inner = (inner + 1u)) {
+ for(uint k = 0u; (k < 64u); k = (k + 1u)) {
+ for(uint inner = 0u; (inner < 4u); inner = (inner + 1u)) {
BCached[inner] = (*(tint_symbol_10))[k][(tileCol + inner)];
}
- for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
+ for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
ACached = (*(tint_symbol_9))[(tileRow + innerRow)][k];
- for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
- uint const index = ((innerRow * ColPerThread) + innerCol);
+ for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
+ uint const index = ((innerRow * 4u) + innerCol);
acc[index] = (acc[index] + (ACached * BCached[innerCol]));
}
}
}
threadgroup_barrier(mem_flags::mem_threadgroup);
}
- for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
- for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
- uint const index = ((innerRow * ColPerThread) + innerCol);
+ for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) {
+ for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) {
+ uint const index = ((innerRow * 4u) + innerCol);
mm_write((globalRow + innerRow), (globalCol + innerCol), acc[index], tint_symbol_11, tint_symbol_14);
}
}
diff --git a/test/tint/bug/tint/914.wgsl.expected.spvasm b/test/tint/bug/tint/914.wgsl.expected.spvasm
index 460cc21..8647c10 100644
--- a/test/tint/bug/tint/914.wgsl.expected.spvasm
+++ b/test/tint/bug/tint/914.wgsl.expected.spvasm
@@ -20,11 +20,6 @@
OpMemberName %Uniforms 1 "dimInner"
OpMemberName %Uniforms 2 "dimBOuter"
OpName %uniforms "uniforms"
- OpName %RowPerThread "RowPerThread"
- OpName %RowPerThread "ColPerThread"
- OpName %TileAOuter "TileAOuter"
- OpName %TileAOuter "TileBOuter"
- OpName %TileAOuter "TileInner"
OpName %mm_Asub "mm_Asub"
OpName %mm_Bsub "mm_Bsub"
OpName %mm_readA "mm_readA"
@@ -80,10 +75,10 @@
OpDecorate %uniforms NonWritable
OpDecorate %uniforms DescriptorSet 0
OpDecorate %uniforms Binding 3
- OpDecorate %_arr_float_TileAOuter ArrayStride 4
- OpDecorate %_arr__arr_float_TileAOuter_TileAOuter ArrayStride 256
+ OpDecorate %_arr_float_uint_64 ArrayStride 4
+ OpDecorate %_arr__arr_float_uint_64_uint_64 ArrayStride 256
OpDecorate %_arr_float_uint_16 ArrayStride 4
- OpDecorate %_arr_float_RowPerThread ArrayStride 4
+ OpDecorate %_arr_float_uint_4 ArrayStride 4
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
@@ -101,199 +96,199 @@
%Uniforms = OpTypeStruct %uint %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform
-%RowPerThread = OpConstant %uint 4
- %TileAOuter = OpConstant %uint 64
-%_arr_float_TileAOuter = OpTypeArray %float %TileAOuter
-%_arr__arr_float_TileAOuter_TileAOuter = OpTypeArray %_arr_float_TileAOuter %TileAOuter
-%_ptr_Workgroup__arr__arr_float_TileAOuter_TileAOuter = OpTypePointer Workgroup %_arr__arr_float_TileAOuter_TileAOuter
- %mm_Asub = OpVariable %_ptr_Workgroup__arr__arr_float_TileAOuter_TileAOuter Workgroup
- %mm_Bsub = OpVariable %_ptr_Workgroup__arr__arr_float_TileAOuter_TileAOuter Workgroup
- %25 = OpTypeFunction %float %uint %uint
+ %uint_64 = OpConstant %uint 64
+%_arr_float_uint_64 = OpTypeArray %float %uint_64
+%_arr__arr_float_uint_64_uint_64 = OpTypeArray %_arr_float_uint_64 %uint_64
+%_ptr_Workgroup__arr__arr_float_uint_64_uint_64 = OpTypePointer Workgroup %_arr__arr_float_uint_64_uint_64
+ %mm_Asub = OpVariable %_ptr_Workgroup__arr__arr_float_uint_64_uint_64 Workgroup
+ %mm_Bsub = OpVariable %_ptr_Workgroup__arr__arr_float_uint_64_uint_64 Workgroup
+ %24 = OpTypeFunction %float %uint %uint
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%bool = OpTypeBool
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
- %52 = OpConstantNull %float
+ %51 = OpConstantNull %float
%uint_2 = OpConstant %uint 2
%void = OpTypeVoid
- %75 = OpTypeFunction %void %uint %uint %float
- %98 = OpTypeFunction %void %v3uint %v3uint %uint
+ %74 = OpTypeFunction %void %uint %uint %float
+ %97 = OpTypeFunction %void %v3uint %v3uint %uint
%_ptr_Function_uint = OpTypePointer Function %uint
- %106 = OpConstantNull %uint
+ %105 = OpConstantNull %uint
%uint_4096 = OpConstant %uint 4096
%_ptr_Workgroup_float = OpTypePointer Workgroup %float
%uint_256 = OpConstant %uint 256
%uint_264 = OpConstant %uint 264
+ %uint_4 = OpConstant %uint 4
%uint_16 = OpConstant %uint 16
%_arr_float_uint_16 = OpTypeArray %float %uint_16
%_ptr_Function__arr_float_uint_16 = OpTypePointer Function %_arr_float_uint_16
%146 = OpConstantNull %_arr_float_uint_16
%_ptr_Function_float = OpTypePointer Function %float
-%_arr_float_RowPerThread = OpTypeArray %float %RowPerThread
-%_ptr_Function__arr_float_RowPerThread = OpTypePointer Function %_arr_float_RowPerThread
- %152 = OpConstantNull %_arr_float_RowPerThread
+%_arr_float_uint_4 = OpTypeArray %float %uint_4
+%_ptr_Function__arr_float_uint_4 = OpTypePointer Function %_arr_float_uint_4
+ %152 = OpConstantNull %_arr_float_uint_4
%367 = OpTypeFunction %void
- %mm_readA = OpFunction %float None %25
+ %mm_readA = OpFunction %float None %24
%row = OpFunctionParameter %uint
%col = OpFunctionParameter %uint
- %29 = OpLabel
- %32 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
- %33 = OpLoad %uint %32
- %34 = OpULessThan %bool %row %33
- OpSelectionMerge %36 None
- OpBranchConditional %34 %37 %36
- %37 = OpLabel
- %39 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
- %40 = OpLoad %uint %39
- %41 = OpULessThan %bool %col %40
- OpBranch %36
+ %28 = OpLabel
+ %31 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
+ %32 = OpLoad %uint %31
+ %33 = OpULessThan %bool %row %32
+ OpSelectionMerge %35 None
+ OpBranchConditional %33 %36 %35
%36 = OpLabel
- %42 = OpPhi %bool %34 %29 %41 %37
- OpSelectionMerge %43 None
- OpBranchConditional %42 %44 %43
- %44 = OpLabel
- %45 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
- %46 = OpLoad %uint %45
- %47 = OpIMul %uint %row %46
- %48 = OpIAdd %uint %47 %col
- %50 = OpAccessChain %_ptr_StorageBuffer_float %firstMatrix %uint_0 %48
- %51 = OpLoad %float %50
- OpReturnValue %51
+ %38 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
+ %39 = OpLoad %uint %38
+ %40 = OpULessThan %bool %col %39
+ OpBranch %35
+ %35 = OpLabel
+ %41 = OpPhi %bool %33 %28 %40 %36
+ OpSelectionMerge %42 None
+ OpBranchConditional %41 %43 %42
%43 = OpLabel
- OpReturnValue %52
+ %44 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
+ %45 = OpLoad %uint %44
+ %46 = OpIMul %uint %row %45
+ %47 = OpIAdd %uint %46 %col
+ %49 = OpAccessChain %_ptr_StorageBuffer_float %firstMatrix %uint_0 %47
+ %50 = OpLoad %float %49
+ OpReturnValue %50
+ %42 = OpLabel
+ OpReturnValue %51
OpFunctionEnd
- %mm_readB = OpFunction %float None %25
+ %mm_readB = OpFunction %float None %24
%row_0 = OpFunctionParameter %uint
%col_0 = OpFunctionParameter %uint
- %56 = OpLabel
- %57 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
- %58 = OpLoad %uint %57
- %59 = OpULessThan %bool %row_0 %58
- OpSelectionMerge %60 None
- OpBranchConditional %59 %61 %60
- %61 = OpLabel
- %63 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2
- %64 = OpLoad %uint %63
- %65 = OpULessThan %bool %col_0 %64
- OpBranch %60
+ %55 = OpLabel
+ %56 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
+ %57 = OpLoad %uint %56
+ %58 = OpULessThan %bool %row_0 %57
+ OpSelectionMerge %59 None
+ OpBranchConditional %58 %60 %59
%60 = OpLabel
- %66 = OpPhi %bool %59 %56 %65 %61
- OpSelectionMerge %67 None
- OpBranchConditional %66 %68 %67
- %68 = OpLabel
- %69 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2
- %70 = OpLoad %uint %69
- %71 = OpIMul %uint %row_0 %70
- %72 = OpIAdd %uint %71 %col_0
- %73 = OpAccessChain %_ptr_StorageBuffer_float %secondMatrix %uint_0 %72
- %74 = OpLoad %float %73
- OpReturnValue %74
+ %62 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2
+ %63 = OpLoad %uint %62
+ %64 = OpULessThan %bool %col_0 %63
+ OpBranch %59
+ %59 = OpLabel
+ %65 = OpPhi %bool %58 %55 %64 %60
+ OpSelectionMerge %66 None
+ OpBranchConditional %65 %67 %66
%67 = OpLabel
- OpReturnValue %52
+ %68 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2
+ %69 = OpLoad %uint %68
+ %70 = OpIMul %uint %row_0 %69
+ %71 = OpIAdd %uint %70 %col_0
+ %72 = OpAccessChain %_ptr_StorageBuffer_float %secondMatrix %uint_0 %71
+ %73 = OpLoad %float %72
+ OpReturnValue %73
+ %66 = OpLabel
+ OpReturnValue %51
OpFunctionEnd
- %mm_write = OpFunction %void None %75
+ %mm_write = OpFunction %void None %74
%row_1 = OpFunctionParameter %uint
%col_1 = OpFunctionParameter %uint
%value = OpFunctionParameter %float
- %81 = OpLabel
- %82 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
- %83 = OpLoad %uint %82
- %84 = OpULessThan %bool %row_1 %83
- OpSelectionMerge %85 None
- OpBranchConditional %84 %86 %85
- %86 = OpLabel
- %87 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2
- %88 = OpLoad %uint %87
- %89 = OpULessThan %bool %col_1 %88
- OpBranch %85
+ %80 = OpLabel
+ %81 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
+ %82 = OpLoad %uint %81
+ %83 = OpULessThan %bool %row_1 %82
+ OpSelectionMerge %84 None
+ OpBranchConditional %83 %85 %84
%85 = OpLabel
- %90 = OpPhi %bool %84 %81 %89 %86
- OpSelectionMerge %91 None
- OpBranchConditional %90 %92 %91
- %92 = OpLabel
- %93 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2
- %94 = OpLoad %uint %93
- %95 = OpIMul %uint %row_1 %94
- %96 = OpIAdd %uint %col_1 %95
- %97 = OpAccessChain %_ptr_StorageBuffer_float %resultMatrix %uint_0 %96
- OpStore %97 %value
- OpBranch %91
+ %86 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2
+ %87 = OpLoad %uint %86
+ %88 = OpULessThan %bool %col_1 %87
+ OpBranch %84
+ %84 = OpLabel
+ %89 = OpPhi %bool %83 %80 %88 %85
+ OpSelectionMerge %90 None
+ OpBranchConditional %89 %91 %90
%91 = OpLabel
+ %92 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2
+ %93 = OpLoad %uint %92
+ %94 = OpIMul %uint %row_1 %93
+ %95 = OpIAdd %uint %col_1 %94
+ %96 = OpAccessChain %_ptr_StorageBuffer_float %resultMatrix %uint_0 %95
+ OpStore %96 %value
+ OpBranch %90
+ %90 = OpLabel
OpReturn
OpFunctionEnd
- %main_inner = OpFunction %void None %98
+ %main_inner = OpFunction %void None %97
%local_id = OpFunctionParameter %v3uint
%global_id = OpFunctionParameter %v3uint
%local_invocation_index = OpFunctionParameter %uint
- %103 = OpLabel
- %idx = OpVariable %_ptr_Function_uint Function %106
+ %102 = OpLabel
+ %idx = OpVariable %_ptr_Function_uint Function %105
%acc = OpVariable %_ptr_Function__arr_float_uint_16 Function %146
- %ACached = OpVariable %_ptr_Function_float Function %52
- %BCached = OpVariable %_ptr_Function__arr_float_RowPerThread Function %152
- %index = OpVariable %_ptr_Function_uint Function %106
- %t = OpVariable %_ptr_Function_uint Function %106
- %innerRow = OpVariable %_ptr_Function_uint Function %106
- %innerCol = OpVariable %_ptr_Function_uint Function %106
- %innerRow_0 = OpVariable %_ptr_Function_uint Function %106
- %innerCol_0 = OpVariable %_ptr_Function_uint Function %106
- %k = OpVariable %_ptr_Function_uint Function %106
- %inner = OpVariable %_ptr_Function_uint Function %106
- %innerRow_1 = OpVariable %_ptr_Function_uint Function %106
- %innerCol_1 = OpVariable %_ptr_Function_uint Function %106
- %innerRow_2 = OpVariable %_ptr_Function_uint Function %106
- %innerCol_2 = OpVariable %_ptr_Function_uint Function %106
+ %ACached = OpVariable %_ptr_Function_float Function %51
+ %BCached = OpVariable %_ptr_Function__arr_float_uint_4 Function %152
+ %index = OpVariable %_ptr_Function_uint Function %105
+ %t = OpVariable %_ptr_Function_uint Function %105
+ %innerRow = OpVariable %_ptr_Function_uint Function %105
+ %innerCol = OpVariable %_ptr_Function_uint Function %105
+ %innerRow_0 = OpVariable %_ptr_Function_uint Function %105
+ %innerCol_0 = OpVariable %_ptr_Function_uint Function %105
+ %k = OpVariable %_ptr_Function_uint Function %105
+ %inner = OpVariable %_ptr_Function_uint Function %105
+ %innerRow_1 = OpVariable %_ptr_Function_uint Function %105
+ %innerCol_1 = OpVariable %_ptr_Function_uint Function %105
+ %innerRow_2 = OpVariable %_ptr_Function_uint Function %105
+ %innerCol_2 = OpVariable %_ptr_Function_uint Function %105
OpStore %idx %local_invocation_index
- OpBranch %107
- %107 = OpLabel
- OpLoopMerge %108 %109 None
- OpBranch %110
- %110 = OpLabel
- %112 = OpLoad %uint %idx
- %114 = OpULessThan %bool %112 %uint_4096
- %111 = OpLogicalNot %bool %114
- OpSelectionMerge %115 None
- OpBranchConditional %111 %116 %115
- %116 = OpLabel
- OpBranch %108
- %115 = OpLabel
- %117 = OpLoad %uint %idx
- %118 = OpUDiv %uint %117 %TileAOuter
- %119 = OpLoad %uint %idx
- %120 = OpUMod %uint %119 %TileAOuter
- %122 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %118 %120
- OpStore %122 %52
- %123 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %118 %120
- OpStore %123 %52
+ OpBranch %106
+ %106 = OpLabel
+ OpLoopMerge %107 %108 None
OpBranch %109
%109 = OpLabel
- %124 = OpLoad %uint %idx
- %126 = OpIAdd %uint %124 %uint_256
- OpStore %idx %126
+ %111 = OpLoad %uint %idx
+ %113 = OpULessThan %bool %111 %uint_4096
+ %110 = OpLogicalNot %bool %113
+ OpSelectionMerge %114 None
+ OpBranchConditional %110 %115 %114
+ %115 = OpLabel
OpBranch %107
+ %114 = OpLabel
+ %116 = OpLoad %uint %idx
+ %117 = OpUDiv %uint %116 %uint_64
+ %118 = OpLoad %uint %idx
+ %119 = OpUMod %uint %118 %uint_64
+ %121 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %117 %119
+ OpStore %121 %51
+ %122 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %117 %119
+ OpStore %122 %51
+ OpBranch %108
%108 = OpLabel
+ %123 = OpLoad %uint %idx
+ %125 = OpIAdd %uint %123 %uint_256
+ OpStore %idx %125
+ OpBranch %106
+ %107 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264
- %129 = OpCompositeExtract %uint %local_id 1
- %130 = OpIMul %uint %129 %RowPerThread
+ %128 = OpCompositeExtract %uint %local_id 1
+ %130 = OpIMul %uint %128 %uint_4
%131 = OpCompositeExtract %uint %local_id 0
- %132 = OpIMul %uint %131 %RowPerThread
+ %132 = OpIMul %uint %131 %uint_4
%133 = OpCompositeExtract %uint %global_id 1
- %134 = OpIMul %uint %133 %RowPerThread
+ %134 = OpIMul %uint %133 %uint_4
%135 = OpCompositeExtract %uint %global_id 0
- %136 = OpIMul %uint %135 %RowPerThread
+ %136 = OpIMul %uint %135 %uint_4
%137 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%138 = OpLoad %uint %137
%139 = OpISub %uint %138 %uint_1
- %140 = OpUDiv %uint %139 %TileAOuter
+ %140 = OpUDiv %uint %139 %uint_64
%141 = OpIAdd %uint %140 %uint_1
- OpStore %index %106
+ OpStore %index %105
OpBranch %154
%154 = OpLabel
OpLoopMerge %155 %156 None
OpBranch %157
%157 = OpLabel
%159 = OpLoad %uint %index
- %160 = OpIMul %uint %RowPerThread %RowPerThread
+ %160 = OpIMul %uint %uint_4 %uint_4
%161 = OpULessThan %bool %159 %160
%158 = OpLogicalNot %bool %161
OpSelectionMerge %162 None
@@ -303,7 +298,7 @@
%162 = OpLabel
%164 = OpLoad %uint %index
%165 = OpAccessChain %_ptr_Function_float %acc %164
- OpStore %165 %52
+ OpStore %165 %51
OpBranch %156
%156 = OpLabel
%166 = OpLoad %uint %index
@@ -311,13 +306,13 @@
OpStore %index %167
OpBranch %154
%155 = OpLabel
- %168 = OpUDiv %uint %TileAOuter %uint_16
+ %168 = OpUDiv %uint %uint_64 %uint_16
%169 = OpCompositeExtract %uint %local_id 0
%170 = OpIMul %uint %169 %168
- %171 = OpUDiv %uint %TileAOuter %uint_16
+ %171 = OpUDiv %uint %uint_64 %uint_16
%172 = OpCompositeExtract %uint %local_id 1
%173 = OpIMul %uint %172 %171
- OpStore %t %106
+ OpStore %t %105
OpBranch %175
%175 = OpLabel
OpLoopMerge %176 %177 None
@@ -331,21 +326,21 @@
%183 = OpLabel
OpBranch %176
%182 = OpLabel
- OpStore %innerRow %106
+ OpStore %innerRow %105
OpBranch %185
%185 = OpLabel
OpLoopMerge %186 %187 None
OpBranch %188
%188 = OpLabel
%190 = OpLoad %uint %innerRow
- %191 = OpULessThan %bool %190 %RowPerThread
+ %191 = OpULessThan %bool %190 %uint_4
%189 = OpLogicalNot %bool %191
OpSelectionMerge %192 None
OpBranchConditional %189 %193 %192
%193 = OpLabel
OpBranch %186
%192 = OpLabel
- OpStore %innerCol %106
+ OpStore %innerCol %105
OpBranch %195
%195 = OpLabel
OpLoopMerge %196 %197 None
@@ -366,7 +361,7 @@
%209 = OpLoad %uint %innerRow
%210 = OpIAdd %uint %134 %209
%211 = OpLoad %uint %t
- %212 = OpIMul %uint %211 %TileAOuter
+ %212 = OpIMul %uint %211 %uint_64
%213 = OpIAdd %uint %212 %207
%208 = OpFunctionCall %float %mm_readA %210 %213
%214 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %205 %207
@@ -385,7 +380,7 @@
OpStore %innerRow %218
OpBranch %185
%186 = OpLabel
- OpStore %innerRow_0 %106
+ OpStore %innerRow_0 %105
OpBranch %220
%220 = OpLabel
OpLoopMerge %221 %222 None
@@ -399,14 +394,14 @@
%228 = OpLabel
OpBranch %221
%227 = OpLabel
- OpStore %innerCol_0 %106
+ OpStore %innerCol_0 %105
OpBranch %230
%230 = OpLabel
OpLoopMerge %231 %232 None
OpBranch %233
%233 = OpLabel
%235 = OpLoad %uint %innerCol_0
- %236 = OpULessThan %bool %235 %RowPerThread
+ %236 = OpULessThan %bool %235 %uint_4
%234 = OpLogicalNot %bool %236
OpSelectionMerge %237 None
OpBranchConditional %234 %238 %237
@@ -418,7 +413,7 @@
%241 = OpLoad %uint %innerCol_0
%242 = OpIAdd %uint %132 %241
%244 = OpLoad %uint %t
- %245 = OpIMul %uint %244 %TileAOuter
+ %245 = OpIMul %uint %244 %uint_64
%246 = OpIAdd %uint %245 %240
%247 = OpLoad %uint %innerCol_0
%248 = OpIAdd %uint %136 %247
@@ -441,28 +436,28 @@
OpBranch %220
%221 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264
- OpStore %k %106
+ OpStore %k %105
OpBranch %257
%257 = OpLabel
OpLoopMerge %258 %259 None
OpBranch %260
%260 = OpLabel
%262 = OpLoad %uint %k
- %263 = OpULessThan %bool %262 %TileAOuter
+ %263 = OpULessThan %bool %262 %uint_64
%261 = OpLogicalNot %bool %263
OpSelectionMerge %264 None
OpBranchConditional %261 %265 %264
%265 = OpLabel
OpBranch %258
%264 = OpLabel
- OpStore %inner %106
+ OpStore %inner %105
OpBranch %267
%267 = OpLabel
OpLoopMerge %268 %269 None
OpBranch %270
%270 = OpLabel
%272 = OpLoad %uint %inner
- %273 = OpULessThan %bool %272 %RowPerThread
+ %273 = OpULessThan %bool %272 %uint_4
%271 = OpLogicalNot %bool %273
OpSelectionMerge %274 None
OpBranchConditional %271 %275 %274
@@ -484,14 +479,14 @@
OpStore %inner %284
OpBranch %267
%268 = OpLabel
- OpStore %innerRow_1 %106
+ OpStore %innerRow_1 %105
OpBranch %286
%286 = OpLabel
OpLoopMerge %287 %288 None
OpBranch %289
%289 = OpLabel
%291 = OpLoad %uint %innerRow_1
- %292 = OpULessThan %bool %291 %RowPerThread
+ %292 = OpULessThan %bool %291 %uint_4
%290 = OpLogicalNot %bool %292
OpSelectionMerge %293 None
OpBranchConditional %290 %294 %293
@@ -504,14 +499,14 @@
%298 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %296 %297
%299 = OpLoad %float %298
OpStore %ACached %299
- OpStore %innerCol_1 %106
+ OpStore %innerCol_1 %105
OpBranch %301
%301 = OpLabel
OpLoopMerge %302 %303 None
OpBranch %304
%304 = OpLabel
%306 = OpLoad %uint %innerCol_1
- %307 = OpULessThan %bool %306 %RowPerThread
+ %307 = OpULessThan %bool %306 %uint_4
%305 = OpLogicalNot %bool %307
OpSelectionMerge %308 None
OpBranchConditional %305 %309 %308
@@ -519,7 +514,7 @@
OpBranch %302
%308 = OpLabel
%310 = OpLoad %uint %innerRow_1
- %311 = OpIMul %uint %310 %RowPerThread
+ %311 = OpIMul %uint %310 %uint_4
%312 = OpLoad %uint %innerCol_1
%313 = OpIAdd %uint %311 %312
%314 = OpAccessChain %_ptr_Function_float %acc %313
@@ -561,28 +556,28 @@
OpStore %t %331
OpBranch %175
%176 = OpLabel
- OpStore %innerRow_2 %106
+ OpStore %innerRow_2 %105
OpBranch %333
%333 = OpLabel
OpLoopMerge %334 %335 None
OpBranch %336
%336 = OpLabel
%338 = OpLoad %uint %innerRow_2
- %339 = OpULessThan %bool %338 %RowPerThread
+ %339 = OpULessThan %bool %338 %uint_4
%337 = OpLogicalNot %bool %339
OpSelectionMerge %340 None
OpBranchConditional %337 %341 %340
%341 = OpLabel
OpBranch %334
%340 = OpLabel
- OpStore %innerCol_2 %106
+ OpStore %innerCol_2 %105
OpBranch %343
%343 = OpLabel
OpLoopMerge %344 %345 None
OpBranch %346
%346 = OpLabel
%348 = OpLoad %uint %innerCol_2
- %349 = OpULessThan %bool %348 %RowPerThread
+ %349 = OpULessThan %bool %348 %uint_4
%347 = OpLogicalNot %bool %349
OpSelectionMerge %350 None
OpBranchConditional %347 %351 %350
@@ -590,7 +585,7 @@
OpBranch %344
%350 = OpLabel
%352 = OpLoad %uint %innerRow_2
- %353 = OpIMul %uint %352 %RowPerThread
+ %353 = OpIMul %uint %352 %uint_4
%354 = OpLoad %uint %innerCol_2
%355 = OpIAdd %uint %353 %354
%357 = OpLoad %uint %innerRow_2
diff --git a/test/tint/bug/tint/914.wgsl.expected.wgsl b/test/tint/bug/tint/914.wgsl.expected.wgsl
index 67fd494..7b1cedb 100644
--- a/test/tint/bug/tint/914.wgsl.expected.wgsl
+++ b/test/tint/bug/tint/914.wgsl.expected.wgsl
@@ -39,15 +39,15 @@
}
}
-let RowPerThread : u32 = 4u;
+const RowPerThread : u32 = 4u;
-let ColPerThread : u32 = 4u;
+const ColPerThread : u32 = 4u;
-let TileAOuter : u32 = 64u;
+const TileAOuter : u32 = 64u;
-let TileBOuter : u32 = 64u;
+const TileBOuter : u32 = 64u;
-let TileInner : u32 = 64u;
+const TileInner : u32 = 64u;
var<workgroup> mm_Asub : array<array<f32, 64>, 64>;
diff --git a/test/tint/const/global/global.wgsl b/test/tint/const/global/global.wgsl
new file mode 100644
index 0000000..12f56a8
--- /dev/null
+++ b/test/tint/const/global/global.wgsl
@@ -0,0 +1,27 @@
+type MyArray = array<f32, 10>;
+
+// Global consts
+const c1 = 1;
+const c2 = 1u;
+const c3 = 1.0;
+
+const c4 = vec3<i32>(1, 1, 1);
+const c5 = vec3<u32>(1u, 1u, 1u);
+const c6 = vec3<f32>(1.0, 1.0, 1.0);
+
+const c7 = mat3x3<f32>(vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0));
+
+const c9 = MyArray();
+
+@fragment
+fn main() -> @location(0) vec4<f32> {
+ var v1 = c1;
+ var v2 = c2;
+ var v3 = c3;
+ var v4 = c4;
+ var v5 = c5;
+ var v6 = c6;
+ var v7 = c7;
+ var v9 = c9;
+ return vec4<f32>(0.0,0.0,0.0,0.0);
+}
diff --git a/test/tint/const/global/global.wgsl.expected.glsl b/test/tint/const/global/global.wgsl.expected.glsl
new file mode 100644
index 0000000..54e642b
--- /dev/null
+++ b/test/tint/const/global/global.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+precision mediump float;
+
+layout(location = 0) out vec4 value;
+vec4 tint_symbol() {
+ int v1 = 1;
+ uint v2 = 1u;
+ float v3 = 1.0f;
+ ivec3 v4 = ivec3(1);
+ uvec3 v5 = uvec3(1u);
+ vec3 v6 = vec3(1.0f);
+ mat3 v7 = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f));
+ float v9[10] = float[10](0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+ return vec4(0.0f);
+}
+
+void main() {
+ vec4 inner_result = tint_symbol();
+ value = inner_result;
+ return;
+}
diff --git a/test/tint/const/global/global.wgsl.expected.hlsl b/test/tint/const/global/global.wgsl.expected.hlsl
new file mode 100644
index 0000000..cc2c4c6
--- /dev/null
+++ b/test/tint/const/global/global.wgsl.expected.hlsl
@@ -0,0 +1,22 @@
+struct tint_symbol {
+ float4 value : SV_Target0;
+};
+
+float4 main_inner() {
+ int v1 = 1;
+ uint v2 = 1u;
+ float v3 = 1.0f;
+ int3 v4 = (1).xxx;
+ uint3 v5 = (1u).xxx;
+ float3 v6 = (1.0f).xxx;
+ float3x3 v7 = float3x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx);
+ float v9[10] = (float[10])0;
+ return (0.0f).xxxx;
+}
+
+tint_symbol main() {
+ const float4 inner_result = main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
diff --git a/test/tint/let/global/global.wgsl.expected.msl b/test/tint/const/global/global.wgsl.expected.msl
similarity index 72%
rename from test/tint/let/global/global.wgsl.expected.msl
rename to test/tint/const/global/global.wgsl.expected.msl
index d4ded52..1807542 100644
--- a/test/tint/let/global/global.wgsl.expected.msl
+++ b/test/tint/const/global/global.wgsl.expected.msl
@@ -14,33 +14,19 @@
T elements[N];
};
-struct MyStruct {
- float f1;
-};
-
-constant int v1 = 1;
-
-constant uint v2 = 1u;
-
-constant float v3 = 1.0f;
-
-constant int3 v4 = int3(1);
-
-constant uint3 v5 = uint3(1u);
-
-constant float3 v6 = float3(1.0f);
-
-constant float3x3 v7 = float3x3(float3(1.0f), float3(1.0f), float3(1.0f));
-
-constant MyStruct v8 = {};
-
-constant tint_array<float, 10> v9 = tint_array<float, 10>{};
-
struct tint_symbol_1 {
float4 value [[color(0)]];
};
float4 tint_symbol_inner() {
+ int v1 = 1;
+ uint v2 = 1u;
+ float v3 = 1.0f;
+ int3 v4 = int3(1);
+ uint3 v5 = uint3(1u);
+ float3 v6 = float3(1.0f);
+ float3x3 v7 = float3x3(float3(1.0f), float3(1.0f), float3(1.0f));
+ tint_array<float, 10> v9 = tint_array<float, 10>{};
return float4(0.0f);
}
diff --git a/test/tint/const/global/global.wgsl.expected.spvasm b/test/tint/const/global/global.wgsl.expected.spvasm
new file mode 100644
index 0000000..d93b74d
--- /dev/null
+++ b/test/tint/const/global/global.wgsl.expected.spvasm
@@ -0,0 +1,87 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 53
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %value
+ OpExecutionMode %main OriginUpperLeft
+ OpName %value "value"
+ OpName %main_inner "main_inner"
+ OpName %v1 "v1"
+ OpName %v2 "v2"
+ OpName %v3 "v3"
+ OpName %v4 "v4"
+ OpName %v5 "v5"
+ OpName %v6 "v6"
+ OpName %v7 "v7"
+ OpName %v9 "v9"
+ OpName %main "main"
+ OpDecorate %value Location 0
+ OpDecorate %_arr_float_uint_10 ArrayStride 4
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+ %6 = OpTypeFunction %v4float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %13 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %18 = OpConstantNull %uint
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %22 = OpConstantNull %float
+ %v3int = OpTypeVector %int 3
+ %24 = OpConstantComposite %v3int %int_1 %int_1 %int_1
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %27 = OpConstantNull %v3int
+ %v3uint = OpTypeVector %uint 3
+ %29 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %32 = OpConstantNull %v3uint
+ %v3float = OpTypeVector %float 3
+ %34 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %37 = OpConstantNull %v3float
+%mat3v3float = OpTypeMatrix %v3float 3
+ %39 = OpConstantComposite %mat3v3float %34 %34 %34
+%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
+ %42 = OpConstantNull %mat3v3float
+ %uint_10 = OpConstant %uint 10
+%_arr_float_uint_10 = OpTypeArray %float %uint_10
+ %45 = OpConstantNull %_arr_float_uint_10
+%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10
+ %void = OpTypeVoid
+ %48 = OpTypeFunction %void
+ %main_inner = OpFunction %v4float None %6
+ %8 = OpLabel
+ %v1 = OpVariable %_ptr_Function_int Function %13
+ %v2 = OpVariable %_ptr_Function_uint Function %18
+ %v3 = OpVariable %_ptr_Function_float Function %22
+ %v4 = OpVariable %_ptr_Function_v3int Function %27
+ %v5 = OpVariable %_ptr_Function_v3uint Function %32
+ %v6 = OpVariable %_ptr_Function_v3float Function %37
+ %v7 = OpVariable %_ptr_Function_mat3v3float Function %42
+ %v9 = OpVariable %_ptr_Function__arr_float_uint_10 Function %45
+ OpStore %v1 %int_1
+ OpStore %v2 %uint_1
+ OpStore %v3 %float_1
+ OpStore %v4 %24
+ OpStore %v5 %29
+ OpStore %v6 %34
+ OpStore %v7 %39
+ OpStore %v9 %45
+ OpReturnValue %5
+ OpFunctionEnd
+ %main = OpFunction %void None %48
+ %51 = OpLabel
+ %52 = OpFunctionCall %v4float %main_inner
+ OpStore %value %52
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/const/global/global.wgsl.expected.wgsl b/test/tint/const/global/global.wgsl.expected.wgsl
new file mode 100644
index 0000000..8fc0106
--- /dev/null
+++ b/test/tint/const/global/global.wgsl.expected.wgsl
@@ -0,0 +1,30 @@
+type MyArray = array<f32, 10>;
+
+const c1 = 1;
+
+const c2 = 1u;
+
+const c3 = 1.0;
+
+const c4 = vec3<i32>(1, 1, 1);
+
+const c5 = vec3<u32>(1u, 1u, 1u);
+
+const c6 = vec3<f32>(1.0, 1.0, 1.0);
+
+const c7 = mat3x3<f32>(vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0));
+
+const c9 = MyArray();
+
+@fragment
+fn main() -> @location(0) vec4<f32> {
+ var v1 = c1;
+ var v2 = c2;
+ var v3 = c3;
+ var v4 = c4;
+ var v5 = c5;
+ var v6 = c6;
+ var v7 = c7;
+ var v9 = c9;
+ return vec4<f32>(0.0, 0.0, 0.0, 0.0);
+}
diff --git a/test/tint/const/inferred/function.wgsl b/test/tint/const/inferred/function.wgsl
new file mode 100644
index 0000000..cd8811b
--- /dev/null
+++ b/test/tint/const/inferred/function.wgsl
@@ -0,0 +1,21 @@
+type MyArray = array<f32, 10>;
+
+// Function-scope consts
+fn const_decls() {
+ const v1 = 1;
+ const v2 = 1u;
+ const v3 = 1.0;
+
+ const v4 = vec3<i32>(1, 1, 1);
+ const v5 = vec3<u32>(1u, 1u, 1u);
+ const v6 = vec3<f32>(1.0, 1.0, 1.0);
+
+ const v7 = mat3x3<f32>(v6, v6, v6);
+
+ const v8 = MyArray();
+}
+
+@fragment
+fn main() -> @location(0) vec4<f32> {
+ return vec4<f32>(0.0,0.0,0.0,0.0);
+}
diff --git a/test/tint/let/global/global.wgsl.expected.glsl b/test/tint/const/inferred/function.wgsl.expected.glsl
similarity index 85%
rename from test/tint/let/global/global.wgsl.expected.glsl
rename to test/tint/const/inferred/function.wgsl.expected.glsl
index b350456..69a3a97 100644
--- a/test/tint/let/global/global.wgsl.expected.glsl
+++ b/test/tint/const/inferred/function.wgsl.expected.glsl
@@ -2,10 +2,6 @@
precision mediump float;
layout(location = 0) out vec4 value;
-struct MyStruct {
- float f1;
-};
-
vec4 tint_symbol() {
return vec4(0.0f);
}
diff --git a/test/tint/const/inferred/function.wgsl.expected.hlsl b/test/tint/const/inferred/function.wgsl.expected.hlsl
new file mode 100644
index 0000000..f60a041
--- /dev/null
+++ b/test/tint/const/inferred/function.wgsl.expected.hlsl
@@ -0,0 +1,17 @@
+void const_decls() {
+}
+
+struct tint_symbol {
+ float4 value : SV_Target0;
+};
+
+float4 main_inner() {
+ return (0.0f).xxxx;
+}
+
+tint_symbol main() {
+ const float4 inner_result = main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
diff --git a/test/tint/const/inferred/function.wgsl.expected.msl b/test/tint/const/inferred/function.wgsl.expected.msl
new file mode 100644
index 0000000..ad4f634
--- /dev/null
+++ b/test/tint/const/inferred/function.wgsl.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void const_decls() {
+}
+
+struct tint_symbol_1 {
+ float4 value [[color(0)]];
+};
+
+float4 tint_symbol_inner() {
+ return float4(0.0f);
+}
+
+fragment tint_symbol_1 tint_symbol() {
+ float4 const inner_result = tint_symbol_inner();
+ tint_symbol_1 wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
diff --git a/test/tint/const/inferred/function.wgsl.expected.spvasm b/test/tint/const/inferred/function.wgsl.expected.spvasm
new file mode 100644
index 0000000..c24ee9e
--- /dev/null
+++ b/test/tint/const/inferred/function.wgsl.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %value
+ OpExecutionMode %main OriginUpperLeft
+ OpName %value "value"
+ OpName %const_decls "const_decls"
+ OpName %main_inner "main_inner"
+ OpName %main "main"
+ OpDecorate %value Location 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %10 = OpTypeFunction %v4float
+%const_decls = OpFunction %void None %6
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main_inner = OpFunction %v4float None %10
+ %12 = OpLabel
+ OpReturnValue %5
+ OpFunctionEnd
+ %main = OpFunction %void None %6
+ %14 = OpLabel
+ %15 = OpFunctionCall %v4float %main_inner
+ OpStore %value %15
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/const/inferred/function.wgsl.expected.wgsl b/test/tint/const/inferred/function.wgsl.expected.wgsl
new file mode 100644
index 0000000..94ff328
--- /dev/null
+++ b/test/tint/const/inferred/function.wgsl.expected.wgsl
@@ -0,0 +1,17 @@
+type MyArray = array<f32, 10>;
+
+fn const_decls() {
+ const v1 = 1;
+ const v2 = 1u;
+ const v3 = 1.0;
+ const v4 = vec3<i32>(1, 1, 1);
+ const v5 = vec3<u32>(1u, 1u, 1u);
+ const v6 = vec3<f32>(1.0, 1.0, 1.0);
+ const v7 = mat3x3<f32>(v6, v6, v6);
+ const v8 = MyArray();
+}
+
+@fragment
+fn main() -> @location(0) vec4<f32> {
+ return vec4<f32>(0.0, 0.0, 0.0, 0.0);
+}
diff --git a/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.hlsl
index cb4a95b..c41e7ef 100644
--- a/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.hlsl
+++ b/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.hlsl
@@ -2,6 +2,6 @@
void f() {
const int a = 4;
const int3 b = int3(1, 2, 3);
- const int3 r = (a / b);
+ const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b));
return;
}
diff --git a/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.hlsl
index 8942ff8..ac675e2 100644
--- a/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.hlsl
+++ b/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.hlsl
@@ -2,6 +2,6 @@
void f() {
const uint a = 4u;
const uint3 b = uint3(1u, 2u, 3u);
- const uint3 r = (a / b);
+ const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b));
return;
}
diff --git a/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.hlsl
index 33a4443..98c4e64 100644
--- a/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.hlsl
+++ b/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.hlsl
@@ -2,6 +2,6 @@
void f() {
const int3 a = int3(1, 2, 3);
const int3 b = int3(4, 5, 6);
- const int3 r = (a / b);
+ const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b));
return;
}
diff --git a/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.hlsl
index 815ad9b..2f2a501 100644
--- a/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.hlsl
+++ b/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.hlsl
@@ -2,6 +2,6 @@
void f() {
const uint3 a = uint3(1u, 2u, 3u);
const uint3 b = uint3(4u, 5u, 6u);
- const uint3 r = (a / b);
+ const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b));
return;
}
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.hlsl
index 35cc532..99ed924 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.hlsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.hlsl
@@ -2,6 +2,6 @@
void f() {
const int a = 4;
const int3 b = int3(0, 2, 0);
- const int3 r = (a / int3(1, 2, 1));
+ const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b));
return;
}
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.hlsl
index f57e7ed..1ebcc7f 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.hlsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.hlsl
@@ -2,6 +2,6 @@
void f() {
const uint a = 4u;
const uint3 b = uint3(0u, 2u, 0u);
- const uint3 r = (a / uint3(1u, 2u, 1u));
+ const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b));
return;
}
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.hlsl
index 3cd640e..30d26ca 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.hlsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.hlsl
@@ -2,6 +2,6 @@
void f() {
const int3 a = int3(1, 2, 3);
const int3 b = int3(0, 5, 0);
- const int3 r = (a / int3(1, 5, 1));
+ const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b));
return;
}
diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.hlsl
index ea7ca06..c337dc3 100644
--- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.hlsl
+++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.hlsl
@@ -2,6 +2,6 @@
void f() {
const uint3 a = uint3(1u, 2u, 3u);
const uint3 b = uint3(0u, 5u, 0u);
- const uint3 r = (a / uint3(1u, 5u, 1u));
+ const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b));
return;
}
diff --git a/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.hlsl
index 5b0bfca..847b0fb 100644
--- a/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.hlsl
+++ b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.hlsl
@@ -2,6 +2,6 @@
void f() {
const int a = 4;
const int3 b = int3(1, 2, 3);
- const int3 r = (a % b);
+ const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b));
return;
}
diff --git a/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.hlsl
index 97533fb..396d57a 100644
--- a/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.hlsl
+++ b/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.hlsl
@@ -2,6 +2,6 @@
void f() {
const uint a = 4u;
const uint3 b = uint3(1u, 2u, 3u);
- const uint3 r = (a % b);
+ const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b));
return;
}
diff --git a/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.hlsl
index f39516d..86d89a5 100644
--- a/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.hlsl
+++ b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.hlsl
@@ -2,6 +2,6 @@
void f() {
const int3 a = int3(1, 2, 3);
const int3 b = int3(4, 5, 6);
- const int3 r = (a % b);
+ const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b));
return;
}
diff --git a/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.hlsl
index 33e6b96..5d234b8 100644
--- a/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.hlsl
+++ b/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.hlsl
@@ -2,6 +2,6 @@
void f() {
const uint3 a = uint3(1u, 2u, 3u);
const uint3 b = uint3(4u, 5u, 6u);
- const uint3 r = (a % b);
+ const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b));
return;
}
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.hlsl
index fa4482f..dfe722c 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.hlsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.hlsl
@@ -2,6 +2,6 @@
void f() {
const int a = 4;
const int3 b = int3(0, 2, 0);
- const int3 r = (a % int3(1, 2, 1));
+ const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b));
return;
}
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.hlsl
index 12aa8c0..5583772 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.hlsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.hlsl
@@ -2,6 +2,6 @@
void f() {
const uint a = 4u;
const uint3 b = uint3(0u, 2u, 0u);
- const uint3 r = (a % uint3(1u, 2u, 1u));
+ const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b));
return;
}
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.hlsl
index ee60674..ce3cfca 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.hlsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.hlsl
@@ -2,6 +2,6 @@
void f() {
const int3 a = int3(1, 2, 3);
const int3 b = int3(0, 5, 0);
- const int3 r = (a % int3(1, 5, 1));
+ const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b));
return;
}
diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.hlsl
index 2389839..ef3ed45 100644
--- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.hlsl
+++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.hlsl
@@ -2,6 +2,6 @@
void f() {
const uint3 a = uint3(1u, 2u, 3u);
const uint3 b = uint3(0u, 5u, 0u);
- const uint3 r = (a % uint3(1u, 5u, 1u));
+ const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b));
return;
}
diff --git a/test/tint/expressions/index/let/let/literal/array.wgsl.expected.glsl b/test/tint/expressions/index/let/let/literal/array.wgsl.expected.glsl
index 4333b6d..3761f17 100644
--- a/test/tint/expressions/index/let/let/literal/array.wgsl.expected.glsl
+++ b/test/tint/expressions/index/let/let/literal/array.wgsl.expected.glsl
@@ -6,6 +6,6 @@
}
int f() {
int a[8] = int[8](1, 2, 3, 4, 5, 6, 7, 8);
- return 2;
+ return a[1];
}
diff --git a/test/tint/expressions/index/let/let/literal/array.wgsl.expected.hlsl b/test/tint/expressions/index/let/let/literal/array.wgsl.expected.hlsl
index 25a029a..7174cfa 100644
--- a/test/tint/expressions/index/let/let/literal/array.wgsl.expected.hlsl
+++ b/test/tint/expressions/index/let/let/literal/array.wgsl.expected.hlsl
@@ -5,5 +5,5 @@
int f() {
const int a[8] = {1, 2, 3, 4, 5, 6, 7, 8};
- return 2;
+ return a[1];
}
diff --git a/test/tint/expressions/index/let/let/literal/array.wgsl.expected.msl b/test/tint/expressions/index/let/let/literal/array.wgsl.expected.msl
index c5f5865..f999fd1 100644
--- a/test/tint/expressions/index/let/let/literal/array.wgsl.expected.msl
+++ b/test/tint/expressions/index/let/let/literal/array.wgsl.expected.msl
@@ -17,6 +17,6 @@
int f() {
tint_array<int, 8> const a = tint_array<int, 8>{1, 2, 3, 4, 5, 6, 7, 8};
int const i = 1;
- return 2;
+ return a[i];
}
diff --git a/test/tint/expressions/index/let/let/literal/array.wgsl.expected.spvasm b/test/tint/expressions/index/let/let/literal/array.wgsl.expected.spvasm
index bc9f2a8..3530a99 100644
--- a/test/tint/expressions/index/let/let/literal/array.wgsl.expected.spvasm
+++ b/test/tint/expressions/index/let/let/literal/array.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 27
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -9,6 +9,7 @@
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %unused_entry_point "unused_entry_point"
OpName %f "f"
+ OpName %var_for_index "var_for_index"
OpDecorate %_arr_int_uint_8 ArrayStride 4
%void = OpTypeVoid
%1 = OpTypeFunction %void
@@ -26,11 +27,18 @@
%int_7 = OpConstant %int 7
%int_8 = OpConstant %int 8
%20 = OpConstantComposite %_arr_int_uint_8 %int_1 %int_2 %int_3 %int_4 %int_5 %int_6 %int_7 %int_8
+%_ptr_Function__arr_int_uint_8 = OpTypePointer Function %_arr_int_uint_8
+ %23 = OpConstantNull %_arr_int_uint_8
+%_ptr_Function_int = OpTypePointer Function %int
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %int None %5
%8 = OpLabel
- OpReturnValue %int_2
+%var_for_index = OpVariable %_ptr_Function__arr_int_uint_8 Function %23
+ OpStore %var_for_index %20
+ %25 = OpAccessChain %_ptr_Function_int %var_for_index %int_1
+ %26 = OpLoad %int %25
+ OpReturnValue %26
OpFunctionEnd
diff --git a/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.glsl b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.glsl
index a88b339..1b66086 100644
--- a/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.glsl
+++ b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.glsl
@@ -6,6 +6,6 @@
}
vec3 f() {
mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f));
- return vec3(4.0f, 5.0f, 6.0f);
+ return m[1];
}
diff --git a/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.hlsl b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.hlsl
index a730c4e..ad2d36b 100644
--- a/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.hlsl
+++ b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.hlsl
@@ -5,5 +5,5 @@
float3 f() {
const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
- return float3(4.0f, 5.0f, 6.0f);
+ return m[1];
}
diff --git a/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.msl b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.msl
index 6cc4826..ca9238e 100644
--- a/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.msl
+++ b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.msl
@@ -4,6 +4,6 @@
float3 f() {
float3x3 const m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
int const i = 1;
- return float3(4.0f, 5.0f, 6.0f);
+ return m[i];
}
diff --git a/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.spvasm b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.spvasm
index 9e8d909..500165e 100644
--- a/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.spvasm
+++ b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -9,6 +9,7 @@
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %unused_entry_point "unused_entry_point"
OpName %f "f"
+ OpName %var_for_index "var_for_index"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
@@ -30,11 +31,18 @@
%23 = OpConstantComposite %mat3v3float %14 %18 %22
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
+%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
+ %28 = OpConstantNull %mat3v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %v3float None %5
%9 = OpLabel
- OpReturnValue %18
+%var_for_index = OpVariable %_ptr_Function_mat3v3float Function %28
+ OpStore %var_for_index %23
+ %30 = OpAccessChain %_ptr_Function_v3float %var_for_index %int_1
+ %31 = OpLoad %v3float %30
+ OpReturnValue %31
OpFunctionEnd
diff --git a/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.glsl b/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.glsl
index 0d06163..0f24df5 100644
--- a/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.glsl
+++ b/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.glsl
@@ -6,6 +6,6 @@
}
float f() {
vec3 v = vec3(1.0f, 2.0f, 3.0f);
- return 2.0f;
+ return v[1];
}
diff --git a/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.hlsl b/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.hlsl
index 04d609c..ede6118 100644
--- a/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.hlsl
+++ b/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.hlsl
@@ -5,5 +5,5 @@
float f() {
const float3 v = float3(1.0f, 2.0f, 3.0f);
- return 2.0f;
+ return v[1];
}
diff --git a/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.msl b/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.msl
index 2218b65..587f5cf 100644
--- a/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.msl
+++ b/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.msl
@@ -4,6 +4,6 @@
float f() {
float3 const v = float3(1.0f, 2.0f, 3.0f);
int const i = 1;
- return 2.0f;
+ return v[i];
}
diff --git a/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.spvasm b/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.spvasm
index 91f8eea..86157e1 100644
--- a/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.spvasm
+++ b/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 16
+; Bound: 17
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -26,5 +26,6 @@
OpFunctionEnd
%f = OpFunction %float None %5
%8 = OpLabel
- OpReturnValue %float_2
+ %16 = OpVectorExtractDynamic %float %13 %int_1
+ OpReturnValue %16
OpFunctionEnd
diff --git a/test/tint/expressions/index/let/literal/array.wgsl.expected.glsl b/test/tint/expressions/index/let/literal/array.wgsl.expected.glsl
index 4333b6d..3761f17 100644
--- a/test/tint/expressions/index/let/literal/array.wgsl.expected.glsl
+++ b/test/tint/expressions/index/let/literal/array.wgsl.expected.glsl
@@ -6,6 +6,6 @@
}
int f() {
int a[8] = int[8](1, 2, 3, 4, 5, 6, 7, 8);
- return 2;
+ return a[1];
}
diff --git a/test/tint/expressions/index/let/literal/array.wgsl.expected.hlsl b/test/tint/expressions/index/let/literal/array.wgsl.expected.hlsl
index 25a029a..7174cfa 100644
--- a/test/tint/expressions/index/let/literal/array.wgsl.expected.hlsl
+++ b/test/tint/expressions/index/let/literal/array.wgsl.expected.hlsl
@@ -5,5 +5,5 @@
int f() {
const int a[8] = {1, 2, 3, 4, 5, 6, 7, 8};
- return 2;
+ return a[1];
}
diff --git a/test/tint/expressions/index/let/literal/array.wgsl.expected.msl b/test/tint/expressions/index/let/literal/array.wgsl.expected.msl
index e0a4066..2196ad9 100644
--- a/test/tint/expressions/index/let/literal/array.wgsl.expected.msl
+++ b/test/tint/expressions/index/let/literal/array.wgsl.expected.msl
@@ -16,6 +16,6 @@
int f() {
tint_array<int, 8> const a = tint_array<int, 8>{1, 2, 3, 4, 5, 6, 7, 8};
- return 2;
+ return a[1];
}
diff --git a/test/tint/expressions/index/let/literal/array.wgsl.expected.spvasm b/test/tint/expressions/index/let/literal/array.wgsl.expected.spvasm
index bc9f2a8..1dc9cda 100644
--- a/test/tint/expressions/index/let/literal/array.wgsl.expected.spvasm
+++ b/test/tint/expressions/index/let/literal/array.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 22
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -32,5 +32,6 @@
OpFunctionEnd
%f = OpFunction %int None %5
%8 = OpLabel
- OpReturnValue %int_2
+ %21 = OpCompositeExtract %int %20 1
+ OpReturnValue %21
OpFunctionEnd
diff --git a/test/tint/expressions/index/let/literal/matrix.wgsl.expected.glsl b/test/tint/expressions/index/let/literal/matrix.wgsl.expected.glsl
index a88b339..1b66086 100644
--- a/test/tint/expressions/index/let/literal/matrix.wgsl.expected.glsl
+++ b/test/tint/expressions/index/let/literal/matrix.wgsl.expected.glsl
@@ -6,6 +6,6 @@
}
vec3 f() {
mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f));
- return vec3(4.0f, 5.0f, 6.0f);
+ return m[1];
}
diff --git a/test/tint/expressions/index/let/literal/matrix.wgsl.expected.hlsl b/test/tint/expressions/index/let/literal/matrix.wgsl.expected.hlsl
index a730c4e..ad2d36b 100644
--- a/test/tint/expressions/index/let/literal/matrix.wgsl.expected.hlsl
+++ b/test/tint/expressions/index/let/literal/matrix.wgsl.expected.hlsl
@@ -5,5 +5,5 @@
float3 f() {
const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
- return float3(4.0f, 5.0f, 6.0f);
+ return m[1];
}
diff --git a/test/tint/expressions/index/let/literal/matrix.wgsl.expected.msl b/test/tint/expressions/index/let/literal/matrix.wgsl.expected.msl
index cd5b0bf..92a23c4 100644
--- a/test/tint/expressions/index/let/literal/matrix.wgsl.expected.msl
+++ b/test/tint/expressions/index/let/literal/matrix.wgsl.expected.msl
@@ -3,6 +3,6 @@
using namespace metal;
float3 f() {
float3x3 const m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
- return float3(4.0f, 5.0f, 6.0f);
+ return m[1];
}
diff --git a/test/tint/expressions/index/let/literal/matrix.wgsl.expected.spvasm b/test/tint/expressions/index/let/literal/matrix.wgsl.expected.spvasm
index 362678c..0e46829 100644
--- a/test/tint/expressions/index/let/literal/matrix.wgsl.expected.spvasm
+++ b/test/tint/expressions/index/let/literal/matrix.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 24
+; Bound: 27
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -28,11 +28,14 @@
%float_9 = OpConstant %float 9
%22 = OpConstantComposite %v3float %float_7 %float_8 %float_9
%23 = OpConstantComposite %mat3v3float %14 %18 %22
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %v3float None %5
%9 = OpLabel
- OpReturnValue %18
+ %26 = OpCompositeExtract %v3float %23 1
+ OpReturnValue %26
OpFunctionEnd
diff --git a/test/tint/expressions/index/let/literal/vector.wgsl.expected.glsl b/test/tint/expressions/index/let/literal/vector.wgsl.expected.glsl
index 0d06163..0f24df5 100644
--- a/test/tint/expressions/index/let/literal/vector.wgsl.expected.glsl
+++ b/test/tint/expressions/index/let/literal/vector.wgsl.expected.glsl
@@ -6,6 +6,6 @@
}
float f() {
vec3 v = vec3(1.0f, 2.0f, 3.0f);
- return 2.0f;
+ return v[1];
}
diff --git a/test/tint/expressions/index/let/literal/vector.wgsl.expected.hlsl b/test/tint/expressions/index/let/literal/vector.wgsl.expected.hlsl
index 04d609c..ede6118 100644
--- a/test/tint/expressions/index/let/literal/vector.wgsl.expected.hlsl
+++ b/test/tint/expressions/index/let/literal/vector.wgsl.expected.hlsl
@@ -5,5 +5,5 @@
float f() {
const float3 v = float3(1.0f, 2.0f, 3.0f);
- return 2.0f;
+ return v[1];
}
diff --git a/test/tint/expressions/index/let/literal/vector.wgsl.expected.msl b/test/tint/expressions/index/let/literal/vector.wgsl.expected.msl
index cb5b4bb..94dc06a 100644
--- a/test/tint/expressions/index/let/literal/vector.wgsl.expected.msl
+++ b/test/tint/expressions/index/let/literal/vector.wgsl.expected.msl
@@ -3,6 +3,6 @@
using namespace metal;
float f() {
float3 const v = float3(1.0f, 2.0f, 3.0f);
- return 2.0f;
+ return v[1];
}
diff --git a/test/tint/expressions/index/let/literal/vector.wgsl.expected.spvasm b/test/tint/expressions/index/let/literal/vector.wgsl.expected.spvasm
index 0c4b98e..d274e46 100644
--- a/test/tint/expressions/index/let/literal/vector.wgsl.expected.spvasm
+++ b/test/tint/expressions/index/let/literal/vector.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 14
+; Bound: 17
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -18,11 +18,14 @@
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%13 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %float None %5
%8 = OpLabel
- OpReturnValue %float_2
+ %16 = OpCompositeExtract %float %13 1
+ OpReturnValue %16
OpFunctionEnd
diff --git a/test/tint/identifiers/underscore/double/const.wgsl b/test/tint/identifiers/underscore/double/const.wgsl
new file mode 100644
index 0000000..cb9cf5b
--- /dev/null
+++ b/test/tint/identifiers/underscore/double/const.wgsl
@@ -0,0 +1,7 @@
+const a : i32 = 1;
+const a__ : i32 = 2;
+
+fn f() {
+ const b = a;
+ const b__ = a__;
+}
diff --git a/test/tint/identifiers/underscore/double/const.wgsl.expected.glsl b/test/tint/identifiers/underscore/double/const.wgsl.expected.glsl
new file mode 100644
index 0000000..45d48f9
--- /dev/null
+++ b/test/tint/identifiers/underscore/double/const.wgsl.expected.glsl
@@ -0,0 +1,9 @@
+#version 310 es
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void unused_entry_point() {
+ return;
+}
+void f() {
+}
+
diff --git a/test/tint/identifiers/underscore/double/const.wgsl.expected.hlsl b/test/tint/identifiers/underscore/double/const.wgsl.expected.hlsl
new file mode 100644
index 0000000..7412e64
--- /dev/null
+++ b/test/tint/identifiers/underscore/double/const.wgsl.expected.hlsl
@@ -0,0 +1,7 @@
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+ return;
+}
+
+void f() {
+}
diff --git a/test/tint/identifiers/underscore/double/const.wgsl.expected.msl b/test/tint/identifiers/underscore/double/const.wgsl.expected.msl
new file mode 100644
index 0000000..7e5829a
--- /dev/null
+++ b/test/tint/identifiers/underscore/double/const.wgsl.expected.msl
@@ -0,0 +1,6 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void f() {
+}
+
diff --git a/test/tint/identifiers/underscore/double/const.wgsl.expected.spvasm b/test/tint/identifiers/underscore/double/const.wgsl.expected.spvasm
new file mode 100644
index 0000000..1c4d684
--- /dev/null
+++ b/test/tint/identifiers/underscore/double/const.wgsl.expected.spvasm
@@ -0,0 +1,21 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 7
+; 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"
+ OpName %f "f"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+%unused_entry_point = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %1
+ %6 = OpLabel
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/identifiers/underscore/double/const.wgsl.expected.wgsl b/test/tint/identifiers/underscore/double/const.wgsl.expected.wgsl
new file mode 100644
index 0000000..9e4c8c2
--- /dev/null
+++ b/test/tint/identifiers/underscore/double/const.wgsl.expected.wgsl
@@ -0,0 +1,8 @@
+const a : i32 = 1;
+
+const a__ : i32 = 2;
+
+fn f() {
+ const b = a;
+ const b__ = a__;
+}
diff --git a/test/tint/identifiers/underscore/double/let.wgsl b/test/tint/identifiers/underscore/double/let.wgsl
index a6f5ba9..0ee15c4 100644
--- a/test/tint/identifiers/underscore/double/let.wgsl
+++ b/test/tint/identifiers/underscore/double/let.wgsl
@@ -1,7 +1,6 @@
-let a : i32 = 1;
-let a__ : i32 = 2;
-
fn f() {
+ let a = 1;
+ let a__ = a;
let b = a;
let b__ = a__;
}
diff --git a/test/tint/identifiers/underscore/double/let.wgsl.expected.glsl b/test/tint/identifiers/underscore/double/let.wgsl.expected.glsl
index a0bbe15..88072ea 100644
--- a/test/tint/identifiers/underscore/double/let.wgsl.expected.glsl
+++ b/test/tint/identifiers/underscore/double/let.wgsl.expected.glsl
@@ -4,10 +4,9 @@
void unused_entry_point() {
return;
}
-const int a = 1;
-const int a__ = 2;
void f() {
+ int a = 1;
int b = a;
- int b__ = a__;
+ int b__ = a;
}
diff --git a/test/tint/identifiers/underscore/double/let.wgsl.expected.hlsl b/test/tint/identifiers/underscore/double/let.wgsl.expected.hlsl
index 8f66e9d..b35994e 100644
--- a/test/tint/identifiers/underscore/double/let.wgsl.expected.hlsl
+++ b/test/tint/identifiers/underscore/double/let.wgsl.expected.hlsl
@@ -3,10 +3,8 @@
return;
}
-static const int a = 1;
-static const int a__ = 2;
-
void f() {
+ const int a = 1;
const int b = a;
- const int b__ = a__;
+ const int b__ = a;
}
diff --git a/test/tint/identifiers/underscore/double/let.wgsl.expected.msl b/test/tint/identifiers/underscore/double/let.wgsl.expected.msl
index 47c1b05..ed01a8f 100644
--- a/test/tint/identifiers/underscore/double/let.wgsl.expected.msl
+++ b/test/tint/identifiers/underscore/double/let.wgsl.expected.msl
@@ -1,11 +1,9 @@
#include <metal_stdlib>
using namespace metal;
-constant int a = 1;
-
-constant int a__ = 2;
-
void f() {
+ int const a = 1;
+ int const a__ = a;
int const b = a;
int const b__ = a__;
}
diff --git a/test/tint/identifiers/underscore/double/let.wgsl.expected.spvasm b/test/tint/identifiers/underscore/double/let.wgsl.expected.spvasm
index f51d6d6..a8ec188 100644
--- a/test/tint/identifiers/underscore/double/let.wgsl.expected.spvasm
+++ b/test/tint/identifiers/underscore/double/let.wgsl.expected.spvasm
@@ -1,26 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 10
+; Bound: 9
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %a "a"
- OpName %a__ "a__"
OpName %unused_entry_point "unused_entry_point"
OpName %f "f"
- %int = OpTypeInt 32 1
- %a = OpConstant %int 1
- %a__ = OpConstant %int 2
%void = OpTypeVoid
- %4 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %4
- %7 = OpLabel
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%unused_entry_point = OpFunction %void None %1
+ %4 = OpLabel
OpReturn
OpFunctionEnd
- %f = OpFunction %void None %4
- %9 = OpLabel
+ %f = OpFunction %void None %1
+ %6 = OpLabel
OpReturn
OpFunctionEnd
diff --git a/test/tint/identifiers/underscore/double/let.wgsl.expected.wgsl b/test/tint/identifiers/underscore/double/let.wgsl.expected.wgsl
index a8db78c..ff017ef 100644
--- a/test/tint/identifiers/underscore/double/let.wgsl.expected.wgsl
+++ b/test/tint/identifiers/underscore/double/let.wgsl.expected.wgsl
@@ -1,8 +1,6 @@
-let a : i32 = 1;
-
-let a__ : i32 = 2;
-
fn f() {
+ let a = 1;
+ let a__ = a;
let b = a;
let b__ = a__;
}
diff --git a/test/tint/identifiers/underscore/prefix/lower/const.wgsl b/test/tint/identifiers/underscore/prefix/lower/const.wgsl
new file mode 100644
index 0000000..626eaa3
--- /dev/null
+++ b/test/tint/identifiers/underscore/prefix/lower/const.wgsl
@@ -0,0 +1,7 @@
+const a : i32 = 1;
+const _a : i32 = 2;
+
+fn f() {
+ const b = a;
+ const _b = _a;
+}
diff --git a/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.glsl b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.glsl
new file mode 100644
index 0000000..45d48f9
--- /dev/null
+++ b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.glsl
@@ -0,0 +1,9 @@
+#version 310 es
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void unused_entry_point() {
+ return;
+}
+void f() {
+}
+
diff --git a/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.hlsl b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.hlsl
new file mode 100644
index 0000000..7412e64
--- /dev/null
+++ b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.hlsl
@@ -0,0 +1,7 @@
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+ return;
+}
+
+void f() {
+}
diff --git a/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.msl b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.msl
new file mode 100644
index 0000000..7e5829a
--- /dev/null
+++ b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.msl
@@ -0,0 +1,6 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void f() {
+}
+
diff --git a/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.spvasm b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.spvasm
new file mode 100644
index 0000000..1c4d684
--- /dev/null
+++ b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.spvasm
@@ -0,0 +1,21 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 7
+; 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"
+ OpName %f "f"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+%unused_entry_point = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %1
+ %6 = OpLabel
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.wgsl b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.wgsl
new file mode 100644
index 0000000..1a5d565
--- /dev/null
+++ b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.wgsl
@@ -0,0 +1,8 @@
+const a : i32 = 1;
+
+const _a : i32 = 2;
+
+fn f() {
+ const b = a;
+ const _b = _a;
+}
diff --git a/test/tint/identifiers/underscore/prefix/lower/let.wgsl b/test/tint/identifiers/underscore/prefix/lower/let.wgsl
index 6ded620..6670f41 100644
--- a/test/tint/identifiers/underscore/prefix/lower/let.wgsl
+++ b/test/tint/identifiers/underscore/prefix/lower/let.wgsl
@@ -1,7 +1,6 @@
-let a : i32 = 1;
-let _a : i32 = 2;
-
fn f() {
+ let a = 1;
+ let _a = a;
let b = a;
let _b = _a;
}
diff --git a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.glsl b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.glsl
index c5a6a9f..469fa8c 100644
--- a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.glsl
+++ b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.glsl
@@ -4,10 +4,9 @@
void unused_entry_point() {
return;
}
-const int a = 1;
-const int _a = 2;
void f() {
+ int a = 1;
int b = a;
- int _b = _a;
+ int _b = a;
}
diff --git a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.hlsl b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.hlsl
index 4e65f71..7698191 100644
--- a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.hlsl
+++ b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.hlsl
@@ -3,10 +3,8 @@
return;
}
-static const int a = 1;
-static const int _a = 2;
-
void f() {
+ const int a = 1;
const int b = a;
- const int _b = _a;
+ const int _b = a;
}
diff --git a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.msl b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.msl
index 7b3d669..f62a1f4 100644
--- a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.msl
+++ b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.msl
@@ -1,11 +1,9 @@
#include <metal_stdlib>
using namespace metal;
-constant int a = 1;
-
-constant int _a = 2;
-
void f() {
+ int const a = 1;
+ int const _a = a;
int const b = a;
int const _b = _a;
}
diff --git a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.spvasm b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.spvasm
index df61dfe..a8ec188 100644
--- a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.spvasm
+++ b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.spvasm
@@ -1,26 +1,23 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 10
+; Bound: 9
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %a "a"
- OpName %_a "_a"
OpName %unused_entry_point "unused_entry_point"
OpName %f "f"
- %int = OpTypeInt 32 1
- %a = OpConstant %int 1
- %_a = OpConstant %int 2
%void = OpTypeVoid
- %4 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %4
- %7 = OpLabel
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%unused_entry_point = OpFunction %void None %1
+ %4 = OpLabel
OpReturn
OpFunctionEnd
- %f = OpFunction %void None %4
- %9 = OpLabel
+ %f = OpFunction %void None %1
+ %6 = OpLabel
OpReturn
OpFunctionEnd
diff --git a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.wgsl b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.wgsl
index 9f75219..f2bfc61 100644
--- a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.wgsl
+++ b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.wgsl
@@ -1,8 +1,6 @@
-let a : i32 = 1;
-
-let _a : i32 = 2;
-
fn f() {
+ let a = 1;
+ let _a = a;
let b = a;
let _b = _a;
}
diff --git a/test/tint/identifiers/underscore/prefix/upper/let.wgsl b/test/tint/identifiers/underscore/prefix/upper/let.wgsl
index 06c3aae..0a76a88 100644
--- a/test/tint/identifiers/underscore/prefix/upper/let.wgsl
+++ b/test/tint/identifiers/underscore/prefix/upper/let.wgsl
@@ -1,7 +1,6 @@
-let A : i32 = 1;
-let _A : i32 = 2;
-
fn f() {
+ let A : i32 = 1;
+ let _A : i32 = 2;
let B = A;
let _B = _A;
}
diff --git a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.glsl b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.glsl
index ae9a9c8..2ea9129 100644
--- a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.glsl
+++ b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.glsl
@@ -4,10 +4,8 @@
void unused_entry_point() {
return;
}
-const int A = 1;
-const int _A = 2;
void f() {
- int B = A;
- int _B = _A;
+ int B = 1;
+ int _B = 2;
}
diff --git a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.hlsl b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.hlsl
index fa81c83..11ce076 100644
--- a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.hlsl
+++ b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.hlsl
@@ -3,10 +3,7 @@
return;
}
-static const int A = 1;
-static const int _A = 2;
-
void f() {
- const int B = A;
- const int _B = _A;
+ const int B = 1;
+ const int _B = 2;
}
diff --git a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.msl b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.msl
index 5afe76f..3614d7c 100644
--- a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.msl
+++ b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.msl
@@ -1,11 +1,9 @@
#include <metal_stdlib>
using namespace metal;
-constant int A = 1;
-
-constant int _A = 2;
-
void f() {
+ int const A = 1;
+ int const _A = 2;
int const B = A;
int const _B = _A;
}
diff --git a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.spvasm b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.spvasm
index 8683520..f52c090 100644
--- a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.spvasm
+++ b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.spvasm
@@ -7,20 +7,18 @@
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
- OpName %A "A"
- OpName %_A "_A"
OpName %unused_entry_point "unused_entry_point"
OpName %f "f"
- %int = OpTypeInt 32 1
- %A = OpConstant %int 1
- %_A = OpConstant %int 2
%void = OpTypeVoid
- %4 = OpTypeFunction %void
-%unused_entry_point = OpFunction %void None %4
- %7 = OpLabel
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %int_2 = OpConstant %int 2
+%unused_entry_point = OpFunction %void None %1
+ %4 = OpLabel
OpReturn
OpFunctionEnd
- %f = OpFunction %void None %4
- %9 = OpLabel
+ %f = OpFunction %void None %1
+ %6 = OpLabel
OpReturn
OpFunctionEnd
diff --git a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.wgsl b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.wgsl
index 5c9a0fb..e9ac4ce 100644
--- a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.wgsl
+++ b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.wgsl
@@ -1,8 +1,6 @@
-let A : i32 = 1;
-
-let _A : i32 = 2;
-
fn f() {
+ let A : i32 = 1;
+ let _A : i32 = 2;
let B = A;
let _B = _A;
}
diff --git a/test/tint/let/global/global.wgsl b/test/tint/let/global/global.wgsl
deleted file mode 100644
index 6639d5d..0000000
--- a/test/tint/let/global/global.wgsl
+++ /dev/null
@@ -1,24 +0,0 @@
-struct MyStruct {
- f1 : f32,
-};
-
-type MyArray = array<f32, 10>;
-
-// Global lets
-let v1 = 1;
-let v2 = 1u;
-let v3 = 1.0;
-
-let v4 = vec3<i32>(1, 1, 1);
-let v5 = vec3<u32>(1u, 1u, 1u);
-let v6 = vec3<f32>(1.0, 1.0, 1.0);
-
-let v7 = mat3x3<f32>(vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0));
-
-let v8 = MyStruct();
-let v9 = MyArray();
-
-@fragment
-fn main() -> @location(0) vec4<f32> {
- return vec4<f32>(0.0,0.0,0.0,0.0);
-}
diff --git a/test/tint/let/global/global.wgsl.expected.hlsl b/test/tint/let/global/global.wgsl.expected.hlsl
deleted file mode 100644
index 2b62ccc..0000000
--- a/test/tint/let/global/global.wgsl.expected.hlsl
+++ /dev/null
@@ -1,28 +0,0 @@
-struct MyStruct {
- float f1;
-};
-
-static const int v1 = 1;
-static const uint v2 = 1u;
-static const float v3 = 1.0f;
-static const int3 v4 = (1).xxx;
-static const uint3 v5 = (1u).xxx;
-static const float3 v6 = (1.0f).xxx;
-static const float3x3 v7 = float3x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx);
-static const MyStruct v8 = (MyStruct)0;
-static const float v9[10] = (float[10])0;
-
-struct tint_symbol {
- float4 value : SV_Target0;
-};
-
-float4 main_inner() {
- return (0.0f).xxxx;
-}
-
-tint_symbol main() {
- const float4 inner_result = main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
diff --git a/test/tint/let/global/global.wgsl.expected.spvasm b/test/tint/let/global/global.wgsl.expected.spvasm
deleted file mode 100644
index f9c63e2..0000000
--- a/test/tint/let/global/global.wgsl.expected.spvasm
+++ /dev/null
@@ -1,62 +0,0 @@
-; SPIR-V
-; Version: 1.3
-; Generator: Google Tint Compiler; 0
-; Bound: 32
-; Schema: 0
- OpCapability Shader
- OpMemoryModel Logical GLSL450
- OpEntryPoint Fragment %main "main" %value
- OpExecutionMode %main OriginUpperLeft
- OpName %value "value"
- OpName %v1 "v1"
- OpName %v2 "v2"
- OpName %v3 "v3"
- OpName %v4 "v4"
- OpName %v5 "v5"
- OpName %v6 "v6"
- OpName %v7 "v7"
- OpName %MyStruct "MyStruct"
- OpMemberName %MyStruct 0 "f1"
- OpName %v8 "v8"
- OpName %v9 "v9"
- OpName %main_inner "main_inner"
- OpName %main "main"
- OpDecorate %value Location 0
- OpMemberDecorate %MyStruct 0 Offset 0
- OpDecorate %_arr_float_uint_10 ArrayStride 4
- %float = OpTypeFloat 32
- %v4float = OpTypeVector %float 4
-%_ptr_Output_v4float = OpTypePointer Output %v4float
- %5 = OpConstantNull %v4float
- %value = OpVariable %_ptr_Output_v4float Output %5
- %int = OpTypeInt 32 1
- %v1 = OpConstant %int 1
- %uint = OpTypeInt 32 0
- %v2 = OpConstant %uint 1
- %v3 = OpConstant %float 1
- %v3int = OpTypeVector %int 3
- %v4 = OpConstantComposite %v3int %v1 %v1 %v1
- %v3uint = OpTypeVector %uint 3
- %v5 = OpConstantComposite %v3uint %v2 %v2 %v2
- %v3float = OpTypeVector %float 3
- %v6 = OpConstantComposite %v3float %v3 %v3 %v3
-%mat3v3float = OpTypeMatrix %v3float 3
- %v7 = OpConstantComposite %mat3v3float %v6 %v6 %v6
- %MyStruct = OpTypeStruct %float
- %v8 = OpConstantNull %MyStruct
- %uint_10 = OpConstant %uint 10
-%_arr_float_uint_10 = OpTypeArray %float %uint_10
- %v9 = OpConstantNull %_arr_float_uint_10
- %24 = OpTypeFunction %v4float
- %void = OpTypeVoid
- %27 = OpTypeFunction %void
- %main_inner = OpFunction %v4float None %24
- %26 = OpLabel
- OpReturnValue %5
- OpFunctionEnd
- %main = OpFunction %void None %27
- %30 = OpLabel
- %31 = OpFunctionCall %v4float %main_inner
- OpStore %value %31
- OpReturn
- OpFunctionEnd
diff --git a/test/tint/let/global/global.wgsl.expected.wgsl b/test/tint/let/global/global.wgsl.expected.wgsl
deleted file mode 100644
index 8f76f49..0000000
--- a/test/tint/let/global/global.wgsl.expected.wgsl
+++ /dev/null
@@ -1,28 +0,0 @@
-struct MyStruct {
- f1 : f32,
-}
-
-type MyArray = array<f32, 10>;
-
-let v1 = 1;
-
-let v2 = 1u;
-
-let v3 = 1.0;
-
-let v4 = vec3<i32>(1, 1, 1);
-
-let v5 = vec3<u32>(1u, 1u, 1u);
-
-let v6 = vec3<f32>(1.0, 1.0, 1.0);
-
-let v7 = mat3x3<f32>(vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0));
-
-let v8 = MyStruct();
-
-let v9 = MyArray();
-
-@fragment
-fn main() -> @location(0) vec4<f32> {
- return vec4<f32>(0.0, 0.0, 0.0, 0.0);
-}
diff --git a/test/tint/let/inferred/function.wgsl.expected.hlsl b/test/tint/let/inferred/function.wgsl.expected.hlsl
index 5a75ea6..152e8d1 100644
--- a/test/tint/let/inferred/function.wgsl.expected.hlsl
+++ b/test/tint/let/inferred/function.wgsl.expected.hlsl
@@ -32,7 +32,7 @@
const int3 v4 = (1).xxx;
const uint3 v5 = (1u).xxx;
const float3 v6 = (1.0f).xxx;
- const float3x3 v7 = float3x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx);
+ const float3x3 v7 = float3x3(v6, v6, v6);
const MyStruct v8 = {1.0f};
const float v9[10] = (float[10])0;
const int v10 = ret_i32();
diff --git a/test/tint/let/inferred/function.wgsl.expected.msl b/test/tint/let/inferred/function.wgsl.expected.msl
index 604c979..440faea 100644
--- a/test/tint/let/inferred/function.wgsl.expected.msl
+++ b/test/tint/let/inferred/function.wgsl.expected.msl
@@ -47,7 +47,7 @@
int3 const v4 = int3(1);
uint3 const v5 = uint3(1u);
float3 const v6 = float3(1.0f);
- float3x3 const v7 = float3x3(float3(1.0f), float3(1.0f), float3(1.0f));
+ float3x3 const v7 = float3x3(v6, v6, v6);
MyStruct const v8 = {.f1=1.0f};
tint_array<float, 10> const v9 = tint_array<float, 10>{};
int const v10 = ret_i32();
diff --git a/test/tint/let/inferred/function.wgsl.expected.spvasm b/test/tint/let/inferred/function.wgsl.expected.spvasm
index e3f36f6..6e2ddcb 100644
--- a/test/tint/let/inferred/function.wgsl.expected.spvasm
+++ b/test/tint/let/inferred/function.wgsl.expected.spvasm
@@ -50,7 +50,6 @@
%v3float = OpTypeVector %float 3
%40 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%mat3v3float = OpTypeMatrix %v3float 3
- %42 = OpConstantComposite %mat3v3float %40 %40 %40
%43 = OpConstantComposite %MyStruct %float_1
%50 = OpTypeFunction %v4float
%ret_i32 = OpFunction %int None %6
@@ -75,6 +74,7 @@
OpFunctionEnd
%let_decls = OpFunction %void None %31
%34 = OpLabel
+ %42 = OpCompositeConstruct %mat3v3float %40 %40 %40
%44 = OpFunctionCall %int %ret_i32
%45 = OpFunctionCall %uint %ret_u32
%46 = OpFunctionCall %float %ret_f32
diff --git a/test/tint/out_of_order_decls/func/const.wgsl b/test/tint/out_of_order_decls/func/const.wgsl
new file mode 100644
index 0000000..df32cd3
--- /dev/null
+++ b/test/tint/out_of_order_decls/func/const.wgsl
@@ -0,0 +1,6 @@
+@fragment
+fn f() {
+ const b = a;
+}
+
+const a : i32 = 1;
diff --git a/test/tint/out_of_order_decls/func/let.wgsl.expected.glsl b/test/tint/out_of_order_decls/func/const.wgsl.expected.glsl
similarity index 74%
rename from test/tint/out_of_order_decls/func/let.wgsl.expected.glsl
rename to test/tint/out_of_order_decls/func/const.wgsl.expected.glsl
index f308959..3d91b99 100644
--- a/test/tint/out_of_order_decls/func/let.wgsl.expected.glsl
+++ b/test/tint/out_of_order_decls/func/const.wgsl.expected.glsl
@@ -1,9 +1,7 @@
#version 310 es
precision mediump float;
-const int a = 1;
void f() {
- int b = a;
}
void main() {
diff --git a/test/tint/out_of_order_decls/func/const.wgsl.expected.hlsl b/test/tint/out_of_order_decls/func/const.wgsl.expected.hlsl
new file mode 100644
index 0000000..f55de92
--- /dev/null
+++ b/test/tint/out_of_order_decls/func/const.wgsl.expected.hlsl
@@ -0,0 +1,3 @@
+void f() {
+ return;
+}
diff --git a/test/tint/out_of_order_decls/func/let.wgsl.expected.msl b/test/tint/out_of_order_decls/func/const.wgsl.expected.msl
similarity index 67%
rename from test/tint/out_of_order_decls/func/let.wgsl.expected.msl
rename to test/tint/out_of_order_decls/func/const.wgsl.expected.msl
index 2509d6c..7733815 100644
--- a/test/tint/out_of_order_decls/func/let.wgsl.expected.msl
+++ b/test/tint/out_of_order_decls/func/const.wgsl.expected.msl
@@ -1,10 +1,7 @@
#include <metal_stdlib>
using namespace metal;
-constant int a = 1;
-
fragment void f() {
- int const b = a;
return;
}
diff --git a/test/tint/out_of_order_decls/func/let.wgsl.expected.spvasm b/test/tint/out_of_order_decls/func/const.wgsl.expected.spvasm
similarity index 64%
rename from test/tint/out_of_order_decls/func/let.wgsl.expected.spvasm
rename to test/tint/out_of_order_decls/func/const.wgsl.expected.spvasm
index 452861f..5a28811 100644
--- a/test/tint/out_of_order_decls/func/let.wgsl.expected.spvasm
+++ b/test/tint/out_of_order_decls/func/const.wgsl.expected.spvasm
@@ -1,19 +1,16 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 7
+; Bound: 5
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %f "f"
OpExecutionMode %f OriginUpperLeft
- OpName %a "a"
OpName %f "f"
- %int = OpTypeInt 32 1
- %a = OpConstant %int 1
%void = OpTypeVoid
- %3 = OpTypeFunction %void
- %f = OpFunction %void None %3
- %6 = OpLabel
+ %1 = OpTypeFunction %void
+ %f = OpFunction %void None %1
+ %4 = OpLabel
OpReturn
OpFunctionEnd
diff --git a/test/tint/out_of_order_decls/func/const.wgsl.expected.wgsl b/test/tint/out_of_order_decls/func/const.wgsl.expected.wgsl
new file mode 100644
index 0000000..df32cd3
--- /dev/null
+++ b/test/tint/out_of_order_decls/func/const.wgsl.expected.wgsl
@@ -0,0 +1,6 @@
+@fragment
+fn f() {
+ const b = a;
+}
+
+const a : i32 = 1;
diff --git a/test/tint/out_of_order_decls/func/let.wgsl b/test/tint/out_of_order_decls/func/let.wgsl
deleted file mode 100644
index 6498fe7..0000000
--- a/test/tint/out_of_order_decls/func/let.wgsl
+++ /dev/null
@@ -1,6 +0,0 @@
-@fragment
-fn f() {
- let b = a;
-}
-
-let a : i32 = 1;
diff --git a/test/tint/out_of_order_decls/func/let.wgsl.expected.wgsl b/test/tint/out_of_order_decls/func/let.wgsl.expected.wgsl
deleted file mode 100644
index 6498fe7..0000000
--- a/test/tint/out_of_order_decls/func/let.wgsl.expected.wgsl
+++ /dev/null
@@ -1,6 +0,0 @@
-@fragment
-fn f() {
- let b = a;
-}
-
-let a : i32 = 1;
diff --git a/test/tint/samples/triangle.wgsl b/test/tint/samples/triangle.wgsl
index 8c6afbd..814c1c0 100644
--- a/test/tint/samples/triangle.wgsl
+++ b/test/tint/samples/triangle.wgsl
@@ -13,10 +13,9 @@
// limitations under the License.
// Vertex shader
-let pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
- vec2<f32>(0.0, 0.5),
- vec2<f32>(-0.5, -0.5),
- vec2<f32>(0.5, -0.5));
+const pos = array<vec2<f32>, 3>(vec2(0.0, 0.5),
+ vec2(-0.5, -0.5),
+ vec2(0.5, -0.5));
@vertex
fn vtx_main(@builtin(vertex_index) VertexIndex : u32)
diff --git a/test/tint/samples/triangle.wgsl.expected.glsl b/test/tint/samples/triangle.wgsl.expected.glsl
index 915a97d..c0961e2 100644
--- a/test/tint/samples/triangle.wgsl.expected.glsl
+++ b/test/tint/samples/triangle.wgsl.expected.glsl
@@ -1,8 +1,8 @@
#version 310 es
-const vec2 pos[3] = vec2[3](vec2(0.0f, 0.5f), vec2(-0.5f), vec2(0.5f, -0.5f));
vec4 vtx_main(uint VertexIndex) {
- return vec4(pos[VertexIndex], 0.0f, 1.0f);
+ vec2 tint_symbol[3] = vec2[3](vec2(0.0f, 0.5f), vec2(-0.5f), vec2(0.5f, -0.5f));
+ return vec4(tint_symbol[VertexIndex], 0.0f, 1.0f);
}
void main() {
diff --git a/test/tint/samples/triangle.wgsl.expected.hlsl b/test/tint/samples/triangle.wgsl.expected.hlsl
index a17efb8..ee8118cd 100644
--- a/test/tint/samples/triangle.wgsl.expected.hlsl
+++ b/test/tint/samples/triangle.wgsl.expected.hlsl
@@ -1,5 +1,3 @@
-static const float2 pos[3] = {float2(0.0f, 0.5f), (-0.5f).xx, float2(0.5f, -0.5f)};
-
struct tint_symbol_1 {
uint VertexIndex : SV_VertexID;
};
@@ -8,7 +6,8 @@
};
float4 vtx_main_inner(uint VertexIndex) {
- return float4(pos[VertexIndex], 0.0f, 1.0f);
+ const float2 tint_symbol_4[3] = {float2(0.0f, 0.5f), (-0.5f).xx, float2(0.5f, -0.5f)};
+ return float4(tint_symbol_4[VertexIndex], 0.0f, 1.0f);
}
tint_symbol_2 vtx_main(tint_symbol_1 tint_symbol) {
diff --git a/test/tint/samples/triangle.wgsl.expected.msl b/test/tint/samples/triangle.wgsl.expected.msl
index 664ec4e..bac249a 100644
--- a/test/tint/samples/triangle.wgsl.expected.msl
+++ b/test/tint/samples/triangle.wgsl.expected.msl
@@ -14,14 +14,13 @@
T elements[N];
};
-constant tint_array<float2, 3> pos = tint_array<float2, 3>{float2(0.0f, 0.5f), float2(-0.5f), float2(0.5f, -0.5f)};
-
struct tint_symbol {
float4 value [[position]];
};
float4 vtx_main_inner(uint VertexIndex) {
- return float4(pos[VertexIndex], 0.0f, 1.0f);
+ tint_array<float2, 3> const tint_symbol_2 = tint_array<float2, 3>{float2(0.0f, 0.5f), float2(-0.5f), float2(0.5f, -0.5f)};
+ return float4(tint_symbol_2[VertexIndex], 0.0f, 1.0f);
}
vertex tint_symbol vtx_main(uint VertexIndex [[vertex_id]]) {
diff --git a/test/tint/samples/triangle.wgsl.expected.spvasm b/test/tint/samples/triangle.wgsl.expected.spvasm
index 63b1751..c8c5b59 100644
--- a/test/tint/samples/triangle.wgsl.expected.spvasm
+++ b/test/tint/samples/triangle.wgsl.expected.spvasm
@@ -12,7 +12,6 @@
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %value_1 "value_1"
- OpName %pos "pos"
OpName %vtx_main_inner "vtx_main_inner"
OpName %VertexIndex "VertexIndex"
OpName %var_for_index "var_for_index"
@@ -36,16 +35,16 @@
%11 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %11
%value_1 = OpVariable %_ptr_Output_v4float Output %8
+ %13 = OpTypeFunction %v4float %uint
%v2float = OpTypeVector %float 2
%uint_3 = OpConstant %uint 3
%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3
%float_0_5 = OpConstant %float 0.5
- %17 = OpConstantComposite %v2float %11 %float_0_5
+ %21 = OpConstantComposite %v2float %11 %float_0_5
%float_n0_5 = OpConstant %float -0.5
- %19 = OpConstantComposite %v2float %float_n0_5 %float_n0_5
- %20 = OpConstantComposite %v2float %float_0_5 %float_n0_5
- %pos = OpConstantComposite %_arr_v2float_uint_3 %17 %19 %20
- %22 = OpTypeFunction %v4float %uint
+ %23 = OpConstantComposite %v2float %float_n0_5 %float_n0_5
+ %24 = OpConstantComposite %v2float %float_0_5 %float_n0_5
+ %25 = OpConstantComposite %_arr_v2float_uint_3 %21 %23 %24
%_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3
%28 = OpConstantNull %_arr_v2float_uint_3
%_ptr_Function_v2float = OpTypePointer Function %v2float
@@ -54,11 +53,11 @@
%36 = OpTypeFunction %void
%42 = OpTypeFunction %v4float
%45 = OpConstantComposite %v4float %float_1 %11 %11 %float_1
-%vtx_main_inner = OpFunction %v4float None %22
+%vtx_main_inner = OpFunction %v4float None %13
%VertexIndex = OpFunctionParameter %uint
- %25 = OpLabel
+ %16 = OpLabel
%var_for_index = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %28
- OpStore %var_for_index %pos
+ OpStore %var_for_index %25
%30 = OpAccessChain %_ptr_Function_v2float %var_for_index %VertexIndex
%31 = OpLoad %v2float %30
%32 = OpCompositeExtract %float %31 0
diff --git a/test/tint/samples/triangle.wgsl.expected.wgsl b/test/tint/samples/triangle.wgsl.expected.wgsl
index 84af3b2..dcdf48c 100644
--- a/test/tint/samples/triangle.wgsl.expected.wgsl
+++ b/test/tint/samples/triangle.wgsl.expected.wgsl
@@ -1,4 +1,4 @@
-let pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(vec2<f32>(0.0, 0.5), vec2<f32>(-0.5, -0.5), vec2<f32>(0.5, -0.5));
+const pos = array<vec2<f32>, 3>(vec2(0.0, 0.5), vec2(-0.5, -0.5), vec2(0.5, -0.5));
@vertex
fn vtx_main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4<f32> {
diff --git a/test/tint/shadowing/alias/const.wgsl b/test/tint/shadowing/alias/const.wgsl
new file mode 100644
index 0000000..a2bdd05
--- /dev/null
+++ b/test/tint/shadowing/alias/const.wgsl
@@ -0,0 +1,10 @@
+type a = i32;
+
+fn f() {
+ {
+ const a : a = a();
+ const b = a;
+ }
+ const a : a = a();
+ const b = a;
+}
diff --git a/test/tint/shadowing/alias/const.wgsl.expected.glsl b/test/tint/shadowing/alias/const.wgsl.expected.glsl
new file mode 100644
index 0000000..0da98e3
--- /dev/null
+++ b/test/tint/shadowing/alias/const.wgsl.expected.glsl
@@ -0,0 +1,11 @@
+#version 310 es
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void unused_entry_point() {
+ return;
+}
+void f() {
+ {
+ }
+}
+
diff --git a/test/tint/shadowing/alias/const.wgsl.expected.hlsl b/test/tint/shadowing/alias/const.wgsl.expected.hlsl
new file mode 100644
index 0000000..6316714
--- /dev/null
+++ b/test/tint/shadowing/alias/const.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+[numthreads(1, 1, 1)]
+void unused_entry_point() {
+ return;
+}
+
+void f() {
+ {
+ }
+}
diff --git a/test/tint/shadowing/alias/const.wgsl.expected.msl b/test/tint/shadowing/alias/const.wgsl.expected.msl
new file mode 100644
index 0000000..ee183f0
--- /dev/null
+++ b/test/tint/shadowing/alias/const.wgsl.expected.msl
@@ -0,0 +1,8 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void f() {
+ {
+ }
+}
+
diff --git a/test/tint/shadowing/alias/const.wgsl.expected.spvasm b/test/tint/shadowing/alias/const.wgsl.expected.spvasm
new file mode 100644
index 0000000..1c4d684
--- /dev/null
+++ b/test/tint/shadowing/alias/const.wgsl.expected.spvasm
@@ -0,0 +1,21 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 7
+; 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"
+ OpName %f "f"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+%unused_entry_point = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %f = OpFunction %void None %1
+ %6 = OpLabel
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/shadowing/alias/const.wgsl.expected.wgsl b/test/tint/shadowing/alias/const.wgsl.expected.wgsl
new file mode 100644
index 0000000..a2bdd05
--- /dev/null
+++ b/test/tint/shadowing/alias/const.wgsl.expected.wgsl
@@ -0,0 +1,10 @@
+type a = i32;
+
+fn f() {
+ {
+ const a : a = a();
+ const b = a;
+ }
+ const a : a = a();
+ const b = a;
+}
diff --git a/test/tint/statements/decrement/vector_component.wgsl.expected.hlsl b/test/tint/statements/decrement/vector_component.wgsl.expected.hlsl
index 843a2b0..88bf0a8 100644
--- a/test/tint/statements/decrement/vector_component.wgsl.expected.hlsl
+++ b/test/tint/statements/decrement/vector_component.wgsl.expected.hlsl
@@ -7,6 +7,6 @@
void main() {
const int tint_symbol_1 = 1;
- a.Store((4u * 1u), asuint((a.Load((4u * 1u)) - 1u)));
+ a.Store((4u * uint(tint_symbol_1)), asuint((a.Load((4u * uint(tint_symbol_1))) - 1u)));
a.Store(8u, asuint((a.Load(8u) - 1u)));
}
diff --git a/test/tint/statements/for/condition/array_ctor.wgsl.expected.glsl b/test/tint/statements/for/condition/array_ctor.wgsl.expected.glsl
index b0d20e8..bf6fed3 100644
--- a/test/tint/statements/for/condition/array_ctor.wgsl.expected.glsl
+++ b/test/tint/statements/for/condition/array_ctor.wgsl.expected.glsl
@@ -8,7 +8,7 @@
int i = 0;
while (true) {
int tint_symbol[1] = int[1](1);
- if (!((i < 1))) {
+ if (!((i < tint_symbol[0]))) {
break;
}
{
diff --git a/test/tint/statements/for/condition/array_ctor.wgsl.expected.hlsl b/test/tint/statements/for/condition/array_ctor.wgsl.expected.hlsl
index ace9c8b..141cd27 100644
--- a/test/tint/statements/for/condition/array_ctor.wgsl.expected.hlsl
+++ b/test/tint/statements/for/condition/array_ctor.wgsl.expected.hlsl
@@ -7,7 +7,7 @@
int i = 0;
[loop] while (true) {
const int tint_symbol[1] = {1};
- if (!((i < 1))) {
+ if (!((i < tint_symbol[0]))) {
break;
}
{
diff --git a/test/tint/statements/for/condition/array_ctor.wgsl.expected.msl b/test/tint/statements/for/condition/array_ctor.wgsl.expected.msl
index ffacf97..db04646 100644
--- a/test/tint/statements/for/condition/array_ctor.wgsl.expected.msl
+++ b/test/tint/statements/for/condition/array_ctor.wgsl.expected.msl
@@ -18,7 +18,7 @@
int i = 0;
while (true) {
tint_array<int, 1> const tint_symbol = tint_array<int, 1>{1};
- if (!((i < 1))) {
+ if (!((i < tint_symbol[0]))) {
break;
}
{
diff --git a/test/tint/statements/for/continuing/array_ctor.wgsl.expected.glsl b/test/tint/statements/for/continuing/array_ctor.wgsl.expected.glsl
index e6c4725..9fb3a6a 100644
--- a/test/tint/statements/for/continuing/array_ctor.wgsl.expected.glsl
+++ b/test/tint/statements/for/continuing/array_ctor.wgsl.expected.glsl
@@ -14,7 +14,7 @@
}
{
int tint_symbol[1] = int[1](1);
- i = (i + 1);
+ i = (i + tint_symbol[0]);
}
}
}
diff --git a/test/tint/statements/for/continuing/array_ctor.wgsl.expected.hlsl b/test/tint/statements/for/continuing/array_ctor.wgsl.expected.hlsl
index 3e525fd..7348a72 100644
--- a/test/tint/statements/for/continuing/array_ctor.wgsl.expected.hlsl
+++ b/test/tint/statements/for/continuing/array_ctor.wgsl.expected.hlsl
@@ -13,7 +13,7 @@
}
{
const int tint_symbol[1] = {1};
- i = (i + 1);
+ i = (i + tint_symbol[0]);
}
}
}
diff --git a/test/tint/statements/for/continuing/array_ctor.wgsl.expected.msl b/test/tint/statements/for/continuing/array_ctor.wgsl.expected.msl
index e596e14..775e167 100644
--- a/test/tint/statements/for/continuing/array_ctor.wgsl.expected.msl
+++ b/test/tint/statements/for/continuing/array_ctor.wgsl.expected.msl
@@ -24,7 +24,7 @@
}
{
tint_array<int, 1> const tint_symbol = tint_array<int, 1>{1};
- i = as_type<int>((as_type<uint>(i) + as_type<uint>(1)));
+ i = as_type<int>((as_type<uint>(i) + as_type<uint>(tint_symbol[0])));
}
}
}
diff --git a/test/tint/statements/for/initializer/array_ctor.wgsl.expected.glsl b/test/tint/statements/for/initializer/array_ctor.wgsl.expected.glsl
index fc74894..eeb0109 100644
--- a/test/tint/statements/for/initializer/array_ctor.wgsl.expected.glsl
+++ b/test/tint/statements/for/initializer/array_ctor.wgsl.expected.glsl
@@ -7,7 +7,7 @@
void f() {
int tint_symbol[1] = int[1](1);
{
- for(int i = 1; false; ) {
+ for(int i = tint_symbol[0]; false; ) {
}
}
}
diff --git a/test/tint/statements/for/initializer/array_ctor.wgsl.expected.hlsl b/test/tint/statements/for/initializer/array_ctor.wgsl.expected.hlsl
index de7d3a5..1de4bce 100644
--- a/test/tint/statements/for/initializer/array_ctor.wgsl.expected.hlsl
+++ b/test/tint/statements/for/initializer/array_ctor.wgsl.expected.hlsl
@@ -6,7 +6,7 @@
void f() {
const int tint_symbol[1] = {1};
{
- [loop] for(int i = 1; false; ) {
+ [loop] for(int i = tint_symbol[0]; false; ) {
}
}
}
diff --git a/test/tint/statements/for/initializer/array_ctor.wgsl.expected.msl b/test/tint/statements/for/initializer/array_ctor.wgsl.expected.msl
index f729fc7..7600e08 100644
--- a/test/tint/statements/for/initializer/array_ctor.wgsl.expected.msl
+++ b/test/tint/statements/for/initializer/array_ctor.wgsl.expected.msl
@@ -16,7 +16,7 @@
void f() {
tint_array<int, 1> const tint_symbol = tint_array<int, 1>{1};
- for(int i = 1; false; ) {
+ for(int i = tint_symbol[0]; false; ) {
}
}
diff --git a/test/tint/statements/increment/vector_component.wgsl.expected.hlsl b/test/tint/statements/increment/vector_component.wgsl.expected.hlsl
index 9ba08fd..95c9272 100644
--- a/test/tint/statements/increment/vector_component.wgsl.expected.hlsl
+++ b/test/tint/statements/increment/vector_component.wgsl.expected.hlsl
@@ -7,6 +7,6 @@
void main() {
const int tint_symbol_1 = 1;
- a.Store((4u * 1u), asuint((a.Load((4u * 1u)) + 1u)));
+ a.Store((4u * uint(tint_symbol_1)), asuint((a.Load((4u * uint(tint_symbol_1))) + 1u)));
a.Store(8u, asuint((a.Load(8u) + 1u)));
}
diff --git a/test/tint/types/module_scope_const.wgsl b/test/tint/types/module_scope_const.wgsl
new file mode 100644
index 0000000..c507b99
--- /dev/null
+++ b/test/tint/types/module_scope_const.wgsl
@@ -0,0 +1,13 @@
+const const_bool : bool = bool();
+const const_i32 : i32 = i32();
+const const_u32 : u32 = u32();
+const const_f32 : f32 = f32();
+const const_v2i32 : vec2<i32> = vec2<i32>();
+const const_v3u32 : vec3<u32> = vec3<u32>();
+const const_v4f32 : vec4<f32> = vec4<f32>();
+const const_m3x4 : mat3x4<f32> = mat3x4<f32>();
+const const_arr : array<f32, 4> = array<f32, 4>();
+
+@compute @workgroup_size(1)
+fn main() {
+}
diff --git a/test/tint/types/module_scope_let.wgsl.expected.glsl b/test/tint/types/module_scope_const.wgsl.expected.glsl
similarity index 85%
rename from test/tint/types/module_scope_let.wgsl.expected.glsl
rename to test/tint/types/module_scope_const.wgsl.expected.glsl
index 966cd2a..5b9616f 100644
--- a/test/tint/types/module_scope_let.wgsl.expected.glsl
+++ b/test/tint/types/module_scope_const.wgsl.expected.glsl
@@ -1,9 +1,5 @@
#version 310 es
-struct S {
- float a;
-};
-
void tint_symbol() {
}
diff --git a/test/tint/types/module_scope_const.wgsl.expected.hlsl b/test/tint/types/module_scope_const.wgsl.expected.hlsl
new file mode 100644
index 0000000..9989160
--- /dev/null
+++ b/test/tint/types/module_scope_const.wgsl.expected.hlsl
@@ -0,0 +1,4 @@
+[numthreads(1, 1, 1)]
+void main() {
+ return;
+}
diff --git a/test/tint/types/module_scope_const.wgsl.expected.msl b/test/tint/types/module_scope_const.wgsl.expected.msl
new file mode 100644
index 0000000..09c45a0
--- /dev/null
+++ b/test/tint/types/module_scope_const.wgsl.expected.msl
@@ -0,0 +1,7 @@
+#include <metal_stdlib>
+
+using namespace metal;
+kernel void tint_symbol() {
+ return;
+}
+
diff --git a/test/tint/types/module_scope_const.wgsl.expected.spvasm b/test/tint/types/module_scope_const.wgsl.expected.spvasm
new file mode 100644
index 0000000..292eb05
--- /dev/null
+++ b/test/tint/types/module_scope_const.wgsl.expected.spvasm
@@ -0,0 +1,16 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 5
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %main = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/types/module_scope_const.wgsl.expected.wgsl b/test/tint/types/module_scope_const.wgsl.expected.wgsl
new file mode 100644
index 0000000..7951dc6
--- /dev/null
+++ b/test/tint/types/module_scope_const.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+const const_bool : bool = bool();
+
+const const_i32 : i32 = i32();
+
+const const_u32 : u32 = u32();
+
+const const_f32 : f32 = f32();
+
+const const_v2i32 : vec2<i32> = vec2<i32>();
+
+const const_v3u32 : vec3<u32> = vec3<u32>();
+
+const const_v4f32 : vec4<f32> = vec4<f32>();
+
+const const_m3x4 : mat3x4<f32> = mat3x4<f32>();
+
+const const_arr : array<f32, 4> = array<f32, 4>();
+
+@compute @workgroup_size(1)
+fn main() {
+}
diff --git a/test/tint/types/module_scope_let.wgsl b/test/tint/types/module_scope_let.wgsl
deleted file mode 100644
index f7e9375..0000000
--- a/test/tint/types/module_scope_let.wgsl
+++ /dev/null
@@ -1,18 +0,0 @@
-struct S {
- a : f32,
-};
-
-let bool_let : bool = bool();
-let i32_let : i32 = i32();
-let u32_let : u32 = u32();
-let f32_let : f32 = f32();
-let v2i32_let : vec2<i32> = vec2<i32>();
-let v3u32_let : vec3<u32> = vec3<u32>();
-let v4f32_let : vec4<f32> = vec4<f32>();
-let m3x4_let : mat3x4<f32> = mat3x4<f32>();
-let arr_let : array<f32, 4> = array<f32, 4>();
-let struct_let : S = S();
-
-@compute @workgroup_size(1)
-fn main() {
-}
diff --git a/test/tint/types/module_scope_let.wgsl.expected.hlsl b/test/tint/types/module_scope_let.wgsl.expected.hlsl
deleted file mode 100644
index 16d38f9..0000000
--- a/test/tint/types/module_scope_let.wgsl.expected.hlsl
+++ /dev/null
@@ -1,19 +0,0 @@
-struct S {
- float a;
-};
-
-static const bool bool_let = false;
-static const int i32_let = 0;
-static const uint u32_let = 0u;
-static const float f32_let = 0.0f;
-static const int2 v2i32_let = (0).xx;
-static const uint3 v3u32_let = (0u).xxx;
-static const float4 v4f32_let = (0.0f).xxxx;
-static const float3x4 m3x4_let = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
-static const float arr_let[4] = (float[4])0;
-static const S struct_let = (S)0;
-
-[numthreads(1, 1, 1)]
-void main() {
- return;
-}
diff --git a/test/tint/types/module_scope_let.wgsl.expected.msl b/test/tint/types/module_scope_let.wgsl.expected.msl
deleted file mode 100644
index a48f863..0000000
--- a/test/tint/types/module_scope_let.wgsl.expected.msl
+++ /dev/null
@@ -1,44 +0,0 @@
-#include <metal_stdlib>
-
-using namespace metal;
-
-template<typename T, size_t N>
-struct tint_array {
- const constant T& operator[](size_t i) const constant { return elements[i]; }
- device T& operator[](size_t i) device { return elements[i]; }
- const device T& operator[](size_t i) const device { return elements[i]; }
- thread T& operator[](size_t i) thread { return elements[i]; }
- const thread T& operator[](size_t i) const thread { return elements[i]; }
- threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
- const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
- T elements[N];
-};
-
-struct S {
- float a;
-};
-
-constant bool bool_let = false;
-
-constant int i32_let = 0;
-
-constant uint u32_let = 0u;
-
-constant float f32_let = 0.0f;
-
-constant int2 v2i32_let = int2(0);
-
-constant uint3 v3u32_let = uint3(0u);
-
-constant float4 v4f32_let = float4(0.0f);
-
-constant float3x4 m3x4_let = float3x4(float4(0.0f), float4(0.0f), float4(0.0f));
-
-constant tint_array<float, 4> arr_let = tint_array<float, 4>{};
-
-constant S struct_let = {};
-
-kernel void tint_symbol() {
- return;
-}
-
diff --git a/test/tint/types/module_scope_let.wgsl.expected.spvasm b/test/tint/types/module_scope_let.wgsl.expected.spvasm
deleted file mode 100644
index 9482c0c..0000000
--- a/test/tint/types/module_scope_let.wgsl.expected.spvasm
+++ /dev/null
@@ -1,51 +0,0 @@
-; SPIR-V
-; Version: 1.3
-; Generator: Google Tint Compiler; 0
-; Bound: 26
-; Schema: 0
- OpCapability Shader
- OpMemoryModel Logical GLSL450
- OpEntryPoint GLCompute %main "main"
- OpExecutionMode %main LocalSize 1 1 1
- OpName %bool_let "bool_let"
- OpName %i32_let "i32_let"
- OpName %u32_let "u32_let"
- OpName %f32_let "f32_let"
- OpName %v2i32_let "v2i32_let"
- OpName %v3u32_let "v3u32_let"
- OpName %v4f32_let "v4f32_let"
- OpName %m3x4_let "m3x4_let"
- OpName %arr_let "arr_let"
- OpName %S "S"
- OpMemberName %S 0 "a"
- OpName %struct_let "struct_let"
- OpName %main "main"
- OpDecorate %_arr_float_uint_4 ArrayStride 4
- OpMemberDecorate %S 0 Offset 0
- %bool = OpTypeBool
- %bool_let = OpConstantNull %bool
- %int = OpTypeInt 32 1
- %i32_let = OpConstantNull %int
- %uint = OpTypeInt 32 0
- %u32_let = OpConstantNull %uint
- %float = OpTypeFloat 32
- %f32_let = OpConstantNull %float
- %v2int = OpTypeVector %int 2
- %v2i32_let = OpConstantNull %v2int
- %v3uint = OpTypeVector %uint 3
- %v3u32_let = OpConstantNull %v3uint
- %v4float = OpTypeVector %float 4
- %v4f32_let = OpConstantNull %v4float
-%mat3v4float = OpTypeMatrix %v4float 3
- %m3x4_let = OpConstantNull %mat3v4float
- %uint_4 = OpConstant %uint 4
-%_arr_float_uint_4 = OpTypeArray %float %uint_4
- %arr_let = OpConstantNull %_arr_float_uint_4
- %S = OpTypeStruct %float
- %struct_let = OpConstantNull %S
- %void = OpTypeVoid
- %22 = OpTypeFunction %void
- %main = OpFunction %void None %22
- %25 = OpLabel
- OpReturn
- OpFunctionEnd
diff --git a/test/tint/types/module_scope_let.wgsl.expected.wgsl b/test/tint/types/module_scope_let.wgsl.expected.wgsl
deleted file mode 100644
index 2baded4..0000000
--- a/test/tint/types/module_scope_let.wgsl.expected.wgsl
+++ /dev/null
@@ -1,27 +0,0 @@
-struct S {
- a : f32,
-}
-
-let bool_let : bool = bool();
-
-let i32_let : i32 = i32();
-
-let u32_let : u32 = u32();
-
-let f32_let : f32 = f32();
-
-let v2i32_let : vec2<i32> = vec2<i32>();
-
-let v3u32_let : vec3<u32> = vec3<u32>();
-
-let v4f32_let : vec4<f32> = vec4<f32>();
-
-let m3x4_let : mat3x4<f32> = mat3x4<f32>();
-
-let arr_let : array<f32, 4> = array<f32, 4>();
-
-let struct_let : S = S();
-
-@compute @workgroup_size(1)
-fn main() {
-}
diff --git a/test/tint/var/initialization/function/array/array_i32.wgsl.expected.glsl b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.glsl
index cff063b..132ba50 100644
--- a/test/tint/var/initialization/function/array/array_i32.wgsl.expected.glsl
+++ b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.glsl
@@ -4,7 +4,7 @@
int zero[2][3] = int[2][3](int[3](0, 0, 0), int[3](0, 0, 0));
int tint_symbol_1[3] = int[3](1, 2, 3);
int tint_symbol_2[3] = int[3](4, 5, 6);
- int init[2][3] = int[2][3](int[3](1, 2, 3), int[3](4, 5, 6));
+ int init[2][3] = int[2][3](tint_symbol_1, tint_symbol_2);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
diff --git a/test/tint/var/initialization/function/array/array_i32.wgsl.expected.hlsl b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.hlsl
index 03352d4..88d2dd3 100644
--- a/test/tint/var/initialization/function/array/array_i32.wgsl.expected.hlsl
+++ b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.hlsl
@@ -3,6 +3,6 @@
int zero[2][3] = (int[2][3])0;
const int tint_symbol[3] = {1, 2, 3};
const int tint_symbol_1[3] = {4, 5, 6};
- int init[2][3] = {{1, 2, 3}, {4, 5, 6}};
+ int init[2][3] = {tint_symbol, tint_symbol_1};
return;
}
diff --git a/test/tint/var/initialization/function/array/array_i32.wgsl.expected.msl b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.msl
index 9b02242..7ad097e 100644
--- a/test/tint/var/initialization/function/array/array_i32.wgsl.expected.msl
+++ b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.msl
@@ -18,7 +18,7 @@
tint_array<tint_array<int, 3>, 2> zero = {};
tint_array<int, 3> const tint_symbol_1 = tint_array<int, 3>{1, 2, 3};
tint_array<int, 3> const tint_symbol_2 = tint_array<int, 3>{4, 5, 6};
- tint_array<tint_array<int, 3>, 2> init = tint_array<tint_array<int, 3>, 2>{tint_array<int, 3>{1, 2, 3}, tint_array<int, 3>{4, 5, 6}};
+ tint_array<tint_array<int, 3>, 2> init = tint_array<tint_array<int, 3>, 2>{tint_symbol_1, tint_symbol_2};
return;
}