Reland "HLSL: force FXC to never unroll loops"
Now that I've landed this change to Dawn to disable FXC optimizations:
https://dawn-review.googlesource.com/c/dawn/+/70700,, we can reland this
change. The Tint-into-Dawn roll was failing because FXC would miscompile
certain loops into infinite loops when not unrolled.
Also reland
test/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.hlsl
Bug: tint:1112
Bug: dawn:1203
Change-Id: I641d68864b833e0fbe3b117d397b89ae96482536
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71000
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/writer/hlsl/generator_impl.cc b/src/writer/hlsl/generator_impl.cc
index 5cc4ecc..290f898 100644
--- a/src/writer/hlsl/generator_impl.cc
+++ b/src/writer/hlsl/generator_impl.cc
@@ -116,6 +116,13 @@
return s;
}
+const char* LoopAttribute() {
+ // Force loops not to be unrolled to work around FXC compilation issues when
+ // it attempts and fails to unroll loops when it contains gradient operations.
+ // https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-while
+ return "[loop] ";
+}
+
} // namespace
SanitizedResult::SanitizedResult() = default;
@@ -2828,7 +2835,7 @@
};
TINT_SCOPED_ASSIGNMENT(emit_continuing_, emit_continuing);
- line() << "while (true) {";
+ line() << LoopAttribute() << "while (true) {";
{
ScopedIndent si(this);
if (!EmitStatements(stmt->body->statements)) {
@@ -2898,7 +2905,7 @@
};
TINT_SCOPED_ASSIGNMENT(emit_continuing_, emit_continuing);
- line() << "while (true) {";
+ line() << LoopAttribute() << "while (true) {";
increment_indent();
TINT_DEFER({
decrement_indent();
@@ -2921,7 +2928,7 @@
// For-loop can be generated.
{
auto out = line();
- out << "for";
+ out << LoopAttribute() << "for";
{
ScopedParen sp(out);
diff --git a/src/writer/hlsl/generator_impl_continue_test.cc b/src/writer/hlsl/generator_impl_continue_test.cc
index e312b82..80baf57 100644
--- a/src/writer/hlsl/generator_impl_continue_test.cc
+++ b/src/writer/hlsl/generator_impl_continue_test.cc
@@ -30,7 +30,7 @@
gen.increment_indent();
ASSERT_TRUE(gen.EmitStatement(loop)) << gen.error();
- EXPECT_EQ(gen.result(), R"( while (true) {
+ EXPECT_EQ(gen.result(), R"( [loop] while (true) {
continue;
}
)");
diff --git a/src/writer/hlsl/generator_impl_loop_test.cc b/src/writer/hlsl/generator_impl_loop_test.cc
index a66782e..c6a919f 100644
--- a/src/writer/hlsl/generator_impl_loop_test.cc
+++ b/src/writer/hlsl/generator_impl_loop_test.cc
@@ -34,7 +34,7 @@
gen.increment_indent();
ASSERT_TRUE(gen.EmitStatement(l)) << gen.error();
- EXPECT_EQ(gen.result(), R"( while (true) {
+ EXPECT_EQ(gen.result(), R"( [loop] while (true) {
discard;
}
)");
@@ -54,7 +54,7 @@
gen.increment_indent();
ASSERT_TRUE(gen.EmitStatement(l)) << gen.error();
- EXPECT_EQ(gen.result(), R"( while (true) {
+ EXPECT_EQ(gen.result(), R"( [loop] while (true) {
discard;
{
a_statement();
@@ -88,8 +88,8 @@
gen.increment_indent();
ASSERT_TRUE(gen.EmitStatement(outer)) << gen.error();
- EXPECT_EQ(gen.result(), R"( while (true) {
- while (true) {
+ EXPECT_EQ(gen.result(), R"( [loop] while (true) {
+ [loop] while (true) {
discard;
{
a_statement();
@@ -142,7 +142,7 @@
gen.increment_indent();
ASSERT_TRUE(gen.EmitStatement(outer)) << gen.error();
- EXPECT_EQ(gen.result(), R"( while (true) {
+ EXPECT_EQ(gen.result(), R"( [loop] while (true) {
float lhs = 2.400000095f;
float other = 0.0f;
{
@@ -169,7 +169,7 @@
ASSERT_TRUE(gen.EmitStatement(f)) << gen.error();
EXPECT_EQ(gen.result(), R"( {
- for(; ; ) {
+ [loop] for(; ; ) {
a_statement();
}
}
@@ -193,7 +193,7 @@
ASSERT_TRUE(gen.EmitStatement(f)) << gen.error();
EXPECT_EQ(gen.result(), R"( {
- for(int i = 0; ; ) {
+ [loop] for(int i = 0; ; ) {
a_statement();
}
}
@@ -223,7 +223,7 @@
tint_tmp = false;
}
bool b = (tint_tmp);
- for(; ; ) {
+ [loop] for(; ; ) {
a_statement();
}
}
@@ -246,7 +246,7 @@
ASSERT_TRUE(gen.EmitStatement(f)) << gen.error();
EXPECT_EQ(gen.result(), R"( {
- for(; true; ) {
+ [loop] for(; true; ) {
a_statement();
}
}
@@ -272,7 +272,7 @@
ASSERT_TRUE(gen.EmitStatement(f)) << gen.error();
EXPECT_EQ(gen.result(), R"( {
- while (true) {
+ [loop] while (true) {
bool tint_tmp = true;
if (tint_tmp) {
tint_tmp = false;
@@ -302,7 +302,7 @@
ASSERT_TRUE(gen.EmitStatement(f)) << gen.error();
EXPECT_EQ(gen.result(), R"( {
- for(; ; i = (i + 1)) {
+ [loop] for(; ; i = (i + 1)) {
a_statement();
}
}
@@ -329,7 +329,7 @@
ASSERT_TRUE(gen.EmitStatement(f)) << gen.error();
EXPECT_EQ(gen.result(), R"( {
- while (true) {
+ [loop] while (true) {
a_statement();
bool tint_tmp = true;
if (tint_tmp) {
@@ -358,7 +358,7 @@
ASSERT_TRUE(gen.EmitStatement(f)) << gen.error();
EXPECT_EQ(gen.result(), R"( {
- for(int i = 0; true; i = (i + 1)) {
+ [loop] for(int i = 0; true; i = (i + 1)) {
a_statement();
}
}
@@ -394,7 +394,7 @@
tint_tmp = false;
}
bool i = (tint_tmp);
- while (true) {
+ [loop] while (true) {
bool tint_tmp_1 = true;
if (tint_tmp_1) {
tint_tmp_1 = false;
diff --git a/test/array/assign_to_function_var.wgsl.expected.hlsl b/test/array/assign_to_function_var.wgsl.expected.hlsl
index 5b15fc1..f5c4ff0 100644
--- a/test/array/assign_to_function_var.wgsl.expected.hlsl
+++ b/test/array/assign_to_function_var.wgsl.expected.hlsl
@@ -32,7 +32,7 @@
tint_symbol_1_ret tint_symbol_1(uint4 buffer[4], uint offset) {
tint_padded_array_element arr_1[4] = (tint_padded_array_element[4])0;
{
- for(uint i = 0u; (i < 4u); i = (i + 1u)) {
+ [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
const uint scalar_offset = ((offset + (i * 16u))) / 4;
arr_1[i].el = asint(buffer[scalar_offset / 4][scalar_offset % 4]);
}
@@ -44,7 +44,7 @@
tint_symbol_3_ret tint_symbol_3(RWByteAddressBuffer buffer, uint offset) {
tint_padded_array_element arr_2[4] = (tint_padded_array_element[4])0;
{
- for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
+ [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
arr_2[i_1].el = asint(buffer.Load((offset + (i_1 * 16u))));
}
}
diff --git a/test/array/assign_to_private_var.wgsl.expected.hlsl b/test/array/assign_to_private_var.wgsl.expected.hlsl
index 8cd8ee1..4fd9d45 100644
--- a/test/array/assign_to_private_var.wgsl.expected.hlsl
+++ b/test/array/assign_to_private_var.wgsl.expected.hlsl
@@ -34,7 +34,7 @@
tint_symbol_1_ret tint_symbol_1(uint4 buffer[4], uint offset) {
tint_padded_array_element arr_1[4] = (tint_padded_array_element[4])0;
{
- for(uint i = 0u; (i < 4u); i = (i + 1u)) {
+ [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
const uint scalar_offset = ((offset + (i * 16u))) / 4;
arr_1[i].el = asint(buffer[scalar_offset / 4][scalar_offset % 4]);
}
@@ -46,7 +46,7 @@
tint_symbol_3_ret tint_symbol_3(RWByteAddressBuffer buffer, uint offset) {
tint_padded_array_element arr_2[4] = (tint_padded_array_element[4])0;
{
- for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
+ [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
arr_2[i_1].el = asint(buffer.Load((offset + (i_1 * 16u))));
}
}
diff --git a/test/array/assign_to_storage_var.wgsl.expected.hlsl b/test/array/assign_to_storage_var.wgsl.expected.hlsl
index 8825ef3..8e9d0b6 100644
--- a/test/array/assign_to_storage_var.wgsl.expected.hlsl
+++ b/test/array/assign_to_storage_var.wgsl.expected.hlsl
@@ -33,7 +33,7 @@
void tint_symbol_1(RWByteAddressBuffer buffer, uint offset, tint_padded_array_element value[4]) {
tint_padded_array_element array[4] = value;
{
- for(uint i = 0u; (i < 4u); i = (i + 1u)) {
+ [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
buffer.Store((offset + (i * 16u)), asuint(array[i].el));
}
}
@@ -43,7 +43,7 @@
tint_symbol_3_ret tint_symbol_3(uint4 buffer[4], uint offset) {
tint_padded_array_element arr_1[4] = (tint_padded_array_element[4])0;
{
- for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
+ [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
const uint scalar_offset = ((offset + (i_1 * 16u))) / 4;
arr_1[i_1].el = asint(buffer[scalar_offset / 4][scalar_offset % 4]);
}
@@ -55,7 +55,7 @@
tint_symbol_5_ret tint_symbol_5(RWByteAddressBuffer buffer, uint offset) {
tint_padded_array_element arr_2[4] = (tint_padded_array_element[4])0;
{
- for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) {
+ [loop] for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) {
arr_2[i_2].el = asint(buffer.Load((offset + (i_2 * 16u))));
}
}
@@ -65,7 +65,7 @@
void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, int value[2]) {
int array_3[2] = value;
{
- for(uint i_3 = 0u; (i_3 < 2u); i_3 = (i_3 + 1u)) {
+ [loop] for(uint i_3 = 0u; (i_3 < 2u); i_3 = (i_3 + 1u)) {
buffer.Store((offset + (i_3 * 4u)), asuint(array_3[i_3]));
}
}
@@ -74,7 +74,7 @@
void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, int value[3][2]) {
int array_2[3][2] = value;
{
- for(uint i_4 = 0u; (i_4 < 3u); i_4 = (i_4 + 1u)) {
+ [loop] for(uint i_4 = 0u; (i_4 < 3u); i_4 = (i_4 + 1u)) {
tint_symbol_9(buffer, (offset + (i_4 * 8u)), array_2[i_4]);
}
}
@@ -83,7 +83,7 @@
void tint_symbol_7(RWByteAddressBuffer buffer, uint offset, int value[4][3][2]) {
int array_1[4][3][2] = value;
{
- for(uint i_5 = 0u; (i_5 < 4u); i_5 = (i_5 + 1u)) {
+ [loop] for(uint i_5 = 0u; (i_5 < 4u); i_5 = (i_5 + 1u)) {
tint_symbol_8(buffer, (offset + (i_5 * 24u)), array_1[i_5]);
}
}
diff --git a/test/array/assign_to_workgroup_var.wgsl.expected.hlsl b/test/array/assign_to_workgroup_var.wgsl.expected.hlsl
index 43a8a1c..b60b974 100644
--- a/test/array/assign_to_workgroup_var.wgsl.expected.hlsl
+++ b/test/array/assign_to_workgroup_var.wgsl.expected.hlsl
@@ -34,7 +34,7 @@
tint_symbol_1_ret tint_symbol_1(uint4 buffer[4], uint offset) {
tint_padded_array_element arr_1[4] = (tint_padded_array_element[4])0;
{
- for(uint i = 0u; (i < 4u); i = (i + 1u)) {
+ [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
const uint scalar_offset = ((offset + (i * 16u))) / 4;
arr_1[i].el = asint(buffer[scalar_offset / 4][scalar_offset % 4]);
}
@@ -46,7 +46,7 @@
tint_symbol_3_ret tint_symbol_3(RWByteAddressBuffer buffer, uint offset) {
tint_padded_array_element arr_2[4] = (tint_padded_array_element[4])0;
{
- for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
+ [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
arr_2[i_1].el = asint(buffer.Load((offset + (i_1 * 16u))));
}
}
diff --git a/test/buffer/storage/dynamic_index/read.wgsl.expected.hlsl b/test/buffer/storage/dynamic_index/read.wgsl.expected.hlsl
index 789126b..25056c1 100644
--- a/test/buffer/storage/dynamic_index/read.wgsl.expected.hlsl
+++ b/test/buffer/storage/dynamic_index/read.wgsl.expected.hlsl
@@ -16,7 +16,7 @@
tint_symbol_11_ret tint_symbol_11(ByteAddressBuffer buffer, uint offset) {
int4 arr_1[4] = (int4[4])0;
{
- for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
+ [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
arr_1[i_1] = asint(buffer.Load4((offset + (i_1 * 16u))));
}
}
diff --git a/test/buffer/storage/dynamic_index/write.wgsl.expected.hlsl b/test/buffer/storage/dynamic_index/write.wgsl.expected.hlsl
index d267673..3fb60a2 100644
--- a/test/buffer/storage/dynamic_index/write.wgsl.expected.hlsl
+++ b/test/buffer/storage/dynamic_index/write.wgsl.expected.hlsl
@@ -18,7 +18,7 @@
void tint_symbol_11(RWByteAddressBuffer buffer, uint offset, int4 value[4]) {
int4 array[4] = value;
{
- for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
+ [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
buffer.Store4((offset + (i_1 * 16u)), asuint(array[i_1]));
}
}
diff --git a/test/buffer/storage/static_index/read.wgsl.expected.hlsl b/test/buffer/storage/static_index/read.wgsl.expected.hlsl
index 42a6a71..667739b 100644
--- a/test/buffer/storage/static_index/read.wgsl.expected.hlsl
+++ b/test/buffer/storage/static_index/read.wgsl.expected.hlsl
@@ -24,7 +24,7 @@
tint_symbol_10_ret tint_symbol_10(ByteAddressBuffer buffer, uint offset) {
tint_padded_array_element arr[4] = (tint_padded_array_element[4])0;
{
- for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
+ [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
arr[i_1].el = tint_symbol_9(buffer, (offset + (i_1 * 16u)));
}
}
diff --git a/test/buffer/storage/static_index/write.wgsl.expected.hlsl b/test/buffer/storage/static_index/write.wgsl.expected.hlsl
index 8c9b7ea..8a2e683 100644
--- a/test/buffer/storage/static_index/write.wgsl.expected.hlsl
+++ b/test/buffer/storage/static_index/write.wgsl.expected.hlsl
@@ -25,7 +25,7 @@
void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, tint_padded_array_element value[4]) {
tint_padded_array_element array[4] = value;
{
- for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
+ [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
tint_symbol_9(buffer, (offset + (i_1 * 16u)), array[i_1].el);
}
}
diff --git a/test/buffer/uniform/dynamic_index/read.wgsl.expected.hlsl b/test/buffer/uniform/dynamic_index/read.wgsl.expected.hlsl
index b110fb7..0d7bd06 100644
--- a/test/buffer/uniform/dynamic_index/read.wgsl.expected.hlsl
+++ b/test/buffer/uniform/dynamic_index/read.wgsl.expected.hlsl
@@ -26,7 +26,7 @@
tint_symbol_12_ret tint_symbol_12(uint4 buffer[96], uint offset) {
int4 arr_1[4] = (int4[4])0;
{
- for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
+ [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
const uint scalar_offset_5 = ((offset + (i_1 * 16u))) / 4;
arr_1[i_1] = asint(buffer[scalar_offset_5 / 4]);
}
diff --git a/test/buffer/uniform/static_index/read.wgsl.expected.hlsl b/test/buffer/uniform/static_index/read.wgsl.expected.hlsl
index f66c81b..9fa1d03 100644
--- a/test/buffer/uniform/static_index/read.wgsl.expected.hlsl
+++ b/test/buffer/uniform/static_index/read.wgsl.expected.hlsl
@@ -35,7 +35,7 @@
tint_symbol_11_ret tint_symbol_11(uint4 buffer[13], uint offset) {
tint_padded_array_element arr[4] = (tint_padded_array_element[4])0;
{
- for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
+ [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
arr[i_1].el = tint_symbol_10(buffer, (offset + (i_1 * 16u)));
}
}
diff --git a/test/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.hlsl b/test/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.hlsl
index 0ea2ad6..0c590e4 100644
--- a/test/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.hlsl
+++ b/test/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.hlsl
@@ -15,7 +15,7 @@
void f_inner(uint local_invocation_index) {
{
- for(uint idx = local_invocation_index; (idx < 64u); idx = (idx + 1u)) {
+ [loop] for(uint idx = local_invocation_index; (idx < 64u); idx = (idx + 1u)) {
const uint i = idx;
s.data[i] = 0;
}
diff --git a/test/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.hlsl b/test/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.hlsl
index 1098254..5080be8 100644
--- a/test/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.hlsl
+++ b/test/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.hlsl
@@ -15,7 +15,7 @@
void f_inner(uint local_invocation_index) {
{
- for(uint idx = local_invocation_index; (idx < 64u); idx = (idx + 1u)) {
+ [loop] for(uint idx = local_invocation_index; (idx < 64u); idx = (idx + 1u)) {
const uint i = idx;
s.data[i] = 0;
}
diff --git a/test/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.hlsl b/test/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.hlsl
index d821643..4c8362a 100644
--- a/test/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.hlsl
+++ b/test/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.hlsl
@@ -12,7 +12,7 @@
float4 main_inner(float2 vUV) {
const float3 random = randomTexture.Sample(tint_symbol, vUV).rgb;
int i = 0;
- while (true) {
+ [loop] while (true) {
if ((i < 1)) {
} else {
break;
diff --git a/test/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.hlsl b/test/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.hlsl
index 7b10259..00000e9 100644
--- a/test/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.hlsl
+++ b/test/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.hlsl
@@ -21,7 +21,7 @@
void foo() {
{
- for(int i = 0; (i < 2); i = (i + 1)) {
+ [loop] for(int i = 0; (i < 2); i = (i + 1)) {
set_float2(v2f, i, 1.0f);
set_int3(v3i, i, 1);
set_uint4(v4u, i, 1u);
@@ -33,7 +33,7 @@
[numthreads(1, 1, 1)]
void main() {
{
- for(int i = 0; (i < 2); i = (i + 1)) {
+ [loop] for(int i = 0; (i < 2); i = (i + 1)) {
foo();
}
}
diff --git a/test/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.hlsl b/test/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.hlsl
index 64b4fea..cc096ac 100644
--- a/test/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.hlsl
+++ b/test/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.hlsl
@@ -30,7 +30,7 @@
[numthreads(1, 1, 1)]
void main() {
{
- for(int i = 0; (i < 2); i = (i + 1)) {
+ [loop] for(int i = 0; (i < 2); i = (i + 1)) {
foo();
}
}
diff --git a/test/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.hlsl b/test/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.hlsl
index 158e0e1..13dd87c 100644
--- a/test/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.hlsl
+++ b/test/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.hlsl
@@ -61,7 +61,7 @@
bool3 v3b = bool3(false, false, false);
bool4 v4b = bool4(false, false, false, false);
{
- for(int i = 0; (i < 2); i = (i + 1)) {
+ [loop] for(int i = 0; (i < 2); i = (i + 1)) {
set_float2(v2f, i, 1.0f);
set_float3(v3f, i, 1.0f);
set_float4(v4f, i, 1.0f);
diff --git a/test/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.hlsl b/test/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.hlsl
index 6cabffe..0c3db07 100644
--- a/test/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.hlsl
+++ b/test/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.hlsl
@@ -25,7 +25,7 @@
bool2 v2b = bool2(false, false);
bool2 v2b_2 = bool2(false, false);
{
- for(int i = 0; (i < 2); i = (i + 1)) {
+ [loop] for(int i = 0; (i < 2); i = (i + 1)) {
set_float2(v2f, i, 1.0f);
set_int3(v3i, i, 1);
set_uint4(v4u, i, 1u);
diff --git a/test/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.hlsl b/test/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.hlsl
index 1461d03..0740864 100644
--- a/test/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.hlsl
+++ b/test/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.hlsl
@@ -61,7 +61,7 @@
bool3 v3b = bool3(false, false, false);
bool4 v4b = bool4(false, false, false, false);
{
- for(int i = 0; (i < 2); i = (i + 1)) {
+ [loop] for(int i = 0; (i < 2); i = (i + 1)) {
set_float2(v2f, i, 1.0f);
set_int2(v2i, i, 1);
set_uint2(v2u, i, 1u);
diff --git a/test/bug/tint/1064.wgsl.expected.hlsl b/test/bug/tint/1064.wgsl.expected.hlsl
index 56911a4..ed00540 100644
--- a/test/bug/tint/1064.wgsl.expected.hlsl
+++ b/test/bug/tint/1064.wgsl.expected.hlsl
@@ -1,5 +1,5 @@
void main() {
- while (true) {
+ [loop] while (true) {
if (false) {
} else {
break;
diff --git a/test/bug/tint/1081.wgsl.expected.hlsl b/test/bug/tint/1081.wgsl.expected.hlsl
index 056c225..1aba907 100644
--- a/test/bug/tint/1081.wgsl.expected.hlsl
+++ b/test/bug/tint/1081.wgsl.expected.hlsl
@@ -22,7 +22,7 @@
int main_inner(int3 x) {
int y = x.x;
- while (true) {
+ [loop] while (true) {
const int r = f(y);
if ((r == 0)) {
break;
diff --git a/test/bug/tint/1121.wgsl.expected.hlsl b/test/bug/tint/1121.wgsl.expected.hlsl
index 12d8865..a5ab12d 100644
--- a/test/bug/tint/1121.wgsl.expected.hlsl
+++ b/test/bug/tint/1121.wgsl.expected.hlsl
@@ -52,9 +52,9 @@
const int TILE_SIZE = 16;
const int TILE_COUNT_X = 2;
{
- for(int y_1 = 0; (y_1 < 2); y_1 = (y_1 + 1)) {
+ [loop] for(int y_1 = 0; (y_1 < 2); y_1 = (y_1 + 1)) {
{
- for(int x_1 = 0; (x_1 < TILE_COUNT_X); x_1 = (x_1 + 1)) {
+ [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) - float2((1.0f).xx));
float2 ceilCoord = (((2.0f * float2((tilePixel0Idx + int2((TILE_SIZE).xx)))) / asfloat(uniforms[10]).xy) - float2((1.0f).xx));
@@ -66,7 +66,7 @@
frustumPlanes[3] = float4(0.0f, -1.0f, (viewCeilCoord.y / viewNear), 0.0f);
float dp = 0.0f;
{
- for(uint i = 0u; (i < 6u); i = (i + 1u)) {
+ [loop] for(uint i = 0u; (i < 6u); i = (i + 1u)) {
float4 p = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((frustumPlanes[i].x > 0.0f)) {
p.x = boxMax.x;
diff --git a/test/bug/tint/221.wgsl.expected.hlsl b/test/bug/tint/221.wgsl.expected.hlsl
index ea467ea..04406bb 100644
--- a/test/bug/tint/221.wgsl.expected.hlsl
+++ b/test/bug/tint/221.wgsl.expected.hlsl
@@ -3,7 +3,7 @@
[numthreads(1, 1, 1)]
void main() {
uint i = 0u;
- while (true) {
+ [loop] while (true) {
if ((i >= b.Load(0u))) {
break;
}
diff --git a/test/bug/tint/534.wgsl.expected.hlsl b/test/bug/tint/534.wgsl.expected.hlsl
index 03518c7..0bee2d8 100644
--- a/test/bug/tint/534.wgsl.expected.hlsl
+++ b/test/bug/tint/534.wgsl.expected.hlsl
@@ -32,7 +32,7 @@
uint4 srcColorBits = uint4(0u, 0u, 0u, 0u);
uint4 dstColorBits = uint4(dstColor);
{
- for(uint i = 0u; (i < uniforms[0].w); i = (i + 1u)) {
+ [loop] for(uint i = 0u; (i < uniforms[0].w); i = (i + 1u)) {
set_uint4(srcColorBits, i, ConvertToFp16FloatValue(srcColor[i]));
bool tint_tmp_1 = success;
if (tint_tmp_1) {
diff --git a/test/bug/tint/744.wgsl.expected.hlsl b/test/bug/tint/744.wgsl.expected.hlsl
index 0b1434e..7870d26 100644
--- a/test/bug/tint/744.wgsl.expected.hlsl
+++ b/test/bug/tint/744.wgsl.expected.hlsl
@@ -15,7 +15,7 @@
const uint dimOutter = uniforms[1].y;
uint result = 0u;
{
- for(uint i = 0u; (i < dimInner); i = (i + 1u)) {
+ [loop] for(uint i = 0u; (i < dimInner); i = (i + 1u)) {
const uint a = (i + (resultCell.x * dimInner));
const uint b = (resultCell.y + (i * dimOutter));
result = (result + (firstMatrix.Load((4u * a)) * secondMatrix.Load((4u * b))));
diff --git a/test/bug/tint/749.spvasm.expected.hlsl b/test/bug/tint/749.spvasm.expected.hlsl
index 3fef834..0b5ecf8 100644
--- a/test/bug/tint/749.spvasm.expected.hlsl
+++ b/test/bug/tint/749.spvasm.expected.hlsl
@@ -153,7 +153,7 @@
const QuicksortObject tint_symbol_11 = {tint_symbol_10};
obj = tint_symbol_11;
obj = x_960;
- while (true) {
+ [loop] while (true) {
const int x_961 = pivot;
pivot = 0;
pivot = x_961;
@@ -453,7 +453,7 @@
p = 0;
p = x_1027;
stack[x_100_save] = x_99;
- while (true) {
+ [loop] while (true) {
const float3 x_566 = float3(x_563.x, x_563.x, x_563.x);
const int x_1028 = h_1;
h_1 = 0;
diff --git a/test/bug/tint/757.wgsl.expected.hlsl b/test/bug/tint/757.wgsl.expected.hlsl
index 8be66c6..d144aff 100644
--- a/test/bug/tint/757.wgsl.expected.hlsl
+++ b/test/bug/tint/757.wgsl.expected.hlsl
@@ -14,7 +14,7 @@
flatIndex = (flatIndex * 1u);
float4 texel = myTexture.Load(int4(int3(int2(GlobalInvocationID.xy), 0), 0));
{
- for(uint i = 0u; (i < 1u); i = (i + 1u)) {
+ [loop] for(uint i = 0u; (i < 1u); i = (i + 1u)) {
result.Store((4u * (flatIndex + i)), asuint(texel.r));
}
}
diff --git a/test/bug/tint/870.spvasm.expected.hlsl b/test/bug/tint/870.spvasm.expected.hlsl
index db19a18..69b21b9 100644
--- a/test/bug/tint/870.spvasm.expected.hlsl
+++ b/test/bug/tint/870.spvasm.expected.hlsl
@@ -4,7 +4,7 @@
tint_symbol_ret tint_symbol(ByteAddressBuffer buffer, uint offset) {
int arr[6] = (int[6])0;
{
- for(uint i = 0u; (i < 6u); i = (i + 1u)) {
+ [loop] for(uint i = 0u; (i < 6u); i = (i + 1u)) {
arr[i] = asint(buffer.Load((offset + (i * 4u))));
}
}
diff --git a/test/bug/tint/914.wgsl.expected.hlsl b/test/bug/tint/914.wgsl.expected.hlsl
index b4add28..4c2e060 100644
--- a/test/bug/tint/914.wgsl.expected.hlsl
+++ b/test/bug/tint/914.wgsl.expected.hlsl
@@ -56,7 +56,7 @@
void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) {
{
- for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 256u)) {
+ [loop] for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 256u)) {
const uint i = (idx / 64u);
const uint i_1 = (idx % 64u);
mm_Asub[i][i_1] = 0.0f;
@@ -73,7 +73,7 @@
float ACached = 0.0f;
float BCached[4] = (float[4])0;
{
- for(uint index = 0u; (index < (RowPerThread * ColPerThread)); index = (index + 1u)) {
+ [loop] for(uint index = 0u; (index < (RowPerThread * ColPerThread)); index = (index + 1u)) {
acc[index] = 0.0f;
}
}
@@ -82,11 +82,11 @@
const uint RowPerThreadB = (TileInner / 16u);
const uint tileRowB = (local_id.y * RowPerThreadB);
{
- for(uint t = 0u; (t < numTiles); t = (t + 1u)) {
+ [loop] for(uint t = 0u; (t < numTiles); t = (t + 1u)) {
{
- for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
+ [loop] for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
{
- for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) {
+ [loop] for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) {
const uint inputRow = (tileRow + innerRow);
const uint inputCol = (tileColA + innerCol);
mm_Asub[inputRow][inputCol] = mm_readA((globalRow + innerRow), ((t * TileInner) + inputCol));
@@ -95,9 +95,9 @@
}
}
{
- for(uint innerRow = 0u; (innerRow < RowPerThreadB); innerRow = (innerRow + 1u)) {
+ [loop] for(uint innerRow = 0u; (innerRow < RowPerThreadB); innerRow = (innerRow + 1u)) {
{
- for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
+ [loop] for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
const uint inputRow = (tileRowB + innerRow);
const uint inputCol = (tileCol + innerCol);
mm_Bsub[innerCol][inputCol] = mm_readB(((t * TileInner) + inputRow), (globalCol + innerCol));
@@ -107,17 +107,17 @@
}
GroupMemoryBarrierWithGroupSync();
{
- for(uint k = 0u; (k < TileInner); k = (k + 1u)) {
+ [loop] for(uint k = 0u; (k < TileInner); k = (k + 1u)) {
{
- for(uint inner = 0u; (inner < ColPerThread); inner = (inner + 1u)) {
+ [loop] for(uint inner = 0u; (inner < ColPerThread); inner = (inner + 1u)) {
BCached[inner] = mm_Bsub[k][(tileCol + inner)];
}
}
{
- for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
+ [loop] for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
ACached = mm_Asub[(tileRow + innerRow)][k];
{
- for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
+ [loop] for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
const uint index = ((innerRow * ColPerThread) + innerCol);
acc[index] = (acc[index] + (ACached * BCached[innerCol]));
}
@@ -130,9 +130,9 @@
}
}
{
- for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
+ [loop] for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) {
{
- for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
+ [loop] for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) {
const uint index = ((innerRow * ColPerThread) + innerCol);
mm_write((globalRow + innerRow), (globalCol + innerCol), acc[index]);
}
diff --git a/test/bug/tint/942.wgsl.expected.hlsl b/test/bug/tint/942.wgsl.expected.hlsl
index 2325c62..7c38bdc 100644
--- a/test/bug/tint/942.wgsl.expected.hlsl
+++ b/test/bug/tint/942.wgsl.expected.hlsl
@@ -18,7 +18,7 @@
void main_inner(uint3 WorkGroupID, uint3 LocalInvocationID, uint local_invocation_index) {
{
- for(uint idx = local_invocation_index; (idx < 1024u); idx = (idx + 64u)) {
+ [loop] for(uint idx = local_invocation_index; (idx < 1024u); idx = (idx + 64u)) {
const uint i_1 = (idx / 256u);
const uint i_2 = (idx % 256u);
tile[i_1][i_2] = float3(0.0f, 0.0f, 0.0f);
@@ -31,9 +31,9 @@
const int2 dims = tint_tmp.xy;
const int2 baseIndex = (int2(((WorkGroupID.xy * uint2(params[0].y, 4u)) + (LocalInvocationID.xy * uint2(4u, 1u)))) - int2(int(filterOffset), 0));
{
- for(uint r = 0u; (r < 4u); r = (r + 1u)) {
+ [loop] for(uint r = 0u; (r < 4u); r = (r + 1u)) {
{
- for(uint c = 0u; (c < 4u); c = (c + 1u)) {
+ [loop] for(uint c = 0u; (c < 4u); c = (c + 1u)) {
int2 loadIndex = (baseIndex + int2(int(c), int(r)));
if ((flip[0].x != 0u)) {
loadIndex = loadIndex.yx;
@@ -45,9 +45,9 @@
}
GroupMemoryBarrierWithGroupSync();
{
- for(uint r = 0u; (r < 4u); r = (r + 1u)) {
+ [loop] for(uint r = 0u; (r < 4u); r = (r + 1u)) {
{
- for(uint c = 0u; (c < 4u); c = (c + 1u)) {
+ [loop] for(uint c = 0u; (c < 4u); c = (c + 1u)) {
int2 writeIndex = (baseIndex + int2(int(c), int(r)));
if ((flip[0].x != 0u)) {
writeIndex = writeIndex.yx;
@@ -64,7 +64,7 @@
if ((tint_tmp_1)) {
float3 acc = float3(0.0f, 0.0f, 0.0f);
{
- for(uint f = 0u; (f < params[0].x); f = (f + 1u)) {
+ [loop] for(uint f = 0u; (f < params[0].x); f = (f + 1u)) {
uint i = ((center + f) - filterOffset);
acc = (acc + ((1.0f / float(params[0].x)) * tile[r][i]));
}
diff --git a/test/bug/tint/943.spvasm.expected.hlsl b/test/bug/tint/943.spvasm.expected.hlsl
index 38e87d3..bdf9b12 100644
--- a/test/bug/tint/943.spvasm.expected.hlsl
+++ b/test/bug/tint/943.spvasm.expected.hlsl
@@ -186,10 +186,10 @@
numTiles = (((x_152 - 1) / 64) + 1);
innerRow = 0;
{
- for(; (innerRow < 1); innerRow = (innerRow + 1)) {
+ [loop] for(; (innerRow < 1); innerRow = (innerRow + 1)) {
innerCol = 0;
{
- for(; (innerCol < 1); innerCol = (innerCol + 1)) {
+ [loop] for(; (innerCol < 1); innerCol = (innerCol + 1)) {
acc[innerRow][innerCol] = 0.0f;
}
}
@@ -201,13 +201,13 @@
tileRowB = (asint(x_192) * 1);
t = 0;
{
- for(; (t < numTiles); t = (t + 1)) {
+ [loop] for(; (t < numTiles); t = (t + 1)) {
innerRow_1 = 0;
{
- for(; (innerRow_1 < 1); innerRow_1 = (innerRow_1 + 1)) {
+ [loop] for(; (innerRow_1 < 1); innerRow_1 = (innerRow_1 + 1)) {
innerCol_1 = 0;
{
- for(; (innerCol_1 < 64); innerCol_1 = (innerCol_1 + 1)) {
+ [loop] for(; (innerCol_1 < 64); innerCol_1 = (innerCol_1 + 1)) {
inputRow = (tileRow + innerRow_1);
inputCol = (tileColA + innerCol_1);
const int x_233 = inputRow;
@@ -224,10 +224,10 @@
}
innerRow_2 = 0;
{
- for(; (innerRow_2 < 1); innerRow_2 = (innerRow_2 + 1)) {
+ [loop] for(; (innerRow_2 < 1); innerRow_2 = (innerRow_2 + 1)) {
innerCol_2 = 0;
{
- for(; (innerCol_2 < 1); innerCol_2 = (innerCol_2 + 1)) {
+ [loop] for(; (innerCol_2 < 1); innerCol_2 = (innerCol_2 + 1)) {
inputRow_1 = (tileRowB + innerRow_2);
inputCol_1 = (tileCol + innerCol_2);
const int x_278 = inputRow_1;
@@ -245,10 +245,10 @@
GroupMemoryBarrierWithGroupSync();
k = 0;
{
- for(; (k < 64); k = (k + 1)) {
+ [loop] for(; (k < 64); k = (k + 1)) {
inner = 0;
{
- for(; (inner < 1); inner = (inner + 1)) {
+ [loop] for(; (inner < 1); inner = (inner + 1)) {
const int x_314 = inner;
const float x_320 = mm_Bsub[k][(tileCol + inner)];
BCached[x_314] = x_320;
@@ -256,12 +256,12 @@
}
innerRow_3 = 0;
{
- for(; (innerRow_3 < 1); innerRow_3 = (innerRow_3 + 1)) {
+ [loop] for(; (innerRow_3 < 1); innerRow_3 = (innerRow_3 + 1)) {
const float x_338 = mm_Asub[(tileRow + innerRow_3)][k];
ACached = x_338;
innerCol_3 = 0;
{
- for(; (innerCol_3 < 1); innerCol_3 = (innerCol_3 + 1)) {
+ [loop] for(; (innerCol_3 < 1); innerCol_3 = (innerCol_3 + 1)) {
const int x_347 = innerRow_3;
const int x_348 = innerCol_3;
const float x_349 = ACached;
@@ -279,9 +279,9 @@
}
innerRow_4 = 0;
{
- for(; (innerRow_4 < 1); innerRow_4 = (innerRow_4 + 1)) {
+ [loop] for(; (innerRow_4 < 1); innerRow_4 = (innerRow_4 + 1)) {
innerCol_4 = 0;
- while (true) {
+ [loop] while (true) {
bool x_393 = false;
bool x_394_phi = false;
if ((innerCol_4 < 1)) {
@@ -352,7 +352,7 @@
mm_Bsub[i_1][i_2] = 0.0f;
}
{
- for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 64u)) {
+ [loop] for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 64u)) {
const uint i = (idx / 64u);
const uint i_1 = (idx % 64u);
mm_Asub[i][i_1] = 0.0f;
diff --git a/test/bug/tint/948.wgsl.expected.hlsl b/test/bug/tint/948.wgsl.expected.hlsl
index 869f3e3..5a253ad 100644
--- a/test/bug/tint/948.wgsl.expected.hlsl
+++ b/test/bug/tint/948.wgsl.expected.hlsl
@@ -62,7 +62,7 @@
stageUnits = (float2(1.0f, 1.0f) / x_111);
i = 0;
{
- for(; (i < 2); i = (i + 1)) {
+ [loop] for(; (i < 2); i = (i + 1)) {
switch(i) {
case 1: {
const float2 x_150 = tileID;
@@ -93,7 +93,7 @@
mt = ((x_181 * x_184) % 1.0f);
f = 0.0f;
{
- for(; (f < 8.0f); f = (f + 1.0f)) {
+ [loop] for(; (f < 8.0f); f = (f + 1.0f)) {
const float x_197 = animationData.y;
if ((x_197 > mt)) {
const float x_203 = animationData.x;
diff --git a/test/bug/tint/949.wgsl.expected.hlsl b/test/bug/tint/949.wgsl.expected.hlsl
index e875c0d..4869166 100644
--- a/test/bug/tint/949.wgsl.expected.hlsl
+++ b/test/bug/tint/949.wgsl.expected.hlsl
@@ -244,7 +244,7 @@
currSampledHeight = 1.0f;
i = 0;
{
- for(; (i < 15); i = (i + 1)) {
+ [loop] for(; (i < 15); i = (i + 1)) {
const float4 x_397 = TextureSamplerTexture.Sample(TextureSamplerSampler, (v_uv + vCurrOffset));
currSampledHeight = x_397.w;
if ((currSampledHeight > currRayHeight)) {
diff --git a/test/bug/tint/990.wgsl.expected.hlsl b/test/bug/tint/990.wgsl.expected.hlsl
index 80751f8..49ec198 100644
--- a/test/bug/tint/990.wgsl.expected.hlsl
+++ b/test/bug/tint/990.wgsl.expected.hlsl
@@ -6,7 +6,7 @@
void f() {
int i = 0;
{
- for(; ; ) {
+ [loop] for(; ; ) {
}
}
}
diff --git a/test/layout/storage/mat2x2/stride/16.spvasm.expected.hlsl b/test/layout/storage/mat2x2/stride/16.spvasm.expected.hlsl
index f9ad3ad..18bd54d 100644
--- a/test/layout/storage/mat2x2/stride/16.spvasm.expected.hlsl
+++ b/test/layout/storage/mat2x2/stride/16.spvasm.expected.hlsl
@@ -18,7 +18,7 @@
tint_symbol_ret tint_symbol(RWByteAddressBuffer buffer, uint offset) {
tint_padded_array_element arr_1[2] = (tint_padded_array_element[2])0;
{
- for(uint i = 0u; (i < 2u); i = (i + 1u)) {
+ [loop] for(uint i = 0u; (i < 2u); i = (i + 1u)) {
arr_1[i].el = asfloat(buffer.Load2((offset + (i * 16u))));
}
}
@@ -28,7 +28,7 @@
void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, tint_padded_array_element value[2]) {
tint_padded_array_element array[2] = value;
{
- for(uint i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) {
+ [loop] for(uint i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) {
buffer.Store2((offset + (i_1 * 16u)), asuint(array[i_1].el));
}
}
diff --git a/test/loops/loop.wgsl.expected.hlsl b/test/loops/loop.wgsl.expected.hlsl
index 44b45fd..8eed4b2 100644
--- a/test/loops/loop.wgsl.expected.hlsl
+++ b/test/loops/loop.wgsl.expected.hlsl
@@ -5,7 +5,7 @@
int f() {
int i = 0;
- while (true) {
+ [loop] while (true) {
i = (i + 1);
if ((i > 4)) {
return i;
diff --git a/test/loops/loop_with_continuing.wgsl.expected.hlsl b/test/loops/loop_with_continuing.wgsl.expected.hlsl
index 0d57d1f..440ef88 100644
--- a/test/loops/loop_with_continuing.wgsl.expected.hlsl
+++ b/test/loops/loop_with_continuing.wgsl.expected.hlsl
@@ -5,7 +5,7 @@
int f() {
int i = 0;
- while (true) {
+ [loop] while (true) {
if ((i > 4)) {
return i;
}
diff --git a/test/loops/nested_loops.wgsl.expected.hlsl b/test/loops/nested_loops.wgsl.expected.hlsl
index 793339e..5278d00 100644
--- a/test/loops/nested_loops.wgsl.expected.hlsl
+++ b/test/loops/nested_loops.wgsl.expected.hlsl
@@ -6,12 +6,12 @@
int f() {
int i = 0;
int j = 0;
- while (true) {
+ [loop] while (true) {
i = (i + 1);
if ((i > 4)) {
return 1;
}
- while (true) {
+ [loop] while (true) {
j = (j + 1);
if ((j > 4)) {
return 2;
diff --git a/test/loops/nested_loops_with_continuing.wgsl.expected.hlsl b/test/loops/nested_loops_with_continuing.wgsl.expected.hlsl
index 9ccdf02..8d795a8 100644
--- a/test/loops/nested_loops_with_continuing.wgsl.expected.hlsl
+++ b/test/loops/nested_loops_with_continuing.wgsl.expected.hlsl
@@ -6,11 +6,11 @@
int f() {
int i = 0;
int j = 0;
- while (true) {
+ [loop] while (true) {
if ((i > 4)) {
return 1;
}
- while (true) {
+ [loop] while (true) {
if ((j > 4)) {
return 2;
}
diff --git a/test/samples/compute_boids.wgsl.expected.hlsl b/test/samples/compute_boids.wgsl.expected.hlsl
index a19fa71..b94e5e7 100644
--- a/test/samples/compute_boids.wgsl.expected.hlsl
+++ b/test/samples/compute_boids.wgsl.expected.hlsl
@@ -60,7 +60,7 @@
float2 pos = float2(0.0f, 0.0f);
float2 vel = float2(0.0f, 0.0f);
{
- for(uint i = 0u; (i < 5u); i = (i + 1u)) {
+ [loop] for(uint i = 0u; (i < 5u); i = (i + 1u)) {
if ((i == index)) {
continue;
}
diff --git a/test/statements/for/basic.wgsl.expected.hlsl b/test/statements/for/basic.wgsl.expected.hlsl
index f215f4b..2236503 100644
--- a/test/statements/for/basic.wgsl.expected.hlsl
+++ b/test/statements/for/basic.wgsl.expected.hlsl
@@ -8,7 +8,7 @@
void f() {
{
- for(int i = 0; (i < 5); i = (i + 1)) {
+ [loop] for(int i = 0; (i < 5); i = (i + 1)) {
some_loop_body();
}
}
diff --git a/test/statements/for/complex.wgsl.expected.hlsl b/test/statements/for/complex.wgsl.expected.hlsl
index b48727f..ebc9720 100644
--- a/test/statements/for/complex.wgsl.expected.hlsl
+++ b/test/statements/for/complex.wgsl.expected.hlsl
@@ -10,7 +10,7 @@
int j = 0;
{
int i = 0;
- while (true) {
+ [loop] while (true) {
bool tint_tmp = (i < 5);
if (tint_tmp) {
tint_tmp = (j < 10);
diff --git a/test/statements/for/condition.wgsl.expected.hlsl b/test/statements/for/condition.wgsl.expected.hlsl
index e4456e0..96122e5 100644
--- a/test/statements/for/condition.wgsl.expected.hlsl
+++ b/test/statements/for/condition.wgsl.expected.hlsl
@@ -6,7 +6,7 @@
void f() {
int i = 0;
{
- for(; (i < 4); ) {
+ [loop] for(; (i < 4); ) {
}
}
}
diff --git a/test/statements/for/continuing.wgsl.expected.hlsl b/test/statements/for/continuing.wgsl.expected.hlsl
index b3ec736..3e2e847 100644
--- a/test/statements/for/continuing.wgsl.expected.hlsl
+++ b/test/statements/for/continuing.wgsl.expected.hlsl
@@ -6,7 +6,7 @@
void f() {
int i = 0;
{
- for(; ; i = (i + 1)) {
+ [loop] for(; ; i = (i + 1)) {
}
}
}
diff --git a/test/statements/for/empty.wgsl.expected.hlsl b/test/statements/for/empty.wgsl.expected.hlsl
index cd85e1a..fe6edee 100644
--- a/test/statements/for/empty.wgsl.expected.hlsl
+++ b/test/statements/for/empty.wgsl.expected.hlsl
@@ -5,7 +5,7 @@
void f() {
{
- for(; ; ) {
+ [loop] for(; ; ) {
}
}
}
diff --git a/test/statements/for/initializer.wgsl.expected.hlsl b/test/statements/for/initializer.wgsl.expected.hlsl
index e614afd..57b4e10 100644
--- a/test/statements/for/initializer.wgsl.expected.hlsl
+++ b/test/statements/for/initializer.wgsl.expected.hlsl
@@ -5,7 +5,7 @@
void f() {
{
- for(int i = 0; ; ) {
+ [loop] for(int i = 0; ; ) {
}
}
}
diff --git a/test/statements/for/scoping.wgsl.expected.hlsl b/test/statements/for/scoping.wgsl.expected.hlsl
index 143b1e3..65cfcf7 100644
--- a/test/statements/for/scoping.wgsl.expected.hlsl
+++ b/test/statements/for/scoping.wgsl.expected.hlsl
@@ -5,7 +5,7 @@
void f() {
{
- for(int must_not_collide = 0; ; ) {
+ [loop] for(int must_not_collide = 0; ; ) {
}
}
int must_not_collide = 0;
diff --git a/test/var/initialization/workgroup/array.wgsl.expected.hlsl b/test/var/initialization/workgroup/array.wgsl.expected.hlsl
index 95222e9..21c4cab 100644
--- a/test/var/initialization/workgroup/array.wgsl.expected.hlsl
+++ b/test/var/initialization/workgroup/array.wgsl.expected.hlsl
@@ -6,7 +6,7 @@
void main_inner(uint local_invocation_index) {
{
- for(uint idx = local_invocation_index; (idx < 3u); idx = (idx + 1u)) {
+ [loop] for(uint idx = local_invocation_index; (idx < 3u); idx = (idx + 1u)) {
const uint i = idx;
v[i] = 0;
}