[tint][hlsl] Fix names of vector / matrix setter utils Previously we'd prefix the type with a string to build the function name, but not all types are pure identifiers. For example a vector of float16 uses the templated form, which results in a broken identifier. Fixed: tint:2146 Change-Id: Idc07d46f66fc57dc7d2167ff2994f1aaa5f0ca63 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/171620 Auto-Submit: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/lang/hlsl/writer/ast_printer/assign_test.cc b/src/tint/lang/hlsl/writer/ast_printer/assign_test.cc index 40384c2..c7fc2e8 100644 --- a/src/tint/lang/hlsl/writer/ast_printer/assign_test.cc +++ b/src/tint/lang/hlsl/writer/ast_printer/assign_test.cc
@@ -69,7 +69,7 @@ ASSERT_TRUE(gen.Generate()); EXPECT_EQ(gen.Result(), - R"(void set_float3(inout float3 vec, int idx, float val) { + R"(void set_vector_element(inout float3 vec, int idx, float val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } @@ -77,7 +77,7 @@ float3 lhs = float3(0.0f, 0.0f, 0.0f); float rhs = 0.0f; const uint index = 0u; - set_float3(lhs, index, rhs); + set_vector_element(lhs, index, rhs); } )"); } @@ -116,7 +116,7 @@ ASSERT_TRUE(gen.Generate()); EXPECT_EQ(gen.Result(), - R"(void set_float3(inout float3 vec, int idx, float val) { + R"(void set_vector_element(inout float3 vec, int idx, float val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } @@ -124,7 +124,7 @@ float3 lhs = float3(0.0f, 0.0f, 0.0f); float rhs = 0.0f; uint index = 0u; - set_float3(lhs, index, rhs); + set_vector_element(lhs, index, rhs); } )"); } @@ -142,7 +142,7 @@ ASSERT_TRUE(gen.Generate()); EXPECT_EQ(gen.Result(), - R"(void set_vector_float4x2(inout float4x2 mat, int col, float2 val) { + R"(void set_matrix_column(inout float4x2 mat, int col, float2 val) { switch (col) { case 0: mat[0] = val; break; case 1: mat[1] = val; break; @@ -155,7 +155,7 @@ float4x2 lhs = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); float2 rhs = float2(0.0f, 0.0f); const uint index = 0u; - set_vector_float4x2(lhs, index, rhs); + set_matrix_column(lhs, index, rhs); } )"); } @@ -194,7 +194,7 @@ ASSERT_TRUE(gen.Generate()); EXPECT_EQ(gen.Result(), - R"(void set_vector_float4x2(inout float4x2 mat, int col, float2 val) { + R"(void set_matrix_column(inout float4x2 mat, int col, float2 val) { switch (col) { case 0: mat[0] = val; break; case 1: mat[1] = val; break; @@ -207,7 +207,7 @@ float4x2 lhs = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); float2 rhs = float2(0.0f, 0.0f); uint index = 0u; - set_vector_float4x2(lhs, index, rhs); + set_matrix_column(lhs, index, rhs); } )"); } @@ -228,7 +228,7 @@ ASSERT_TRUE(gen.Generate()); EXPECT_EQ(gen.Result(), - R"(void set_scalar_float4x2(inout float4x2 mat, int col, int row, float val) { + R"(void set_matrix_scalar(inout float4x2 mat, int col, int row, float val) { switch (col) { case 0: mat[0] = (row.xx == int2(0, 1)) ? val.xx : mat[0]; @@ -250,7 +250,7 @@ float rhs = 0.0f; const uint col = 0u; const uint row = 1u; - set_scalar_float4x2(lhs, col, row, rhs); + set_matrix_scalar(lhs, col, row, rhs); } )"); } @@ -295,7 +295,7 @@ ASSERT_TRUE(gen.Generate()); EXPECT_EQ(gen.Result(), - R"(void set_scalar_float4x2(inout float4x2 mat, int col, int row, float val) { + R"(void set_matrix_scalar(inout float4x2 mat, int col, int row, float val) { switch (col) { case 0: mat[0] = (row.xx == int2(0, 1)) ? val.xx : mat[0]; @@ -317,7 +317,119 @@ float rhs = 0.0f; uint col = 0u; uint row = 0u; - set_scalar_float4x2(lhs, col, row, rhs); + set_matrix_scalar(lhs, col, row, rhs); +} +)"); +} + +//////////////////////////////////////////////////////////////////////////////// +// Assignment to composites of f16 +// See crbug.com/tint/2146 +//////////////////////////////////////////////////////////////////////////////// +TEST_F(HlslASTPrinterTest_Assign, Emit_Vector_f16_Assign) { + Enable(wgsl::Extension::kF16); + + Func("fn", tint::Empty, ty.void_(), + Vector{ + Decl(Var("lhs", ty.vec3<f16>())), + Decl(Var("rhs", ty.f16())), + Decl(Let("index", ty.u32(), Expr(0_u))), + Assign(IndexAccessor("lhs", "index"), "rhs"), + }); + + ASTPrinter& gen = Build(); + + ASSERT_TRUE(gen.Generate()); + EXPECT_EQ(gen.Result(), + R"(void set_vector_element(inout vector<float16_t, 3> vec, int idx, float16_t val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void fn() { + vector<float16_t, 3> lhs = vector<float16_t, 3>(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); + float16_t rhs = float16_t(0.0h); + const uint index = 0u; + set_vector_element(lhs, index, rhs); +} +)"); +} + +TEST_F(HlslASTPrinterTest_Assign, Emit_Matrix_f16_Assign_Vector) { + Enable(wgsl::Extension::kF16); + + Func("fn", tint::Empty, ty.void_(), + Vector{ + Decl(Var("lhs", ty.mat4x2<f16>())), + Decl(Var("rhs", ty.vec2<f16>())), + Decl(Let("index", ty.u32(), Expr(0_u))), + Assign(IndexAccessor("lhs", "index"), "rhs"), + }); + + ASTPrinter& gen = Build(); + + ASSERT_TRUE(gen.Generate()); + EXPECT_EQ( + gen.Result(), + R"(void set_matrix_column(inout matrix<float16_t, 4, 2> mat, int col, vector<float16_t, 2> val) { + switch (col) { + case 0: mat[0] = val; break; + case 1: mat[1] = val; break; + case 2: mat[2] = val; break; + case 3: mat[3] = val; break; + } +} + +void fn() { + matrix<float16_t, 4, 2> lhs = matrix<float16_t, 4, 2>(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h), float16_t(0.0h), float16_t(0.0h), float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); + vector<float16_t, 2> rhs = vector<float16_t, 2>(float16_t(0.0h), float16_t(0.0h)); + const uint index = 0u; + set_matrix_column(lhs, index, rhs); +} +)"); +} + +TEST_F(HlslASTPrinterTest_Assign, Emit_Matrix_f16_Assign_Scalar) { + Enable(wgsl::Extension::kF16); + + auto* col = IndexAccessor("lhs", "col"); + auto* el = IndexAccessor(col, "row"); + Func("fn", tint::Empty, ty.void_(), + Vector{ + Decl(Var("lhs", ty.mat4x2<f16>())), + Decl(Var("rhs", ty.f16())), + Decl(Let("col", ty.u32(), Expr(0_u))), + Decl(Let("row", ty.u32(), Expr(1_u))), + Assign(el, "rhs"), + }); + + ASTPrinter& gen = Build(); + + ASSERT_TRUE(gen.Generate()); + EXPECT_EQ( + gen.Result(), + R"(void set_matrix_scalar(inout matrix<float16_t, 4, 2> mat, int col, int row, float16_t val) { + switch (col) { + case 0: + mat[0] = (row.xx == int2(0, 1)) ? val.xx : mat[0]; + break; + case 1: + mat[1] = (row.xx == int2(0, 1)) ? val.xx : mat[1]; + break; + case 2: + mat[2] = (row.xx == int2(0, 1)) ? val.xx : mat[2]; + break; + case 3: + mat[3] = (row.xx == int2(0, 1)) ? val.xx : mat[3]; + break; + } +} + +void fn() { + matrix<float16_t, 4, 2> lhs = matrix<float16_t, 4, 2>(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h), float16_t(0.0h), float16_t(0.0h), float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); + float16_t rhs = float16_t(0.0h); + const uint col = 0u; + const uint row = 1u; + set_matrix_scalar(lhs, col, row, rhs); } )"); }
diff --git a/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc b/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc index d6eec1a..5a43388 100644 --- a/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc +++ b/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc
@@ -461,15 +461,7 @@ bool ASTPrinter::EmitDynamicVectorAssignment(const ast::AssignmentStatement* stmt, const core::type::Vector* vec) { auto name = tint::GetOrCreate(dynamic_vector_write_, vec, [&]() -> std::string { - std::string fn; - { - StringStream ss; - if (!EmitType(ss, vec, tint::core::AddressSpace::kUndefined, core::Access::kUndefined, - "")) { - return ""; - } - fn = UniqueIdentifier("set_" + ss.str()); - } + std::string fn = UniqueIdentifier("set_vector_element"); { auto out = Line(&helpers_); out << "void " << fn << "(inout "; @@ -534,15 +526,7 @@ bool ASTPrinter::EmitDynamicMatrixVectorAssignment(const ast::AssignmentStatement* stmt, const core::type::Matrix* mat) { auto name = tint::GetOrCreate(dynamic_matrix_vector_write_, mat, [&]() -> std::string { - std::string fn; - { - StringStream ss; - if (!EmitType(ss, mat, tint::core::AddressSpace::kUndefined, core::Access::kUndefined, - "")) { - return ""; - } - fn = UniqueIdentifier("set_vector_" + ss.str()); - } + std::string fn = UniqueIdentifier("set_matrix_column"); { auto out = Line(&helpers_); out << "void " << fn << "(inout "; @@ -603,15 +587,7 @@ auto* lhs_col_access = lhs_row_access->object->As<ast::IndexAccessorExpression>(); auto name = tint::GetOrCreate(dynamic_matrix_scalar_write_, mat, [&]() -> std::string { - std::string fn; - { - StringStream ss; - if (!EmitType(ss, mat, tint::core::AddressSpace::kUndefined, core::Access::kUndefined, - "")) { - return ""; - } - fn = UniqueIdentifier("set_scalar_" + ss.str()); - } + std::string fn = UniqueIdentifier("set_matrix_scalar"); { auto out = Line(&helpers_); out << "void " << fn << "(inout ";
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.dxc.hlsl index 3bf110e..ea6cf2e 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.dxc.hlsl
@@ -1,4 +1,4 @@ -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { +void set_matrix_scalar(inout float2x4 mat, int col, int row, float val) { switch (col) { case 0: mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; @@ -16,6 +16,6 @@ [numthreads(1, 1, 1)] void main() { float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - set_scalar_float2x4(m1, uniforms[0].x, 0, 1.0f); + set_matrix_scalar(m1, uniforms[0].x, 0, 1.0f); return; }
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.fxc.hlsl index 3bf110e..ea6cf2e 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.fxc.hlsl
@@ -1,4 +1,4 @@ -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { +void set_matrix_scalar(inout float2x4 mat, int col, int row, float val) { switch (col) { case 0: mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; @@ -16,6 +16,6 @@ [numthreads(1, 1, 1)] void main() { float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - set_scalar_float2x4(m1, uniforms[0].x, 0, 1.0f); + set_matrix_scalar(m1, uniforms[0].x, 0, 1.0f); return; }
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.dxc.hlsl index 910f845..45e9234 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.dxc.hlsl
@@ -1,4 +1,4 @@ -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { +void set_matrix_scalar(inout float2x4 mat, int col, int row, float val) { switch (col) { case 0: mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; @@ -16,6 +16,6 @@ [numthreads(1, 1, 1)] void main() { float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - set_scalar_float2x4(m1, uniforms[0].x, uniforms[0].y, 1.0f); + set_matrix_scalar(m1, uniforms[0].x, uniforms[0].y, 1.0f); return; }
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.fxc.hlsl index 910f845..45e9234 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.fxc.hlsl
@@ -1,4 +1,4 @@ -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { +void set_matrix_scalar(inout float2x4 mat, int col, int row, float val) { switch (col) { case 0: mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; @@ -16,6 +16,6 @@ [numthreads(1, 1, 1)] void main() { float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - set_scalar_float2x4(m1, uniforms[0].x, uniforms[0].y, 1.0f); + set_matrix_scalar(m1, uniforms[0].x, uniforms[0].y, 1.0f); return; }
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.dxc.hlsl index cedfc5a..03fba5d 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.dxc.hlsl
@@ -1,4 +1,4 @@ -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { +void set_matrix_scalar(inout float2x4 mat, int col, int row, float val) { switch (col) { case 0: mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; @@ -16,6 +16,6 @@ [numthreads(1, 1, 1)] void main() { - set_scalar_float2x4(m1, 0, uniforms[0].y, 1.0f); + set_matrix_scalar(m1, 0, uniforms[0].y, 1.0f); return; }
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.fxc.hlsl index cedfc5a..03fba5d 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.fxc.hlsl
@@ -1,4 +1,4 @@ -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { +void set_matrix_scalar(inout float2x4 mat, int col, int row, float val) { switch (col) { case 0: mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; @@ -16,6 +16,6 @@ [numthreads(1, 1, 1)] void main() { - set_scalar_float2x4(m1, 0, uniforms[0].y, 1.0f); + set_matrix_scalar(m1, 0, uniforms[0].y, 1.0f); return; }
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.dxc.hlsl index c4a4418..b7b3c87 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.dxc.hlsl
@@ -1,4 +1,4 @@ -void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { +void set_matrix_column(inout float2x4 mat, int col, float4 val) { switch (col) { case 0: mat[0] = val; break; case 1: mat[1] = val; break; @@ -12,6 +12,6 @@ [numthreads(1, 1, 1)] void main() { float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - set_vector_float2x4(m1, uniforms[0].x, (1.0f).xxxx); + set_matrix_column(m1, uniforms[0].x, (1.0f).xxxx); return; }
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.fxc.hlsl index c4a4418..b7b3c87 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.fxc.hlsl
@@ -1,4 +1,4 @@ -void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { +void set_matrix_column(inout float2x4 mat, int col, float4 val) { switch (col) { case 0: mat[0] = val; break; case 1: mat[1] = val; break; @@ -12,6 +12,6 @@ [numthreads(1, 1, 1)] void main() { float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - set_vector_float2x4(m1, uniforms[0].x, (1.0f).xxxx); + set_matrix_column(m1, uniforms[0].x, (1.0f).xxxx); return; }
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.dxc.hlsl index 4b4aeb1..f8b97cf 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.dxc.hlsl
@@ -1,4 +1,4 @@ -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { +void set_matrix_scalar(inout float2x4 mat, int col, int row, float val) { switch (col) { case 0: mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; @@ -16,6 +16,6 @@ [numthreads(1, 1, 1)] void main() { - set_scalar_float2x4(m1, uniforms[0].x, 0, 1.0f); + set_matrix_scalar(m1, uniforms[0].x, 0, 1.0f); return; }
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.fxc.hlsl index 4b4aeb1..f8b97cf 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.fxc.hlsl
@@ -1,4 +1,4 @@ -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { +void set_matrix_scalar(inout float2x4 mat, int col, int row, float val) { switch (col) { case 0: mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; @@ -16,6 +16,6 @@ [numthreads(1, 1, 1)] void main() { - set_scalar_float2x4(m1, uniforms[0].x, 0, 1.0f); + set_matrix_scalar(m1, uniforms[0].x, 0, 1.0f); return; }
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.dxc.hlsl index 7cb37c4..62c740c5 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.dxc.hlsl
@@ -1,4 +1,4 @@ -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { +void set_matrix_scalar(inout float2x4 mat, int col, int row, float val) { switch (col) { case 0: mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; @@ -16,6 +16,6 @@ [numthreads(1, 1, 1)] void main() { - set_scalar_float2x4(m1, uniforms[0].x, uniforms[0].y, 1.0f); + set_matrix_scalar(m1, uniforms[0].x, uniforms[0].y, 1.0f); return; }
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.fxc.hlsl index 7cb37c4..62c740c5 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.fxc.hlsl
@@ -1,4 +1,4 @@ -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { +void set_matrix_scalar(inout float2x4 mat, int col, int row, float val) { switch (col) { case 0: mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; @@ -16,6 +16,6 @@ [numthreads(1, 1, 1)] void main() { - set_scalar_float2x4(m1, uniforms[0].x, uniforms[0].y, 1.0f); + set_matrix_scalar(m1, uniforms[0].x, uniforms[0].y, 1.0f); return; }
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.dxc.hlsl index cedfc5a..03fba5d 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.dxc.hlsl
@@ -1,4 +1,4 @@ -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { +void set_matrix_scalar(inout float2x4 mat, int col, int row, float val) { switch (col) { case 0: mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; @@ -16,6 +16,6 @@ [numthreads(1, 1, 1)] void main() { - set_scalar_float2x4(m1, 0, uniforms[0].y, 1.0f); + set_matrix_scalar(m1, 0, uniforms[0].y, 1.0f); return; }
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.fxc.hlsl index cedfc5a..03fba5d 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.fxc.hlsl
@@ -1,4 +1,4 @@ -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { +void set_matrix_scalar(inout float2x4 mat, int col, int row, float val) { switch (col) { case 0: mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; @@ -16,6 +16,6 @@ [numthreads(1, 1, 1)] void main() { - set_scalar_float2x4(m1, 0, uniforms[0].y, 1.0f); + set_matrix_scalar(m1, 0, uniforms[0].y, 1.0f); return; }
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.dxc.hlsl index 263c2bc..e2ba202 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.dxc.hlsl
@@ -1,4 +1,4 @@ -void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { +void set_matrix_column(inout float2x4 mat, int col, float4 val) { switch (col) { case 0: mat[0] = val; break; case 1: mat[1] = val; break; @@ -12,6 +12,6 @@ [numthreads(1, 1, 1)] void main() { - set_vector_float2x4(m1, uniforms[0].x, (1.0f).xxxx); + set_matrix_column(m1, uniforms[0].x, (1.0f).xxxx); return; }
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.fxc.hlsl index 263c2bc..e2ba202 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.fxc.hlsl
@@ -1,4 +1,4 @@ -void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { +void set_matrix_column(inout float2x4 mat, int col, float4 val) { switch (col) { case 0: mat[0] = val; break; case 1: mat[1] = val; break; @@ -12,6 +12,6 @@ [numthreads(1, 1, 1)] void main() { - set_vector_float2x4(m1, uniforms[0].x, (1.0f).xxxx); + set_matrix_column(m1, uniforms[0].x, (1.0f).xxxx); return; }
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.dxc.hlsl index 7b10259..1bc07f3 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.dxc.hlsl
@@ -1,16 +1,16 @@ -void set_float2(inout float2 vec, int idx, float val) { +void set_vector_element(inout float2 vec, int idx, float val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_int3(inout int3 vec, int idx, int val) { +void set_vector_element_1(inout int3 vec, int idx, int val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_uint4(inout uint4 vec, int idx, uint val) { +void set_vector_element_2(inout uint4 vec, int idx, uint val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_bool2(inout bool2 vec, int idx, bool val) { +void set_vector_element_3(inout bool2 vec, int idx, bool val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } @@ -22,10 +22,10 @@ void foo() { { 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); - set_bool2(v2b, i, true); + set_vector_element(v2f, i, 1.0f); + set_vector_element_1(v3i, i, 1); + set_vector_element_2(v4u, i, 1u); + set_vector_element_3(v2b, i, true); } } }
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.fxc.hlsl index 7b10259..1bc07f3 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.fxc.hlsl
@@ -1,16 +1,16 @@ -void set_float2(inout float2 vec, int idx, float val) { +void set_vector_element(inout float2 vec, int idx, float val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_int3(inout int3 vec, int idx, int val) { +void set_vector_element_1(inout int3 vec, int idx, int val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_uint4(inout uint4 vec, int idx, uint val) { +void set_vector_element_2(inout uint4 vec, int idx, uint val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_bool2(inout bool2 vec, int idx, bool val) { +void set_vector_element_3(inout bool2 vec, int idx, bool val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } @@ -22,10 +22,10 @@ void foo() { { 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); - set_bool2(v2b, i, true); + set_vector_element(v2f, i, 1.0f); + set_vector_element_1(v3i, i, 1); + set_vector_element_2(v4u, i, 1u); + set_vector_element_3(v2b, i, true); } } }
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.dxc.hlsl index 64b4fea..bb49c65 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.dxc.hlsl
@@ -1,16 +1,16 @@ -void set_float2(inout float2 vec, int idx, float val) { +void set_vector_element(inout float2 vec, int idx, float val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_int3(inout int3 vec, int idx, int val) { +void set_vector_element_1(inout int3 vec, int idx, int val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_uint4(inout uint4 vec, int idx, uint val) { +void set_vector_element_2(inout uint4 vec, int idx, uint val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_bool2(inout bool2 vec, int idx, bool val) { +void set_vector_element_3(inout bool2 vec, int idx, bool val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } @@ -21,10 +21,10 @@ void foo() { int i = 0; - set_float2(v2f, i, 1.0f); - set_int3(v3i, i, 1); - set_uint4(v4u, i, 1u); - set_bool2(v2b, i, true); + set_vector_element(v2f, i, 1.0f); + set_vector_element_1(v3i, i, 1); + set_vector_element_2(v4u, i, 1u); + set_vector_element_3(v2b, i, true); } [numthreads(1, 1, 1)]
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.fxc.hlsl index 64b4fea..bb49c65 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.fxc.hlsl
@@ -1,16 +1,16 @@ -void set_float2(inout float2 vec, int idx, float val) { +void set_vector_element(inout float2 vec, int idx, float val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_int3(inout int3 vec, int idx, int val) { +void set_vector_element_1(inout int3 vec, int idx, int val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_uint4(inout uint4 vec, int idx, uint val) { +void set_vector_element_2(inout uint4 vec, int idx, uint val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_bool2(inout bool2 vec, int idx, bool val) { +void set_vector_element_3(inout bool2 vec, int idx, bool val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } @@ -21,10 +21,10 @@ void foo() { int i = 0; - set_float2(v2f, i, 1.0f); - set_int3(v3i, i, 1); - set_uint4(v4u, i, 1u); - set_bool2(v2b, i, true); + set_vector_element(v2f, i, 1.0f); + set_vector_element_1(v3i, i, 1); + set_vector_element_2(v4u, i, 1u); + set_vector_element_3(v2b, i, true); } [numthreads(1, 1, 1)]
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.dxc.hlsl index 158e0e1..2b40cd2 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.dxc.hlsl
@@ -1,48 +1,48 @@ -void set_float2(inout float2 vec, int idx, float val) { +void set_vector_element(inout float2 vec, int idx, float val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_float3(inout float3 vec, int idx, float val) { +void set_vector_element_1(inout float3 vec, int idx, float val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_float4(inout float4 vec, int idx, float val) { +void set_vector_element_2(inout float4 vec, int idx, float val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_int2(inout int2 vec, int idx, int val) { +void set_vector_element_3(inout int2 vec, int idx, int val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_int3(inout int3 vec, int idx, int val) { +void set_vector_element_4(inout int3 vec, int idx, int val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_int4(inout int4 vec, int idx, int val) { +void set_vector_element_5(inout int4 vec, int idx, int val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_uint2(inout uint2 vec, int idx, uint val) { +void set_vector_element_6(inout uint2 vec, int idx, uint val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_uint3(inout uint3 vec, int idx, uint val) { +void set_vector_element_7(inout uint3 vec, int idx, uint val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_uint4(inout uint4 vec, int idx, uint val) { +void set_vector_element_8(inout uint4 vec, int idx, uint val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_bool2(inout bool2 vec, int idx, bool val) { +void set_vector_element_9(inout bool2 vec, int idx, bool val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_bool3(inout bool3 vec, int idx, bool val) { +void set_vector_element_10(inout bool3 vec, int idx, bool val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_bool4(inout bool4 vec, int idx, bool val) { +void set_vector_element_11(inout bool4 vec, int idx, bool val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } @@ -62,18 +62,18 @@ bool4 v4b = bool4(false, false, false, false); { 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); - set_int2(v2i, i, 1); - set_int3(v3i, i, 1); - set_int4(v4i, i, 1); - set_uint2(v2u, i, 1u); - set_uint3(v3u, i, 1u); - set_uint4(v4u, i, 1u); - set_bool2(v2b, i, true); - set_bool3(v3b, i, true); - set_bool4(v4b, i, true); + set_vector_element(v2f, i, 1.0f); + set_vector_element_1(v3f, i, 1.0f); + set_vector_element_2(v4f, i, 1.0f); + set_vector_element_3(v2i, i, 1); + set_vector_element_4(v3i, i, 1); + set_vector_element_5(v4i, i, 1); + set_vector_element_6(v2u, i, 1u); + set_vector_element_7(v3u, i, 1u); + set_vector_element_8(v4u, i, 1u); + set_vector_element_9(v2b, i, true); + set_vector_element_10(v3b, i, true); + set_vector_element_11(v4b, i, true); } } return;
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.fxc.hlsl index 158e0e1..2b40cd2 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.fxc.hlsl
@@ -1,48 +1,48 @@ -void set_float2(inout float2 vec, int idx, float val) { +void set_vector_element(inout float2 vec, int idx, float val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_float3(inout float3 vec, int idx, float val) { +void set_vector_element_1(inout float3 vec, int idx, float val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_float4(inout float4 vec, int idx, float val) { +void set_vector_element_2(inout float4 vec, int idx, float val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_int2(inout int2 vec, int idx, int val) { +void set_vector_element_3(inout int2 vec, int idx, int val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_int3(inout int3 vec, int idx, int val) { +void set_vector_element_4(inout int3 vec, int idx, int val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_int4(inout int4 vec, int idx, int val) { +void set_vector_element_5(inout int4 vec, int idx, int val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_uint2(inout uint2 vec, int idx, uint val) { +void set_vector_element_6(inout uint2 vec, int idx, uint val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_uint3(inout uint3 vec, int idx, uint val) { +void set_vector_element_7(inout uint3 vec, int idx, uint val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_uint4(inout uint4 vec, int idx, uint val) { +void set_vector_element_8(inout uint4 vec, int idx, uint val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_bool2(inout bool2 vec, int idx, bool val) { +void set_vector_element_9(inout bool2 vec, int idx, bool val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_bool3(inout bool3 vec, int idx, bool val) { +void set_vector_element_10(inout bool3 vec, int idx, bool val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_bool4(inout bool4 vec, int idx, bool val) { +void set_vector_element_11(inout bool4 vec, int idx, bool val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } @@ -62,18 +62,18 @@ bool4 v4b = bool4(false, false, false, false); { 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); - set_int2(v2i, i, 1); - set_int3(v3i, i, 1); - set_int4(v4i, i, 1); - set_uint2(v2u, i, 1u); - set_uint3(v3u, i, 1u); - set_uint4(v4u, i, 1u); - set_bool2(v2b, i, true); - set_bool3(v3b, i, true); - set_bool4(v4b, i, true); + set_vector_element(v2f, i, 1.0f); + set_vector_element_1(v3f, i, 1.0f); + set_vector_element_2(v4f, i, 1.0f); + set_vector_element_3(v2i, i, 1); + set_vector_element_4(v3i, i, 1); + set_vector_element_5(v4i, i, 1); + set_vector_element_6(v2u, i, 1u); + set_vector_element_7(v3u, i, 1u); + set_vector_element_8(v4u, i, 1u); + set_vector_element_9(v2b, i, true); + set_vector_element_10(v3b, i, true); + set_vector_element_11(v4b, i, true); } } return;
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.dxc.hlsl index 6cabffe..27051ff 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.dxc.hlsl
@@ -1,16 +1,16 @@ -void set_float2(inout float2 vec, int idx, float val) { +void set_vector_element(inout float2 vec, int idx, float val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_int3(inout int3 vec, int idx, int val) { +void set_vector_element_1(inout int3 vec, int idx, int val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_uint4(inout uint4 vec, int idx, uint val) { +void set_vector_element_2(inout uint4 vec, int idx, uint val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_bool2(inout bool2 vec, int idx, bool val) { +void set_vector_element_3(inout bool2 vec, int idx, bool val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } @@ -26,14 +26,14 @@ bool2 v2b_2 = bool2(false, false); { 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); - set_bool2(v2b, i, true); - set_float2(v2f_2, i, 1.0f); - set_int3(v3i_2, i, 1); - set_uint4(v4u_2, i, 1u); - set_bool2(v2b_2, i, true); + set_vector_element(v2f, i, 1.0f); + set_vector_element_1(v3i, i, 1); + set_vector_element_2(v4u, i, 1u); + set_vector_element_3(v2b, i, true); + set_vector_element(v2f_2, i, 1.0f); + set_vector_element_1(v3i_2, i, 1); + set_vector_element_2(v4u_2, i, 1u); + set_vector_element_3(v2b_2, i, true); } } return;
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.fxc.hlsl index 6cabffe..27051ff 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.fxc.hlsl
@@ -1,16 +1,16 @@ -void set_float2(inout float2 vec, int idx, float val) { +void set_vector_element(inout float2 vec, int idx, float val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_int3(inout int3 vec, int idx, int val) { +void set_vector_element_1(inout int3 vec, int idx, int val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_uint4(inout uint4 vec, int idx, uint val) { +void set_vector_element_2(inout uint4 vec, int idx, uint val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_bool2(inout bool2 vec, int idx, bool val) { +void set_vector_element_3(inout bool2 vec, int idx, bool val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } @@ -26,14 +26,14 @@ bool2 v2b_2 = bool2(false, false); { 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); - set_bool2(v2b, i, true); - set_float2(v2f_2, i, 1.0f); - set_int3(v3i_2, i, 1); - set_uint4(v4u_2, i, 1u); - set_bool2(v2b_2, i, true); + set_vector_element(v2f, i, 1.0f); + set_vector_element_1(v3i, i, 1); + set_vector_element_2(v4u, i, 1u); + set_vector_element_3(v2b, i, true); + set_vector_element(v2f_2, i, 1.0f); + set_vector_element_1(v3i_2, i, 1); + set_vector_element_2(v4u_2, i, 1u); + set_vector_element_3(v2b_2, i, true); } } return;
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.dxc.hlsl index 1461d03..499bc18 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.dxc.hlsl
@@ -1,48 +1,48 @@ -void set_float2(inout float2 vec, int idx, float val) { +void set_vector_element(inout float2 vec, int idx, float val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_int2(inout int2 vec, int idx, int val) { +void set_vector_element_1(inout int2 vec, int idx, int val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_uint2(inout uint2 vec, int idx, uint val) { +void set_vector_element_2(inout uint2 vec, int idx, uint val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_bool2(inout bool2 vec, int idx, bool val) { +void set_vector_element_3(inout bool2 vec, int idx, bool val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_float3(inout float3 vec, int idx, float val) { +void set_vector_element_4(inout float3 vec, int idx, float val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_float4(inout float4 vec, int idx, float val) { +void set_vector_element_5(inout float4 vec, int idx, float val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_int3(inout int3 vec, int idx, int val) { +void set_vector_element_6(inout int3 vec, int idx, int val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_int4(inout int4 vec, int idx, int val) { +void set_vector_element_7(inout int4 vec, int idx, int val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_uint3(inout uint3 vec, int idx, uint val) { +void set_vector_element_8(inout uint3 vec, int idx, uint val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_uint4(inout uint4 vec, int idx, uint val) { +void set_vector_element_9(inout uint4 vec, int idx, uint val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_bool3(inout bool3 vec, int idx, bool val) { +void set_vector_element_10(inout bool3 vec, int idx, bool val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_bool4(inout bool4 vec, int idx, bool val) { +void set_vector_element_11(inout bool4 vec, int idx, bool val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } @@ -62,20 +62,20 @@ bool4 v4b = bool4(false, false, false, false); { 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); - set_bool2(v2b, i, true); + set_vector_element(v2f, i, 1.0f); + set_vector_element_1(v2i, i, 1); + set_vector_element_2(v2u, i, 1u); + set_vector_element_3(v2b, i, true); } } int i = 0; - set_float3(v3f, i, 1.0f); - set_float4(v4f, i, 1.0f); - set_int3(v3i, i, 1); - set_int4(v4i, i, 1); - set_uint3(v3u, i, 1u); - set_uint4(v4u, i, 1u); - set_bool3(v3b, i, true); - set_bool4(v4b, i, true); + set_vector_element_4(v3f, i, 1.0f); + set_vector_element_5(v4f, i, 1.0f); + set_vector_element_6(v3i, i, 1); + set_vector_element_7(v4i, i, 1); + set_vector_element_8(v3u, i, 1u); + set_vector_element_9(v4u, i, 1u); + set_vector_element_10(v3b, i, true); + set_vector_element_11(v4b, i, true); return; }
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.fxc.hlsl index 1461d03..499bc18 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.fxc.hlsl
@@ -1,48 +1,48 @@ -void set_float2(inout float2 vec, int idx, float val) { +void set_vector_element(inout float2 vec, int idx, float val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_int2(inout int2 vec, int idx, int val) { +void set_vector_element_1(inout int2 vec, int idx, int val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_uint2(inout uint2 vec, int idx, uint val) { +void set_vector_element_2(inout uint2 vec, int idx, uint val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_bool2(inout bool2 vec, int idx, bool val) { +void set_vector_element_3(inout bool2 vec, int idx, bool val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_float3(inout float3 vec, int idx, float val) { +void set_vector_element_4(inout float3 vec, int idx, float val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_float4(inout float4 vec, int idx, float val) { +void set_vector_element_5(inout float4 vec, int idx, float val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_int3(inout int3 vec, int idx, int val) { +void set_vector_element_6(inout int3 vec, int idx, int val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_int4(inout int4 vec, int idx, int val) { +void set_vector_element_7(inout int4 vec, int idx, int val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_uint3(inout uint3 vec, int idx, uint val) { +void set_vector_element_8(inout uint3 vec, int idx, uint val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_uint4(inout uint4 vec, int idx, uint val) { +void set_vector_element_9(inout uint4 vec, int idx, uint val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_bool3(inout bool3 vec, int idx, bool val) { +void set_vector_element_10(inout bool3 vec, int idx, bool val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_bool4(inout bool4 vec, int idx, bool val) { +void set_vector_element_11(inout bool4 vec, int idx, bool val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } @@ -62,20 +62,20 @@ bool4 v4b = bool4(false, false, false, false); { 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); - set_bool2(v2b, i, true); + set_vector_element(v2f, i, 1.0f); + set_vector_element_1(v2i, i, 1); + set_vector_element_2(v2u, i, 1u); + set_vector_element_3(v2b, i, true); } } int i = 0; - set_float3(v3f, i, 1.0f); - set_float4(v4f, i, 1.0f); - set_int3(v3i, i, 1); - set_int4(v4i, i, 1); - set_uint3(v3u, i, 1u); - set_uint4(v4u, i, 1u); - set_bool3(v3b, i, true); - set_bool4(v4b, i, true); + set_vector_element_4(v3f, i, 1.0f); + set_vector_element_5(v4f, i, 1.0f); + set_vector_element_6(v3i, i, 1); + set_vector_element_7(v4i, i, 1); + set_vector_element_8(v3u, i, 1u); + set_vector_element_9(v4u, i, 1u); + set_vector_element_10(v3b, i, true); + set_vector_element_11(v4b, i, true); return; }
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.dxc.hlsl index 69170f0..7e32f5c 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.dxc.hlsl
@@ -1,48 +1,48 @@ -void set_float2(inout float2 vec, int idx, float val) { +void set_vector_element(inout float2 vec, int idx, float val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_float3(inout float3 vec, int idx, float val) { +void set_vector_element_1(inout float3 vec, int idx, float val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_float4(inout float4 vec, int idx, float val) { +void set_vector_element_2(inout float4 vec, int idx, float val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_int2(inout int2 vec, int idx, int val) { +void set_vector_element_3(inout int2 vec, int idx, int val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_int3(inout int3 vec, int idx, int val) { +void set_vector_element_4(inout int3 vec, int idx, int val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_int4(inout int4 vec, int idx, int val) { +void set_vector_element_5(inout int4 vec, int idx, int val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_uint2(inout uint2 vec, int idx, uint val) { +void set_vector_element_6(inout uint2 vec, int idx, uint val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_uint3(inout uint3 vec, int idx, uint val) { +void set_vector_element_7(inout uint3 vec, int idx, uint val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_uint4(inout uint4 vec, int idx, uint val) { +void set_vector_element_8(inout uint4 vec, int idx, uint val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_bool2(inout bool2 vec, int idx, bool val) { +void set_vector_element_9(inout bool2 vec, int idx, bool val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_bool3(inout bool3 vec, int idx, bool val) { +void set_vector_element_10(inout bool3 vec, int idx, bool val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_bool4(inout bool4 vec, int idx, bool val) { +void set_vector_element_11(inout bool4 vec, int idx, bool val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } @@ -61,17 +61,17 @@ bool3 v3b = bool3(false, false, false); bool4 v4b = bool4(false, false, false, false); int i = 0; - set_float2(v2f, i, 1.0f); - set_float3(v3f, i, 1.0f); - set_float4(v4f, i, 1.0f); - set_int2(v2i, i, 1); - set_int3(v3i, i, 1); - set_int4(v4i, i, 1); - set_uint2(v2u, i, 1u); - set_uint3(v3u, i, 1u); - set_uint4(v4u, i, 1u); - set_bool2(v2b, i, true); - set_bool3(v3b, i, true); - set_bool4(v4b, i, true); + set_vector_element(v2f, i, 1.0f); + set_vector_element_1(v3f, i, 1.0f); + set_vector_element_2(v4f, i, 1.0f); + set_vector_element_3(v2i, i, 1); + set_vector_element_4(v3i, i, 1); + set_vector_element_5(v4i, i, 1); + set_vector_element_6(v2u, i, 1u); + set_vector_element_7(v3u, i, 1u); + set_vector_element_8(v4u, i, 1u); + set_vector_element_9(v2b, i, true); + set_vector_element_10(v3b, i, true); + set_vector_element_11(v4b, i, true); return; }
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.fxc.hlsl index 69170f0..7e32f5c 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.fxc.hlsl
@@ -1,48 +1,48 @@ -void set_float2(inout float2 vec, int idx, float val) { +void set_vector_element(inout float2 vec, int idx, float val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_float3(inout float3 vec, int idx, float val) { +void set_vector_element_1(inout float3 vec, int idx, float val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_float4(inout float4 vec, int idx, float val) { +void set_vector_element_2(inout float4 vec, int idx, float val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_int2(inout int2 vec, int idx, int val) { +void set_vector_element_3(inout int2 vec, int idx, int val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_int3(inout int3 vec, int idx, int val) { +void set_vector_element_4(inout int3 vec, int idx, int val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_int4(inout int4 vec, int idx, int val) { +void set_vector_element_5(inout int4 vec, int idx, int val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_uint2(inout uint2 vec, int idx, uint val) { +void set_vector_element_6(inout uint2 vec, int idx, uint val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_uint3(inout uint3 vec, int idx, uint val) { +void set_vector_element_7(inout uint3 vec, int idx, uint val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_uint4(inout uint4 vec, int idx, uint val) { +void set_vector_element_8(inout uint4 vec, int idx, uint val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } -void set_bool2(inout bool2 vec, int idx, bool val) { +void set_vector_element_9(inout bool2 vec, int idx, bool val) { vec = (idx.xx == int2(0, 1)) ? val.xx : vec; } -void set_bool3(inout bool3 vec, int idx, bool val) { +void set_vector_element_10(inout bool3 vec, int idx, bool val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } -void set_bool4(inout bool4 vec, int idx, bool val) { +void set_vector_element_11(inout bool4 vec, int idx, bool val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } @@ -61,17 +61,17 @@ bool3 v3b = bool3(false, false, false); bool4 v4b = bool4(false, false, false, false); int i = 0; - set_float2(v2f, i, 1.0f); - set_float3(v3f, i, 1.0f); - set_float4(v4f, i, 1.0f); - set_int2(v2i, i, 1); - set_int3(v3i, i, 1); - set_int4(v4i, i, 1); - set_uint2(v2u, i, 1u); - set_uint3(v3u, i, 1u); - set_uint4(v4u, i, 1u); - set_bool2(v2b, i, true); - set_bool3(v3b, i, true); - set_bool4(v4b, i, true); + set_vector_element(v2f, i, 1.0f); + set_vector_element_1(v3f, i, 1.0f); + set_vector_element_2(v4f, i, 1.0f); + set_vector_element_3(v2i, i, 1); + set_vector_element_4(v3i, i, 1); + set_vector_element_5(v4i, i, 1); + set_vector_element_6(v2u, i, 1u); + set_vector_element_7(v3u, i, 1u); + set_vector_element_8(v4u, i, 1u); + set_vector_element_9(v2b, i, true); + set_vector_element_10(v3b, i, true); + set_vector_element_11(v4b, i, true); return; }
diff --git a/test/tint/bug/tint/1563.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1563.wgsl.expected.dxc.hlsl index 0dfb59d..55c2cc1 100644 --- a/test/tint/bug/tint/1563.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/tint/1563.wgsl.expected.dxc.hlsl
@@ -1,4 +1,4 @@ -void set_float4(inout float4 vec, int idx, float val) { +void set_vector_element(inout float4 vec, int idx, float val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } @@ -11,6 +11,6 @@ const int oob = 99; const float b = (0.0f).xxxx[min(uint(oob), 3u)]; float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); - set_float4(v, min(uint(oob), 3u), b); + set_vector_element(v, min(uint(oob), 3u), b); return b; }
diff --git a/test/tint/bug/tint/1563.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1563.wgsl.expected.fxc.hlsl index 0dfb59d..55c2cc1 100644 --- a/test/tint/bug/tint/1563.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/tint/1563.wgsl.expected.fxc.hlsl
@@ -1,4 +1,4 @@ -void set_float4(inout float4 vec, int idx, float val) { +void set_vector_element(inout float4 vec, int idx, float val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } @@ -11,6 +11,6 @@ const int oob = 99; const float b = (0.0f).xxxx[min(uint(oob), 3u)]; float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); - set_float4(v, min(uint(oob), 3u), b); + set_vector_element(v, min(uint(oob), 3u), b); return b; }
diff --git a/test/tint/bug/tint/2059.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/2059.wgsl.expected.dxc.hlsl index 0c85f3a..d16b843 100644 --- a/test/tint/bug/tint/2059.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/tint/2059.wgsl.expected.dxc.hlsl
@@ -1,4 +1,4 @@ -void set_vector_float3x3(inout float3x3 mat, int col, float3 val) { +void set_matrix_column(inout float3x3 mat, int col, float3 val) { switch (col) { case 0: mat[0] = val; break; case 1: mat[1] = val; break; @@ -167,7 +167,7 @@ float3x3 m = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); { for(uint c = 0u; (c < 3u); c = (c + 1u)) { - set_vector_float3x3(m, c, float3(float(((c * 3u) + 1u)), float(((c * 3u) + 2u)), float(((c * 3u) + 3u)))); + set_matrix_column(m, c, float3(float(((c * 3u) + 1u)), float(((c * 3u) + 2u)), float(((c * 3u) + 3u)))); } } {
diff --git a/test/tint/bug/tint/2059.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/2059.wgsl.expected.fxc.hlsl index 0c85f3a..d16b843 100644 --- a/test/tint/bug/tint/2059.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/tint/2059.wgsl.expected.fxc.hlsl
@@ -1,4 +1,4 @@ -void set_vector_float3x3(inout float3x3 mat, int col, float3 val) { +void set_matrix_column(inout float3x3 mat, int col, float3 val) { switch (col) { case 0: mat[0] = val; break; case 1: mat[1] = val; break; @@ -167,7 +167,7 @@ float3x3 m = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); { for(uint c = 0u; (c < 3u); c = (c + 1u)) { - set_vector_float3x3(m, c, float3(float(((c * 3u) + 1u)), float(((c * 3u) + 2u)), float(((c * 3u) + 3u)))); + set_matrix_column(m, c, float3(float(((c * 3u) + 1u)), float(((c * 3u) + 2u)), float(((c * 3u) + 3u)))); } } {
diff --git a/test/tint/bug/tint/2146.wgsl b/test/tint/bug/tint/2146.wgsl new file mode 100644 index 0000000..3c58d17 --- /dev/null +++ b/test/tint/bug/tint/2146.wgsl
@@ -0,0 +1,21 @@ +// flags: --hlsl_shader_model 66 + +enable f16; + +var<private> localId: vec3<u32>; +var<private> localIndex: u32; +var<private> globalId: vec3<u32>; +var<private> numWorkgroups: vec3<u32>; +var<private> workgroupId: vec3<u32>; + + +fn globalId2Index()-> u32 { +return globalId.x; +} + +@compute @workgroup_size(1, 1, 1) +fn main() { + var a = vec4<f16>(0,0,0,0); + let b = (f16(0)+f16(1)); + a[0] += b; +}
diff --git a/test/tint/bug/tint/2146.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/2146.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000..f2478b6 --- /dev/null +++ b/test/tint/bug/tint/2146.wgsl.expected.dxc.hlsl
@@ -0,0 +1,22 @@ +void set_vector_element(inout vector<float16_t, 4> vec, int idx, float16_t val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +static uint3 localId = uint3(0u, 0u, 0u); +static uint localIndex = 0u; +static uint3 globalId = uint3(0u, 0u, 0u); +static uint3 numWorkgroups = uint3(0u, 0u, 0u); +static uint3 workgroupId = uint3(0u, 0u, 0u); + +uint globalId2Index() { + return globalId.x; +} + +[numthreads(1, 1, 1)] +void main() { + vector<float16_t, 4> a = (float16_t(0.0h)).xxxx; + const float16_t b = float16_t(1.0h); + const int tint_symbol_1 = 0; + set_vector_element(a, tint_symbol_1, (a[tint_symbol_1] + b)); + return; +}
diff --git a/test/tint/bug/tint/2146.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/2146.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000..a21f98e --- /dev/null +++ b/test/tint/bug/tint/2146.wgsl.expected.fxc.hlsl
@@ -0,0 +1,28 @@ +SKIP: FAILED + +void set_vector_element(inout vector<float16_t, 4> vec, int idx, float16_t val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +static uint3 localId = uint3(0u, 0u, 0u); +static uint localIndex = 0u; +static uint3 globalId = uint3(0u, 0u, 0u); +static uint3 numWorkgroups = uint3(0u, 0u, 0u); +static uint3 workgroupId = uint3(0u, 0u, 0u); + +uint globalId2Index() { + return globalId.x; +} + +[numthreads(1, 1, 1)] +void main() { + vector<float16_t, 4> a = (float16_t(0.0h)).xxxx; + const float16_t b = float16_t(1.0h); + const int tint_symbol_1 = 0; + set_vector_element(a, tint_symbol_1, (a[tint_symbol_1] + b)); + return; +} +FXC validation failure: +C:\src\dawn\Shader@0x000001DC942B5A50(1,38-46): error X3000: syntax error: unexpected token 'float16_t' +C:\src\dawn\Shader@0x000001DC942B5A50(2,3-5): error X3004: undeclared identifier 'vec' +
diff --git a/test/tint/bug/tint/2146.wgsl.expected.glsl b/test/tint/bug/tint/2146.wgsl.expected.glsl new file mode 100644 index 0000000..e3ed540 --- /dev/null +++ b/test/tint/bug/tint/2146.wgsl.expected.glsl
@@ -0,0 +1,15 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tint_symbol() { + f16vec4 a = f16vec4(0.0hf); + float16_t b = 1.0hf; + int tint_symbol_2 = 0; + a[tint_symbol_2] = (a[tint_symbol_2] + b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + tint_symbol(); + return; +}
diff --git a/test/tint/bug/tint/2146.wgsl.expected.msl b/test/tint/bug/tint/2146.wgsl.expected.msl new file mode 100644 index 0000000..cbbabcb --- /dev/null +++ b/test/tint/bug/tint/2146.wgsl.expected.msl
@@ -0,0 +1,23 @@ +#include <metal_stdlib> + +using namespace metal; +struct tint_private_vars_struct { + uint3 localId; + uint localIndex; + uint3 globalId; + uint3 numWorkgroups; + uint3 workgroupId; +}; + +uint globalId2Index(thread tint_private_vars_struct* const tint_private_vars) { + return (*(tint_private_vars)).globalId[0]; +} + +kernel void tint_symbol() { + half4 a = half4(0.0h); + half const b = 1.0h; + int const tint_symbol_2 = 0; + a[tint_symbol_2] = (a[tint_symbol_2] + b); + return; +} +
diff --git a/test/tint/bug/tint/2146.wgsl.expected.spvasm b/test/tint/bug/tint/2146.wgsl.expected.spvasm new file mode 100644 index 0000000..6f724b5 --- /dev/null +++ b/test/tint/bug/tint/2146.wgsl.expected.spvasm
@@ -0,0 +1,61 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %localId "localId" + OpName %localIndex "localIndex" + OpName %globalId "globalId" + OpName %numWorkgroups "numWorkgroups" + OpName %workgroupId "workgroupId" + OpName %globalId2Index "globalId2Index" + OpName %main "main" + OpName %a "a" + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %localId = OpVariable %_ptr_Private_v3uint Private %5 +%_ptr_Private_uint = OpTypePointer Private %uint + %8 = OpConstantNull %uint + %localIndex = OpVariable %_ptr_Private_uint Private %8 + %globalId = OpVariable %_ptr_Private_v3uint Private %5 +%numWorkgroups = OpVariable %_ptr_Private_v3uint Private %5 +%workgroupId = OpVariable %_ptr_Private_v3uint Private %5 + %12 = OpTypeFunction %uint + %uint_0 = OpConstant %uint 0 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %24 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %int = OpTypeInt 32 1 + %29 = OpConstantNull %int +%_ptr_Function_half = OpTypePointer Function %half +%globalId2Index = OpFunction %uint None %12 + %14 = OpLabel + %16 = OpAccessChain %_ptr_Private_uint %globalId %uint_0 + %17 = OpLoad %uint %16 + OpReturnValue %17 + OpFunctionEnd + %main = OpFunction %void None %18 + %21 = OpLabel + %a = OpVariable %_ptr_Function_v4half Function %24 + OpStore %a %24 + %31 = OpAccessChain %_ptr_Function_half %a %29 + %32 = OpAccessChain %_ptr_Function_half %a %29 + %33 = OpLoad %half %32 + %34 = OpFAdd %half %33 %half_0x1p_0 + OpStore %31 %34 + OpReturn + OpFunctionEnd
diff --git a/test/tint/bug/tint/2146.wgsl.expected.wgsl b/test/tint/bug/tint/2146.wgsl.expected.wgsl new file mode 100644 index 0000000..4e99da1 --- /dev/null +++ b/test/tint/bug/tint/2146.wgsl.expected.wgsl
@@ -0,0 +1,22 @@ +enable f16; + +var<private> localId : vec3<u32>; + +var<private> localIndex : u32; + +var<private> globalId : vec3<u32>; + +var<private> numWorkgroups : vec3<u32>; + +var<private> workgroupId : vec3<u32>; + +fn globalId2Index() -> u32 { + return globalId.x; +} + +@compute @workgroup_size(1, 1, 1) +fn main() { + var a = vec4<f16>(0, 0, 0, 0); + let b = (f16(0) + f16(1)); + a[0] += b; +}
diff --git a/test/tint/bug/tint/534.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/534.wgsl.expected.dxc.hlsl index 17e2f5f..0e6d501 100644 --- a/test/tint/bug/tint/534.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/tint/534.wgsl.expected.dxc.hlsl
@@ -1,4 +1,4 @@ -void set_uint4(inout uint4 vec, int idx, uint val) { +void set_vector_element(inout uint4 vec, int idx, uint val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } @@ -38,7 +38,7 @@ { for(uint i = 0u; (i < uniforms[0].w); i = (i + 1u)) { const uint tint_symbol_1 = i; - set_uint4(srcColorBits, tint_symbol_1, ConvertToFp16FloatValue(srcColor[i])); + set_vector_element(srcColorBits, tint_symbol_1, ConvertToFp16FloatValue(srcColor[i])); bool tint_tmp_1 = success; if (tint_tmp_1) { tint_tmp_1 = (srcColorBits[i] == dstColorBits[i]);
diff --git a/test/tint/bug/tint/534.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/534.wgsl.expected.fxc.hlsl index 17e2f5f..0e6d501 100644 --- a/test/tint/bug/tint/534.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/tint/534.wgsl.expected.fxc.hlsl
@@ -1,4 +1,4 @@ -void set_uint4(inout uint4 vec, int idx, uint val) { +void set_vector_element(inout uint4 vec, int idx, uint val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } @@ -38,7 +38,7 @@ { for(uint i = 0u; (i < uniforms[0].w); i = (i + 1u)) { const uint tint_symbol_1 = i; - set_uint4(srcColorBits, tint_symbol_1, ConvertToFp16FloatValue(srcColor[i])); + set_vector_element(srcColorBits, tint_symbol_1, ConvertToFp16FloatValue(srcColor[i])); bool tint_tmp_1 = success; if (tint_tmp_1) { tint_tmp_1 = (srcColorBits[i] == dstColorBits[i]);
diff --git a/test/tint/bug/tint/980.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/980.wgsl.expected.dxc.hlsl index 6c9ec67..0e4a5a5 100644 --- a/test/tint/bug/tint/980.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/tint/980.wgsl.expected.dxc.hlsl
@@ -1,10 +1,10 @@ -void set_float3(inout float3 vec, int idx, float val) { +void set_vector_element(inout float3 vec, int idx, float val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } float3 Bad(uint index, float3 rd) { float3 normal = (0.0f).xxx; - set_float3(normal, index, -(float(sign(rd[index])))); + set_vector_element(normal, index, -(float(sign(rd[index])))); return normalize(normal); }
diff --git a/test/tint/bug/tint/980.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/980.wgsl.expected.fxc.hlsl index 6c9ec67..0e4a5a5 100644 --- a/test/tint/bug/tint/980.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/tint/980.wgsl.expected.fxc.hlsl
@@ -1,10 +1,10 @@ -void set_float3(inout float3 vec, int idx, float val) { +void set_vector_element(inout float3 vec, int idx, float val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } float3 Bad(uint index, float3 rd) { float3 normal = (0.0f).xxx; - set_float3(normal, index, -(float(sign(rd[index])))); + set_vector_element(normal, index, -(float(sign(rd[index])))); return normalize(normal); }
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.dxc.hlsl index 642e72c..4364c02 100644 --- a/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.dxc.hlsl +++ b/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.dxc.hlsl
@@ -1,4 +1,4 @@ -void set_vector_float2x2(inout float2x2 mat, int col, float2 val) { +void set_matrix_column(inout float2x2 mat, int col, float2 val) { switch (col) { case 0: mat[0] = val; break; case 1: mat[1] = val; break; @@ -8,7 +8,7 @@ groupshared float2x2 S; void func_S_X(uint pointer[1]) { - set_vector_float2x2(S, pointer[0], (0.0f).xx); + set_matrix_column(S, pointer[0], (0.0f).xx); } struct tint_symbol_1 {
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.fxc.hlsl index 642e72c..4364c02 100644 --- a/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.fxc.hlsl +++ b/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.fxc.hlsl
@@ -1,4 +1,4 @@ -void set_vector_float2x2(inout float2x2 mat, int col, float2 val) { +void set_matrix_column(inout float2x2 mat, int col, float2 val) { switch (col) { case 0: mat[0] = val; break; case 1: mat[1] = val; break; @@ -8,7 +8,7 @@ groupshared float2x2 S; void func_S_X(uint pointer[1]) { - set_vector_float2x2(S, pointer[0], (0.0f).xx); + set_matrix_column(S, pointer[0], (0.0f).xx); } struct tint_symbol_1 {
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.dxc.hlsl index bceda5e..084b6f0 100644 --- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.dxc.hlsl +++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.dxc.hlsl
@@ -1,4 +1,4 @@ -void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { +void set_matrix_column(inout float2x4 mat, int col, float4 val) { switch (col) { case 0: mat[0] = val; break; case 1: mat[1] = val; break; @@ -8,7 +8,7 @@ groupshared float2x4 S; void func_S_X(uint pointer[1]) { - set_vector_float2x4(S, pointer[0], (0.0f).xxxx); + set_matrix_column(S, pointer[0], (0.0f).xxxx); } struct tint_symbol_1 {
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.fxc.hlsl index bceda5e..084b6f0 100644 --- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.fxc.hlsl +++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.fxc.hlsl
@@ -1,4 +1,4 @@ -void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { +void set_matrix_column(inout float2x4 mat, int col, float4 val) { switch (col) { case 0: mat[0] = val; break; case 1: mat[1] = val; break; @@ -8,7 +8,7 @@ groupshared float2x4 S; void func_S_X(uint pointer[1]) { - set_vector_float2x4(S, pointer[0], (0.0f).xxxx); + set_matrix_column(S, pointer[0], (0.0f).xxxx); } struct tint_symbol_1 {
diff --git a/test/tint/ptr_sugar/compound_assign_index.wgsl.expected.dxc.hlsl b/test/tint/ptr_sugar/compound_assign_index.wgsl.expected.dxc.hlsl index 25853e3..e995a25 100644 --- a/test/tint/ptr_sugar/compound_assign_index.wgsl.expected.dxc.hlsl +++ b/test/tint/ptr_sugar/compound_assign_index.wgsl.expected.dxc.hlsl
@@ -1,29 +1,29 @@ -void set_int3(inout int3 vec, int idx, int val) { +void set_vector_element(inout int3 vec, int idx, int val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } void deref() { int3 a = int3(0, 0, 0); const int tint_symbol_1 = 0; - set_int3(a, tint_symbol_1, (a[tint_symbol_1] + 42)); + set_vector_element(a, tint_symbol_1, (a[tint_symbol_1] + 42)); } void no_deref() { int3 a = int3(0, 0, 0); const int tint_symbol_3 = 0; - set_int3(a, tint_symbol_3, (a[tint_symbol_3] + 42)); + set_vector_element(a, tint_symbol_3, (a[tint_symbol_3] + 42)); } void deref_inc() { int3 a = int3(0, 0, 0); const int tint_symbol_5 = 0; - set_int3(a, tint_symbol_5, (a[tint_symbol_5] + 1)); + set_vector_element(a, tint_symbol_5, (a[tint_symbol_5] + 1)); } void no_deref_inc() { int3 a = int3(0, 0, 0); const int tint_symbol_7 = 0; - set_int3(a, tint_symbol_7, (a[tint_symbol_7] + 1)); + set_vector_element(a, tint_symbol_7, (a[tint_symbol_7] + 1)); } [numthreads(1, 1, 1)]
diff --git a/test/tint/ptr_sugar/compound_assign_index.wgsl.expected.fxc.hlsl b/test/tint/ptr_sugar/compound_assign_index.wgsl.expected.fxc.hlsl index 25853e3..e995a25 100644 --- a/test/tint/ptr_sugar/compound_assign_index.wgsl.expected.fxc.hlsl +++ b/test/tint/ptr_sugar/compound_assign_index.wgsl.expected.fxc.hlsl
@@ -1,29 +1,29 @@ -void set_int3(inout int3 vec, int idx, int val) { +void set_vector_element(inout int3 vec, int idx, int val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } void deref() { int3 a = int3(0, 0, 0); const int tint_symbol_1 = 0; - set_int3(a, tint_symbol_1, (a[tint_symbol_1] + 42)); + set_vector_element(a, tint_symbol_1, (a[tint_symbol_1] + 42)); } void no_deref() { int3 a = int3(0, 0, 0); const int tint_symbol_3 = 0; - set_int3(a, tint_symbol_3, (a[tint_symbol_3] + 42)); + set_vector_element(a, tint_symbol_3, (a[tint_symbol_3] + 42)); } void deref_inc() { int3 a = int3(0, 0, 0); const int tint_symbol_5 = 0; - set_int3(a, tint_symbol_5, (a[tint_symbol_5] + 1)); + set_vector_element(a, tint_symbol_5, (a[tint_symbol_5] + 1)); } void no_deref_inc() { int3 a = int3(0, 0, 0); const int tint_symbol_7 = 0; - set_int3(a, tint_symbol_7, (a[tint_symbol_7] + 1)); + set_vector_element(a, tint_symbol_7, (a[tint_symbol_7] + 1)); } [numthreads(1, 1, 1)]
diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.dxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.dxc.hlsl index 0ec20f0..76df457 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.dxc.hlsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.dxc.hlsl
@@ -1,11 +1,11 @@ -void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { +void set_matrix_column(inout float2x4 mat, int col, float4 val) { switch (col) { case 0: mat[0] = val; break; case 1: mat[1] = val; break; } } -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { +void set_matrix_scalar(inout float2x4 mat, int col, int row, float val) { switch (col) { case 0: mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; @@ -27,7 +27,7 @@ [numthreads(1, 1, 1)] void main() { OuterS s1 = (OuterS)0; - set_vector_float2x4(s1.m1, uniforms[0].x, (1.0f).xxxx); - set_scalar_float2x4(s1.m1, uniforms[0].x, uniforms[0].x, 1.0f); + set_matrix_column(s1.m1, uniforms[0].x, (1.0f).xxxx); + set_matrix_scalar(s1.m1, uniforms[0].x, uniforms[0].x, 1.0f); return; }
diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.fxc.hlsl index 0ec20f0..76df457 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.fxc.hlsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.fxc.hlsl
@@ -1,11 +1,11 @@ -void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { +void set_matrix_column(inout float2x4 mat, int col, float4 val) { switch (col) { case 0: mat[0] = val; break; case 1: mat[1] = val; break; } } -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { +void set_matrix_scalar(inout float2x4 mat, int col, int row, float val) { switch (col) { case 0: mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; @@ -27,7 +27,7 @@ [numthreads(1, 1, 1)] void main() { OuterS s1 = (OuterS)0; - set_vector_float2x4(s1.m1, uniforms[0].x, (1.0f).xxxx); - set_scalar_float2x4(s1.m1, uniforms[0].x, uniforms[0].x, 1.0f); + set_matrix_column(s1.m1, uniforms[0].x, (1.0f).xxxx); + set_matrix_scalar(s1.m1, uniforms[0].x, uniforms[0].x, 1.0f); return; }
diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.dxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.dxc.hlsl index dc3f415..e556fab 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.dxc.hlsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.dxc.hlsl
@@ -1,4 +1,4 @@ -void set_float3(inout float3 vec, int idx, float val) { +void set_vector_element(inout float3 vec, int idx, float val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } @@ -13,6 +13,6 @@ [numthreads(1, 1, 1)] void main() { OuterS s1 = (OuterS)0; - set_float3(s1.v1, uniforms[0].x, 1.0f); + set_vector_element(s1.v1, uniforms[0].x, 1.0f); return; }
diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.fxc.hlsl index dc3f415..e556fab 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.fxc.hlsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.fxc.hlsl
@@ -1,4 +1,4 @@ -void set_float3(inout float3 vec, int idx, float val) { +void set_vector_element(inout float3 vec, int idx, float val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } @@ -13,6 +13,6 @@ [numthreads(1, 1, 1)] void main() { OuterS s1 = (OuterS)0; - set_float3(s1.v1, uniforms[0].x, 1.0f); + set_vector_element(s1.v1, uniforms[0].x, 1.0f); return; }
diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.dxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.dxc.hlsl index 2d0a255..1676c4b 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.dxc.hlsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.dxc.hlsl
@@ -1,4 +1,4 @@ -void set_float3(inout float3 vec, int idx, float val) { +void set_vector_element(inout float3 vec, int idx, float val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } @@ -18,8 +18,8 @@ void main() { OuterS s1 = (OuterS)0; float3 v = float3(0.0f, 0.0f, 0.0f); - set_float3(v, s1.a1[uniforms[0].x], 1.0f); + set_vector_element(v, s1.a1[uniforms[0].x], 1.0f); const uint tint_symbol = f(s1.a1[uniforms[0].x]); - set_float3(v, tint_symbol, 1.0f); + set_vector_element(v, tint_symbol, 1.0f); return; }
diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.fxc.hlsl index 2d0a255..1676c4b 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.fxc.hlsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.fxc.hlsl
@@ -1,4 +1,4 @@ -void set_float3(inout float3 vec, int idx, float val) { +void set_vector_element(inout float3 vec, int idx, float val) { vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; } @@ -18,8 +18,8 @@ void main() { OuterS s1 = (OuterS)0; float3 v = float3(0.0f, 0.0f, 0.0f); - set_float3(v, s1.a1[uniforms[0].x], 1.0f); + set_vector_element(v, s1.a1[uniforms[0].x], 1.0f); const uint tint_symbol = f(s1.a1[uniforms[0].x]); - set_float3(v, tint_symbol, 1.0f); + set_vector_element(v, tint_symbol, 1.0f); return; }
diff --git a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.dxc.hlsl index 2edcd67..b3add26 100644 --- a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.dxc.hlsl +++ b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.dxc.hlsl
@@ -1,4 +1,4 @@ -void set_int4(inout int4 vec, int idx, int val) { +void set_vector_element(inout int4 vec, int idx, int val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } @@ -29,7 +29,7 @@ const int tint_symbol_1 = bar(); { int4 tint_symbol_3[4] = x.a; - set_int4(tint_symbol_3[tint_symbol_save], tint_symbol_1, (x.a[tint_symbol_save][tint_symbol_1] + 5)); + set_vector_element(tint_symbol_3[tint_symbol_save], tint_symbol_1, (x.a[tint_symbol_save][tint_symbol_1] + 5)); x.a = tint_symbol_3; } }
diff --git a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.fxc.hlsl index 2edcd67..b3add26 100644 --- a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.fxc.hlsl +++ b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.fxc.hlsl
@@ -1,4 +1,4 @@ -void set_int4(inout int4 vec, int idx, int val) { +void set_vector_element(inout int4 vec, int idx, int val) { vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; } @@ -29,7 +29,7 @@ const int tint_symbol_1 = bar(); { int4 tint_symbol_3[4] = x.a; - set_int4(tint_symbol_3[tint_symbol_save], tint_symbol_1, (x.a[tint_symbol_save][tint_symbol_1] + 5)); + set_vector_element(tint_symbol_3[tint_symbol_save], tint_symbol_1, (x.a[tint_symbol_save][tint_symbol_1] + 5)); x.a = tint_symbol_3; } }