HLSL-IR: ReplaceNonIndexableMatVecStores transform
FXC workaround for cases of stores to dynamically-indexed shader-local
matrices and vectors.
Bug: 368355095
Change-Id: Ie4c61ff69e7cf7db1880ea8813ec04ab01352638
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/209755
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/lang/hlsl/writer/raise/BUILD.bazel b/src/tint/lang/hlsl/writer/raise/BUILD.bazel
index ba70b5f..46be924 100644
--- a/src/tint/lang/hlsl/writer/raise/BUILD.bazel
+++ b/src/tint/lang/hlsl/writer/raise/BUILD.bazel
@@ -47,6 +47,7 @@
"localize_struct_array_assignment.cc",
"promote_initializers.cc",
"raise.cc",
+ "replace_non_indexable_mat_vec_stores.cc",
"shader_io.cc",
],
hdrs = [
@@ -58,6 +59,7 @@
"localize_struct_array_assignment.h",
"promote_initializers.h",
"raise.h",
+ "replace_non_indexable_mat_vec_stores.h",
"shader_io.h",
],
deps = [
@@ -103,6 +105,7 @@
"fxc_polyfill_test.cc",
"localize_struct_array_assignment_test.cc",
"promote_initializers_test.cc",
+ "replace_non_indexable_mat_vec_stores_test.cc",
"shader_io_test.cc",
],
deps = [
diff --git a/src/tint/lang/hlsl/writer/raise/BUILD.cmake b/src/tint/lang/hlsl/writer/raise/BUILD.cmake
index 814c9fe..9f2515b 100644
--- a/src/tint/lang/hlsl/writer/raise/BUILD.cmake
+++ b/src/tint/lang/hlsl/writer/raise/BUILD.cmake
@@ -55,6 +55,8 @@
lang/hlsl/writer/raise/promote_initializers.h
lang/hlsl/writer/raise/raise.cc
lang/hlsl/writer/raise/raise.h
+ lang/hlsl/writer/raise/replace_non_indexable_mat_vec_stores.cc
+ lang/hlsl/writer/raise/replace_non_indexable_mat_vec_stores.h
lang/hlsl/writer/raise/shader_io.cc
lang/hlsl/writer/raise/shader_io.h
)
@@ -104,6 +106,7 @@
lang/hlsl/writer/raise/fxc_polyfill_test.cc
lang/hlsl/writer/raise/localize_struct_array_assignment_test.cc
lang/hlsl/writer/raise/promote_initializers_test.cc
+ lang/hlsl/writer/raise/replace_non_indexable_mat_vec_stores_test.cc
lang/hlsl/writer/raise/shader_io_test.cc
)
diff --git a/src/tint/lang/hlsl/writer/raise/BUILD.gn b/src/tint/lang/hlsl/writer/raise/BUILD.gn
index 882d21f..48efb8d 100644
--- a/src/tint/lang/hlsl/writer/raise/BUILD.gn
+++ b/src/tint/lang/hlsl/writer/raise/BUILD.gn
@@ -61,6 +61,8 @@
"promote_initializers.h",
"raise.cc",
"raise.h",
+ "replace_non_indexable_mat_vec_stores.cc",
+ "replace_non_indexable_mat_vec_stores.h",
"shader_io.cc",
"shader_io.h",
]
@@ -104,6 +106,7 @@
"fxc_polyfill_test.cc",
"localize_struct_array_assignment_test.cc",
"promote_initializers_test.cc",
+ "replace_non_indexable_mat_vec_stores_test.cc",
"shader_io_test.cc",
]
deps = [
diff --git a/src/tint/lang/hlsl/writer/raise/raise.cc b/src/tint/lang/hlsl/writer/raise/raise.cc
index feecca8..228d1e4 100644
--- a/src/tint/lang/hlsl/writer/raise/raise.cc
+++ b/src/tint/lang/hlsl/writer/raise/raise.cc
@@ -54,6 +54,7 @@
#include "src/tint/lang/hlsl/writer/raise/fxc_polyfill.h"
#include "src/tint/lang/hlsl/writer/raise/localize_struct_array_assignment.h"
#include "src/tint/lang/hlsl/writer/raise/promote_initializers.h"
+#include "src/tint/lang/hlsl/writer/raise/replace_non_indexable_mat_vec_stores.h"
#include "src/tint/lang/hlsl/writer/raise/shader_io.h"
#include "src/tint/utils/result/result.h"
@@ -138,6 +139,7 @@
if (options.compiler == Options::Compiler::kFXC) {
RUN_TRANSFORM(raise::FxcPolyfill, module);
RUN_TRANSFORM(raise::LocalizeStructArrayAssignment, module);
+ RUN_TRANSFORM(raise::ReplaceNonIndexableMatVecStores, module);
}
if (!options.disable_robustness) {
diff --git a/src/tint/lang/hlsl/writer/raise/replace_non_indexable_mat_vec_stores.cc b/src/tint/lang/hlsl/writer/raise/replace_non_indexable_mat_vec_stores.cc
new file mode 100644
index 0000000..1cf3f3f
--- /dev/null
+++ b/src/tint/lang/hlsl/writer/raise/replace_non_indexable_mat_vec_stores.cc
@@ -0,0 +1,300 @@
+// Copyright 2024 The Dawn & Tint Authors
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "src/tint/lang/hlsl/writer/raise/replace_non_indexable_mat_vec_stores.h"
+
+#include "src/tint/lang/core/ir/builder.h"
+#include "src/tint/lang/core/ir/validator.h"
+#include "src/tint/utils/result/result.h"
+
+namespace tint::hlsl::writer::raise {
+namespace {
+
+using namespace tint::core::fluent_types; // NOLINT
+using namespace tint::core::number_suffixes; // NOLINT
+
+/// PIMPL state for the transform.
+struct State {
+ /// The IR module.
+ core::ir::Module& ir;
+
+ /// The IR builder.
+ core::ir::Builder b{ir};
+
+ /// The type manager.
+ core::type::Manager& ty{ir.Types()};
+
+ const core::type::Type* GetElementType(const core::type::Type* type,
+ const core::ir::Value* idx) {
+ if (auto* constant = idx->As<core::ir::Constant>()) {
+ auto i = constant->Value()->ValueAs<u32>();
+ return type->Element(i);
+ }
+ return type->Elements().type;
+ }
+
+ bool IsConstant(core::ir::Value* value) {
+ if (value->Is<core::ir::Constant>()) {
+ return true;
+ }
+ // Also check for lets to constant, which is a common use-case
+ if (auto* result = value->As<core::ir::InstructionResult>()) {
+ if (auto* let = result->Instruction()->As<core::ir::Let>()) {
+ if (let->Value()->Is<core::ir::Constant>()) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ // If the input access chain is a dynamic index to a matrix, this function will replace the
+ // input store (either a Store or a StoreVectorElement) with a switch statement over the
+ // dynamic index, with a case for each column index used to index the matrix directly.
+ // Returns a vector of the new Store/StoreVectorElements that were created in each case block.
+ // NOTE: `store` may be destroyed
+ Vector<core::ir::Instruction*, 4> ProcessMatrixColumnAccess(core::ir::Instruction* store,
+ core::ir::Access* const to_access) {
+ // Look for a dynamically indexed matrix through the access chain.
+ // This will always be the last index in the chain.
+
+ // The last index must be dynamic
+ if (IsConstant(to_access->Indices().Back())) {
+ return {};
+ }
+ // Get the root object type
+ const auto* object_ty = to_access->Object()->Type()->As<core::type::Pointer>()->StoreType();
+ const auto indicesButLast =
+ to_access->Indices().Truncate(to_access->Indices().Length() - 1);
+ for (auto* idx : indicesButLast) {
+ object_ty = GetElementType(object_ty, idx);
+ }
+ // It must be a matrix
+ const auto* mat_ty = object_ty->As<core::type::Matrix>();
+ if (!mat_ty) {
+ return {};
+ }
+
+ core::ir::Value* const to = Switch(
+ store, //
+ [&](core::ir::Store* s) { return s->To(); }, //
+ [&](core::ir::StoreVectorElement* s) { return s->To(); }, //
+ TINT_ICE_ON_NO_MATCH);
+
+ auto* const to_ptr = to->Type()->As<core::type::Pointer>();
+
+ // Instead of indexing the matrix dynamically, we want to replace it with a switch statement
+ // over the dynamic index, with each case in [0-3] emitting the store with a constant index.
+ Vector<core::ir::Instruction*, 4> new_stores;
+
+ b.InsertBefore(store, [&] {
+ // Create access to the matrix we're dynamically indexing
+ core::ir::Value* matrix = to_access->Object();
+ if (!indicesButLast.IsEmpty()) {
+ // Matrix is in a struct or array, for example
+ matrix = b.Access(ty.ptr(to_ptr->AddressSpace(), mat_ty), to_access->Object(),
+ ToVector<4>(indicesButLast))
+ ->Result(0);
+ }
+ // Switch over dynamic index, emitting a case for all possible column indices
+ auto* switch_ = b.Switch(to_access->Indices().Back());
+ for (uint32_t i = 0; i < mat_ty->Columns(); ++i) {
+ b.Append(b.Case(switch_, {b.Constant(u32(i))}), [&] {
+ auto* const vec_ty = to_ptr->StoreType();
+ auto* access = b.Access(ty.ptr(to_ptr->AddressSpace(), vec_ty), matrix, u32(i));
+ auto* new_store = Switch(
+ store,
+ [&](core::ir::Store* s) { //
+ return b.Store(access, s->From());
+ },
+ [&](core::ir::StoreVectorElement* s) {
+ return b.StoreVectorElement(access, s->Index(), s->Value());
+ },
+ TINT_ICE_ON_NO_MATCH);
+ new_stores.Push(new_store);
+ b.ExitSwitch(switch_);
+ });
+ }
+ b.Append(b.DefaultCase(switch_), [&] { b.ExitSwitch(switch_); });
+
+ store->Destroy();
+ });
+ TINT_ASSERT(!new_stores.IsEmpty());
+ return new_stores;
+ }
+
+ // Process store to matrix column
+ void ProcessStore(core::ir::Store* store) {
+ // Must be storing to a shader-local variable
+ auto* to_ptr = store->To()->Type()->As<core::type::Pointer>();
+ if (to_ptr->AddressSpace() != core::AddressSpace::kFunction &&
+ to_ptr->AddressSpace() != core::AddressSpace::kPrivate) {
+ return;
+ }
+ // Must be storing a vector
+ if (!to_ptr->StoreType()->Is<core::type::Vector>()) {
+ return;
+ }
+ // Must be storing via an access
+ auto* to = store->To()->As<core::ir::InstructionResult>();
+ if (!to) {
+ return;
+ }
+ auto* to_access = to->Instruction()->As<core::ir::Access>();
+ if (!to_access) {
+ return;
+ }
+ ProcessMatrixColumnAccess(store, to_access);
+ }
+
+ // Replaces the vector element store with a full vector store that masks in the indexed
+ // value. Example HLSL: vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
+ void ReplaceStoreVectorElement(core::ir::StoreVectorElement* store) {
+ TINT_ASSERT(!IsConstant(store->Index()));
+ auto* to_ptr = store->To()->Type()->As<core::type::Pointer>();
+ TINT_ASSERT(to_ptr);
+
+ b.InsertBefore(store, [&] {
+ auto* vec_param = store->Operands()[0];
+ auto* index_param = store->Operands()[1];
+ auto* value_param = store->Operands()[2];
+
+ auto* vec_ty = to_ptr->StoreType()->As<core::type::Vector>();
+
+ // e.g. "xxx" for vec3
+ Vector<uint32_t, 4> swizzle_indices;
+ swizzle_indices.Resize(vec_ty->Width(), 0);
+
+ // e.g. "0,1,2" for vec3
+ Vector<core::ir::Value*, 4> select_indices;
+ switch (vec_ty->Width()) {
+ case 2:
+ select_indices = b.Values(0_i, 1_i);
+ break;
+ case 3:
+ select_indices = b.Values(0_i, 1_i, 2_i);
+ break;
+ case 4:
+ select_indices = b.Values(0_i, 1_i, 2_i, 3_i);
+ break;
+ }
+
+ auto* false_val = b.Load(vec_param);
+ auto* true_val = b.Swizzle(vec_ty, value_param, swizzle_indices);
+
+ auto* lhs = b.Swizzle(vec_ty, index_param, swizzle_indices);
+ auto* rhs = b.Construct(vec_ty, select_indices);
+ auto* cond = b.Equal(ty.MatchWidth(ty.bool_(), vec_ty), lhs, rhs);
+
+ // NOTE: Using Select means we depend on BuiltinPolyfill to run after this transform. We
+ // could also just emit a Ternary instruction.
+ auto* result = b.Call(vec_ty, core::BuiltinFn::kSelect, false_val, true_val, cond);
+ b.Store(vec_param, result);
+
+ store->Destroy();
+ });
+ }
+
+ // Process store to vector element for both vector and matrix element stores
+ void ProcessStoreVectorElement(core::ir::StoreVectorElement* store) {
+ auto* to_ptr = store->To()->Type()->As<core::type::Pointer>();
+ if (to_ptr->AddressSpace() != core::AddressSpace::kFunction &&
+ to_ptr->AddressSpace() != core::AddressSpace::kPrivate) {
+ return;
+ }
+ auto* to = store->To()->As<core::ir::InstructionResult>();
+ if (!to) {
+ return;
+ }
+
+ const bool is_dynamic_index = !IsConstant(store->Index());
+
+ // This may be a vector store to a dynamically indexed matrix
+ if (auto* to_access = to->Instruction()->As<core::ir::Access>()) {
+ auto new_stores = ProcessMatrixColumnAccess(store, to_access);
+ if (!new_stores.IsEmpty() && is_dynamic_index) {
+ // The dynamic matrix index has been replaced by a switch with cases containing
+ // multiple StoreVectorElement copies of the input one to this function. If
+ // dynamically indexed, replace each of the new stores and return.
+ for (auto* s : new_stores) {
+ ReplaceStoreVectorElement(s->As<core::ir::StoreVectorElement>());
+ }
+ return;
+ }
+ }
+
+ // If the index is dynamic, replace
+ if (is_dynamic_index) {
+ ReplaceStoreVectorElement(store);
+ }
+ }
+
+ /// Process the module.
+ void Process() {
+ // Collect stores before processing them
+ Vector<core::ir::Store*, 16> stores;
+ Vector<core::ir::StoreVectorElement*, 16> store_vec_elems;
+ for (auto* inst : ir.Instructions()) {
+ // Inline pointers
+ if (auto* l = inst->As<core::ir::Let>()) {
+ if (l->Result(0)->Type()->Is<core::type::Pointer>()) {
+ l->Result(0)->ReplaceAllUsesWith(l->Value());
+ l->Destroy();
+ }
+ }
+
+ if (auto* store = inst->As<core::ir::Store>()) {
+ stores.Push(store);
+ } else if (auto* vector_store = inst->As<core::ir::StoreVectorElement>()) {
+ store_vec_elems.Push(vector_store);
+ }
+ }
+
+ // Process the stores
+ for (auto* store : stores) {
+ ProcessStore(store);
+ }
+ for (auto* store : store_vec_elems) {
+ ProcessStoreVectorElement(store);
+ }
+ }
+};
+
+} // namespace
+
+Result<SuccessType> ReplaceNonIndexableMatVecStores(core::ir::Module& ir) {
+ auto result = ValidateAndDumpIfNeeded(ir, "ReplaceNonIndexableMatVecStores transform");
+ if (result != Success) {
+ return result.Failure();
+ }
+
+ State{ir}.Process();
+
+ return Success;
+}
+
+} // namespace tint::hlsl::writer::raise
diff --git a/src/tint/lang/hlsl/writer/raise/replace_non_indexable_mat_vec_stores.h b/src/tint/lang/hlsl/writer/raise/replace_non_indexable_mat_vec_stores.h
new file mode 100644
index 0000000..d109116
--- /dev/null
+++ b/src/tint/lang/hlsl/writer/raise/replace_non_indexable_mat_vec_stores.h
@@ -0,0 +1,57 @@
+// Copyright 2024 The Dawn & Tint Authors
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef SRC_TINT_LANG_HLSL_WRITER_RAISE_REPLACE_NON_INDEXABLE_MAT_VEC_STORES_H_
+#define SRC_TINT_LANG_HLSL_WRITER_RAISE_REPLACE_NON_INDEXABLE_MAT_VEC_STORES_H_
+
+#include "src/tint/utils/result/result.h"
+
+// Forward declarations.
+namespace tint::core::ir {
+class Module;
+} // namespace tint::core::ir
+
+namespace tint::hlsl::writer::raise {
+
+/// This transform replaces element stores to dynamically-indexed shader-local matrices or vectors
+/// with full vector stores. This is done to work around FXC's inability to compile in these cases
+/// (see crbug.com/42250349 and crbug.com/42251617).
+///
+/// This transform is similar to LocalizeStructArrayAssignment, but for matrices and vectors. As
+/// with structs of arrays, FXC does not allocate indexable registers to shader-local matrix and
+/// vector variables. For dynamically indexed vectors, we replace the indexed element store with
+/// a full vector store using a selection mask. For dynamically indexed matrices, we replace the
+/// indexed matrix store with a switch over the index, and emit a case for each column that sets the
+/// matrix column by constant index.
+
+/// @param module the module to transform
+/// @returns success or failure
+Result<SuccessType> ReplaceNonIndexableMatVecStores(core::ir::Module& module);
+
+} // namespace tint::hlsl::writer::raise
+
+#endif // SRC_TINT_LANG_HLSL_WRITER_RAISE_REPLACE_NON_INDEXABLE_MAT_VEC_STORES_H_
diff --git a/src/tint/lang/hlsl/writer/raise/replace_non_indexable_mat_vec_stores_test.cc b/src/tint/lang/hlsl/writer/raise/replace_non_indexable_mat_vec_stores_test.cc
new file mode 100644
index 0000000..f77e48c
--- /dev/null
+++ b/src/tint/lang/hlsl/writer/raise/replace_non_indexable_mat_vec_stores_test.cc
@@ -0,0 +1,2041 @@
+// Copyright 2024 The Dawn & Tint Authors
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "src/tint/lang/hlsl/writer/raise/replace_non_indexable_mat_vec_stores.h"
+
+#include <gtest/gtest.h>
+
+#include "src/tint/lang/core/fluent_types.h"
+#include "src/tint/lang/core/ir/function.h"
+#include "src/tint/lang/core/ir/transform/helper_test.h"
+#include "src/tint/lang/core/number.h"
+
+using namespace tint::core::fluent_types; // NOLINT
+using namespace tint::core::number_suffixes; // NOLINT
+
+namespace tint::hlsl::writer::raise {
+namespace {
+
+using HlslWriterReplaceNonIndexableMatVecStoresTest = core::ir::transform::TransformTest;
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, Vector) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* v = b.Var("v", ty.ptr<function>(ty.vec3<f32>()));
+ b.StoreVectorElement(v, b.Load(dyn_index), 1_f);
+ b.StoreVectorElement(v, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, vec3<f32>, read_write> = var
+ %5:u32 = load %dyn_index
+ store_vector_element %v, %5, 1.0f
+ store_vector_element %v, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, vec3<f32>, read_write> = var
+ %5:u32 = load %dyn_index
+ %6:vec3<f32> = load %v
+ %7:vec3<f32> = swizzle 1.0f, xxx
+ %8:vec3<f32> = swizzle %5, xxx
+ %9:vec3<f32> = construct 0i, 1i, 2i
+ %10:vec3<bool> = eq %8, %9
+ %11:vec3<f32> = select %6, %7, %10
+ store %v, %11
+ store_vector_element %v, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, VectorInStruct) {
+ auto* vec_ty = ty.vec3<f32>();
+ auto* struct_ty = ty.Struct(mod.symbols.New("S"), {{mod.symbols.New("v"), vec_ty}});
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* v = b.Var("v", ty.ptr<function>(struct_ty));
+ auto* access = b.Access(ty.ptr<function>(vec_ty), v, 0_u);
+ b.StoreVectorElement(access, b.Load(dyn_index), 1_f);
+ b.StoreVectorElement(access, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+S = struct @align(16) {
+ v:vec3<f32> @offset(0)
+}
+
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, S, read_write> = var
+ %5:ptr<function, vec3<f32>, read_write> = access %v, 0u
+ %6:u32 = load %dyn_index
+ store_vector_element %5, %6, 1.0f
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+S = struct @align(16) {
+ v:vec3<f32> @offset(0)
+}
+
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, S, read_write> = var
+ %5:ptr<function, vec3<f32>, read_write> = access %v, 0u
+ %6:u32 = load %dyn_index
+ %7:vec3<f32> = load %5
+ %8:vec3<f32> = swizzle 1.0f, xxx
+ %9:vec3<f32> = swizzle %6, xxx
+ %10:vec3<f32> = construct 0i, 1i, 2i
+ %11:vec3<bool> = eq %9, %10
+ %12:vec3<f32> = select %7, %8, %11
+ store %5, %12
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, VectorInArray) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* vec_ty = ty.vec3<f32>();
+ auto* v = b.Var("v", ty.ptr<function>(ty.array(vec_ty, 8)));
+ auto* access = b.Access(ty.ptr<function>(vec_ty), v, 0_u);
+ b.StoreVectorElement(access, b.Load(dyn_index), 1_f);
+ b.StoreVectorElement(access, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, array<vec3<f32>, 8>, read_write> = var
+ %5:ptr<function, vec3<f32>, read_write> = access %v, 0u
+ %6:u32 = load %dyn_index
+ store_vector_element %5, %6, 1.0f
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, array<vec3<f32>, 8>, read_write> = var
+ %5:ptr<function, vec3<f32>, read_write> = access %v, 0u
+ %6:u32 = load %dyn_index
+ %7:vec3<f32> = load %5
+ %8:vec3<f32> = swizzle 1.0f, xxx
+ %9:vec3<f32> = swizzle %6, xxx
+ %10:vec3<f32> = construct 0i, 1i, 2i
+ %11:vec3<bool> = eq %9, %10
+ %12:vec3<f32> = select %7, %8, %11
+ store %5, %12
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, VectorInArrayInStruct) {
+ auto* vec_ty = ty.vec3<f32>();
+ auto* struct_ty =
+ ty.Struct(mod.symbols.New("S"), {{mod.symbols.New("v"), ty.array(vec_ty, 8)}});
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* v = b.Var("v", ty.ptr<function>(struct_ty));
+ auto* access = b.Access(ty.ptr<function>(vec_ty), v, 0_u, 0_u);
+ b.StoreVectorElement(access, b.Load(dyn_index), 1_f);
+ b.StoreVectorElement(access, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+S = struct @align(16) {
+ v:array<vec3<f32>, 8> @offset(0)
+}
+
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, S, read_write> = var
+ %5:ptr<function, vec3<f32>, read_write> = access %v, 0u, 0u
+ %6:u32 = load %dyn_index
+ store_vector_element %5, %6, 1.0f
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+S = struct @align(16) {
+ v:array<vec3<f32>, 8> @offset(0)
+}
+
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, S, read_write> = var
+ %5:ptr<function, vec3<f32>, read_write> = access %v, 0u, 0u
+ %6:u32 = load %dyn_index
+ %7:vec3<f32> = load %5
+ %8:vec3<f32> = swizzle 1.0f, xxx
+ %9:vec3<f32> = swizzle %6, xxx
+ %10:vec3<f32> = construct 0i, 1i, 2i
+ %11:vec3<bool> = eq %9, %10
+ %12:vec3<f32> = select %7, %8, %11
+ store %5, %12
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, VectorByFunc) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+ auto* get_dynamic = b.Function("get_dynamic", ty.u32());
+ b.Append(get_dynamic->Block(), [&] { b.Return(get_dynamic, b.Load(dyn_index)); });
+ auto* get_static = b.Function("get_static", ty.u32());
+ b.Append(get_static->Block(), [&] { b.Return(get_static, 0_u); });
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* v = b.Var("v", ty.ptr<function>(ty.vec3<f32>()));
+ b.StoreVectorElement(v, b.Call(get_dynamic), 1_f);
+ // Will be transformed because we assume functions return a dynamic value
+ b.StoreVectorElement(v, b.Call(get_static), 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%get_dynamic = func():u32 {
+ $B2: {
+ %3:u32 = load %dyn_index
+ ret %3
+ }
+}
+%get_static = func():u32 {
+ $B3: {
+ ret 0u
+ }
+}
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B4: {
+ %v:ptr<function, vec3<f32>, read_write> = var
+ %7:u32 = call %get_dynamic
+ store_vector_element %v, %7, 1.0f
+ %8:u32 = call %get_static
+ store_vector_element %v, %8, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%get_dynamic = func():u32 {
+ $B2: {
+ %3:u32 = load %dyn_index
+ ret %3
+ }
+}
+%get_static = func():u32 {
+ $B3: {
+ ret 0u
+ }
+}
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B4: {
+ %v:ptr<function, vec3<f32>, read_write> = var
+ %7:u32 = call %get_dynamic
+ %8:vec3<f32> = load %v
+ %9:vec3<f32> = swizzle 1.0f, xxx
+ %10:vec3<f32> = swizzle %7, xxx
+ %11:vec3<f32> = construct 0i, 1i, 2i
+ %12:vec3<bool> = eq %10, %11
+ %13:vec3<f32> = select %8, %9, %12
+ store %v, %13
+ %14:u32 = call %get_static
+ %15:vec3<f32> = load %v
+ %16:vec3<f32> = swizzle 1.0f, xxx
+ %17:vec3<f32> = swizzle %14, xxx
+ %18:vec3<f32> = construct 0i, 1i, 2i
+ %19:vec3<bool> = eq %17, %18
+ %20:vec3<f32> = select %15, %16, %19
+ store %v, %20
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, Vector_ViaPointer) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* v = b.Var("v", ty.ptr<function>(ty.vec3<f32>()));
+ auto* p = b.Let("p", v);
+ b.StoreVectorElement(p, b.Load(dyn_index), 1_f);
+ b.StoreVectorElement(p, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, vec3<f32>, read_write> = var
+ %p:ptr<function, vec3<f32>, read_write> = let %v
+ %6:u32 = load %dyn_index
+ store_vector_element %p, %6, 1.0f
+ store_vector_element %p, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, vec3<f32>, read_write> = var
+ %5:u32 = load %dyn_index
+ %6:vec3<f32> = load %v
+ %7:vec3<f32> = swizzle 1.0f, xxx
+ %8:vec3<f32> = swizzle %5, xxx
+ %9:vec3<f32> = construct 0i, 1i, 2i
+ %10:vec3<bool> = eq %8, %9
+ %11:vec3<f32> = select %6, %7, %10
+ store %v, %11
+ store_vector_element %v, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, Vector_PrivateVar) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+ auto* v = b.Var("v", ty.ptr<private_>(ty.vec3<f32>()));
+ mod.root_block->Append(v);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ b.StoreVectorElement(v, b.Load(dyn_index), 1_f);
+ b.StoreVectorElement(v, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+ %v:ptr<private, vec3<f32>, read_write> = var
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %5:u32 = load %dyn_index
+ store_vector_element %v, %5, 1.0f
+ store_vector_element %v, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+ %v:ptr<private, vec3<f32>, read_write> = var
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %5:u32 = load %dyn_index
+ %6:vec3<f32> = load %v
+ %7:vec3<f32> = swizzle 1.0f, xxx
+ %8:vec3<f32> = swizzle %5, xxx
+ %9:vec3<f32> = construct 0i, 1i, 2i
+ %10:vec3<bool> = eq %8, %9
+ %11:vec3<f32> = select %6, %7, %10
+ store %v, %11
+ store_vector_element %v, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, Vector_StorageVar) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+ auto* v = b.Var("v", ty.ptr<storage>(ty.vec3<f32>()));
+ v->SetBindingPoint(0, 1);
+ mod.root_block->Append(v);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ b.StoreVectorElement(v, b.Load(dyn_index), 1_f);
+ b.StoreVectorElement(v, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+ %v:ptr<storage, vec3<f32>, read_write> = var @binding_point(0, 1)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %5:u32 = load %dyn_index
+ store_vector_element %v, %5, 1.0f
+ store_vector_element %v, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = src;
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, Vector_WorkgroupVar) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+ auto* v = b.Var("v", ty.ptr<workgroup>(ty.vec3<f32>()));
+ mod.root_block->Append(v);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ b.StoreVectorElement(v, b.Load(dyn_index), 1_f);
+ b.StoreVectorElement(v, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+ %v:ptr<workgroup, vec3<f32>, read_write> = var
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %5:u32 = load %dyn_index
+ store_vector_element %v, %5, 1.0f
+ store_vector_element %v, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = src;
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixElement) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* v = b.Var("v", ty.ptr<function>(ty.mat2x4<f32>()));
+ auto* access = b.Access(ty.ptr<function, vec4<f32>>(), v, 1_u);
+ b.StoreVectorElement(access, b.Load(dyn_index), 1_f);
+ b.StoreVectorElement(access, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, mat2x4<f32>, read_write> = var
+ %5:ptr<function, vec4<f32>, read_write> = access %v, 1u
+ %6:u32 = load %dyn_index
+ store_vector_element %5, %6, 1.0f
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, mat2x4<f32>, read_write> = var
+ %5:ptr<function, vec4<f32>, read_write> = access %v, 1u
+ %6:u32 = load %dyn_index
+ %7:vec4<f32> = load %5
+ %8:vec4<f32> = swizzle 1.0f, xxxx
+ %9:vec4<f32> = swizzle %6, xxxx
+ %10:vec4<f32> = construct 0i, 1i, 2i, 3i
+ %11:vec4<bool> = eq %9, %10
+ %12:vec4<f32> = select %7, %8, %11
+ store %5, %12
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixElementInStruct) {
+ auto* mat_ty = ty.mat2x4<f32>();
+ auto* struct_ty = ty.Struct(mod.symbols.New("S"), {{mod.symbols.New("v"), mat_ty}});
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* v = b.Var("v", ty.ptr<function>(struct_ty));
+ auto* access = b.Access(ty.ptr<function, vec4<f32>>(), v, 0_u, 1_u);
+ b.StoreVectorElement(access, b.Load(dyn_index), 1_f);
+ b.StoreVectorElement(access, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+S = struct @align(16) {
+ v:mat2x4<f32> @offset(0)
+}
+
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, S, read_write> = var
+ %5:ptr<function, vec4<f32>, read_write> = access %v, 0u, 1u
+ %6:u32 = load %dyn_index
+ store_vector_element %5, %6, 1.0f
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+S = struct @align(16) {
+ v:mat2x4<f32> @offset(0)
+}
+
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, S, read_write> = var
+ %5:ptr<function, vec4<f32>, read_write> = access %v, 0u, 1u
+ %6:u32 = load %dyn_index
+ %7:vec4<f32> = load %5
+ %8:vec4<f32> = swizzle 1.0f, xxxx
+ %9:vec4<f32> = swizzle %6, xxxx
+ %10:vec4<f32> = construct 0i, 1i, 2i, 3i
+ %11:vec4<bool> = eq %9, %10
+ %12:vec4<f32> = select %7, %8, %11
+ store %5, %12
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixElementInArray) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* v = b.Var("v", ty.ptr<function>(ty.array(ty.mat2x4<f32>(), 8)));
+ auto* access = b.Access(ty.ptr<function, vec4<f32>>(), v, 7_u, 1_u);
+ b.StoreVectorElement(access, b.Load(dyn_index), 1_f);
+ b.StoreVectorElement(access, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, array<mat2x4<f32>, 8>, read_write> = var
+ %5:ptr<function, vec4<f32>, read_write> = access %v, 7u, 1u
+ %6:u32 = load %dyn_index
+ store_vector_element %5, %6, 1.0f
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, array<mat2x4<f32>, 8>, read_write> = var
+ %5:ptr<function, vec4<f32>, read_write> = access %v, 7u, 1u
+ %6:u32 = load %dyn_index
+ %7:vec4<f32> = load %5
+ %8:vec4<f32> = swizzle 1.0f, xxxx
+ %9:vec4<f32> = swizzle %6, xxxx
+ %10:vec4<f32> = construct 0i, 1i, 2i, 3i
+ %11:vec4<bool> = eq %9, %10
+ %12:vec4<f32> = select %7, %8, %11
+ store %5, %12
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixElementInArrayInStruct) {
+ auto* mat_ty = ty.mat2x4<f32>();
+ auto* struct_ty =
+ ty.Struct(mod.symbols.New("S"), {{mod.symbols.New("v"), ty.array(mat_ty, 8)}});
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* v = b.Var("v", ty.ptr<function>(struct_ty));
+ auto* access = b.Access(ty.ptr<function, vec4<f32>>(), v, 0_u, 7_u, 1_u);
+ b.StoreVectorElement(access, b.Load(dyn_index), 1_f);
+ b.StoreVectorElement(access, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+S = struct @align(16) {
+ v:array<mat2x4<f32>, 8> @offset(0)
+}
+
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, S, read_write> = var
+ %5:ptr<function, vec4<f32>, read_write> = access %v, 0u, 7u, 1u
+ %6:u32 = load %dyn_index
+ store_vector_element %5, %6, 1.0f
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+S = struct @align(16) {
+ v:array<mat2x4<f32>, 8> @offset(0)
+}
+
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, S, read_write> = var
+ %5:ptr<function, vec4<f32>, read_write> = access %v, 0u, 7u, 1u
+ %6:u32 = load %dyn_index
+ %7:vec4<f32> = load %5
+ %8:vec4<f32> = swizzle 1.0f, xxxx
+ %9:vec4<f32> = swizzle %6, xxxx
+ %10:vec4<f32> = construct 0i, 1i, 2i, 3i
+ %11:vec4<bool> = eq %9, %10
+ %12:vec4<f32> = select %7, %8, %11
+ store %5, %12
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+// MatrixElementByFunc
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixElementByFunc) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+ auto* get_dynamic = b.Function("get_dynamic", ty.u32());
+ b.Append(get_dynamic->Block(), [&] { b.Return(get_dynamic, b.Load(dyn_index)); });
+ auto* get_static = b.Function("get_static", ty.u32());
+ b.Append(get_static->Block(), [&] { b.Return(get_static, 0_u); });
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* v = b.Var("v", ty.ptr<function>(ty.mat2x4<f32>()));
+ auto* access = b.Access(ty.ptr<function, vec4<f32>>(), v, 1_u);
+ b.StoreVectorElement(access, b.Call(get_dynamic), 1_f);
+ // Will be transformed because we assume functions return a dynamic value
+ b.StoreVectorElement(access, b.Call(get_static), 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%get_dynamic = func():u32 {
+ $B2: {
+ %3:u32 = load %dyn_index
+ ret %3
+ }
+}
+%get_static = func():u32 {
+ $B3: {
+ ret 0u
+ }
+}
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B4: {
+ %v:ptr<function, mat2x4<f32>, read_write> = var
+ %7:ptr<function, vec4<f32>, read_write> = access %v, 1u
+ %8:u32 = call %get_dynamic
+ store_vector_element %7, %8, 1.0f
+ %9:u32 = call %get_static
+ store_vector_element %7, %9, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%get_dynamic = func():u32 {
+ $B2: {
+ %3:u32 = load %dyn_index
+ ret %3
+ }
+}
+%get_static = func():u32 {
+ $B3: {
+ ret 0u
+ }
+}
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B4: {
+ %v:ptr<function, mat2x4<f32>, read_write> = var
+ %7:ptr<function, vec4<f32>, read_write> = access %v, 1u
+ %8:u32 = call %get_dynamic
+ %9:vec4<f32> = load %7
+ %10:vec4<f32> = swizzle 1.0f, xxxx
+ %11:vec4<f32> = swizzle %8, xxxx
+ %12:vec4<f32> = construct 0i, 1i, 2i, 3i
+ %13:vec4<bool> = eq %11, %12
+ %14:vec4<f32> = select %9, %10, %13
+ store %7, %14
+ %15:u32 = call %get_static
+ %16:vec4<f32> = load %7
+ %17:vec4<f32> = swizzle 1.0f, xxxx
+ %18:vec4<f32> = swizzle %15, xxxx
+ %19:vec4<f32> = construct 0i, 1i, 2i, 3i
+ %20:vec4<bool> = eq %18, %19
+ %21:vec4<f32> = select %16, %17, %20
+ store %7, %21
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixElement_ViaPointer) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* v = b.Var("v", ty.ptr<function>(ty.mat2x4<f32>()));
+ auto* access = b.Access(ty.ptr<function, vec4<f32>>(), v, 1_u);
+ auto* p = b.Let("p", access);
+ b.StoreVectorElement(p, b.Load(dyn_index), 1_f);
+ b.StoreVectorElement(p, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, mat2x4<f32>, read_write> = var
+ %5:ptr<function, vec4<f32>, read_write> = access %v, 1u
+ %p:ptr<function, vec4<f32>, read_write> = let %5
+ %7:u32 = load %dyn_index
+ store_vector_element %p, %7, 1.0f
+ store_vector_element %p, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, mat2x4<f32>, read_write> = var
+ %5:ptr<function, vec4<f32>, read_write> = access %v, 1u
+ %6:u32 = load %dyn_index
+ %7:vec4<f32> = load %5
+ %8:vec4<f32> = swizzle 1.0f, xxxx
+ %9:vec4<f32> = swizzle %6, xxxx
+ %10:vec4<f32> = construct 0i, 1i, 2i, 3i
+ %11:vec4<bool> = eq %9, %10
+ %12:vec4<f32> = select %7, %8, %11
+ store %5, %12
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixElement_PrivateVar) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+ auto* v = b.Var("v", ty.ptr<private_>(ty.mat2x4<f32>()));
+ mod.root_block->Append(v);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* access = b.Access(ty.ptr<private_, vec4<f32>>(), v, 1_u);
+ b.StoreVectorElement(access, b.Load(dyn_index), 1_f);
+ b.StoreVectorElement(access, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+ %v:ptr<private, mat2x4<f32>, read_write> = var
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %5:ptr<private, vec4<f32>, read_write> = access %v, 1u
+ %6:u32 = load %dyn_index
+ store_vector_element %5, %6, 1.0f
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+ %v:ptr<private, mat2x4<f32>, read_write> = var
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %5:ptr<private, vec4<f32>, read_write> = access %v, 1u
+ %6:u32 = load %dyn_index
+ %7:vec4<f32> = load %5
+ %8:vec4<f32> = swizzle 1.0f, xxxx
+ %9:vec4<f32> = swizzle %6, xxxx
+ %10:vec4<f32> = construct 0i, 1i, 2i, 3i
+ %11:vec4<bool> = eq %9, %10
+ %12:vec4<f32> = select %7, %8, %11
+ store %5, %12
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixElement_StorageVar) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+ auto* v = b.Var("v", ty.ptr<storage>(ty.mat2x4<f32>()));
+ v->SetBindingPoint(0, 1);
+ mod.root_block->Append(v);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* access = b.Access(ty.ptr<storage, vec4<f32>>(), v, 1_u);
+ b.StoreVectorElement(access, b.Load(dyn_index), 1_f);
+ b.StoreVectorElement(access, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+ %v:ptr<storage, mat2x4<f32>, read_write> = var @binding_point(0, 1)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %5:ptr<storage, vec4<f32>, read_write> = access %v, 1u
+ %6:u32 = load %dyn_index
+ store_vector_element %5, %6, 1.0f
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = src;
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixElement_WorkgroupVar) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+ auto* v = b.Var("v", ty.ptr<workgroup>(ty.mat2x4<f32>()));
+ mod.root_block->Append(v);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* access = b.Access(ty.ptr<workgroup, vec4<f32>>(), v, 1_u);
+ b.StoreVectorElement(access, b.Load(dyn_index), 1_f);
+ b.StoreVectorElement(access, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+ %v:ptr<workgroup, mat2x4<f32>, read_write> = var
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %5:ptr<workgroup, vec4<f32>, read_write> = access %v, 1u
+ %6:u32 = load %dyn_index
+ store_vector_element %5, %6, 1.0f
+ store_vector_element %5, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = src;
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixColumn) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* v = b.Var("v", ty.ptr<function>(ty.mat2x4<f32>()));
+ auto* vec = b.Construct(ty.vec4<f32>(), 0_f);
+ auto* access0 = b.Access(ty.ptr<function, vec4<f32>>(), v, b.Load(dyn_index));
+ b.Store(access0, vec);
+ auto* access1 = b.Access(ty.ptr<function, vec4<f32>>(), v, static_index);
+ b.Store(access1, vec);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, mat2x4<f32>, read_write> = var
+ %5:vec4<f32> = construct 0.0f
+ %6:u32 = load %dyn_index
+ %7:ptr<function, vec4<f32>, read_write> = access %v, %6
+ store %7, %5
+ %8:ptr<function, vec4<f32>, read_write> = access %v, %static_index
+ store %8, %5
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, mat2x4<f32>, read_write> = var
+ %5:vec4<f32> = construct 0.0f
+ %6:u32 = load %dyn_index
+ %7:ptr<function, vec4<f32>, read_write> = access %v, %6
+ switch %6 [c: (0u, $B3), c: (1u, $B4), c: (default, $B5)] { # switch_1
+ $B3: { # case
+ %8:ptr<function, vec4<f32>, read_write> = access %v, 0u
+ store %8, %5
+ exit_switch # switch_1
+ }
+ $B4: { # case
+ %9:ptr<function, vec4<f32>, read_write> = access %v, 1u
+ store %9, %5
+ exit_switch # switch_1
+ }
+ $B5: { # case
+ exit_switch # switch_1
+ }
+ }
+ %10:ptr<function, vec4<f32>, read_write> = access %v, %static_index
+ store %10, %5
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixColumnInStruct) {
+ auto* mat_ty = ty.mat2x4<f32>();
+ auto* struct_ty = ty.Struct(mod.symbols.New("S"), {{mod.symbols.New("v"), mat_ty}});
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* v = b.Var("v", ty.ptr<function>(struct_ty));
+ auto* vec = b.Construct(ty.vec4<f32>(), 0_f);
+ auto* access0 = b.Access(ty.ptr<function, vec4<f32>>(), v, 0_u, b.Load(dyn_index));
+ b.Store(access0, vec);
+ auto* access1 = b.Access(ty.ptr<function, vec4<f32>>(), v, 0_u, static_index);
+ b.Store(access1, vec);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+S = struct @align(16) {
+ v:mat2x4<f32> @offset(0)
+}
+
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, S, read_write> = var
+ %5:vec4<f32> = construct 0.0f
+ %6:u32 = load %dyn_index
+ %7:ptr<function, vec4<f32>, read_write> = access %v, 0u, %6
+ store %7, %5
+ %8:ptr<function, vec4<f32>, read_write> = access %v, 0u, %static_index
+ store %8, %5
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+S = struct @align(16) {
+ v:mat2x4<f32> @offset(0)
+}
+
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, S, read_write> = var
+ %5:vec4<f32> = construct 0.0f
+ %6:u32 = load %dyn_index
+ %7:ptr<function, vec4<f32>, read_write> = access %v, 0u, %6
+ %8:ptr<function, mat2x4<f32>, read_write> = access %v, 0u
+ switch %6 [c: (0u, $B3), c: (1u, $B4), c: (default, $B5)] { # switch_1
+ $B3: { # case
+ %9:ptr<function, vec4<f32>, read_write> = access %8, 0u
+ store %9, %5
+ exit_switch # switch_1
+ }
+ $B4: { # case
+ %10:ptr<function, vec4<f32>, read_write> = access %8, 1u
+ store %10, %5
+ exit_switch # switch_1
+ }
+ $B5: { # case
+ exit_switch # switch_1
+ }
+ }
+ %11:ptr<function, vec4<f32>, read_write> = access %v, 0u, %static_index
+ store %11, %5
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixColumnInArray) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* v = b.Var("v", ty.ptr<function>(ty.array(ty.mat2x4<f32>(), 8)));
+ auto* vec = b.Construct(ty.vec4<f32>(), 0_f);
+ auto* access0 = b.Access(ty.ptr<function, vec4<f32>>(), v, 7_u, b.Load(dyn_index));
+ b.Store(access0, vec);
+ auto* access1 = b.Access(ty.ptr<function, vec4<f32>>(), v, 7_u, static_index);
+ b.Store(access1, vec);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, array<mat2x4<f32>, 8>, read_write> = var
+ %5:vec4<f32> = construct 0.0f
+ %6:u32 = load %dyn_index
+ %7:ptr<function, vec4<f32>, read_write> = access %v, 7u, %6
+ store %7, %5
+ %8:ptr<function, vec4<f32>, read_write> = access %v, 7u, %static_index
+ store %8, %5
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, array<mat2x4<f32>, 8>, read_write> = var
+ %5:vec4<f32> = construct 0.0f
+ %6:u32 = load %dyn_index
+ %7:ptr<function, vec4<f32>, read_write> = access %v, 7u, %6
+ %8:ptr<function, mat2x4<f32>, read_write> = access %v, 7u
+ switch %6 [c: (0u, $B3), c: (1u, $B4), c: (default, $B5)] { # switch_1
+ $B3: { # case
+ %9:ptr<function, vec4<f32>, read_write> = access %8, 0u
+ store %9, %5
+ exit_switch # switch_1
+ }
+ $B4: { # case
+ %10:ptr<function, vec4<f32>, read_write> = access %8, 1u
+ store %10, %5
+ exit_switch # switch_1
+ }
+ $B5: { # case
+ exit_switch # switch_1
+ }
+ }
+ %11:ptr<function, vec4<f32>, read_write> = access %v, 7u, %static_index
+ store %11, %5
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixColumnInArrayInStruct) {
+ auto* mat_ty = ty.mat2x4<f32>();
+ auto* struct_ty =
+ ty.Struct(mod.symbols.New("S"), {{mod.symbols.New("v"), ty.array(mat_ty, 8)}});
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* v = b.Var("v", ty.ptr<function>(struct_ty));
+ auto* vec = b.Construct(ty.vec4<f32>(), 0_f);
+ auto* access0 = b.Access(ty.ptr<function, vec4<f32>>(), v, 0_u, 7_u, b.Load(dyn_index));
+ b.Store(access0, vec);
+ auto* access1 = b.Access(ty.ptr<function, vec4<f32>>(), v, 0_u, 7_u, static_index);
+ b.Store(access1, vec);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+S = struct @align(16) {
+ v:array<mat2x4<f32>, 8> @offset(0)
+}
+
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, S, read_write> = var
+ %5:vec4<f32> = construct 0.0f
+ %6:u32 = load %dyn_index
+ %7:ptr<function, vec4<f32>, read_write> = access %v, 0u, 7u, %6
+ store %7, %5
+ %8:ptr<function, vec4<f32>, read_write> = access %v, 0u, 7u, %static_index
+ store %8, %5
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+S = struct @align(16) {
+ v:array<mat2x4<f32>, 8> @offset(0)
+}
+
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, S, read_write> = var
+ %5:vec4<f32> = construct 0.0f
+ %6:u32 = load %dyn_index
+ %7:ptr<function, vec4<f32>, read_write> = access %v, 0u, 7u, %6
+ %8:ptr<function, mat2x4<f32>, read_write> = access %v, 0u, 7u
+ switch %6 [c: (0u, $B3), c: (1u, $B4), c: (default, $B5)] { # switch_1
+ $B3: { # case
+ %9:ptr<function, vec4<f32>, read_write> = access %8, 0u
+ store %9, %5
+ exit_switch # switch_1
+ }
+ $B4: { # case
+ %10:ptr<function, vec4<f32>, read_write> = access %8, 1u
+ store %10, %5
+ exit_switch # switch_1
+ }
+ $B5: { # case
+ exit_switch # switch_1
+ }
+ }
+ %11:ptr<function, vec4<f32>, read_write> = access %v, 0u, 7u, %static_index
+ store %11, %5
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixColumnByFunc) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+ auto* get_dynamic = b.Function("get_dynamic", ty.u32());
+ b.Append(get_dynamic->Block(), [&] { b.Return(get_dynamic, b.Load(dyn_index)); });
+ auto* get_static = b.Function("get_static", ty.u32());
+ b.Append(get_static->Block(), [&] { b.Return(get_static, 0_u); });
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* v = b.Var("v", ty.ptr<function>(ty.mat2x4<f32>()));
+ auto* vec = b.Construct(ty.vec4<f32>(), 0_f);
+ auto* access0 = b.Access(ty.ptr<function, vec4<f32>>(), v, b.Call(get_dynamic));
+ b.Store(access0, vec);
+ // Will be transformed because we assume functions return a dynamic value
+ auto* access1 = b.Access(ty.ptr<function, vec4<f32>>(), v, b.Call(get_static));
+ b.Store(access1, vec);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%get_dynamic = func():u32 {
+ $B2: {
+ %3:u32 = load %dyn_index
+ ret %3
+ }
+}
+%get_static = func():u32 {
+ $B3: {
+ ret 0u
+ }
+}
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B4: {
+ %v:ptr<function, mat2x4<f32>, read_write> = var
+ %7:vec4<f32> = construct 0.0f
+ %8:u32 = call %get_dynamic
+ %9:ptr<function, vec4<f32>, read_write> = access %v, %8
+ store %9, %7
+ %10:u32 = call %get_static
+ %11:ptr<function, vec4<f32>, read_write> = access %v, %10
+ store %11, %7
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%get_dynamic = func():u32 {
+ $B2: {
+ %3:u32 = load %dyn_index
+ ret %3
+ }
+}
+%get_static = func():u32 {
+ $B3: {
+ ret 0u
+ }
+}
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B4: {
+ %v:ptr<function, mat2x4<f32>, read_write> = var
+ %7:vec4<f32> = construct 0.0f
+ %8:u32 = call %get_dynamic
+ %9:ptr<function, vec4<f32>, read_write> = access %v, %8
+ switch %8 [c: (0u, $B5), c: (1u, $B6), c: (default, $B7)] { # switch_1
+ $B5: { # case
+ %10:ptr<function, vec4<f32>, read_write> = access %v, 0u
+ store %10, %7
+ exit_switch # switch_1
+ }
+ $B6: { # case
+ %11:ptr<function, vec4<f32>, read_write> = access %v, 1u
+ store %11, %7
+ exit_switch # switch_1
+ }
+ $B7: { # case
+ exit_switch # switch_1
+ }
+ }
+ %12:u32 = call %get_static
+ %13:ptr<function, vec4<f32>, read_write> = access %v, %12
+ switch %12 [c: (0u, $B8), c: (1u, $B9), c: (default, $B10)] { # switch_2
+ $B8: { # case
+ %14:ptr<function, vec4<f32>, read_write> = access %v, 0u
+ store %14, %7
+ exit_switch # switch_2
+ }
+ $B9: { # case
+ %15:ptr<function, vec4<f32>, read_write> = access %v, 1u
+ store %15, %7
+ exit_switch # switch_2
+ }
+ $B10: { # case
+ exit_switch # switch_2
+ }
+ }
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixColumn_ViaPointer) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* v = b.Var("v", ty.ptr<function>(ty.mat2x4<f32>()));
+ auto* vec = b.Construct(ty.vec4<f32>(), 0_f);
+ auto* access0 = b.Access(ty.ptr<function, vec4<f32>>(), v, b.Load(dyn_index));
+ auto* p0 = b.Let("p0", access0);
+ b.Store(p0, vec);
+ auto* access1 = b.Access(ty.ptr<function, vec4<f32>>(), v, static_index);
+ auto* p1 = b.Let("p1", access1);
+ b.Store(p1, vec);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, mat2x4<f32>, read_write> = var
+ %5:vec4<f32> = construct 0.0f
+ %6:u32 = load %dyn_index
+ %7:ptr<function, vec4<f32>, read_write> = access %v, %6
+ %p0:ptr<function, vec4<f32>, read_write> = let %7
+ store %p0, %5
+ %9:ptr<function, vec4<f32>, read_write> = access %v, %static_index
+ %p1:ptr<function, vec4<f32>, read_write> = let %9
+ store %p1, %5
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, mat2x4<f32>, read_write> = var
+ %5:vec4<f32> = construct 0.0f
+ %6:u32 = load %dyn_index
+ %7:ptr<function, vec4<f32>, read_write> = access %v, %6
+ switch %6 [c: (0u, $B3), c: (1u, $B4), c: (default, $B5)] { # switch_1
+ $B3: { # case
+ %8:ptr<function, vec4<f32>, read_write> = access %v, 0u
+ store %8, %5
+ exit_switch # switch_1
+ }
+ $B4: { # case
+ %9:ptr<function, vec4<f32>, read_write> = access %v, 1u
+ store %9, %5
+ exit_switch # switch_1
+ }
+ $B5: { # case
+ exit_switch # switch_1
+ }
+ }
+ %10:ptr<function, vec4<f32>, read_write> = access %v, %static_index
+ store %10, %5
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixColumn_PrivateVar) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+ auto* v = b.Var("v", ty.ptr<private_>(ty.mat2x4<f32>()));
+ mod.root_block->Append(v);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* vec = b.Construct(ty.vec4<f32>(), 0_f);
+ auto* access0 = b.Access(ty.ptr<private_, vec4<f32>>(), v, b.Load(dyn_index));
+ b.Store(access0, vec);
+ auto* access1 = b.Access(ty.ptr<private_, vec4<f32>>(), v, static_index);
+ b.Store(access1, vec);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+ %v:ptr<private, mat2x4<f32>, read_write> = var
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %5:vec4<f32> = construct 0.0f
+ %6:u32 = load %dyn_index
+ %7:ptr<private, vec4<f32>, read_write> = access %v, %6
+ store %7, %5
+ %8:ptr<private, vec4<f32>, read_write> = access %v, %static_index
+ store %8, %5
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+ %v:ptr<private, mat2x4<f32>, read_write> = var
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %5:vec4<f32> = construct 0.0f
+ %6:u32 = load %dyn_index
+ %7:ptr<private, vec4<f32>, read_write> = access %v, %6
+ switch %6 [c: (0u, $B3), c: (1u, $B4), c: (default, $B5)] { # switch_1
+ $B3: { # case
+ %8:ptr<private, vec4<f32>, read_write> = access %v, 0u
+ store %8, %5
+ exit_switch # switch_1
+ }
+ $B4: { # case
+ %9:ptr<private, vec4<f32>, read_write> = access %v, 1u
+ store %9, %5
+ exit_switch # switch_1
+ }
+ $B5: { # case
+ exit_switch # switch_1
+ }
+ }
+ %10:ptr<private, vec4<f32>, read_write> = access %v, %static_index
+ store %10, %5
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixColumn_StorageVar) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+ auto* v = b.Var("v", ty.ptr<storage>(ty.mat2x4<f32>()));
+ v->SetBindingPoint(0, 1);
+ mod.root_block->Append(v);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* vec = b.Construct(ty.vec4<f32>(), 0_f);
+ auto* access0 = b.Access(ty.ptr<storage, vec4<f32>>(), v, b.Load(dyn_index));
+ b.Store(access0, vec);
+ auto* access1 = b.Access(ty.ptr<storage, vec4<f32>>(), v, static_index);
+ b.Store(access1, vec);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+ %v:ptr<storage, mat2x4<f32>, read_write> = var @binding_point(0, 1)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %5:vec4<f32> = construct 0.0f
+ %6:u32 = load %dyn_index
+ %7:ptr<storage, vec4<f32>, read_write> = access %v, %6
+ store %7, %5
+ %8:ptr<storage, vec4<f32>, read_write> = access %v, %static_index
+ store %8, %5
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = src;
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixColumn_WorkgroupVar) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+ auto* v = b.Var("v", ty.ptr<workgroup>(ty.mat2x4<f32>()));
+ mod.root_block->Append(v);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* vec = b.Construct(ty.vec4<f32>(), 0_f);
+ auto* access0 = b.Access(ty.ptr<workgroup, vec4<f32>>(), v, b.Load(dyn_index));
+ b.Store(access0, vec);
+ auto* access1 = b.Access(ty.ptr<workgroup, vec4<f32>>(), v, static_index);
+ b.Store(access1, vec);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+ %v:ptr<workgroup, mat2x4<f32>, read_write> = var
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %5:vec4<f32> = construct 0.0f
+ %6:u32 = load %dyn_index
+ %7:ptr<workgroup, vec4<f32>, read_write> = access %v, %6
+ store %7, %5
+ %8:ptr<workgroup, vec4<f32>, read_write> = access %v, %static_index
+ store %8, %5
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = src;
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(HlslWriterReplaceNonIndexableMatVecStoresTest, MatrixColumnAndElement) {
+ auto* dyn_index = b.Var("dyn_index", ty.ptr<uniform, u32>());
+ dyn_index->SetBindingPoint(0, 0);
+ mod.root_block->Append(dyn_index);
+
+ auto* func = b.Function("main", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ func->SetWorkgroupSize(1, 1, 1);
+ b.Append(func->Block(), [&] {
+ auto* static_index = b.Let("static_index", 0_u);
+ auto* v = b.Var("v", ty.ptr<function>(ty.mat2x4<f32>()));
+ auto* access0 = b.Access(ty.ptr<function, vec4<f32>>(), v, b.Load(dyn_index));
+ b.StoreVectorElement(access0, b.Load(dyn_index), 1_f);
+ auto* access1 = b.Access(ty.ptr<function, vec4<f32>>(), v, static_index);
+ b.StoreVectorElement(access1, static_index, 1_f);
+ b.Return(func);
+ });
+
+ auto* src = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, mat2x4<f32>, read_write> = var
+ %5:u32 = load %dyn_index
+ %6:ptr<function, vec4<f32>, read_write> = access %v, %5
+ %7:u32 = load %dyn_index
+ store_vector_element %6, %7, 1.0f
+ %8:ptr<function, vec4<f32>, read_write> = access %v, %static_index
+ store_vector_element %8, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+$B1: { # root
+ %dyn_index:ptr<uniform, u32, read> = var @binding_point(0, 0)
+}
+
+%main = @compute @workgroup_size(1, 1, 1) func():void {
+ $B2: {
+ %static_index:u32 = let 0u
+ %v:ptr<function, mat2x4<f32>, read_write> = var
+ %5:u32 = load %dyn_index
+ %6:ptr<function, vec4<f32>, read_write> = access %v, %5
+ %7:u32 = load %dyn_index
+ switch %5 [c: (0u, $B3), c: (1u, $B4), c: (default, $B5)] { # switch_1
+ $B3: { # case
+ %8:ptr<function, vec4<f32>, read_write> = access %v, 0u
+ %9:vec4<f32> = load %8
+ %10:vec4<f32> = swizzle 1.0f, xxxx
+ %11:vec4<f32> = swizzle %7, xxxx
+ %12:vec4<f32> = construct 0i, 1i, 2i, 3i
+ %13:vec4<bool> = eq %11, %12
+ %14:vec4<f32> = select %9, %10, %13
+ store %8, %14
+ exit_switch # switch_1
+ }
+ $B4: { # case
+ %15:ptr<function, vec4<f32>, read_write> = access %v, 1u
+ %16:vec4<f32> = load %15
+ %17:vec4<f32> = swizzle 1.0f, xxxx
+ %18:vec4<f32> = swizzle %7, xxxx
+ %19:vec4<f32> = construct 0i, 1i, 2i, 3i
+ %20:vec4<bool> = eq %18, %19
+ %21:vec4<f32> = select %16, %17, %20
+ store %15, %21
+ exit_switch # switch_1
+ }
+ $B5: { # case
+ exit_switch # switch_1
+ }
+ }
+ %22:ptr<function, vec4<f32>, read_write> = access %v, %static_index
+ store_vector_element %22, %static_index, 1.0f
+ ret
+ }
+}
+)";
+
+ Run(ReplaceNonIndexableMatVecStores);
+
+ EXPECT_EQ(expect, str());
+}
+
+} // namespace
+} // namespace tint::hlsl::writer::raise
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.ir.fxc.hlsl
index 90cc569..f87c5c2 100644
--- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.ir.fxc.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
@@ -7,11 +5,22 @@
[numthreads(1, 1, 1)]
void main() {
float2x4 m1 = float2x4((0.0f).xxxx, (0.0f).xxxx);
- m1[uniforms[0u].x][0] = 1.0f;
+ uint v = uniforms[0u].x;
+ switch(v) {
+ case 0u:
+ {
+ m1[0u][int(0)] = 1.0f;
+ break;
+ }
+ case 1u:
+ {
+ m1[1u][int(0)] = 1.0f;
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
}
-FXC validation failure:
-<scrubbed_path>(8,3-20): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.ir.fxc.hlsl
index b2d4f59..0751a3d 100644
--- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.ir.fxc.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
@@ -7,11 +5,25 @@
[numthreads(1, 1, 1)]
void main() {
float2x4 m1 = float2x4((0.0f).xxxx, (0.0f).xxxx);
- m1[uniforms[0u].x][uniforms[0u].y] = 1.0f;
+ uint v = uniforms[0u].x;
+ uint v_1 = uniforms[0u].y;
+ switch(v) {
+ case 0u:
+ {
+ float4 v_2 = m1[0u];
+ m1[0u] = (((v_1.xxxx == float4(int(0), int(1), int(2), int(3)))) ? (1.0f.xxxx) : (v_2));
+ break;
+ }
+ case 1u:
+ {
+ float4 v_3 = m1[1u];
+ m1[1u] = (((v_1.xxxx == float4(int(0), int(1), int(2), int(3)))) ? (1.0f.xxxx) : (v_3));
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
}
-FXC validation failure:
-<scrubbed_path>(8,3-20): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.ir.fxc.hlsl
index f12523a..6fa43fc 100644
--- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.ir.fxc.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
@@ -7,11 +5,8 @@
static float2x4 m1 = float2x4((0.0f).xxxx, (0.0f).xxxx);
[numthreads(1, 1, 1)]
void main() {
- m1[0][uniforms[0u].y] = 1.0f;
+ float4 v = m1[int(0)];
+ float4 v_1 = uniforms[0u].y.xxxx;
+ m1[int(0)] = (((v_1 == float4(int(0), int(1), int(2), int(3)))) ? (1.0f.xxxx) : (v));
}
-FXC validation failure:
-<scrubbed_path>(8,3-23): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.ir.fxc.hlsl
index e10bf36..99effaf 100644
--- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.ir.fxc.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
@@ -7,11 +5,22 @@
[numthreads(1, 1, 1)]
void main() {
float2x4 m1 = float2x4((0.0f).xxxx, (0.0f).xxxx);
- m1[uniforms[0u].x] = (1.0f).xxxx;
+ uint v = uniforms[0u].x;
+ switch(v) {
+ case 0u:
+ {
+ m1[0u] = (1.0f).xxxx;
+ break;
+ }
+ case 1u:
+ {
+ m1[1u] = (1.0f).xxxx;
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
}
-FXC validation failure:
-<scrubbed_path>(8,3-20): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.ir.fxc.hlsl
index 5f16a9d..3f4f699 100644
--- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.ir.fxc.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
@@ -7,11 +5,22 @@
static float2x4 m1 = float2x4((0.0f).xxxx, (0.0f).xxxx);
[numthreads(1, 1, 1)]
void main() {
- m1[uniforms[0u].x][0] = 1.0f;
+ uint v = uniforms[0u].x;
+ switch(v) {
+ case 0u:
+ {
+ m1[0u][int(0)] = 1.0f;
+ break;
+ }
+ case 1u:
+ {
+ m1[1u][int(0)] = 1.0f;
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
}
-FXC validation failure:
-<scrubbed_path>(8,3-20): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.ir.fxc.hlsl
index c91def8..fc07399 100644
--- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.ir.fxc.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
@@ -7,11 +5,25 @@
static float2x4 m1 = float2x4((0.0f).xxxx, (0.0f).xxxx);
[numthreads(1, 1, 1)]
void main() {
- m1[uniforms[0u].x][uniforms[0u].y] = 1.0f;
+ uint v = uniforms[0u].x;
+ uint v_1 = uniforms[0u].y;
+ switch(v) {
+ case 0u:
+ {
+ float4 v_2 = m1[0u];
+ m1[0u] = (((v_1.xxxx == float4(int(0), int(1), int(2), int(3)))) ? (1.0f.xxxx) : (v_2));
+ break;
+ }
+ case 1u:
+ {
+ float4 v_3 = m1[1u];
+ m1[1u] = (((v_1.xxxx == float4(int(0), int(1), int(2), int(3)))) ? (1.0f.xxxx) : (v_3));
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
}
-FXC validation failure:
-<scrubbed_path>(8,3-20): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.ir.fxc.hlsl
index f12523a..6fa43fc 100644
--- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.ir.fxc.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
@@ -7,11 +5,8 @@
static float2x4 m1 = float2x4((0.0f).xxxx, (0.0f).xxxx);
[numthreads(1, 1, 1)]
void main() {
- m1[0][uniforms[0u].y] = 1.0f;
+ float4 v = m1[int(0)];
+ float4 v_1 = uniforms[0u].y.xxxx;
+ m1[int(0)] = (((v_1 == float4(int(0), int(1), int(2), int(3)))) ? (1.0f.xxxx) : (v));
}
-FXC validation failure:
-<scrubbed_path>(8,3-23): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.ir.fxc.hlsl
index b8f8b30..25208fe 100644
--- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.ir.fxc.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
@@ -7,11 +5,22 @@
static float2x4 m1 = float2x4((0.0f).xxxx, (0.0f).xxxx);
[numthreads(1, 1, 1)]
void main() {
- m1[uniforms[0u].x] = (1.0f).xxxx;
+ uint v = uniforms[0u].x;
+ switch(v) {
+ case 0u:
+ {
+ m1[0u] = (1.0f).xxxx;
+ break;
+ }
+ case 1u:
+ {
+ m1[1u] = (1.0f).xxxx;
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
}
-FXC validation failure:
-<scrubbed_path>(8,3-20): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/bug/fxc/vector_assignment_dynamic_index/function_var.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_dynamic_index/function_var.wgsl.expected.ir.fxc.hlsl
index a0e620d..78a74a4 100644
--- a/test/tint/bug/fxc/vector_assignment_dynamic_index/function_var.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/fxc/vector_assignment_dynamic_index/function_var.wgsl.expected.ir.fxc.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
cbuffer cbuffer_i : register(b0) {
uint4 i[1];
@@ -7,11 +5,8 @@
[numthreads(1, 1, 1)]
void main() {
float3 v1 = (0.0f).xxx;
- v1[i[0u].x] = 1.0f;
+ float3 v = v1;
+ float3 v_1 = i[0u].x.xxx;
+ v1 = (((v_1 == float3(int(0), int(1), int(2)))) ? (1.0f.xxx) : (v));
}
-FXC validation failure:
-<scrubbed_path>(8,3-13): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/bug/fxc/vector_assignment_dynamic_index/private_var.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_dynamic_index/private_var.wgsl.expected.ir.fxc.hlsl
index 4545f7c..b3df419 100644
--- a/test/tint/bug/fxc/vector_assignment_dynamic_index/private_var.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/fxc/vector_assignment_dynamic_index/private_var.wgsl.expected.ir.fxc.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
cbuffer cbuffer_i : register(b0) {
uint4 i[1];
@@ -7,11 +5,8 @@
static float3 v1 = (0.0f).xxx;
[numthreads(1, 1, 1)]
void main() {
- v1[i[0u].x] = 1.0f;
+ float3 v = v1;
+ float3 v_1 = i[0u].x.xxx;
+ v1 = (((v_1 == float3(int(0), int(1), int(2)))) ? (1.0f.xxx) : (v));
}
-FXC validation failure:
-<scrubbed_path>(8,3-13): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.ir.fxc.hlsl
index cc983da..75dba2e 100644
--- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.ir.fxc.hlsl
@@ -11,10 +11,18 @@
} else {
break;
}
- v2f[i] = 1.0f;
- v3i[i] = int(1);
- v4u[i] = 1u;
- v2b[i] = true;
+ float2 v = v2f;
+ float2 v_1 = i.xx;
+ v2f = (((v_1 == float2(int(0), int(1)))) ? (1.0f.xx) : (v));
+ int3 v_2 = v3i;
+ int3 v_3 = i.xxx;
+ v3i = (((v_3 == int3(int(0), int(1), int(2)))) ? (int(1).xxx) : (v_2));
+ uint4 v_4 = v4u;
+ uint4 v_5 = i.xxxx;
+ v4u = (((v_5 == uint4(int(0), int(1), int(2), int(3)))) ? (1u.xxxx) : (v_4));
+ bool2 v_6 = v2b;
+ bool2 v_7 = i.xx;
+ v2b = (((v_7 == bool2(int(0), int(1)))) ? (true.xx) : (v_6));
{
i = (i + int(1));
}
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.ir.fxc.hlsl
index efcfa31..de7c05e 100644
--- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.ir.fxc.hlsl
@@ -5,10 +5,18 @@
static bool2 v2b = (false).xx;
void foo() {
int i = int(0);
- v2f[i] = 1.0f;
- v3i[i] = int(1);
- v4u[i] = 1u;
- v2b[i] = true;
+ float2 v = v2f;
+ float2 v_1 = i.xx;
+ v2f = (((v_1 == float2(int(0), int(1)))) ? (1.0f.xx) : (v));
+ int3 v_2 = v3i;
+ int3 v_3 = i.xxx;
+ v3i = (((v_3 == int3(int(0), int(1), int(2)))) ? (int(1).xxx) : (v_2));
+ uint4 v_4 = v4u;
+ uint4 v_5 = i.xxxx;
+ v4u = (((v_5 == uint4(int(0), int(1), int(2), int(3)))) ? (1u.xxxx) : (v_4));
+ bool2 v_6 = v2b;
+ bool2 v_7 = i.xx;
+ v2b = (((v_7 == bool2(int(0), int(1)))) ? (true.xx) : (v_6));
}
[numthreads(1, 1, 1)]
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.ir.fxc.hlsl
index a2633f2..d48859e 100644
--- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.ir.fxc.hlsl
@@ -20,18 +20,42 @@
} else {
break;
}
- v2f[i] = 1.0f;
- v3f[i] = 1.0f;
- v4f[i] = 1.0f;
- v2i[i] = int(1);
- v3i[i] = int(1);
- v4i[i] = int(1);
- v2u[i] = 1u;
- v3u[i] = 1u;
- v4u[i] = 1u;
- v2b[i] = true;
- v3b[i] = true;
- v4b[i] = true;
+ float2 v = v2f;
+ float2 v_1 = i.xx;
+ v2f = (((v_1 == float2(int(0), int(1)))) ? (1.0f.xx) : (v));
+ float3 v_2 = v3f;
+ float3 v_3 = i.xxx;
+ v3f = (((v_3 == float3(int(0), int(1), int(2)))) ? (1.0f.xxx) : (v_2));
+ float4 v_4 = v4f;
+ float4 v_5 = i.xxxx;
+ v4f = (((v_5 == float4(int(0), int(1), int(2), int(3)))) ? (1.0f.xxxx) : (v_4));
+ int2 v_6 = v2i;
+ int2 v_7 = i.xx;
+ v2i = (((v_7 == int2(int(0), int(1)))) ? (int(1).xx) : (v_6));
+ int3 v_8 = v3i;
+ int3 v_9 = i.xxx;
+ v3i = (((v_9 == int3(int(0), int(1), int(2)))) ? (int(1).xxx) : (v_8));
+ int4 v_10 = v4i;
+ int4 v_11 = i.xxxx;
+ v4i = (((v_11 == int4(int(0), int(1), int(2), int(3)))) ? (int(1).xxxx) : (v_10));
+ uint2 v_12 = v2u;
+ uint2 v_13 = i.xx;
+ v2u = (((v_13 == uint2(int(0), int(1)))) ? (1u.xx) : (v_12));
+ uint3 v_14 = v3u;
+ uint3 v_15 = i.xxx;
+ v3u = (((v_15 == uint3(int(0), int(1), int(2)))) ? (1u.xxx) : (v_14));
+ uint4 v_16 = v4u;
+ uint4 v_17 = i.xxxx;
+ v4u = (((v_17 == uint4(int(0), int(1), int(2), int(3)))) ? (1u.xxxx) : (v_16));
+ bool2 v_18 = v2b;
+ bool2 v_19 = i.xx;
+ v2b = (((v_19 == bool2(int(0), int(1)))) ? (true.xx) : (v_18));
+ bool3 v_20 = v3b;
+ bool3 v_21 = i.xxx;
+ v3b = (((v_21 == bool3(int(0), int(1), int(2)))) ? (true.xxx) : (v_20));
+ bool4 v_22 = v4b;
+ bool4 v_23 = i.xxxx;
+ v4b = (((v_23 == bool4(int(0), int(1), int(2), int(3)))) ? (true.xxxx) : (v_22));
{
i = (i + int(1));
}
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.ir.fxc.hlsl
index 3d27cfa..6df324f 100644
--- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.ir.fxc.hlsl
@@ -16,14 +16,30 @@
} else {
break;
}
- v2f[i] = 1.0f;
- v3i[i] = int(1);
- v4u[i] = 1u;
- v2b[i] = true;
- v2f_2[i] = 1.0f;
- v3i_2[i] = int(1);
- v4u_2[i] = 1u;
- v2b_2[i] = true;
+ float2 v = v2f;
+ float2 v_1 = i.xx;
+ v2f = (((v_1 == float2(int(0), int(1)))) ? (1.0f.xx) : (v));
+ int3 v_2 = v3i;
+ int3 v_3 = i.xxx;
+ v3i = (((v_3 == int3(int(0), int(1), int(2)))) ? (int(1).xxx) : (v_2));
+ uint4 v_4 = v4u;
+ uint4 v_5 = i.xxxx;
+ v4u = (((v_5 == uint4(int(0), int(1), int(2), int(3)))) ? (1u.xxxx) : (v_4));
+ bool2 v_6 = v2b;
+ bool2 v_7 = i.xx;
+ v2b = (((v_7 == bool2(int(0), int(1)))) ? (true.xx) : (v_6));
+ float2 v_8 = v2f_2;
+ float2 v_9 = i.xx;
+ v2f_2 = (((v_9 == float2(int(0), int(1)))) ? (1.0f.xx) : (v_8));
+ int3 v_10 = v3i_2;
+ int3 v_11 = i.xxx;
+ v3i_2 = (((v_11 == int3(int(0), int(1), int(2)))) ? (int(1).xxx) : (v_10));
+ uint4 v_12 = v4u_2;
+ uint4 v_13 = i.xxxx;
+ v4u_2 = (((v_13 == uint4(int(0), int(1), int(2), int(3)))) ? (1u.xxxx) : (v_12));
+ bool2 v_14 = v2b_2;
+ bool2 v_15 = i.xx;
+ v2b_2 = (((v_15 == bool2(int(0), int(1)))) ? (true.xx) : (v_14));
{
i = (i + int(1));
}
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.ir.fxc.hlsl
index 69fe60a..2876a60 100644
--- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.ir.fxc.hlsl
@@ -20,10 +20,18 @@
} else {
break;
}
- v2f[i] = 1.0f;
- v2i[i] = int(1);
- v2u[i] = 1u;
- v2b[i] = true;
+ float2 v = v2f;
+ float2 v_1 = i.xx;
+ v2f = (((v_1 == float2(int(0), int(1)))) ? (1.0f.xx) : (v));
+ int2 v_2 = v2i;
+ int2 v_3 = i.xx;
+ v2i = (((v_3 == int2(int(0), int(1)))) ? (int(1).xx) : (v_2));
+ uint2 v_4 = v2u;
+ uint2 v_5 = i.xx;
+ v2u = (((v_5 == uint2(int(0), int(1)))) ? (1u.xx) : (v_4));
+ bool2 v_6 = v2b;
+ bool2 v_7 = i.xx;
+ v2b = (((v_7 == bool2(int(0), int(1)))) ? (true.xx) : (v_6));
{
i = (i + int(1));
}
@@ -31,13 +39,29 @@
}
}
int i = int(0);
- v3f[i] = 1.0f;
- v4f[i] = 1.0f;
- v3i[i] = int(1);
- v4i[i] = int(1);
- v3u[i] = 1u;
- v4u[i] = 1u;
- v3b[i] = true;
- v4b[i] = true;
+ float3 v_8 = v3f;
+ float3 v_9 = i.xxx;
+ v3f = (((v_9 == float3(int(0), int(1), int(2)))) ? (1.0f.xxx) : (v_8));
+ float4 v_10 = v4f;
+ float4 v_11 = i.xxxx;
+ v4f = (((v_11 == float4(int(0), int(1), int(2), int(3)))) ? (1.0f.xxxx) : (v_10));
+ int3 v_12 = v3i;
+ int3 v_13 = i.xxx;
+ v3i = (((v_13 == int3(int(0), int(1), int(2)))) ? (int(1).xxx) : (v_12));
+ int4 v_14 = v4i;
+ int4 v_15 = i.xxxx;
+ v4i = (((v_15 == int4(int(0), int(1), int(2), int(3)))) ? (int(1).xxxx) : (v_14));
+ uint3 v_16 = v3u;
+ uint3 v_17 = i.xxx;
+ v3u = (((v_17 == uint3(int(0), int(1), int(2)))) ? (1u.xxx) : (v_16));
+ uint4 v_18 = v4u;
+ uint4 v_19 = i.xxxx;
+ v4u = (((v_19 == uint4(int(0), int(1), int(2), int(3)))) ? (1u.xxxx) : (v_18));
+ bool3 v_20 = v3b;
+ bool3 v_21 = i.xxx;
+ v3b = (((v_21 == bool3(int(0), int(1), int(2)))) ? (true.xxx) : (v_20));
+ bool4 v_22 = v4b;
+ bool4 v_23 = i.xxxx;
+ v4b = (((v_23 == bool4(int(0), int(1), int(2), int(3)))) ? (true.xxxx) : (v_22));
}
diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.ir.fxc.hlsl
index 7d6c6e4..0fc73a3 100644
--- a/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.ir.fxc.hlsl
@@ -14,17 +14,41 @@
bool3 v3b = (false).xxx;
bool4 v4b = (false).xxxx;
int i = int(0);
- v2f[i] = 1.0f;
- v3f[i] = 1.0f;
- v4f[i] = 1.0f;
- v2i[i] = int(1);
- v3i[i] = int(1);
- v4i[i] = int(1);
- v2u[i] = 1u;
- v3u[i] = 1u;
- v4u[i] = 1u;
- v2b[i] = true;
- v3b[i] = true;
- v4b[i] = true;
+ float2 v = v2f;
+ float2 v_1 = i.xx;
+ v2f = (((v_1 == float2(int(0), int(1)))) ? (1.0f.xx) : (v));
+ float3 v_2 = v3f;
+ float3 v_3 = i.xxx;
+ v3f = (((v_3 == float3(int(0), int(1), int(2)))) ? (1.0f.xxx) : (v_2));
+ float4 v_4 = v4f;
+ float4 v_5 = i.xxxx;
+ v4f = (((v_5 == float4(int(0), int(1), int(2), int(3)))) ? (1.0f.xxxx) : (v_4));
+ int2 v_6 = v2i;
+ int2 v_7 = i.xx;
+ v2i = (((v_7 == int2(int(0), int(1)))) ? (int(1).xx) : (v_6));
+ int3 v_8 = v3i;
+ int3 v_9 = i.xxx;
+ v3i = (((v_9 == int3(int(0), int(1), int(2)))) ? (int(1).xxx) : (v_8));
+ int4 v_10 = v4i;
+ int4 v_11 = i.xxxx;
+ v4i = (((v_11 == int4(int(0), int(1), int(2), int(3)))) ? (int(1).xxxx) : (v_10));
+ uint2 v_12 = v2u;
+ uint2 v_13 = i.xx;
+ v2u = (((v_13 == uint2(int(0), int(1)))) ? (1u.xx) : (v_12));
+ uint3 v_14 = v3u;
+ uint3 v_15 = i.xxx;
+ v3u = (((v_15 == uint3(int(0), int(1), int(2)))) ? (1u.xxx) : (v_14));
+ uint4 v_16 = v4u;
+ uint4 v_17 = i.xxxx;
+ v4u = (((v_17 == uint4(int(0), int(1), int(2), int(3)))) ? (1u.xxxx) : (v_16));
+ bool2 v_18 = v2b;
+ bool2 v_19 = i.xx;
+ v2b = (((v_19 == bool2(int(0), int(1)))) ? (true.xx) : (v_18));
+ bool3 v_20 = v3b;
+ bool3 v_21 = i.xxx;
+ v3b = (((v_21 == bool3(int(0), int(1), int(2)))) ? (true.xxx) : (v_20));
+ bool4 v_22 = v4b;
+ bool4 v_23 = i.xxxx;
+ v4b = (((v_23 == bool4(int(0), int(1), int(2), int(3)))) ? (true.xxxx) : (v_22));
}
diff --git a/test/tint/bug/tint/2059.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/2059.wgsl.expected.ir.fxc.hlsl
index 0fd28a0..10d187e 100644
--- a/test/tint/bug/tint/2059.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/tint/2059.wgsl.expected.ir.fxc.hlsl
@@ -231,7 +231,28 @@
uint v_41 = c;
float v_42 = float(((c * 3u) + 1u));
float v_43 = float(((c * 3u) + 2u));
- m[v_41] = float3(v_42, v_43, float(((c * 3u) + 3u)));
+ float3 v_44 = float3(v_42, v_43, float(((c * 3u) + 3u)));
+ switch(v_41) {
+ case 0u:
+ {
+ m[0u] = v_44;
+ break;
+ }
+ case 1u:
+ {
+ m[1u] = v_44;
+ break;
+ }
+ case 2u:
+ {
+ m[2u] = v_44;
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
{
c = (c + 1u);
}
@@ -240,33 +261,33 @@
}
float3x3 a = m;
v_40(0u, a);
- S v_44 = {m};
- S a_1 = v_44;
+ S v_45 = {m};
+ S a_1 = v_45;
v_39(0u, a_1);
- float3x3 v_45[1] = (float3x3[1])0;
- S2 v_46 = {v_45};
- S2 a_2 = v_46;
+ float3x3 v_46[1] = (float3x3[1])0;
+ S2 v_47 = {v_46};
+ S2 a_2 = v_47;
v_36(0u, a_2);
- S v_47 = {m};
- S3 v_48 = {v_47};
- S3 a_3 = v_48;
+ S v_48 = {m};
+ S3 v_49 = {v_48};
+ S3 a_3 = v_49;
v_30(0u, a_3);
- S v_49 = {m};
- S v_50[1] = (S[1])0;
- S4 v_51 = {v_50};
- S4 a_4 = v_51;
+ S v_50 = {m};
+ S v_51[1] = (S[1])0;
+ S4 v_52 = {v_51};
+ S4 a_4 = v_52;
v_26(0u, a_4);
- float3x3 v_52[1] = (float3x3[1])0;
- float3x3 a_5[1] = v_52;
+ float3x3 v_53[1] = (float3x3[1])0;
+ float3x3 a_5[1] = v_53;
v_17(0u, a_5);
- S v_53 = {m};
- S v_54[1] = (S[1])0;
- S a_6[1] = v_54;
+ S v_54 = {m};
+ S v_55[1] = (S[1])0;
+ S a_6[1] = v_55;
v_12(0u, a_6);
- float3x3 v_55[1] = (float3x3[1])0;
- S2 v_56 = {v_55};
- S2 v_57[1] = (S2[1])0;
- S2 a_7[1] = v_57;
+ float3x3 v_56[1] = (float3x3[1])0;
+ S2 v_57 = {v_56};
+ S2 v_58[1] = (S2[1])0;
+ S2 a_7[1] = v_58;
v_6(0u, a_7);
}
diff --git a/test/tint/bug/tint/534.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/534.wgsl.expected.ir.fxc.hlsl
index 83f7d28..040f13e 100644
--- a/test/tint/bug/tint/534.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/tint/534.wgsl.expected.ir.fxc.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
struct main_inputs {
uint3 GlobalInvocationID : SV_DispatchThreadID;
};
@@ -28,12 +26,10 @@
if ((uniforms[0u].x == 1u)) {
srcTexCoord[1u] = ((size.y - dstTexCoord.y) - 1u);
}
- Texture2D<float4> v_1 = src;
- int2 v_2 = int2(srcTexCoord);
- float4 srcColor = float4(v_1.Load(int3(v_2, int(0))));
- Texture2D<float4> v_3 = tint_symbol;
- int2 v_4 = int2(dstTexCoord);
- float4 dstColor = float4(v_3.Load(int3(v_4, int(0))));
+ int2 v_1 = int2(srcTexCoord);
+ float4 srcColor = float4(src.Load(int3(v_1, int(int(0)))));
+ int2 v_2 = int2(dstTexCoord);
+ float4 dstColor = float4(tint_symbol.Load(int3(v_2, int(int(0)))));
bool success = true;
uint4 srcColorBits = (0u).xxxx;
uint4 dstColorBits = tint_v4f32_to_v4u32(dstColor);
@@ -44,8 +40,10 @@
} else {
break;
}
- uint v_5 = i;
- srcColorBits[v_5] = ConvertToFp16FloatValue(srcColor[i]);
+ uint v_3 = i;
+ uint v_4 = ConvertToFp16FloatValue(srcColor[i]);
+ uint4 v_5 = srcColorBits;
+ srcColorBits = (((v_3.xxxx == uint4(int(0), int(1), int(2), int(3)))) ? (v_4.xxxx) : (v_5));
bool v_6 = false;
if (success) {
v_6 = (srcColorBits[i] == dstColorBits[i]);
@@ -72,8 +70,3 @@
main_inner(inputs.GlobalInvocationID);
}
-FXC validation failure:
-<scrubbed_path>(40,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/bug/tint/980.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/980.wgsl.expected.ir.fxc.hlsl
index d60f572..e5d0c5d 100644
--- a/test/tint/bug/tint/980.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/tint/980.wgsl.expected.ir.fxc.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
struct main_inputs {
uint idx : SV_GroupIndex;
};
@@ -8,13 +6,15 @@
RWByteAddressBuffer io : register(u0);
float3 Bad(uint index, float3 rd) {
float3 normal = (0.0f).xxx;
- normal[index] = -(float(sign(rd[index])));
+ float v_1 = -(float(sign(rd[index])));
+ float3 v_2 = normal;
+ normal = (((index.xxx == float3(int(0), int(1), int(2)))) ? (v_1.xxx) : (v_2));
return normalize(normal);
}
void main_inner(uint idx) {
- uint v_1 = io.Load(12u);
- io.Store3(0u, asuint(Bad(v_1, asfloat(io.Load3(0u)))));
+ uint v_3 = io.Load(12u);
+ io.Store3(0u, asuint(Bad(v_3, asfloat(io.Load3(0u)))));
}
[numthreads(1, 1, 1)]
@@ -22,8 +22,3 @@
main_inner(inputs.idx);
}
-FXC validation failure:
-<scrubbed_path>(9,3-15): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.ir.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.ir.fxc.hlsl
index a6d2f00..0595fe8 100644
--- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.ir.fxc.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
struct OuterS {
float2x4 m1;
};
@@ -11,12 +9,42 @@
[numthreads(1, 1, 1)]
void main() {
OuterS s1 = (OuterS)0;
- s1.m1[uniforms[0u].x] = (1.0f).xxxx;
- s1.m1[uniforms[0u].x][uniforms[0u].x] = 1.0f;
+ uint v = uniforms[0u].x;
+ switch(v) {
+ case 0u:
+ {
+ s1.m1[0u] = (1.0f).xxxx;
+ break;
+ }
+ case 1u:
+ {
+ s1.m1[1u] = (1.0f).xxxx;
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ uint v_1 = uniforms[0u].x;
+ uint v_2 = uniforms[0u].x;
+ switch(v_1) {
+ case 0u:
+ {
+ float4 v_3 = s1.m1[0u];
+ s1.m1[0u] = (((v_2.xxxx == float4(int(0), int(1), int(2), int(3)))) ? (1.0f.xxxx) : (v_3));
+ break;
+ }
+ case 1u:
+ {
+ float4 v_4 = s1.m1[1u];
+ s1.m1[1u] = (((v_2.xxxx == float4(int(0), int(1), int(2), int(3)))) ? (1.0f.xxxx) : (v_4));
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
}
-FXC validation failure:
-<scrubbed_path>(12,3-23): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.ir.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.ir.fxc.hlsl
index 26172b0..1b0ff6b 100644
--- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.ir.fxc.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
struct OuterS {
float3 v1;
};
@@ -11,11 +9,8 @@
[numthreads(1, 1, 1)]
void main() {
OuterS s1 = (OuterS)0;
- s1.v1[uniforms[0u].x] = 1.0f;
+ float3 v = s1.v1;
+ float3 v_1 = uniforms[0u].x.xxx;
+ s1.v1 = (((v_1 == float3(int(0), int(1), int(2)))) ? (1.0f.xxx) : (v));
}
-FXC validation failure:
-<scrubbed_path>(12,3-23): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.ir.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.ir.fxc.hlsl
index c380d42..5a7f3d5 100644
--- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.ir.fxc.hlsl
@@ -15,8 +15,12 @@
OuterS s1 = (OuterS)0;
float3 v = (0.0f).xxx;
uint v_1 = uniforms[0u].x;
- v[s1.a1[v_1]] = 1.0f;
- uint v_2 = uniforms[0u].x;
- v[f(s1.a1[v_2])] = 1.0f;
+ float3 v_2 = v;
+ float3 v_3 = s1.a1[v_1].xxx;
+ v = (((v_3 == float3(int(0), int(1), int(2)))) ? (1.0f.xxx) : (v_2));
+ uint v_4 = uniforms[0u].x;
+ uint v_5 = f(s1.a1[v_4]);
+ float3 v_6 = v;
+ v = (((v_5.xxx == float3(int(0), int(1), int(2)))) ? (1.0f.xxx) : (v_6));
}
diff --git a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.ir.fxc.hlsl b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.ir.fxc.hlsl
index b99a5f0..d5f7a21 100644
--- a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.ir.fxc.hlsl
@@ -18,7 +18,9 @@
S x = (S)0;
int v = foo();
int v_1 = bar();
- x.a[v][v_1] = (x.a[v][v_1] + int(5));
+ int4 v_2 = x.a[v];
+ int4 v_3 = (x.a[v][v_1] + int(5)).xxxx;
+ x.a[v] = (((v_1.xxxx == int4(int(0), int(1), int(2), int(3)))) ? (v_3) : (v_2));
}
[numthreads(1, 1, 1)]
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index 90e9bef..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,3 +0,0 @@
-SKIP: FAILED
-
-test timed out after 2m0s
\ No newline at end of file
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index 90e9bef..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,3 +0,0 @@
-SKIP: FAILED
-
-test timed out after 2m0s
\ No newline at end of file
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index dd6a20e..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,177 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-struct main_inputs {
- float4 gl_FragCoord_param : SV_Position;
-};
-
-
-static float4 gl_FragCoord = (0.0f).xxxx;
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float4 c = (0.0f).xxxx;
- int a = 0;
- int i1 = 0;
- int i2 = 0;
- int i3 = 0;
- int i4 = 0;
- int i5 = 0;
- int i6 = 0;
- int i7 = 0;
- int i8_1 = 0;
- c = float4(0.0f, 0.0f, 0.0f, 1.0f);
- a = 0;
- {
- while(true) {
- {
- while(true) {
- int x_46 = a;
- c[x_46] = 1.0f;
- i1 = 0;
- {
- while(true) {
- if ((i1 < 1)) {
- } else {
- break;
- }
- i2 = 0;
- {
- while(true) {
- if ((i2 < 1)) {
- } else {
- break;
- }
- i3 = 0;
- {
- while(true) {
- if ((i3 < 1)) {
- } else {
- break;
- }
- i4 = 0;
- {
- while(true) {
- if ((i4 < 1)) {
- } else {
- break;
- }
- i5 = 0;
- {
- while(true) {
- if ((i5 < 1)) {
- } else {
- break;
- }
- i6 = 0;
- {
- while(true) {
- if ((i6 < 1)) {
- } else {
- break;
- }
- i7 = 0;
- {
- while(true) {
- if ((i7 < 1)) {
- } else {
- break;
- }
- i8_1 = 0;
- {
- while(true) {
- if ((i8_1 < 17)) {
- } else {
- break;
- }
- a = (a + 1);
- {
- i8_1 = (i8_1 + 1);
- }
- continue;
- }
- }
- {
- i7 = (i7 + 1);
- }
- continue;
- }
- }
- {
- i6 = (i6 + 1);
- }
- continue;
- }
- }
- {
- i5 = (i5 + 1);
- }
- continue;
- }
- }
- {
- i4 = (i4 + 1);
- }
- continue;
- }
- }
- {
- i3 = (i3 + 1);
- }
- continue;
- }
- }
- {
- i2 = (i2 + 1);
- }
- continue;
- }
- }
- {
- i1 = (i1 + 1);
- }
- continue;
- }
- }
- {
- float x_123 = gl_FragCoord.x;
- if (!((x_123 < -1.0f))) { break; }
- }
- continue;
- }
- }
- {
- float x_126 = gl_FragCoord.y;
- if (!((x_126 < -1.0f))) { break; }
- }
- continue;
- }
- }
- x_GLF_color = c;
-}
-
-main_out main_inner(float4 gl_FragCoord_param) {
- gl_FragCoord = gl_FragCoord_param;
- main_1();
- main_out v = {x_GLF_color};
- return v;
-}
-
-main_outputs main(main_inputs inputs) {
- main_out v_1 = main_inner(float4(inputs.gl_FragCoord_param.xyz, (1.0f / inputs.gl_FragCoord_param[3u])));
- main_outputs v_2 = {v_1.x_GLF_color_1};
- return v_2;
-}
-
-FXC validation failure:
-<scrubbed_path>(32,9-19): error X3511: forced to unroll loop, but unrolling failed.
-<scrubbed_path>(30,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index 5effb80..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,195 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-struct main_inputs {
- float4 gl_FragCoord_param : SV_Position;
-};
-
-
-static float4 gl_FragCoord = (0.0f).xxxx;
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float4 c = (0.0f).xxxx;
- int a = 0;
- int i1 = 0;
- int i2 = 0;
- int i3 = 0;
- int i4 = 0;
- int i5 = 0;
- int i6 = 0;
- int i7 = 0;
- int i8_1 = 0;
- c = float4(0.0f, 0.0f, 0.0f, 1.0f);
- a = 0;
- {
- while(true) {
- {
- while(true) {
- int x_46 = a;
- c[x_46] = 1.0f;
- i1 = 0;
- {
- while(true) {
- int x_52 = i1;
- if ((x_52 < 1)) {
- } else {
- break;
- }
- i2 = 0;
- {
- while(true) {
- int x_59 = i2;
- if ((x_59 < 1)) {
- } else {
- break;
- }
- i3 = 0;
- {
- while(true) {
- int x_66 = i3;
- if ((x_66 < 1)) {
- } else {
- break;
- }
- i4 = 0;
- {
- while(true) {
- int x_73 = i4;
- if ((x_73 < 1)) {
- } else {
- break;
- }
- i5 = 0;
- {
- while(true) {
- int x_80 = i5;
- if ((x_80 < 1)) {
- } else {
- break;
- }
- i6 = 0;
- {
- while(true) {
- int x_87 = i6;
- if ((x_87 < 1)) {
- } else {
- break;
- }
- i7 = 0;
- {
- while(true) {
- int x_94 = i7;
- if ((x_94 < 1)) {
- } else {
- break;
- }
- i8_1 = 0;
- {
- while(true) {
- int x_101 = i8_1;
- if ((x_101 < 17)) {
- } else {
- break;
- }
- int x_104 = a;
- a = (x_104 + 1);
- {
- int x_106 = i8_1;
- i8_1 = (x_106 + 1);
- }
- continue;
- }
- }
- {
- int x_108 = i7;
- i7 = (x_108 + 1);
- }
- continue;
- }
- }
- {
- int x_110 = i6;
- i6 = (x_110 + 1);
- }
- continue;
- }
- }
- {
- int x_112 = i5;
- i5 = (x_112 + 1);
- }
- continue;
- }
- }
- {
- int x_114 = i4;
- i4 = (x_114 + 1);
- }
- continue;
- }
- }
- {
- int x_116 = i3;
- i3 = (x_116 + 1);
- }
- continue;
- }
- }
- {
- int x_118 = i2;
- i2 = (x_118 + 1);
- }
- continue;
- }
- }
- {
- int x_120 = i1;
- i1 = (x_120 + 1);
- }
- continue;
- }
- }
- {
- float x_123 = gl_FragCoord.x;
- if (!((x_123 < -1.0f))) { break; }
- }
- continue;
- }
- }
- {
- float x_126 = gl_FragCoord.y;
- if (!((x_126 < -1.0f))) { break; }
- }
- continue;
- }
- }
- float4 x_128 = c;
- x_GLF_color = x_128;
-}
-
-main_out main_inner(float4 gl_FragCoord_param) {
- gl_FragCoord = gl_FragCoord_param;
- main_1();
- main_out v = {x_GLF_color};
- return v;
-}
-
-main_outputs main(main_inputs inputs) {
- main_out v_1 = main_inner(float4(inputs.gl_FragCoord_param.xyz, (1.0f / inputs.gl_FragCoord_param[3u])));
- main_outputs v_2 = {v_1.x_GLF_color_1};
- return v_2;
-}
-
-FXC validation failure:
-<scrubbed_path>(32,9-19): error X3511: forced to unroll loop, but unrolling failed.
-<scrubbed_path>(30,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index 3185918..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,80 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_6 : register(b1) {
- uint4 x_6[5];
-};
-cbuffer cbuffer_x_9 : register(b0) {
- uint4 x_9[2];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float4 v = (0.0f).xxxx;
- int i = 0;
- float v_1 = float(asint(x_6[1u].x));
- float v_2 = float(asint(x_6[2u].x));
- float v_3 = float(asint(x_6[3u].x));
- v = float4(v_1, v_2, v_3, float(asint(x_6[0u].x)));
- i = asint(x_6[4u].x);
- {
- while(true) {
- int v_4 = i;
- if ((v_4 < asint(x_6[0u].x))) {
- } else {
- break;
- }
- float4 v_5 = float4(v.x, v.y, v.z, v.w);
- float4 v_6 = float4(v.x, v.y, v.z, v.w);
- float4 v_7 = float4(v.x, v.y, v.z, v.w);
- float4x4 v_8 = float4x4(v_5, v_6, v_7, float4(v.x, v.y, v.z, v.w));
- float v_9 = v_8[0u][i];
- if ((v_9 > asfloat(x_9[0u].x))) {
- int x_96 = i;
- float4 v_10 = v;
- float4 v_11 = float4((asfloat(x_9[1u].x)).xxxx);
- float4 v_12 = clamp(v_10, v_11, float4((asfloat(x_9[0u].x)).xxxx));
- v[x_96] = v_12[asint(x_6[1u].x)];
- }
- {
- i = (i + 1);
- }
- continue;
- }
- }
- float4 v_13 = v;
- if (all((v_13 == float4((float(asint(x_6[1u].x))).xxxx)))) {
- float v_14 = float(asint(x_6[1u].x));
- float v_15 = float(asint(x_6[4u].x));
- float v_16 = float(asint(x_6[4u].x));
- x_GLF_color = float4(v_14, v_15, v_16, float(asint(x_6[1u].x)));
- } else {
- x_GLF_color = float4((float(asint(x_6[4u].x))).xxxx);
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_17 = {x_GLF_color};
- return v_17;
-}
-
-main_outputs main() {
- main_out v_18 = main_inner();
- main_outputs v_19 = {v_18.x_GLF_color_1};
- return v_19;
-}
-
-FXC validation failure:
-<scrubbed_path>(42,9-15): error X3500: array reference cannot be used as an l-value; not natively addressable
-<scrubbed_path>(26,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index de9f7f8..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,101 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_6 : register(b1) {
- uint4 x_6[5];
-};
-cbuffer cbuffer_x_9 : register(b0) {
- uint4 x_9[2];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float4 v = (0.0f).xxxx;
- int i = 0;
- int x_40 = asint(x_6[1u].x);
- int x_43 = asint(x_6[2u].x);
- int x_46 = asint(x_6[3u].x);
- int x_49 = asint(x_6[0u].x);
- float v_1 = float(x_40);
- float v_2 = float(x_43);
- float v_3 = float(x_46);
- v = float4(v_1, v_2, v_3, float(x_49));
- int x_53 = asint(x_6[4u].x);
- i = x_53;
- {
- while(true) {
- int x_58 = i;
- int x_60 = asint(x_6[0u].x);
- if ((x_58 < x_60)) {
- } else {
- break;
- }
- float4 x_63 = v;
- float4 x_64 = v;
- float4 x_65 = v;
- float4 x_66 = v;
- int x_88 = i;
- float x_92 = asfloat(x_9[0u].x);
- float4 v_4 = float4(x_63[0u], x_63[1u], x_63[2u], x_63[3u]);
- float4 v_5 = float4(x_64[0u], x_64[1u], x_64[2u], x_64[3u]);
- float4 v_6 = float4(x_65[0u], x_65[1u], x_65[2u], x_65[3u]);
- if ((float4x4(v_4, v_5, v_6, float4(x_66[0u], x_66[1u], x_66[2u], x_66[3u]))[0u][x_88] > x_92)) {
- int x_96 = i;
- float4 x_97 = v;
- float x_99 = asfloat(x_9[1u].x);
- float x_102 = asfloat(x_9[0u].x);
- int x_106 = asint(x_6[1u].x);
- float4 v_7 = float4(x_99, x_99, x_99, x_99);
- v[x_96] = clamp(x_97, v_7, float4(x_102, x_102, x_102, x_102))[x_106];
- }
- {
- int x_109 = i;
- i = (x_109 + 1);
- }
- continue;
- }
- }
- float4 x_111 = v;
- int x_113 = asint(x_6[1u].x);
- float x_114 = float(x_113);
- if (all((x_111 == float4(x_114, x_114, x_114, x_114)))) {
- int x_122 = asint(x_6[1u].x);
- int x_125 = asint(x_6[4u].x);
- int x_128 = asint(x_6[4u].x);
- int x_131 = asint(x_6[1u].x);
- float v_8 = float(x_122);
- float v_9 = float(x_125);
- float v_10 = float(x_128);
- x_GLF_color = float4(v_8, v_9, v_10, float(x_131));
- } else {
- int x_135 = asint(x_6[4u].x);
- float x_136 = float(x_135);
- x_GLF_color = float4(x_136, x_136, x_136, x_136);
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_11 = {x_GLF_color};
- return v_11;
-}
-
-main_outputs main() {
- main_out v_12 = main_inner();
- main_outputs v_13 = {v_12.x_GLF_color_1};
- return v_13;
-}
-
-FXC validation failure:
-<scrubbed_path>(54,9-15): error X3500: array reference cannot be used as an l-value; not natively addressable
-<scrubbed_path>(31,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index dcdc528..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,67 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_6 : register(b0) {
- uint4 x_6[4];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float4 v = (0.0f).xxxx;
- int i = 0;
- v = float4((float(asint(x_6[3u].x))).xxxx);
- i = asint(x_6[0u].x);
- {
- while(true) {
- int v_1 = i;
- if ((v_1 < asint(x_6[3u].x))) {
- } else {
- break;
- }
- int x_50 = i;
- v[uint3(0u, 1u, 2u)[x_50]] = float(i);
- {
- i = (i + 1);
- }
- continue;
- }
- }
- float4 v_2 = v;
- float v_3 = float(asint(x_6[0u].x));
- float v_4 = float(asint(x_6[1u].x));
- float v_5 = float(asint(x_6[2u].x));
- if (all((v_2 == float4(v_3, v_4, v_5, float(asint(x_6[3u].x)))))) {
- float v_6 = float(asint(x_6[1u].x));
- float v_7 = float(asint(x_6[0u].x));
- float v_8 = float(asint(x_6[0u].x));
- x_GLF_color = float4(v_6, v_7, v_8, float(asint(x_6[1u].x)));
- } else {
- x_GLF_color = float4((float(asint(x_6[0u].x))).xxxx);
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_9 = {x_GLF_color};
- return v_9;
-}
-
-main_outputs main() {
- main_out v_10 = main_inner();
- main_outputs v_11 = {v_10.x_GLF_color_1};
- return v_11;
-}
-
-FXC validation failure:
-<scrubbed_path>(27,7-32): error X3500: array reference cannot be used as an l-value; not natively addressable
-<scrubbed_path>(20,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index 138ce89..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,83 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_6 : register(b0) {
- uint4 x_6[4];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float4 v = (0.0f).xxxx;
- int i = 0;
- int x_36 = asint(x_6[3u].x);
- float x_37 = float(x_36);
- v = float4(x_37, x_37, x_37, x_37);
- int x_40 = asint(x_6[0u].x);
- i = x_40;
- {
- while(true) {
- int x_45 = i;
- int x_47 = asint(x_6[3u].x);
- if ((x_45 < x_47)) {
- } else {
- break;
- }
- int x_50 = i;
- int x_51 = i;
- v[uint3(0u, 1u, 2u)[x_50]] = float(x_51);
- {
- int x_55 = i;
- i = (x_55 + 1);
- }
- continue;
- }
- }
- float4 x_57 = v;
- int x_59 = asint(x_6[0u].x);
- int x_62 = asint(x_6[1u].x);
- int x_65 = asint(x_6[2u].x);
- int x_68 = asint(x_6[3u].x);
- float v_1 = float(x_59);
- float v_2 = float(x_62);
- float v_3 = float(x_65);
- if (all((x_57 == float4(v_1, v_2, v_3, float(x_68))))) {
- int x_77 = asint(x_6[1u].x);
- int x_80 = asint(x_6[0u].x);
- int x_83 = asint(x_6[0u].x);
- int x_86 = asint(x_6[1u].x);
- float v_4 = float(x_77);
- float v_5 = float(x_80);
- float v_6 = float(x_83);
- x_GLF_color = float4(v_4, v_5, v_6, float(x_86));
- } else {
- int x_90 = asint(x_6[0u].x);
- float x_91 = float(x_90);
- x_GLF_color = float4(x_91, x_91, x_91, x_91);
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_7 = {x_GLF_color};
- return v_7;
-}
-
-main_outputs main() {
- main_out v_8 = main_inner();
- main_outputs v_9 = {v_8.x_GLF_color_1};
- return v_9;
-}
-
-FXC validation failure:
-<scrubbed_path>(32,7-32): error X3500: array reference cannot be used as an l-value; not natively addressable
-<scrubbed_path>(23,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index b262d9c..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,131 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-static int x_GLF_global_loop_count = 0;
-cbuffer cbuffer_x_7 : register(b1) {
- uint4 x_7[18];
-};
-cbuffer cbuffer_x_12 : register(b0) {
- uint4 x_12[4];
-};
-cbuffer cbuffer_x_15 : register(b2) {
- uint4 x_15[1];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-static bool continue_execution = true;
-void main_1() {
- float4x4 m = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
- float4 v = (0.0f).xxxx;
- float f = 0.0f;
- int a = 0;
- int b = 0;
- float zero = 0.0f;
- x_GLF_global_loop_count = 0;
- float v_1 = asfloat(x_7[1u].x);
- float v_2 = asfloat(x_7[2u].x);
- float v_3 = asfloat(x_7[3u].x);
- float4 v_4 = float4(v_1, v_2, v_3, asfloat(x_7[4u].x));
- float v_5 = asfloat(x_7[5u].x);
- float v_6 = asfloat(x_7[6u].x);
- float v_7 = asfloat(x_7[7u].x);
- float4 v_8 = float4(v_5, v_6, v_7, asfloat(x_7[8u].x));
- float v_9 = asfloat(x_7[9u].x);
- float v_10 = asfloat(x_7[10u].x);
- float v_11 = asfloat(x_7[11u].x);
- float4 v_12 = float4(v_9, v_10, v_11, asfloat(x_7[12u].x));
- float v_13 = asfloat(x_7[13u].x);
- float v_14 = asfloat(x_7[14u].x);
- float v_15 = asfloat(x_7[15u].x);
- m = float4x4(v_4, v_8, v_12, float4(v_13, v_14, v_15, asfloat(x_7[16u].x)));
- float v_16 = asfloat(x_7[1u].x);
- float v_17 = asfloat(x_7[2u].x);
- float v_18 = asfloat(x_7[3u].x);
- v = float4(v_16, v_17, v_18, asfloat(x_7[4u].x));
- f = asfloat(x_7[1u].x);
- a = asint(x_12[0u].x);
- {
- while(true) {
- if ((x_GLF_global_loop_count < 10)) {
- } else {
- break;
- }
- x_GLF_global_loop_count = (x_GLF_global_loop_count + 1);
- int x_121 = min(max(a, 0), 3);
- float v_19 = v[x_121];
- v[x_121] = (v_19 + asfloat(x_7[1u].x));
- b = asint(x_12[2u].x);
- {
- while(true) {
- if ((x_GLF_global_loop_count < 10)) {
- } else {
- break;
- }
- x_GLF_global_loop_count = (x_GLF_global_loop_count + 1);
- float v_20 = f;
- float v_21 = v[min(max(b, 0), 3)];
- float4 v_22 = m[min(max(b, 0), 3)];
- f = (v_20 + (v_21 * v_22[a]));
- {
- b = (b - 1);
- }
- continue;
- }
- }
- int x_153 = a;
- int v_23 = min(max(x_153, 0), 3);
- m[1][v_23] = asfloat(x_7[1u].x);
- int v_24 = asint(x_15[0u].x);
- if ((v_24 == asint(x_12[0u].x))) {
- continue_execution = false;
- }
- int v_25 = asint(x_15[0u].x);
- if ((v_25 == asint(x_12[1u].x))) {
- continue_execution = false;
- }
- {
- a = (a + 1);
- }
- continue;
- }
- }
- zero = asfloat(x_7[0u].x);
- float v_26 = f;
- if (!((v_26 == asfloat(x_7[17u].x)))) {
- zero = asfloat(x_7[1u].x);
- }
- float v_27 = f;
- float v_28 = zero;
- float v_29 = float(asint(x_12[0u].x));
- x_GLF_color = float4(v_27, v_28, v_29, f);
-}
-
-main_out main_inner() {
- main_1();
- main_out v_30 = {x_GLF_color};
- return v_30;
-}
-
-main_outputs main() {
- main_out v_31 = main_inner();
- main_outputs v_32 = {v_31.x_GLF_color_1};
- if (!(continue_execution)) {
- discard;
- }
- main_outputs v_33 = v_32;
- return v_33;
-}
-
-FXC validation failure:
-<scrubbed_path>(61,7-14): error X3500: array reference cannot be used as an l-value; not natively addressable
-<scrubbed_path>(53,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index fc6d64e..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,156 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-static int x_GLF_global_loop_count = 0;
-cbuffer cbuffer_x_7 : register(b1) {
- uint4 x_7[18];
-};
-cbuffer cbuffer_x_12 : register(b0) {
- uint4 x_12[4];
-};
-cbuffer cbuffer_x_15 : register(b2) {
- uint4 x_15[1];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-static bool continue_execution = true;
-void main_1() {
- float4x4 m = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
- float4 v = (0.0f).xxxx;
- float f = 0.0f;
- int a = 0;
- int b = 0;
- float zero = 0.0f;
- x_GLF_global_loop_count = 0;
- float x_62 = asfloat(x_7[1u].x);
- float x_64 = asfloat(x_7[2u].x);
- float x_66 = asfloat(x_7[3u].x);
- float x_68 = asfloat(x_7[4u].x);
- float x_70 = asfloat(x_7[5u].x);
- float x_72 = asfloat(x_7[6u].x);
- float x_74 = asfloat(x_7[7u].x);
- float x_76 = asfloat(x_7[8u].x);
- float x_78 = asfloat(x_7[9u].x);
- float x_80 = asfloat(x_7[10u].x);
- float x_82 = asfloat(x_7[11u].x);
- float x_84 = asfloat(x_7[12u].x);
- float x_86 = asfloat(x_7[13u].x);
- float x_88 = asfloat(x_7[14u].x);
- float x_90 = asfloat(x_7[15u].x);
- float x_92 = asfloat(x_7[16u].x);
- float4 v_1 = float4(x_62, x_64, x_66, x_68);
- float4 v_2 = float4(x_70, x_72, x_74, x_76);
- float4 v_3 = float4(x_78, x_80, x_82, x_84);
- m = float4x4(v_1, v_2, v_3, float4(x_86, x_88, x_90, x_92));
- float x_99 = asfloat(x_7[1u].x);
- float x_101 = asfloat(x_7[2u].x);
- float x_103 = asfloat(x_7[3u].x);
- float x_105 = asfloat(x_7[4u].x);
- v = float4(x_99, x_101, x_103, x_105);
- float x_108 = asfloat(x_7[1u].x);
- f = x_108;
- int x_110 = asint(x_12[0u].x);
- a = x_110;
- {
- while(true) {
- int x_115 = x_GLF_global_loop_count;
- if ((x_115 < 10)) {
- } else {
- break;
- }
- int x_118 = x_GLF_global_loop_count;
- x_GLF_global_loop_count = (x_118 + 1);
- int x_120 = a;
- int x_121 = min(max(x_120, 0), 3);
- float x_123 = asfloat(x_7[1u].x);
- float x_125 = v[x_121];
- v[x_121] = (x_125 + x_123);
- int x_129 = asint(x_12[2u].x);
- b = x_129;
- {
- while(true) {
- int x_134 = x_GLF_global_loop_count;
- if ((x_134 < 10)) {
- } else {
- break;
- }
- int x_137 = x_GLF_global_loop_count;
- x_GLF_global_loop_count = (x_137 + 1);
- int x_139 = b;
- float x_142 = v[min(max(x_139, 0), 3)];
- int x_143 = b;
- int x_145 = a;
- float x_147 = m[min(max(x_143, 0), 3)][x_145];
- float x_149 = f;
- f = (x_149 + (x_142 * x_147));
- {
- int x_151 = b;
- b = (x_151 - 1);
- }
- continue;
- }
- }
- int x_153 = a;
- float x_156 = asfloat(x_7[1u].x);
- m[1][min(max(x_153, 0), 3)] = x_156;
- int x_159 = asint(x_15[0u].x);
- int x_161 = asint(x_12[0u].x);
- if ((x_159 == x_161)) {
- continue_execution = false;
- }
- int x_166 = asint(x_15[0u].x);
- int x_168 = asint(x_12[1u].x);
- if ((x_166 == x_168)) {
- continue_execution = false;
- }
- {
- int x_172 = a;
- a = (x_172 + 1);
- }
- continue;
- }
- }
- float x_175 = asfloat(x_7[0u].x);
- zero = x_175;
- float x_176 = f;
- float x_178 = asfloat(x_7[17u].x);
- if (!((x_176 == x_178))) {
- float x_183 = asfloat(x_7[1u].x);
- zero = x_183;
- }
- float x_184 = f;
- float x_185 = zero;
- int x_187 = asint(x_12[0u].x);
- float x_189 = f;
- x_GLF_color = float4(x_184, x_185, float(x_187), x_189);
-}
-
-main_out main_inner() {
- main_1();
- main_out v_4 = {x_GLF_color};
- return v_4;
-}
-
-main_outputs main() {
- main_out v_5 = main_inner();
- main_outputs v_6 = {v_5.x_GLF_color_1};
- if (!(continue_execution)) {
- discard;
- }
- main_outputs v_7 = v_6;
- return v_7;
-}
-
-FXC validation failure:
-<scrubbed_path>(72,7-14): error X3500: array reference cannot be used as an l-value; not natively addressable
-<scrubbed_path>(60,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index 11faf9e..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,65 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_6 : register(b0) {
- uint4 x_6[4];
-};
-cbuffer cbuffer_x_9 : register(b1) {
- uint4 x_9[2];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float3x3 m = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
- int a = 0;
- float3 arr[2] = (float3[2])0;
- float3 v = (0.0f).xxx;
- float x_46 = float(asint(x_6[0u].x));
- float3 v_1 = float3(x_46, 0.0f, 0.0f);
- float3 v_2 = float3(0.0f, x_46, 0.0f);
- m = float3x3(v_1, v_2, float3(0.0f, 0.0f, x_46));
- a = asint(x_6[0u].x);
- int x_53 = a;
- int x_54 = a;
- m[x_53][x_54] = asfloat(x_9[0u].x);
- float3 v_3[2] = {m[1], m[1]};
- arr = v_3;
- v = float3((asfloat(x_9[1u].x)).xxx);
- v = (v + arr[a]);
- float3 v_4 = v;
- float v_5 = float(asint(x_6[1u].x));
- float v_6 = float(asint(x_6[2u].x));
- if (all((v_4 == float3(v_5, v_6, float(asint(x_6[1u].x)))))) {
- float v_7 = float(asint(x_6[0u].x));
- float v_8 = float(asint(x_6[3u].x));
- float v_9 = float(asint(x_6[3u].x));
- x_GLF_color = float4(v_7, v_8, v_9, float(asint(x_6[0u].x)));
- } else {
- x_GLF_color = float4((float(asint(x_6[3u].x))).xxxx);
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_10 = {x_GLF_color};
- return v_10;
-}
-
-main_outputs main() {
- main_out v_11 = main_inner();
- main_outputs v_12 = {v_11.x_GLF_color_1};
- return v_12;
-}
-
-FXC validation failure:
-<scrubbed_path>(29,3-9): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index 84639a6..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,83 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_6 : register(b0) {
- uint4 x_6[4];
-};
-cbuffer cbuffer_x_9 : register(b1) {
- uint4 x_9[2];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float3x3 m = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
- int a = 0;
- float3 arr[2] = (float3[2])0;
- float3 v = (0.0f).xxx;
- int x_45 = asint(x_6[0u].x);
- float x_46 = float(x_45);
- float3 v_1 = float3(x_46, 0.0f, 0.0f);
- float3 v_2 = float3(0.0f, x_46, 0.0f);
- m = float3x3(v_1, v_2, float3(0.0f, 0.0f, x_46));
- int x_52 = asint(x_6[0u].x);
- a = x_52;
- int x_53 = a;
- int x_54 = a;
- float x_56 = asfloat(x_9[0u].x);
- m[x_53][x_54] = x_56;
- float3 x_59 = m[1];
- float3 x_61 = m[1];
- float3 v_3[2] = {x_59, x_61};
- arr = v_3;
- float x_64 = asfloat(x_9[1u].x);
- v = float3(x_64, x_64, x_64);
- int x_66 = a;
- float3 x_68 = arr[x_66];
- float3 x_69 = v;
- v = (x_69 + x_68);
- float3 x_71 = v;
- int x_73 = asint(x_6[1u].x);
- int x_76 = asint(x_6[2u].x);
- int x_79 = asint(x_6[1u].x);
- float v_4 = float(x_73);
- float v_5 = float(x_76);
- if (all((x_71 == float3(v_4, v_5, float(x_79))))) {
- int x_88 = asint(x_6[0u].x);
- int x_91 = asint(x_6[3u].x);
- int x_94 = asint(x_6[3u].x);
- int x_97 = asint(x_6[0u].x);
- float v_6 = float(x_88);
- float v_7 = float(x_91);
- float v_8 = float(x_94);
- x_GLF_color = float4(v_6, v_7, v_8, float(x_97));
- } else {
- int x_101 = asint(x_6[3u].x);
- float x_102 = float(x_101);
- x_GLF_color = float4(x_102, x_102, x_102, x_102);
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_9 = {x_GLF_color};
- return v_9;
-}
-
-main_outputs main() {
- main_out v_10 = main_inner();
- main_outputs v_11 = {v_10.x_GLF_color_1};
- return v_11;
-}
-
-FXC validation failure:
-<scrubbed_path>(32,3-9): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index 8ece67a..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,67 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_6 : register(b0) {
- uint4 x_6[2];
-};
-cbuffer cbuffer_x_9 : register(b1) {
- uint4 x_9[4];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- int a = 0;
- float4 v = (0.0f).xxxx;
- float3x4 m = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
- float4x4 indexable = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
- a = asint(x_6[0u].x);
- v = float4((asfloat(x_9[2u].x)).xxxx);
- float x_49 = asfloat(x_9[3u].x);
- float4 v_1 = float4(x_49, 0.0f, 0.0f, 0.0f);
- float4 v_2 = float4(0.0f, x_49, 0.0f, 0.0f);
- m = float3x4(v_1, v_2, float4(0.0f, 0.0f, x_49, 0.0f));
- int x_54 = a;
- int x_55 = a;
- m[x_54][x_55] = asfloat(x_9[0u].x);
- int x_59 = a;
- int x_78 = a;
- int x_79 = a;
- float4 v_3 = float4(m[0u].x, m[0u].y, m[0u].z, m[0u].w);
- float4 v_4 = float4(m[1u].x, m[1u].y, m[1u].z, m[1u].w);
- indexable = float4x4(v_3, v_4, float4(m[2u].x, m[2u].y, m[2u].z, m[2u].w), float4(0.0f, 0.0f, 0.0f, 1.0f));
- v[x_59] = (v[x_59] + indexable[x_78][x_79]);
- float v_5 = v.y;
- if ((v_5 == asfloat(x_9[1u].x))) {
- float v_6 = float(asint(x_6[0u].x));
- float v_7 = float(asint(x_6[1u].x));
- float v_8 = float(asint(x_6[1u].x));
- x_GLF_color = float4(v_6, v_7, v_8, float(asint(x_6[0u].x)));
- } else {
- x_GLF_color = float4((float(asint(x_6[1u].x))).xxxx);
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_9 = {x_GLF_color};
- return v_9;
-}
-
-main_outputs main() {
- main_out v_10 = main_inner();
- main_outputs v_11 = {v_10.x_GLF_color_1};
- return v_11;
-}
-
-FXC validation failure:
-<scrubbed_path>(30,3-9): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index e33b357..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,80 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_6 : register(b0) {
- uint4 x_6[2];
-};
-cbuffer cbuffer_x_9 : register(b1) {
- uint4 x_9[4];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- int a = 0;
- float4 v = (0.0f).xxxx;
- float3x4 m = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
- float4x4 indexable = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
- int x_44 = asint(x_6[0u].x);
- a = x_44;
- float x_46 = asfloat(x_9[2u].x);
- v = float4(x_46, x_46, x_46, x_46);
- float x_49 = asfloat(x_9[3u].x);
- float4 v_1 = float4(x_49, 0.0f, 0.0f, 0.0f);
- float4 v_2 = float4(0.0f, x_49, 0.0f, 0.0f);
- m = float3x4(v_1, v_2, float4(0.0f, 0.0f, x_49, 0.0f));
- int x_54 = a;
- int x_55 = a;
- float x_57 = asfloat(x_9[0u].x);
- m[x_54][x_55] = x_57;
- int x_59 = a;
- float3x4 x_60 = m;
- int x_78 = a;
- int x_79 = a;
- float4 v_3 = float4(x_60[0u][0u], x_60[0u][1u], x_60[0u][2u], x_60[0u][3u]);
- float4 v_4 = float4(x_60[1u][0u], x_60[1u][1u], x_60[1u][2u], x_60[1u][3u]);
- indexable = float4x4(v_3, v_4, float4(x_60[2u][0u], x_60[2u][1u], x_60[2u][2u], x_60[2u][3u]), float4(0.0f, 0.0f, 0.0f, 1.0f));
- float x_81 = indexable[x_78][x_79];
- float x_83 = v[x_59];
- v[x_59] = (x_83 + x_81);
- float x_87 = v.y;
- float x_89 = asfloat(x_9[1u].x);
- if ((x_87 == x_89)) {
- int x_95 = asint(x_6[0u].x);
- int x_98 = asint(x_6[1u].x);
- int x_101 = asint(x_6[1u].x);
- int x_104 = asint(x_6[0u].x);
- float v_5 = float(x_95);
- float v_6 = float(x_98);
- float v_7 = float(x_101);
- x_GLF_color = float4(v_5, v_6, v_7, float(x_104));
- } else {
- int x_108 = asint(x_6[1u].x);
- float x_109 = float(x_108);
- x_GLF_color = float4(x_109, x_109, x_109, x_109);
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_8 = {x_GLF_color};
- return v_8;
-}
-
-main_outputs main() {
- main_out v_9 = main_inner();
- main_outputs v_10 = {v_9.x_GLF_color_1};
- return v_10;
-}
-
-FXC validation failure:
-<scrubbed_path>(33,3-9): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index 7277d76..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,57 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_6 : register(b0) {
- uint4 x_6[2];
-};
-cbuffer cbuffer_x_8 : register(b1) {
- uint4 x_8[2];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float4 color = (0.0f).xxxx;
- float v = asfloat(x_6[0u].x);
- float v_1 = asfloat(x_6[0u].x);
- float v_2 = asfloat(x_6[0u].x);
- color = float4(v, v_1, v_2, asfloat(x_6[1u].x));
- int x_38 = asint(x_8[1u].x);
- switch(((1 | x_38) ^ 1)) {
- case 0:
- {
- int x_44 = asint(x_8[0u].x);
- color[x_44] = asfloat(x_6[1u].x);
- break;
- }
- default:
- {
- break;
- }
- }
- x_GLF_color = color;
-}
-
-main_out main_inner() {
- main_1();
- main_out v_3 = {x_GLF_color};
- return v_3;
-}
-
-main_outputs main() {
- main_out v_4 = main_inner();
- main_outputs v_5 = {v_4.x_GLF_color_1};
- return v_5;
-}
-
-FXC validation failure:
-internal error: compilation aborted unexpectedly
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index d2172f3..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,60 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_6 : register(b0) {
- uint4 x_6[2];
-};
-cbuffer cbuffer_x_8 : register(b1) {
- uint4 x_8[2];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float4 color = (0.0f).xxxx;
- float x_29 = asfloat(x_6[0u].x);
- float x_31 = asfloat(x_6[0u].x);
- float x_33 = asfloat(x_6[0u].x);
- float x_35 = asfloat(x_6[1u].x);
- color = float4(x_29, x_31, x_33, x_35);
- int x_38 = asint(x_8[1u].x);
- switch(((1 | x_38) ^ 1)) {
- case 0:
- {
- int x_44 = asint(x_8[0u].x);
- float x_46 = asfloat(x_6[1u].x);
- color[x_44] = x_46;
- break;
- }
- default:
- {
- break;
- }
- }
- float4 x_48 = color;
- x_GLF_color = x_48;
-}
-
-main_out main_inner() {
- main_1();
- main_out v = {x_GLF_color};
- return v;
-}
-
-main_outputs main() {
- main_out v_1 = main_inner();
- main_outputs v_2 = {v_1.x_GLF_color_1};
- return v_2;
-}
-
-FXC validation failure:
-internal error: compilation aborted unexpectedly
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index 3399f32..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,52 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_6 : register(b0) {
- uint4 x_6[2];
-};
-cbuffer cbuffer_x_8 : register(b1) {
- uint4 x_8[2];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float2 v1 = (0.0f).xx;
- float x_35 = asfloat(x_6[0u].x);
- v1 = float2((x_35).xx);
- int x_38 = asint(x_8[0u].x);
- v1[x_38] = ldexp(v1.y, -256);
- float2 v = v1;
- float2 v_1 = float2(x_35, 0.0f);
- if ((mul(float2x2(v_1, float2(0.0f, x_35)), v)[0u] == x_35)) {
- float x_53 = float(x_38);
- float x_56 = float(asint(x_8[1u].x));
- x_GLF_color = float4(x_53, x_56, x_56, x_53);
- } else {
- x_GLF_color = float4((float(asint(x_8[1u].x))).xxxx);
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_2 = {x_GLF_color};
- return v_2;
-}
-
-main_outputs main() {
- main_out v_3 = main_inner();
- main_outputs v_4 = {v_3.x_GLF_color_1};
- return v_4;
-}
-
-FXC validation failure:
-<scrubbed_path>(22,3-10): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index 256e059..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,56 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_6 : register(b0) {
- uint4 x_6[2];
-};
-cbuffer cbuffer_x_8 : register(b1) {
- uint4 x_8[2];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float2 v1 = (0.0f).xx;
- float x_35 = asfloat(x_6[0u].x);
- v1 = float2(x_35, x_35);
- int x_38 = asint(x_8[0u].x);
- float x_40 = v1.y;
- v1[x_38] = ldexp(x_40, -256);
- float2 x_43 = v1;
- float2 v = float2(x_35, 0.0f);
- if ((mul(float2x2(v, float2(0.0f, x_35)), x_43)[0u] == x_35)) {
- float x_53 = float(x_38);
- int x_55 = asint(x_8[1u].x);
- float x_56 = float(x_55);
- x_GLF_color = float4(x_53, x_56, x_56, x_53);
- } else {
- int x_59 = asint(x_8[1u].x);
- float x_60 = float(x_59);
- x_GLF_color = float4(x_60, x_60, x_60, x_60);
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_1 = {x_GLF_color};
- return v_1;
-}
-
-main_outputs main() {
- main_out v_2 = main_inner();
- main_outputs v_3 = {v_2.x_GLF_color_1};
- return v_3;
-}
-
-FXC validation failure:
-<scrubbed_path>(23,3-10): error X3500: array reference cannot be used as an l-value; not natively addressable
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index 718e3cc..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,96 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-struct main_inputs {
- float4 gl_FragCoord_param : SV_Position;
-};
-
-
-cbuffer cbuffer_x_7 : register(b1) {
- uint4 x_7[2];
-};
-cbuffer cbuffer_x_10 : register(b0) {
- uint4 x_10[4];
-};
-static float4 gl_FragCoord = (0.0f).xxxx;
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float2x3 m23 = float2x3((0.0f).xxx, (0.0f).xxx);
- int i = 0;
- float x_46 = asfloat(x_7[1u].x);
- float3 v = float3(x_46, 0.0f, 0.0f);
- m23 = float2x3(v, float3(0.0f, x_46, 0.0f));
- i = 1;
- {
- while(true) {
- bool x_80 = false;
- bool x_81 = false;
- int v_1 = i;
- if ((v_1 < asint(x_10[3u].x))) {
- } else {
- break;
- }
- int x_60 = asint(x_10[0u].x);
- int x_62 = asint(x_10[2u].x);
- float v_2 = m23[x_60][x_62];
- m23[x_60][x_62] = (v_2 + asfloat(x_7[0u].x));
- float v_3 = gl_FragCoord.y;
- if ((v_3 < asfloat(x_7[0u].x))) {
- }
- x_81 = true;
- if (true) {
- x_80 = (gl_FragCoord.x < 0.0f);
- x_81 = x_80;
- }
- if (!(x_81)) {
- break;
- }
- {
- i = (i + 1);
- }
- continue;
- }
- }
- float v_4 = float(asint(x_10[1u].x));
- float v_5 = float(asint(x_10[1u].x));
- float3 v_6 = float3(v_4, v_5, float(asint(x_10[1u].x)));
- float v_7 = float(asint(x_10[1u].x));
- float v_8 = float(asint(x_10[1u].x));
- float2x3 x_108 = float2x3(v_6, float3(v_7, v_8, float(asint(x_10[0u].x))));
- bool v_9 = all((m23[0u] == x_108[0u]));
- if ((v_9 & all((m23[1u] == x_108[1u])))) {
- float v_10 = float(asint(x_10[0u].x));
- float v_11 = float(asint(x_10[1u].x));
- float v_12 = float(asint(x_10[1u].x));
- x_GLF_color = float4(v_10, v_11, v_12, float(asint(x_10[0u].x)));
- } else {
- x_GLF_color = float4((float(asint(x_10[1u].x))).xxxx);
- }
-}
-
-main_out main_inner(float4 gl_FragCoord_param) {
- gl_FragCoord = gl_FragCoord_param;
- main_1();
- main_out v_13 = {x_GLF_color};
- return v_13;
-}
-
-main_outputs main(main_inputs inputs) {
- main_out v_14 = main_inner(float4(inputs.gl_FragCoord_param.xyz, (1.0f / inputs.gl_FragCoord_param[3u])));
- main_outputs v_15 = {v_14.x_GLF_color_1};
- return v_15;
-}
-
-FXC validation failure:
-<scrubbed_path>(41,7-15): error X3500: array reference cannot be used as an l-value; not natively addressable
-<scrubbed_path>(30,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index c71e57a..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,115 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-struct main_inputs {
- float4 gl_FragCoord_param : SV_Position;
-};
-
-
-cbuffer cbuffer_x_7 : register(b1) {
- uint4 x_7[2];
-};
-cbuffer cbuffer_x_10 : register(b0) {
- uint4 x_10[4];
-};
-static float4 gl_FragCoord = (0.0f).xxxx;
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float2x3 m23 = float2x3((0.0f).xxx, (0.0f).xxx);
- int i = 0;
- float x_46 = asfloat(x_7[1u].x);
- float3 v = float3(x_46, 0.0f, 0.0f);
- m23 = float2x3(v, float3(0.0f, x_46, 0.0f));
- i = 1;
- {
- while(true) {
- bool x_80 = false;
- bool x_81_phi = false;
- int x_54 = i;
- int x_56 = asint(x_10[3u].x);
- if ((x_54 < x_56)) {
- } else {
- break;
- }
- int x_60 = asint(x_10[0u].x);
- int x_62 = asint(x_10[2u].x);
- float x_64 = asfloat(x_7[0u].x);
- float x_66 = m23[x_60][x_62];
- m23[x_60][x_62] = (x_66 + x_64);
- float x_70 = gl_FragCoord.y;
- float x_72 = asfloat(x_7[0u].x);
- if ((x_70 < x_72)) {
- }
- x_81_phi = true;
- if (true) {
- float x_79 = gl_FragCoord.x;
- x_80 = (x_79 < 0.0f);
- x_81_phi = x_80;
- }
- bool x_81 = x_81_phi;
- if (!(x_81)) {
- break;
- }
- {
- int x_85 = i;
- i = (x_85 + 1);
- }
- continue;
- }
- }
- float2x3 x_87 = m23;
- int x_89 = asint(x_10[1u].x);
- int x_92 = asint(x_10[1u].x);
- int x_95 = asint(x_10[1u].x);
- int x_98 = asint(x_10[1u].x);
- int x_101 = asint(x_10[1u].x);
- int x_104 = asint(x_10[0u].x);
- float v_1 = float(x_89);
- float v_2 = float(x_92);
- float3 v_3 = float3(v_1, v_2, float(x_95));
- float v_4 = float(x_98);
- float v_5 = float(x_101);
- float2x3 x_108 = float2x3(v_3, float3(v_4, v_5, float(x_104)));
- bool v_6 = all((x_87[0u] == x_108[0u]));
- if ((v_6 & all((x_87[1u] == x_108[1u])))) {
- int x_122 = asint(x_10[0u].x);
- int x_125 = asint(x_10[1u].x);
- int x_128 = asint(x_10[1u].x);
- int x_131 = asint(x_10[0u].x);
- float v_7 = float(x_122);
- float v_8 = float(x_125);
- float v_9 = float(x_128);
- x_GLF_color = float4(v_7, v_8, v_9, float(x_131));
- } else {
- int x_135 = asint(x_10[1u].x);
- float x_136 = float(x_135);
- x_GLF_color = float4(x_136, x_136, x_136, x_136);
- }
-}
-
-main_out main_inner(float4 gl_FragCoord_param) {
- gl_FragCoord = gl_FragCoord_param;
- main_1();
- main_out v_10 = {x_GLF_color};
- return v_10;
-}
-
-main_outputs main(main_inputs inputs) {
- main_out v_11 = main_inner(float4(inputs.gl_FragCoord_param.xyz, (1.0f / inputs.gl_FragCoord_param[3u])));
- main_outputs v_12 = {v_11.x_GLF_color_1};
- return v_12;
-}
-
-FXC validation failure:
-<scrubbed_path>(43,7-15): error X3500: array reference cannot be used as an l-value; not natively addressable
-<scrubbed_path>(30,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index 03fccdf..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,95 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_6 : register(b0) {
- uint4 x_6[2];
-};
-cbuffer cbuffer_x_10 : register(b1) {
- uint4 x_10[4];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float4 v0 = (0.0f).xxxx;
- float4 v1 = (0.0f).xxxx;
- int a = 0;
- int c = 0;
- v0 = float4((asfloat(x_6[1u].x)).xxxx);
- v1 = float4((asfloat(x_6[0u].x)).xxxx);
- a = asint(x_10[1u].x);
- {
- while(true) {
- int v = a;
- if ((v < asint(x_10[0u].x))) {
- } else {
- break;
- }
- c = asint(x_10[3u].x);
- {
- while(true) {
- int v_1 = c;
- if ((v_1 < asint(x_10[2u].x))) {
- } else {
- break;
- }
- int x_69 = min(max(c, 0), 3);
- float v_2 = v0[x_69];
- v0[x_69] = (v_2 - asfloat(x_6[1u].x));
- int v_3 = asint(x_10[1u].x);
- if ((v_3 == asint(x_10[3u].x))) {
- int x_83 = a;
- float v_4 = asfloat(x_6[1u].x);
- float v_5 = asfloat(x_6[1u].x);
- float4 v_6 = float4(v_4, v_5, asfloat(x_6[1u].x), 3.0f);
- float4 v_7 = smoothstep(v_6, (1.0f).xxxx, v0);
- v1[x_83] = v_7[a];
- }
- {
- c = (c + 1);
- }
- continue;
- }
- }
- {
- a = (a + 1);
- }
- continue;
- }
- }
- float v_8 = v1.x;
- if ((v_8 == asfloat(x_6[0u].x))) {
- float v_9 = float(asint(x_10[1u].x));
- float v_10 = float(asint(x_10[3u].x));
- float v_11 = float(asint(x_10[3u].x));
- x_GLF_color = float4(v_9, v_10, v_11, float(asint(x_10[1u].x)));
- } else {
- x_GLF_color = float4((float(asint(x_10[3u].x))).xxxx);
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_12 = {x_GLF_color};
- return v_12;
-}
-
-main_outputs main() {
- main_out v_13 = main_inner();
- main_outputs v_14 = {v_13.x_GLF_color_1};
- return v_14;
-}
-
-FXC validation failure:
-<scrubbed_path>(42,11-18): error X3500: array reference cannot be used as an l-value; not natively addressable
-<scrubbed_path>(34,9-19): error X3511: forced to unroll loop, but unrolling failed.
-<scrubbed_path>(26,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index fe1be4e..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,114 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_6 : register(b0) {
- uint4 x_6[2];
-};
-cbuffer cbuffer_x_10 : register(b1) {
- uint4 x_10[4];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float4 v0 = (0.0f).xxxx;
- float4 v1 = (0.0f).xxxx;
- int a = 0;
- int c = 0;
- float x_41 = asfloat(x_6[1u].x);
- v0 = float4(x_41, x_41, x_41, x_41);
- float x_44 = asfloat(x_6[0u].x);
- v1 = float4(x_44, x_44, x_44, x_44);
- int x_47 = asint(x_10[1u].x);
- a = x_47;
- {
- while(true) {
- int x_52 = a;
- int x_54 = asint(x_10[0u].x);
- if ((x_52 < x_54)) {
- } else {
- break;
- }
- int x_58 = asint(x_10[3u].x);
- c = x_58;
- {
- while(true) {
- int x_63 = c;
- int x_65 = asint(x_10[2u].x);
- if ((x_63 < x_65)) {
- } else {
- break;
- }
- int x_68 = c;
- int x_69 = min(max(x_68, 0), 3);
- float x_71 = asfloat(x_6[1u].x);
- float x_73 = v0[x_69];
- v0[x_69] = (x_73 - x_71);
- int x_77 = asint(x_10[1u].x);
- int x_79 = asint(x_10[3u].x);
- if ((x_77 == x_79)) {
- int x_83 = a;
- float x_85 = asfloat(x_6[1u].x);
- float x_87 = asfloat(x_6[1u].x);
- float x_89 = asfloat(x_6[1u].x);
- float4 x_91 = v0;
- int x_93 = a;
- v1[x_83] = smoothstep(float4(x_85, x_87, x_89, 3.0f), (1.0f).xxxx, x_91)[x_93];
- }
- {
- int x_96 = c;
- c = (x_96 + 1);
- }
- continue;
- }
- }
- {
- int x_98 = a;
- a = (x_98 + 1);
- }
- continue;
- }
- }
- float x_101 = v1.x;
- float x_103 = asfloat(x_6[0u].x);
- if ((x_101 == x_103)) {
- int x_109 = asint(x_10[1u].x);
- int x_112 = asint(x_10[3u].x);
- int x_115 = asint(x_10[3u].x);
- int x_118 = asint(x_10[1u].x);
- float v = float(x_109);
- float v_1 = float(x_112);
- float v_2 = float(x_115);
- x_GLF_color = float4(v, v_1, v_2, float(x_118));
- } else {
- int x_122 = asint(x_10[3u].x);
- float x_123 = float(x_122);
- x_GLF_color = float4(x_123, x_123, x_123, x_123);
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_3 = {x_GLF_color};
- return v_3;
-}
-
-main_outputs main() {
- main_out v_4 = main_inner();
- main_outputs v_5 = {v_4.x_GLF_color_1};
- return v_5;
-}
-
-FXC validation failure:
-<scrubbed_path>(50,11-18): error X3500: array reference cannot be used as an l-value; not natively addressable
-<scrubbed_path>(39,9-19): error X3511: forced to unroll loop, but unrolling failed.
-<scrubbed_path>(29,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index e812c4c..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,91 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_5 : register(b0) {
- uint4 x_5[4];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float2x2 m = float2x2((0.0f).xx, (0.0f).xx);
- float f = 0.0f;
- int i = 0;
- int j = 0;
- if ((asint(x_5[1u].x) == 1)) {
- float2 v = float2(f, 0.0f);
- m = float2x2(v, float2(0.0f, f));
- }
- i = asint(x_5[1u].x);
- {
- while(true) {
- int v_1 = i;
- if ((v_1 < asint(x_5[0u].x))) {
- } else {
- break;
- }
- j = asint(x_5[1u].x);
- {
- while(true) {
- int v_2 = j;
- if ((v_2 < asint(x_5[0u].x))) {
- } else {
- break;
- }
- int x_66 = i;
- int x_67 = j;
- int v_3 = i;
- int v_4 = (v_3 * asint(x_5[0u].x));
- m[x_66][x_67] = float((v_4 + j));
- {
- j = (j + 1);
- }
- continue;
- }
- }
- {
- i = (i + 1);
- }
- continue;
- }
- }
- float v_5 = float(asint(x_5[1u].x));
- float2 v_6 = float2(v_5, float(asint(x_5[2u].x)));
- float v_7 = float(asint(x_5[0u].x));
- float2x2 x_95 = float2x2(v_6, float2(v_7, float(asint(x_5[3u].x))));
- bool v_8 = all((m[0u] == x_95[0u]));
- if ((v_8 & all((m[1u] == x_95[1u])))) {
- float v_9 = float(asint(x_5[2u].x));
- float v_10 = float(asint(x_5[1u].x));
- float v_11 = float(asint(x_5[1u].x));
- x_GLF_color = float4(v_9, v_10, v_11, float(asint(x_5[2u].x)));
- } else {
- x_GLF_color = float4((float(asint(x_5[1u].x))).xxxx);
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_12 = {x_GLF_color};
- return v_12;
-}
-
-main_outputs main() {
- main_out v_13 = main_inner();
- main_outputs v_14 = {v_13.x_GLF_color_1};
- return v_14;
-}
-
-FXC validation failure:
-<scrubbed_path>(43,11-17): error X3500: array reference cannot be used as an l-value; not natively addressable
-<scrubbed_path>(33,9-19): error X3511: forced to unroll loop, but unrolling failed.
-<scrubbed_path>(25,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index c1d51cb..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,111 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_5 : register(b0) {
- uint4 x_5[4];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float2x2 m = float2x2((0.0f).xx, (0.0f).xx);
- float f = 0.0f;
- int i = 0;
- int j = 0;
- int x_36 = asint(x_5[1u].x);
- if ((x_36 == 1)) {
- float x_40 = f;
- float2 v = float2(x_40, 0.0f);
- m = float2x2(v, float2(0.0f, x_40));
- }
- int x_45 = asint(x_5[1u].x);
- i = x_45;
- {
- while(true) {
- int x_50 = i;
- int x_52 = asint(x_5[0u].x);
- if ((x_50 < x_52)) {
- } else {
- break;
- }
- int x_56 = asint(x_5[1u].x);
- j = x_56;
- {
- while(true) {
- int x_61 = j;
- int x_63 = asint(x_5[0u].x);
- if ((x_61 < x_63)) {
- } else {
- break;
- }
- int x_66 = i;
- int x_67 = j;
- int x_68 = i;
- int x_70 = asint(x_5[0u].x);
- int x_72 = j;
- m[x_66][x_67] = float(((x_68 * x_70) + x_72));
- {
- int x_76 = j;
- j = (x_76 + 1);
- }
- continue;
- }
- }
- {
- int x_78 = i;
- i = (x_78 + 1);
- }
- continue;
- }
- }
- float2x2 x_80 = m;
- int x_82 = asint(x_5[1u].x);
- int x_85 = asint(x_5[2u].x);
- int x_88 = asint(x_5[0u].x);
- int x_91 = asint(x_5[3u].x);
- float v_1 = float(x_82);
- float2 v_2 = float2(v_1, float(x_85));
- float v_3 = float(x_88);
- float2x2 x_95 = float2x2(v_2, float2(v_3, float(x_91)));
- bool v_4 = all((x_80[0u] == x_95[0u]));
- if ((v_4 & all((x_80[1u] == x_95[1u])))) {
- int x_109 = asint(x_5[2u].x);
- int x_112 = asint(x_5[1u].x);
- int x_115 = asint(x_5[1u].x);
- int x_118 = asint(x_5[2u].x);
- float v_5 = float(x_109);
- float v_6 = float(x_112);
- float v_7 = float(x_115);
- x_GLF_color = float4(v_5, v_6, v_7, float(x_118));
- } else {
- int x_122 = asint(x_5[1u].x);
- float x_123 = float(x_122);
- x_GLF_color = float4(x_123, x_123, x_123, x_123);
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_8 = {x_GLF_color};
- return v_8;
-}
-
-main_outputs main() {
- main_out v_9 = main_inner();
- main_outputs v_10 = {v_9.x_GLF_color_1};
- return v_10;
-}
-
-FXC validation failure:
-<scrubbed_path>(50,11-17): error X3500: array reference cannot be used as an l-value; not natively addressable
-<scrubbed_path>(38,9-19): error X3511: forced to unroll loop, but unrolling failed.
-<scrubbed_path>(28,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index 590f760..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,70 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_7 : register(b0) {
- uint4 x_7[1];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- int4 a = (0).xxxx;
- int i = 0;
- int sum = 0;
- a = (0).xxxx;
- i = 0;
- {
- while(true) {
- int v = i;
- if ((v < (asint(x_7[0u].w) + 1))) {
- } else {
- break;
- }
- int v_1 = i;
- int v_2 = asint(x_7[0u].x);
- int v_3 = i;
- uint v_4 = (uint(min(max(v_1, v_2), v_3)) * 4u);
- if ((asint(x_7[(v_4 / 16u)][((v_4 % 16u) / 4u)]) == 1)) {
- int x_57 = i;
- a[x_57] = 5;
- } else {
- int x_59 = i;
- a[x_59] = i;
- }
- {
- i = (i + 1);
- }
- continue;
- }
- }
- sum = (((a.x + a.y) + a.z) + a.w);
- if ((sum == 10)) {
- x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
- } else {
- x_GLF_color = (0.0f).xxxx;
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_5 = {x_GLF_color};
- return v_5;
-}
-
-main_outputs main() {
- main_out v_6 = main_inner();
- main_outputs v_7 = {v_6.x_GLF_color_1};
- return v_7;
-}
-
-FXC validation failure:
-<scrubbed_path>(21,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index 0c15cfa..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,79 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_7 : register(b0) {
- uint4 x_7[1];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- int4 a = (0).xxxx;
- int i = 0;
- int sum = 0;
- a = (0).xxxx;
- i = 0;
- {
- while(true) {
- int x_40 = i;
- int x_42 = asint(x_7[0u].w);
- if ((x_40 < (x_42 + 1))) {
- } else {
- break;
- }
- int x_46 = i;
- int x_48 = asint(x_7[0u].x);
- int x_49 = i;
- uint v = (uint(min(max(x_46, x_48), x_49)) * 4u);
- int x_52 = asint(x_7[(v / 16u)][((v % 16u) / 4u)]);
- if ((x_52 == 1)) {
- int x_57 = i;
- a[x_57] = 5;
- } else {
- int x_59 = i;
- int x_60 = i;
- a[x_59] = x_60;
- }
- {
- int x_62 = i;
- i = (x_62 + 1);
- }
- continue;
- }
- }
- int x_65 = a.x;
- int x_67 = a.y;
- int x_70 = a.z;
- int x_73 = a.w;
- sum = (((x_65 + x_67) + x_70) + x_73);
- int x_75 = sum;
- if ((x_75 == 10)) {
- x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
- } else {
- x_GLF_color = (0.0f).xxxx;
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_1 = {x_GLF_color};
- return v_1;
-}
-
-main_outputs main() {
- main_out v_2 = main_inner();
- main_outputs v_3 = {v_2.x_GLF_color_1};
- return v_3;
-}
-
-FXC validation failure:
-<scrubbed_path>(21,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index 3c75f33..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,105 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_7 : register(b0) {
- uint4 x_7[2];
-};
-cbuffer cbuffer_x_11 : register(b1) {
- uint4 x_11[1];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float4 color = (0.0f).xxxx;
- int i = 0;
- int j = 0;
- int k = 0;
- color = (1.0f).xxxx;
- i = asint(x_7[0u].x);
- {
- while(true) {
- int v = i;
- if ((v < asint(x_7[1u].x))) {
- } else {
- break;
- }
- int x_47 = i;
- switch(x_47) {
- case 2:
- {
- int x_83 = i;
- color[x_83] = asfloat(x_11[0u].x);
- break;
- }
- case 1:
- {
- j = asint(x_7[0u].x);
- {
- while(true) {
- if ((i > i)) {
- } else {
- break;
- }
- k = asint(x_7[0u].x);
- {
- while(true) {
- if ((k < i)) {
- } else {
- break;
- }
- int x_71 = k;
- color[x_71] = asfloat(x_11[0u].x);
- {
- k = (k + 1);
- }
- continue;
- }
- }
- {
- j = (j + 1);
- }
- continue;
- }
- }
- int x_79 = i;
- color[x_79] = asfloat(x_11[0u].x);
- break;
- }
- default:
- {
- break;
- }
- }
- {
- i = (i + 1);
- }
- continue;
- }
- }
- x_GLF_color = color;
-}
-
-main_out main_inner() {
- main_1();
- main_out v_1 = {x_GLF_color};
- return v_1;
-}
-
-main_outputs main() {
- main_out v_2 = main_inner();
- main_outputs v_3 = {v_2.x_GLF_color_1};
- return v_3;
-}
-
-FXC validation failure:
-<scrubbed_path>(25,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index d4c544a..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,120 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_7 : register(b0) {
- uint4 x_7[2];
-};
-cbuffer cbuffer_x_11 : register(b1) {
- uint4 x_11[1];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float4 color = (0.0f).xxxx;
- int i = 0;
- int j = 0;
- int k = 0;
- color = (1.0f).xxxx;
- int x_37 = asint(x_7[0u].x);
- i = x_37;
- {
- while(true) {
- int x_42 = i;
- int x_44 = asint(x_7[1u].x);
- if ((x_42 < x_44)) {
- } else {
- break;
- }
- int x_47 = i;
- switch(x_47) {
- case 2:
- {
- int x_83 = i;
- float x_85 = asfloat(x_11[0u].x);
- color[x_83] = x_85;
- break;
- }
- case 1:
- {
- int x_52 = asint(x_7[0u].x);
- j = x_52;
- {
- while(true) {
- int x_57 = i;
- int x_58 = i;
- if ((x_57 > x_58)) {
- } else {
- break;
- }
- int x_62 = asint(x_7[0u].x);
- k = x_62;
- {
- while(true) {
- int x_67 = k;
- int x_68 = i;
- if ((x_67 < x_68)) {
- } else {
- break;
- }
- int x_71 = k;
- float x_73 = asfloat(x_11[0u].x);
- color[x_71] = x_73;
- {
- int x_75 = k;
- k = (x_75 + 1);
- }
- continue;
- }
- }
- {
- int x_77 = j;
- j = (x_77 + 1);
- }
- continue;
- }
- }
- int x_79 = i;
- float x_81 = asfloat(x_11[0u].x);
- color[x_79] = x_81;
- break;
- }
- default:
- {
- break;
- }
- }
- {
- int x_87 = i;
- i = (x_87 + 1);
- }
- continue;
- }
- }
- float4 x_89 = color;
- x_GLF_color = x_89;
-}
-
-main_out main_inner() {
- main_1();
- main_out v = {x_GLF_color};
- return v;
-}
-
-main_outputs main() {
- main_out v_1 = main_inner();
- main_outputs v_2 = {v_1.x_GLF_color_1};
- return v_2;
-}
-
-FXC validation failure:
-<scrubbed_path>(26,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index 69df49a..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,105 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_6 : register(b1) {
- uint4 x_6[4];
-};
-cbuffer cbuffer_x_10 : register(b0) {
- uint4 x_10[1];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-int tint_mod_i32(int lhs, int rhs) {
- int v = ((((rhs == 0) | ((lhs == -2147483648) & (rhs == -1)))) ? (1) : (rhs));
- return (lhs - ((lhs / v) * v));
-}
-
-void main_1() {
- float4x4 m0 = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
- int c = 0;
- float4x4 m1 = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
- float x_41 = float(asint(x_6[1u].x));
- float4 v_1 = float4(x_41, 0.0f, 0.0f, 0.0f);
- float4 v_2 = float4(0.0f, x_41, 0.0f, 0.0f);
- float4 v_3 = float4(0.0f, 0.0f, x_41, 0.0f);
- m0 = float4x4(v_1, v_2, v_3, float4(0.0f, 0.0f, 0.0f, x_41));
- c = asint(x_6[2u].x);
- {
- while(true) {
- int v_4 = c;
- if ((v_4 < asint(x_6[0u].x))) {
- } else {
- break;
- }
- m1 = m0;
- int x_59 = c;
- int x_61 = asint(x_6[3u].x);
- int x_64 = asint(x_6[2u].x);
- float4 v_5 = m1[tint_mod_i32(x_59, x_61)];
- v_5[x_64] = asfloat(x_10[0u].x);
- int x_68 = c;
- int x_70 = asint(x_6[3u].x);
- int x_73 = asint(x_6[2u].x);
- float4 v_6 = m0[tint_mod_i32(x_68, x_70)];
- v_6[x_73] = asfloat(x_10[0u].x);
- {
- c = (c + 1);
- }
- continue;
- }
- }
- float v_7 = float(asint(x_6[1u].x));
- float v_8 = float(asint(x_6[2u].x));
- float v_9 = float(asint(x_6[1u].x));
- float4 v_10 = float4(v_7, v_8, v_9, float(asint(x_6[1u].x)));
- float v_11 = float(asint(x_6[1u].x));
- float v_12 = float(asint(x_6[2u].x));
- float v_13 = float(asint(x_6[1u].x));
- float4 v_14 = float4(v_11, v_12, v_13, float(asint(x_6[1u].x)));
- float v_15 = float(asint(x_6[1u].x));
- float v_16 = float(asint(x_6[2u].x));
- float v_17 = float(asint(x_6[1u].x));
- float4 v_18 = float4(v_15, v_16, v_17, float(asint(x_6[1u].x)));
- float v_19 = float(asint(x_6[1u].x));
- float v_20 = float(asint(x_6[2u].x));
- float v_21 = float(asint(x_6[1u].x));
- float4x4 x_132 = float4x4(v_10, v_14, v_18, float4(v_19, v_20, v_21, float(asint(x_6[1u].x))));
- bool v_22 = all((m0[0u] == x_132[0u]));
- bool v_23 = (v_22 & all((m0[1u] == x_132[1u])));
- bool v_24 = (v_23 & all((m0[2u] == x_132[2u])));
- if ((v_24 & all((m0[3u] == x_132[3u])))) {
- float v_25 = float(asint(x_6[2u].x));
- float v_26 = float(asint(x_6[1u].x));
- float v_27 = float(asint(x_6[1u].x));
- x_GLF_color = float4(v_25, v_26, v_27, float(asint(x_6[2u].x)));
- } else {
- x_GLF_color = float4((float(asint(x_6[1u].x))).xxxx);
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_28 = {x_GLF_color};
- return v_28;
-}
-
-main_outputs main() {
- main_out v_29 = main_inner();
- main_outputs v_30 = {v_29.x_GLF_color_1};
- return v_30;
-}
-
-FXC validation failure:
-<scrubbed_path>(19,19-25): warning X3556: integer divides may be much slower, try using uints if possible.
-<scrubbed_path>(44,7-15): error X3500: array reference cannot be used as an l-value; not natively addressable
-<scrubbed_path>(33,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index 1c59b70..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,133 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_6 : register(b1) {
- uint4 x_6[4];
-};
-cbuffer cbuffer_x_10 : register(b0) {
- uint4 x_10[1];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-int tint_mod_i32(int lhs, int rhs) {
- int v = ((((rhs == 0) | ((lhs == -2147483648) & (rhs == -1)))) ? (1) : (rhs));
- return (lhs - ((lhs / v) * v));
-}
-
-void main_1() {
- float4x4 m0 = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
- int c = 0;
- float4x4 m1 = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
- int x_40 = asint(x_6[1u].x);
- float x_41 = float(x_40);
- float4 v_1 = float4(x_41, 0.0f, 0.0f, 0.0f);
- float4 v_2 = float4(0.0f, x_41, 0.0f, 0.0f);
- float4 v_3 = float4(0.0f, 0.0f, x_41, 0.0f);
- m0 = float4x4(v_1, v_2, v_3, float4(0.0f, 0.0f, 0.0f, x_41));
- int x_48 = asint(x_6[2u].x);
- c = x_48;
- {
- while(true) {
- int x_53 = c;
- int x_55 = asint(x_6[0u].x);
- if ((x_53 < x_55)) {
- } else {
- break;
- }
- float4x4 x_58 = m0;
- m1 = x_58;
- int x_59 = c;
- int x_61 = asint(x_6[3u].x);
- int x_64 = asint(x_6[2u].x);
- float x_66 = asfloat(x_10[0u].x);
- m1[tint_mod_i32(x_59, x_61)][x_64] = x_66;
- int x_68 = c;
- int x_70 = asint(x_6[3u].x);
- int x_73 = asint(x_6[2u].x);
- float x_75 = asfloat(x_10[0u].x);
- m0[tint_mod_i32(x_68, x_70)][x_73] = x_75;
- {
- int x_77 = c;
- c = (x_77 + 1);
- }
- continue;
- }
- }
- float4x4 x_79 = m0;
- int x_81 = asint(x_6[1u].x);
- int x_84 = asint(x_6[2u].x);
- int x_87 = asint(x_6[1u].x);
- int x_90 = asint(x_6[1u].x);
- int x_93 = asint(x_6[1u].x);
- int x_96 = asint(x_6[2u].x);
- int x_99 = asint(x_6[1u].x);
- int x_102 = asint(x_6[1u].x);
- int x_105 = asint(x_6[1u].x);
- int x_108 = asint(x_6[2u].x);
- int x_111 = asint(x_6[1u].x);
- int x_114 = asint(x_6[1u].x);
- int x_117 = asint(x_6[1u].x);
- int x_120 = asint(x_6[2u].x);
- int x_123 = asint(x_6[1u].x);
- int x_126 = asint(x_6[1u].x);
- float v_4 = float(x_81);
- float v_5 = float(x_84);
- float v_6 = float(x_87);
- float4 v_7 = float4(v_4, v_5, v_6, float(x_90));
- float v_8 = float(x_93);
- float v_9 = float(x_96);
- float v_10 = float(x_99);
- float4 v_11 = float4(v_8, v_9, v_10, float(x_102));
- float v_12 = float(x_105);
- float v_13 = float(x_108);
- float v_14 = float(x_111);
- float4 v_15 = float4(v_12, v_13, v_14, float(x_114));
- float v_16 = float(x_117);
- float v_17 = float(x_120);
- float v_18 = float(x_123);
- float4x4 x_132 = float4x4(v_7, v_11, v_15, float4(v_16, v_17, v_18, float(x_126)));
- bool v_19 = all((x_79[0u] == x_132[0u]));
- bool v_20 = (v_19 & all((x_79[1u] == x_132[1u])));
- bool v_21 = (v_20 & all((x_79[2u] == x_132[2u])));
- if ((v_21 & all((x_79[3u] == x_132[3u])))) {
- int x_156 = asint(x_6[2u].x);
- int x_159 = asint(x_6[1u].x);
- int x_162 = asint(x_6[1u].x);
- int x_165 = asint(x_6[2u].x);
- float v_22 = float(x_156);
- float v_23 = float(x_159);
- float v_24 = float(x_162);
- x_GLF_color = float4(v_22, v_23, v_24, float(x_165));
- } else {
- int x_169 = asint(x_6[1u].x);
- float x_170 = float(x_169);
- x_GLF_color = float4(x_170, x_170, x_170, x_170);
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_25 = {x_GLF_color};
- return v_25;
-}
-
-main_outputs main() {
- main_out v_26 = main_inner();
- main_outputs v_27 = {v_26.x_GLF_color_1};
- return v_27;
-}
-
-FXC validation failure:
-<scrubbed_path>(19,19-25): warning X3556: integer divides may be much slower, try using uints if possible.
-<scrubbed_path>(48,7-34): error X3500: array reference cannot be used as an l-value; not natively addressable
-<scrubbed_path>(35,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index 0673328..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,114 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-struct main_inputs {
- float4 gl_FragCoord_param : SV_Position;
-};
-
-
-cbuffer cbuffer_x_9 : register(b0) {
- uint4 x_9[1];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-static float4 gl_FragCoord = (0.0f).xxxx;
-static bool continue_execution = true;
-int tint_f32_to_i32(float value) {
- return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : (-2147483648))) : (2147483647));
-}
-
-void main_1() {
- float2 v = (0.0f).xx;
- float floats[9] = (float[9])0;
- int one = 0;
- int i = 0;
- bool alwaysFalse = false;
- v = (0.0f).xx;
- floats[1] = 0.0f;
- one = tint_f32_to_i32(asfloat(x_9[0u].y));
- {
- while(true) {
- i = 0;
- {
- while(true) {
- if ((i < one)) {
- } else {
- break;
- }
- if ((i == 0)) {
- float v_1 = asfloat(x_9[0u].x);
- alwaysFalse = (v_1 > asfloat(x_9[0u].y));
- if (!(alwaysFalse)) {
- int x_73 = one;
- floats[x_73] = 1.0f;
- x_GLF_color = float4(1.0f, 1.0f, 0.0f, 1.0f);
- }
- int x_75 = one;
- v[x_75] = 1.0f;
- if (alwaysFalse) {
- continue_execution = false;
- }
- if ((asfloat(x_9[0u].y) < 0.0f)) {
- x_GLF_color = float4(0.0f, 1.0f, 0.0f, 1.0f);
- }
- }
- {
- i = (i + 1);
- }
- continue;
- }
- }
- {
- int x_87 = one;
- if (!((x_87 < 0))) { break; }
- }
- continue;
- }
- }
- bool x_102 = false;
- bool x_103 = false;
- if ((gl_FragCoord.y >= 0.0f)) {
- bool x_97 = (v.y == 1.0f);
- x_103 = x_97;
- if (x_97) {
- x_102 = (floats[1] == 1.0f);
- x_103 = x_102;
- }
- if (x_103) {
- x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
- }
- } else {
- x_GLF_color = (0.0f).xxxx;
- }
-}
-
-main_out main_inner(float4 gl_FragCoord_param) {
- gl_FragCoord = gl_FragCoord_param;
- main_1();
- main_out v_2 = {x_GLF_color};
- return v_2;
-}
-
-main_outputs main(main_inputs inputs) {
- main_out v_3 = main_inner(float4(inputs.gl_FragCoord_param.xyz, (1.0f / inputs.gl_FragCoord_param[3u])));
- main_outputs v_4 = {v_3.x_GLF_color_1};
- if (!(continue_execution)) {
- discard;
- }
- main_outputs v_5 = v_4;
- return v_5;
-}
-
-FXC validation failure:
-<scrubbed_path>(51,13-19): error X3500: array reference cannot be used as an l-value; not natively addressable
-<scrubbed_path>(37,9-19): error X3511: forced to unroll loop, but unrolling failed.
-<scrubbed_path>(34,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index f2c5dab..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,127 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-struct main_inputs {
- float4 gl_FragCoord_param : SV_Position;
-};
-
-
-cbuffer cbuffer_x_9 : register(b0) {
- uint4 x_9[1];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-static float4 gl_FragCoord = (0.0f).xxxx;
-static bool continue_execution = true;
-int tint_f32_to_i32(float value) {
- return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : (-2147483648))) : (2147483647));
-}
-
-void main_1() {
- float2 v = (0.0f).xx;
- float floats[9] = (float[9])0;
- int one = 0;
- int i = 0;
- bool alwaysFalse = false;
- v = (0.0f).xx;
- floats[1] = 0.0f;
- float x_46 = asfloat(x_9[0u].y);
- one = tint_f32_to_i32(x_46);
- {
- while(true) {
- i = 0;
- {
- while(true) {
- int x_56 = i;
- int x_57 = one;
- if ((x_56 < x_57)) {
- } else {
- break;
- }
- int x_60 = i;
- if ((x_60 == 0)) {
- float x_65 = asfloat(x_9[0u].x);
- float x_67 = asfloat(x_9[0u].y);
- alwaysFalse = (x_65 > x_67);
- bool x_69 = alwaysFalse;
- if (!(x_69)) {
- int x_73 = one;
- floats[x_73] = 1.0f;
- x_GLF_color = float4(1.0f, 1.0f, 0.0f, 1.0f);
- }
- int x_75 = one;
- v[x_75] = 1.0f;
- bool x_77 = alwaysFalse;
- if (x_77) {
- continue_execution = false;
- }
- float x_81 = asfloat(x_9[0u].y);
- if ((x_81 < 0.0f)) {
- x_GLF_color = float4(0.0f, 1.0f, 0.0f, 1.0f);
- }
- }
- {
- int x_85 = i;
- i = (x_85 + 1);
- }
- continue;
- }
- }
- {
- int x_87 = one;
- if (!((x_87 < 0))) { break; }
- }
- continue;
- }
- }
- bool x_102 = false;
- bool x_103_phi = false;
- float x_90 = gl_FragCoord.y;
- if ((x_90 >= 0.0f)) {
- float x_96 = v.y;
- bool x_97 = (x_96 == 1.0f);
- x_103_phi = x_97;
- if (x_97) {
- float x_101 = floats[1];
- x_102 = (x_101 == 1.0f);
- x_103_phi = x_102;
- }
- bool x_103 = x_103_phi;
- if (x_103) {
- x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
- }
- } else {
- x_GLF_color = (0.0f).xxxx;
- }
-}
-
-main_out main_inner(float4 gl_FragCoord_param) {
- gl_FragCoord = gl_FragCoord_param;
- main_1();
- main_out v_1 = {x_GLF_color};
- return v_1;
-}
-
-main_outputs main(main_inputs inputs) {
- main_out v_2 = main_inner(float4(inputs.gl_FragCoord_param.xyz, (1.0f / inputs.gl_FragCoord_param[3u])));
- main_outputs v_3 = {v_2.x_GLF_color_1};
- if (!(continue_execution)) {
- discard;
- }
- main_outputs v_4 = v_3;
- return v_4;
-}
-
-FXC validation failure:
-<scrubbed_path>(57,13-19): error X3500: array reference cannot be used as an l-value; not natively addressable
-<scrubbed_path>(38,9-19): error X3511: forced to unroll loop, but unrolling failed.
-<scrubbed_path>(35,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index ac5ea90..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,90 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-struct main_inputs {
- float4 gl_FragCoord_param : SV_Position;
-};
-
-
-static float4 gl_FragCoord = (0.0f).xxxx;
-cbuffer cbuffer_x_7 : register(b0) {
- uint4 x_7[1];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float4x4 m44 = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
- int x_10 = 0;
- m44 = float4x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f), float4(13.0f, 14.0f, 15.0f, 16.0f));
- x_10 = 0;
- {
- while(true) {
- int x_11 = 0;
- int x_9 = 0;
- if ((x_10 < 4)) {
- } else {
- break;
- }
- if ((gl_FragCoord.y < 0.0f)) {
- break;
- }
- x_11 = 0;
- {
- while(true) {
- int x_8 = 0;
- if ((x_11 < 4)) {
- } else {
- break;
- }
- {
- float4 v = m44[x_10];
- int v_1 = x_11;
- float v_2 = m44[x_10][x_11];
- v[v_1] = (v_2 + asfloat(x_7[0u].x));
- x_8 = (x_11 + 1);
- x_11 = x_8;
- }
- continue;
- }
- }
- {
- x_9 = (x_10 + 1);
- x_10 = x_9;
- }
- continue;
- }
- }
- float x_77 = m44[1].y;
- float4 x_79_1 = (0.0f).xxxx;
- x_79_1[0u] = (x_77 - 6.0f);
- float4 x_79 = x_79_1;
- float x_81 = m44[2].z;
- float4 x_83_1 = x_79;
- x_83_1[3u] = (x_81 - 11.0f);
- x_GLF_color = x_83_1;
-}
-
-main_out main_inner(float4 gl_FragCoord_param) {
- gl_FragCoord = gl_FragCoord_param;
- main_1();
- main_out v_3 = {x_GLF_color};
- return v_3;
-}
-
-main_outputs main(main_inputs inputs) {
- main_out v_4 = main_inner(float4(inputs.gl_FragCoord_param.xyz, (1.0f / inputs.gl_FragCoord_param[3u])));
- main_outputs v_5 = {v_4.x_GLF_color_1};
- return v_5;
-}
-
-FXC validation failure:
-<scrubbed_path>(25,5-15): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (435 iterations) or unrolled loop is too large, use the [unroll(n)] attribute to force an exact higher number
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index 123414e..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,93 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-struct main_inputs {
- float4 gl_FragCoord_param : SV_Position;
-};
-
-
-static float4 gl_FragCoord = (0.0f).xxxx;
-cbuffer cbuffer_x_7 : register(b0) {
- uint4 x_7[1];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- float4x4 m44 = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
- int x_10_phi = 0;
- m44 = float4x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f), float4(13.0f, 14.0f, 15.0f, 16.0f));
- x_10_phi = 0;
- {
- while(true) {
- int x_9 = 0;
- int x_11_phi = 0;
- int x_10 = x_10_phi;
- if ((x_10 < 4)) {
- } else {
- break;
- }
- float x_63 = gl_FragCoord.y;
- if ((x_63 < 0.0f)) {
- break;
- }
- x_11_phi = 0;
- {
- while(true) {
- int x_8 = 0;
- int x_11 = x_11_phi;
- if ((x_11 < 4)) {
- } else {
- break;
- }
- {
- float x_72 = asfloat(x_7[0u].x);
- float x_74 = m44[x_10][x_11];
- m44[x_10][x_11] = (x_74 + x_72);
- x_8 = (x_11 + 1);
- x_11_phi = x_8;
- }
- continue;
- }
- }
- {
- x_9 = (x_10 + 1);
- x_10_phi = x_9;
- }
- continue;
- }
- }
- float x_77 = m44[1].y;
- float4 x_79_1 = (0.0f).xxxx;
- x_79_1[0u] = (x_77 - 6.0f);
- float4 x_79 = x_79_1;
- float x_81 = m44[2].z;
- float4 x_83_1 = x_79;
- x_83_1[3u] = (x_81 - 11.0f);
- float4 x_83 = x_83_1;
- x_GLF_color = x_83;
-}
-
-main_out main_inner(float4 gl_FragCoord_param) {
- gl_FragCoord = gl_FragCoord_param;
- main_1();
- main_out v = {x_GLF_color};
- return v;
-}
-
-main_outputs main(main_inputs inputs) {
- main_out v_1 = main_inner(float4(inputs.gl_FragCoord_param.xyz, (1.0f / inputs.gl_FragCoord_param[3u])));
- main_outputs v_2 = {v_1.x_GLF_color_1};
- return v_2;
-}
-
-FXC validation failure:
-<scrubbed_path>(25,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index c73e49a..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,127 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-struct main_inputs {
- float4 gl_FragCoord_param : SV_Position;
-};
-
-
-cbuffer cbuffer_x_13 : register(b0) {
- uint4 x_13[1];
-};
-static float4 gl_FragCoord = (0.0f).xxxx;
-static float4 x_GLF_color = (0.0f).xxxx;
-int tint_mod_i32(int lhs, int rhs) {
- int v = ((((rhs == 0) | ((lhs == -2147483648) & (rhs == -1)))) ? (1) : (rhs));
- return (lhs - ((lhs / v) * v));
-}
-
-float compute_value_f1_f1_(inout float limit, inout float thirty_two) {
- float result = 0.0f;
- int i = 0;
- result = -0.5f;
- i = 1;
- {
- while(true) {
- if ((i < 800)) {
- } else {
- break;
- }
- if ((tint_mod_i32(i, 32) == 0)) {
- result = (result + 0.40000000596046447754f);
- } else {
- float x_149 = thirty_two;
- float v_1 = float(i);
- float v_2 = round(x_149);
- float v_3 = float(i);
- if (((v_1 - (v_2 * floor((v_3 / round(x_149))))) <= 0.00999999977648258209f)) {
- result = (result + 100.0f);
- }
- }
- float v_4 = float(i);
- if ((v_4 >= limit)) {
- float x_163 = result;
- return x_163;
- }
- {
- i = (i + 1);
- }
- continue;
- }
- }
- float x_166 = result;
- return x_166;
-}
-
-void main_1() {
- float3 c = (0.0f).xxx;
- float thirty_two_1 = 0.0f;
- float param = 0.0f;
- float param_1 = 0.0f;
- float param_2 = 0.0f;
- float param_3 = 0.0f;
- int i_1 = 0;
- c = float3(7.0f, 8.0f, 9.0f);
- thirty_two_1 = round((asfloat(x_13[0u].x) / 8.0f));
- param = gl_FragCoord.x;
- param_1 = thirty_two_1;
- float x_69 = compute_value_f1_f1_(param, param_1);
- c[0u] = x_69;
- param_2 = gl_FragCoord.y;
- param_3 = thirty_two_1;
- float x_74 = compute_value_f1_f1_(param_2, param_3);
- c[1u] = x_74;
- float2 v_5 = float2(c.x, c.y);
- float4x2 x_87 = float4x2(v_5, float2(c.z, 1.0f), float2(1.0f, 0.0f), float2(1.0f, 0.0f));
- float v_6 = mul(float3x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f)), c)[0u];
- c[2u] = (v_6 + float3(x_87[0u][0u], x_87[0u][1u], x_87[1u][0u])[1u]);
- i_1 = 0;
- {
- while(true) {
- if ((i_1 < 3)) {
- } else {
- break;
- }
- if ((c[i_1] >= 1.0f)) {
- int x_108 = i_1;
- c[x_108] = (c[i_1] * c[i_1]);
- if ((gl_FragCoord.y < 0.0f)) {
- break;
- }
- }
- {
- i_1 = (i_1 + 1);
- }
- continue;
- }
- }
- float3 x_126 = normalize(abs(c));
- x_GLF_color = float4(x_126[0u], x_126[1u], x_126[2u], 1.0f);
-}
-
-main_out main_inner(float4 gl_FragCoord_param) {
- gl_FragCoord = gl_FragCoord_param;
- main_1();
- main_out v_7 = {x_GLF_color};
- return v_7;
-}
-
-main_outputs main(main_inputs inputs) {
- main_out v_8 = main_inner(float4(inputs.gl_FragCoord_param.xyz, (1.0f / inputs.gl_FragCoord_param[3u])));
- main_outputs v_9 = {v_8.x_GLF_color_1};
- return v_9;
-}
-
-FXC validation failure:
-<scrubbed_path>(21,19-25): warning X3556: integer divides may be much slower, try using uints if possible.
-<scrubbed_path>(85,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index 6757463..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,151 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-struct main_inputs {
- float4 gl_FragCoord_param : SV_Position;
-};
-
-
-cbuffer cbuffer_x_13 : register(b0) {
- uint4 x_13[1];
-};
-static float4 gl_FragCoord = (0.0f).xxxx;
-static float4 x_GLF_color = (0.0f).xxxx;
-int tint_mod_i32(int lhs, int rhs) {
- int v = ((((rhs == 0) | ((lhs == -2147483648) & (rhs == -1)))) ? (1) : (rhs));
- return (lhs - ((lhs / v) * v));
-}
-
-float compute_value_f1_f1_(inout float limit, inout float thirty_two) {
- float result = 0.0f;
- int i = 0;
- result = -0.5f;
- i = 1;
- {
- while(true) {
- int x_136 = i;
- if ((x_136 < 800)) {
- } else {
- break;
- }
- int x_139 = i;
- if ((tint_mod_i32(x_139, 32) == 0)) {
- float x_145 = result;
- result = (x_145 + 0.40000000596046447754f);
- } else {
- int x_147 = i;
- float x_149 = thirty_two;
- float v_1 = float(x_147);
- float v_2 = round(x_149);
- float v_3 = float(x_147);
- if (((v_1 - (v_2 * floor((v_3 / round(x_149))))) <= 0.00999999977648258209f)) {
- float x_155 = result;
- result = (x_155 + 100.0f);
- }
- }
- int x_157 = i;
- float x_159 = limit;
- if ((float(x_157) >= x_159)) {
- float x_163 = result;
- return x_163;
- }
- {
- int x_164 = i;
- i = (x_164 + 1);
- }
- continue;
- }
- }
- float x_166 = result;
- return x_166;
-}
-
-void main_1() {
- float3 c = (0.0f).xxx;
- float thirty_two_1 = 0.0f;
- float param = 0.0f;
- float param_1 = 0.0f;
- float param_2 = 0.0f;
- float param_3 = 0.0f;
- int i_1 = 0;
- c = float3(7.0f, 8.0f, 9.0f);
- float x_63 = asfloat(x_13[0u].x);
- thirty_two_1 = round((x_63 / 8.0f));
- float x_67 = gl_FragCoord.x;
- param = x_67;
- float x_68 = thirty_two_1;
- param_1 = x_68;
- float x_69 = compute_value_f1_f1_(param, param_1);
- c[0u] = x_69;
- float x_72 = gl_FragCoord.y;
- param_2 = x_72;
- float x_73 = thirty_two_1;
- param_3 = x_73;
- float x_74 = compute_value_f1_f1_(param_2, param_3);
- c[1u] = x_74;
- float3 x_76 = c;
- float3 x_79 = c;
- float2 v_4 = float2(x_79[0u], x_79[1u]);
- float4x2 x_87 = float4x2(v_4, float2(x_79[2u], 1.0f), float2(1.0f, 0.0f), float2(1.0f, 0.0f));
- float v_5 = mul(float3x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f)), x_76)[0u];
- c[2u] = (v_5 + float3(x_87[0u][0u], x_87[0u][1u], x_87[1u][0u])[1u]);
- i_1 = 0;
- {
- while(true) {
- int x_99 = i_1;
- if ((x_99 < 3)) {
- } else {
- break;
- }
- int x_102 = i_1;
- float x_104 = c[x_102];
- if ((x_104 >= 1.0f)) {
- int x_108 = i_1;
- int x_109 = i_1;
- float x_111 = c[x_109];
- int x_112 = i_1;
- float x_114 = c[x_112];
- c[x_108] = (x_111 * x_114);
- float x_118 = gl_FragCoord.y;
- if ((x_118 < 0.0f)) {
- break;
- }
- }
- {
- int x_122 = i_1;
- i_1 = (x_122 + 1);
- }
- continue;
- }
- }
- float3 x_124 = c;
- float3 x_126 = normalize(abs(x_124));
- x_GLF_color = float4(x_126[0u], x_126[1u], x_126[2u], 1.0f);
-}
-
-main_out main_inner(float4 gl_FragCoord_param) {
- gl_FragCoord = gl_FragCoord_param;
- main_1();
- main_out v_6 = {x_GLF_color};
- return v_6;
-}
-
-main_outputs main(main_inputs inputs) {
- main_out v_7 = main_inner(float4(inputs.gl_FragCoord_param.xyz, (1.0f / inputs.gl_FragCoord_param[3u])));
- main_outputs v_8 = {v_7.x_GLF_color_1};
- return v_8;
-}
-
-FXC validation failure:
-<scrubbed_path>(21,19-25): warning X3556: integer divides may be much slower, try using uints if possible.
-<scrubbed_path>(99,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index eaa6d46..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,77 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_8 : register(b0) {
- uint4 x_8[4];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- int x = 0;
- float4 matrix_u = (0.0f).xxxx;
- int b = 0;
- float4 matrix_b = (0.0f).xxxx;
- float4 x_42 = (0.0f).xxxx;
- x = 4;
- {
- while(true) {
- if ((x >= 1)) {
- } else {
- break;
- }
- int x_11 = x;
- matrix_u[x_11] = 1.0f;
- {
- x = (x - 1);
- }
- continue;
- }
- }
- b = 4;
- {
- while(true) {
- if ((asfloat(x_8[0u].x) < -1.0f)) {
- } else {
- break;
- }
- int x_14 = b;
- if ((b > 1)) {
- x_42 = min(matrix_b, matrix_b);
- } else {
- x_42 = matrix_u;
- }
- matrix_b[x_14] = x_42.y;
- {
- b = (b - 1);
- }
- continue;
- }
- }
- x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
-}
-
-main_out main_inner() {
- main_1();
- main_out v = {x_GLF_color};
- return v;
-}
-
-main_outputs main() {
- main_out v_1 = main_inner();
- main_outputs v_2 = {v_1.x_GLF_color_1};
- return v_2;
-}
-
-FXC validation failure:
-<scrubbed_path>(28,7-20): error X3504: literal loop terminated early due to out of bounds array access
-<scrubbed_path>(22,5-15): warning X3557: loop only executes for 0 iteration(s), forcing loop to unroll
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index 5aa7d2e..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,86 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_8 : register(b0) {
- uint4 x_8[4];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- int x = 0;
- float4 matrix_u = (0.0f).xxxx;
- int b = 0;
- float4 matrix_b = (0.0f).xxxx;
- float4 x_42 = (0.0f).xxxx;
- x = 4;
- {
- while(true) {
- int x_10 = x;
- if ((x_10 >= 1)) {
- } else {
- break;
- }
- int x_11 = x;
- matrix_u[x_11] = 1.0f;
- {
- int x_12 = x;
- x = (x_12 - 1);
- }
- continue;
- }
- }
- b = 4;
- {
- while(true) {
- float x_55 = asfloat(x_8[0u].x);
- if ((x_55 < -1.0f)) {
- } else {
- break;
- }
- int x_14 = b;
- int x_15 = b;
- if ((x_15 > 1)) {
- float4 x_62 = matrix_b;
- float4 x_63 = matrix_b;
- x_42 = min(x_62, x_63);
- } else {
- float4 x_65 = matrix_u;
- x_42 = x_65;
- }
- float x_67 = x_42.y;
- matrix_b[x_14] = x_67;
- {
- int x_16 = b;
- b = (x_16 - 1);
- }
- continue;
- }
- }
- x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
-}
-
-main_out main_inner() {
- main_1();
- main_out v = {x_GLF_color};
- return v;
-}
-
-main_outputs main() {
- main_out v_1 = main_inner();
- main_outputs v_2 = {v_1.x_GLF_color_1};
- return v_2;
-}
-
-FXC validation failure:
-<scrubbed_path>(29,7-20): error X3504: literal loop terminated early due to out of bounds array access
-<scrubbed_path>(22,5-15): warning X3557: loop only executes for 0 iteration(s), forcing loop to unroll
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.ir.fxc.hlsl
deleted file mode 100644
index da28904..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,115 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_9 : register(b0) {
- uint4 x_9[1];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- int idx = int(0);
- float4x3 m43 = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
- int ll_1 = int(0);
- int GLF_live6rows = int(0);
- int z = int(0);
- int ll_2 = int(0);
- int ctr = int(0);
- float4x3 tempm43 = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
- int ll_3 = int(0);
- int c = int(0);
- int d = int(0);
- float GLF_live6sums[9] = (float[9])0;
- idx = int(0);
- m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), (0.0f).xxx);
- ll_1 = int(0);
- GLF_live6rows = int(2);
- {
- while(true) {
- int v = ll_1;
- if ((v >= asint(x_9[0u].x))) {
- x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
- break;
- }
- ll_1 = (ll_1 + int(1));
- z = asint(x_9[0u].x);
- ll_2 = int(0);
- ctr = int(0);
- {
- while(true) {
- if ((ctr < int(1))) {
- } else {
- break;
- }
- int v_1 = ll_2;
- if ((v_1 >= asint(x_9[0u].x))) {
- break;
- }
- ll_2 = (ll_2 + int(1));
- tempm43 = m43;
- ll_3 = int(0);
- c = int(0);
- {
- while(true) {
- if ((int(1) < z)) {
- } else {
- break;
- }
- d = int(0);
- int x_29 = c;
- int x_30 = c;
- int x_31 = c;
- int x_32 = d;
- int x_33 = d;
- int x_34 = d;
- int v_2 = ((((x_29 >= int(0)) & (x_30 < int(4)))) ? (x_31) : (int(0)));
- tempm43[v_2][((((x_32 >= int(0)) & (x_33 < int(3)))) ? (x_34) : (int(0)))] = 1.0f;
- {
- c = (c + int(1));
- }
- continue;
- }
- }
- int x_117 = ((((idx >= int(0)) & (idx < int(9)))) ? (idx) : (int(0)));
- float v_3 = GLF_live6sums[x_117];
- int v_4 = ctr;
- GLF_live6sums[x_117] = (v_3 + m43[v_4].y);
- {
- ctr = (ctr + int(1));
- }
- continue;
- }
- }
- idx = (idx + int(1));
- {
- }
- continue;
- }
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_5 = {x_GLF_color};
- return v_5;
-}
-
-main_outputs main() {
- main_out v_6 = main_inner();
- main_outputs v_7 = {v_6.x_GLF_color_1};
- return v_7;
-}
-
-FXC validation failure:
-<scrubbed_path>(57,13-23): error X3511: forced to unroll loop, but unrolling failed.
-<scrubbed_path>(43,9-19): error X3511: forced to unroll loop, but unrolling failed.
-<scrubbed_path>(32,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1
diff --git a/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.ir.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.ir.fxc.hlsl
deleted file mode 100644
index 034fa8d..0000000
--- a/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.ir.fxc.hlsl
+++ /dev/null
@@ -1,130 +0,0 @@
-SKIP: FAILED
-
-struct main_out {
- float4 x_GLF_color_1;
-};
-
-struct main_outputs {
- float4 main_out_x_GLF_color_1 : SV_Target0;
-};
-
-
-cbuffer cbuffer_x_9 : register(b0) {
- uint4 x_9[1];
-};
-static float4 x_GLF_color = (0.0f).xxxx;
-void main_1() {
- int idx = int(0);
- float4x3 m43 = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
- int ll_1 = int(0);
- int GLF_live6rows = int(0);
- int z = int(0);
- int ll_2 = int(0);
- int ctr = int(0);
- float4x3 tempm43 = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
- int ll_3 = int(0);
- int c = int(0);
- int d = int(0);
- float GLF_live6sums[9] = (float[9])0;
- idx = int(0);
- m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), (0.0f).xxx);
- ll_1 = int(0);
- GLF_live6rows = int(2);
- {
- while(true) {
- int x_18 = ll_1;
- int x_19 = asint(x_9[0u].x);
- if ((x_18 >= x_19)) {
- x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
- break;
- }
- int x_20 = ll_1;
- ll_1 = (x_20 + int(1));
- int x_22 = asint(x_9[0u].x);
- z = x_22;
- ll_2 = int(0);
- ctr = int(0);
- {
- while(true) {
- int x_23 = ctr;
- if ((x_23 < int(1))) {
- } else {
- break;
- }
- int x_24 = ll_2;
- int x_25 = asint(x_9[0u].x);
- if ((x_24 >= x_25)) {
- break;
- }
- int x_26 = ll_2;
- ll_2 = (x_26 + int(1));
- float4x3 x_98 = m43;
- tempm43 = x_98;
- ll_3 = int(0);
- c = int(0);
- {
- while(true) {
- int x_28 = z;
- if ((int(1) < x_28)) {
- } else {
- break;
- }
- d = int(0);
- int x_29 = c;
- int x_30 = c;
- int x_31 = c;
- int x_32 = d;
- int x_33 = d;
- int x_34 = d;
- int v = ((((x_29 >= int(0)) & (x_30 < int(4)))) ? (x_31) : (int(0)));
- tempm43[v][((((x_32 >= int(0)) & (x_33 < int(3)))) ? (x_34) : (int(0)))] = 1.0f;
- {
- int x_35 = c;
- c = (x_35 + int(1));
- }
- continue;
- }
- }
- int x_37 = idx;
- int x_38 = idx;
- int x_39 = idx;
- int x_117 = ((((x_37 >= int(0)) & (x_38 < int(9)))) ? (x_39) : (int(0)));
- int x_40 = ctr;
- float x_119 = m43[x_40].y;
- float x_121 = GLF_live6sums[x_117];
- GLF_live6sums[x_117] = (x_121 + x_119);
- {
- int x_41 = ctr;
- ctr = (x_41 + int(1));
- }
- continue;
- }
- }
- int x_43 = idx;
- idx = (x_43 + int(1));
- {
- }
- continue;
- }
- }
-}
-
-main_out main_inner() {
- main_1();
- main_out v_1 = {x_GLF_color};
- return v_1;
-}
-
-main_outputs main() {
- main_out v_2 = main_inner();
- main_outputs v_3 = {v_2.x_GLF_color_1};
- return v_3;
-}
-
-FXC validation failure:
-<scrubbed_path>(64,13-23): error X3511: forced to unroll loop, but unrolling failed.
-<scrubbed_path>(46,9-19): error X3511: forced to unroll loop, but unrolling failed.
-<scrubbed_path>(32,5-15): error X3511: forced to unroll loop, but unrolling failed.
-
-
-tint executable returned error: exit status 1