HLSL: work around FXC failures when dynamically indexing arrays in structs

FXC fails to compile code that assigns to dynamically-indexed fixed-size
arrays in structs on internal shader variables with:

error X3500: array reference cannot be used as an l-value; not natively
addressable

This CL detects this case, and transforms such assignments into copying
out the array to a local variable, assigning to that local, and then
copying the array back.

Also manually regenerate SKIPs for HLSL/FXC after this change, which
fixes 30 tests. Also exposes some "compilation aborted unexpectedly" now
that  "array reference cannot be used as an l-value" has been fixed. For
tests that fail for both DXC and FXC, updating SKIPs to the DXC one to
help distinguish actual FXC bugs from valid errors.

Bug: tint:998
Bug: tint:1206
Change-Id: I09204d8d81ab27d1c257538ad702414ccc386543
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71620
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Antonio Maiorano 2021-12-13 15:55:11 +00:00 committed by Tint LUCI CQ
parent 5923803f7e
commit d733fdb85c
98 changed files with 2149 additions and 6619 deletions

View File

@ -451,6 +451,8 @@ libtint_source_set("libtint_core_all_src") {
"transform/fold_trivial_single_use_lets.h",
"transform/for_loop_to_loop.cc",
"transform/for_loop_to_loop.h",
"transform/localize_struct_array_assignment.cc",
"transform/localize_struct_array_assignment.h",
"transform/loop_to_for_loop.cc",
"transform/loop_to_for_loop.h",
"transform/manager.cc",

View File

@ -312,6 +312,8 @@ set(TINT_LIB_SRCS
transform/fold_constants.h
transform/fold_trivial_single_use_lets.cc
transform/fold_trivial_single_use_lets.h
transform/localize_struct_array_assignment.cc
transform/localize_struct_array_assignment.h
transform/for_loop_to_loop.cc
transform/for_loop_to_loop.h
transform/glsl.cc
@ -971,6 +973,7 @@ if(${TINT_BUILD_TESTS})
transform/fold_constants_test.cc
transform/fold_trivial_single_use_lets_test.cc
transform/for_loop_to_loop_test.cc
transform/localize_struct_array_assignment_test.cc
transform/loop_to_for_loop_test.cc
transform/module_scope_var_to_entry_point_param_test.cc
transform/multiplanar_external_texture_test.cc

View File

@ -2468,6 +2468,15 @@ class ProgramBuilder {
}
}
/// Unmarks that the given transform `T` has been applied to this program.
template <typename T>
void UnsetTransformApplied() {
auto it = transforms_applied_.find(&TypeInfo::Of<T>());
if (it != transforms_applied_.end()) {
transforms_applied_.erase(it);
}
}
/// @returns true if the transform of type `T` was applied.
template <typename T>
bool HasTransformApplied() {

View File

@ -0,0 +1,230 @@
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/transform/localize_struct_array_assignment.h"
#include <unordered_map>
#include <utility>
#include "src/ast/assignment_statement.h"
#include "src/ast/traverse_expressions.h"
#include "src/program_builder.h"
#include "src/sem/expression.h"
#include "src/sem/member_accessor_expression.h"
#include "src/sem/reference_type.h"
#include "src/sem/statement.h"
#include "src/sem/variable.h"
#include "src/transform/simplify_pointers.h"
#include "src/utils/scoped_assignment.h"
TINT_INSTANTIATE_TYPEINFO(tint::transform::LocalizeStructArrayAssignment);
namespace tint {
namespace transform {
/// Private implementation of LocalizeStructArrayAssignment transform
class LocalizeStructArrayAssignment::State {
private:
CloneContext& ctx;
ProgramBuilder& b;
/// Returns true if `expr` contains an index accessor expression to a
/// structure member of array type.
bool ContainsStructArrayIndex(const ast::Expression* expr) {
bool result = false;
ast::TraverseExpressions(
expr, b.Diagnostics(), [&](const ast::IndexAccessorExpression* ia) {
// Indexing using a runtime value?
auto* idx_sem = ctx.src->Sem().Get(ia->index);
if (!idx_sem->ConstantValue().IsValid()) {
// Indexing a member access expr?
if (auto* ma = ia->object->As<ast::MemberAccessorExpression>()) {
// That accesses an array?
if (ctx.src->TypeOf(ma)->UnwrapRef()->Is<sem::Array>()) {
result = true;
return ast::TraverseAction::Stop;
}
}
}
return ast::TraverseAction::Descend;
});
return result;
}
// Returns the type and storage class of the originating variable of the lhs
// of the assignment statement.
// See https://www.w3.org/TR/WGSL/#originating-variable-section
std::pair<const sem::Type*, ast::StorageClass>
GetOriginatingTypeAndStorageClass(
const ast::AssignmentStatement* assign_stmt) {
// Get first IdentifierExpr from lhs of assignment, which should resolve to
// the pointer or reference of the originating variable of the assignment.
// TraverseExpressions traverses left to right, and this code depends on the
// fact that for an assignment statement, the variable will be the left-most
// expression.
// TODO(crbug.com/tint/1341): do this in the Resolver, setting the
// originating variable on sem::Expression.
const ast::IdentifierExpression* ident = nullptr;
ast::TraverseExpressions(assign_stmt->lhs, b.Diagnostics(),
[&](const ast::IdentifierExpression* id) {
ident = id;
return ast::TraverseAction::Stop;
});
auto* sem_var_user = ctx.src->Sem().Get<sem::VariableUser>(ident);
if (!sem_var_user) {
TINT_ICE(Transform, b.Diagnostics())
<< "Expected to find variable of lhs of assignment statement";
return {};
}
auto* var = sem_var_user->Variable();
if (auto* ptr = var->Type()->As<sem::Pointer>()) {
return {ptr->StoreType(), ptr->StorageClass()};
}
auto* ref = var->Type()->As<sem::Reference>();
if (!ref) {
TINT_ICE(Transform, b.Diagnostics())
<< "Expecting to find variable of type pointer or reference on lhs "
"of assignment statement";
return {};
}
return {ref->StoreType(), ref->StorageClass()};
}
public:
/// Constructor
/// @param ctx_in the CloneContext primed with the input program and
/// ProgramBuilder
explicit State(CloneContext& ctx_in) : ctx(ctx_in), b(*ctx_in.dst) {}
/// Runs the transform
void Run() {
struct Shared {
bool process_nested_nodes = false;
ast::StatementList insert_before_stmts;
ast::StatementList insert_after_stmts;
} s;
ctx.ReplaceAll([&](const ast::AssignmentStatement* assign_stmt)
-> const ast::Statement* {
// Process if it's an assignment statement to a dynamically indexed array
// within a struct on a function or private storage variable. This
// specific use-case is what FXC fails to compile with:
// error X3500: array reference cannot be used as an l-value; not natively
// addressable
if (!ContainsStructArrayIndex(assign_stmt->lhs)) {
return nullptr;
}
auto og = GetOriginatingTypeAndStorageClass(assign_stmt);
if (!(og.first->Is<sem::Struct>() &&
(og.second == ast::StorageClass::kFunction ||
og.second == ast::StorageClass::kPrivate))) {
return nullptr;
}
// Reset shared state for this assignment statement
s = Shared{};
const ast::Expression* new_lhs = nullptr;
{
TINT_SCOPED_ASSIGNMENT(s.process_nested_nodes, true);
new_lhs = ctx.Clone(assign_stmt->lhs);
}
auto* new_assign_stmt = b.Assign(new_lhs, ctx.Clone(assign_stmt->rhs));
// Combine insert_before_stmts + new_assign_stmt + insert_after_stmts into
// a block and return it
ast::StatementList stmts = std::move(s.insert_before_stmts);
stmts.reserve(1 + s.insert_after_stmts.size());
stmts.emplace_back(new_assign_stmt);
stmts.insert(stmts.end(), s.insert_after_stmts.begin(),
s.insert_after_stmts.end());
return b.Block(std::move(stmts));
});
ctx.ReplaceAll([&](const ast::IndexAccessorExpression* index_access)
-> const ast::Expression* {
if (!s.process_nested_nodes) {
return nullptr;
}
// Indexing a member access expr?
auto* mem_access =
index_access->object->As<ast::MemberAccessorExpression>();
if (!mem_access) {
return nullptr;
}
// Process any nested IndexAccessorExpressions
mem_access = ctx.Clone(mem_access);
// Store the address of the member access into a let as we need to read
// the value twice e.g. let tint_symbol = &(s.a1);
auto mem_access_ptr = b.Sym();
s.insert_before_stmts.push_back(
b.Decl(b.Const(mem_access_ptr, nullptr, b.AddressOf(mem_access))));
// Disable further transforms when cloning
TINT_SCOPED_ASSIGNMENT(s.process_nested_nodes, false);
// Copy entire array out of struct into local temp var
// e.g. var tint_symbol_1 = *(tint_symbol);
auto tmp_var = b.Sym();
s.insert_before_stmts.push_back(
b.Decl(b.Var(tmp_var, nullptr, b.Deref(mem_access_ptr))));
// Replace input index_access with a clone of itself, but with its
// .object replaced by the new temp var. This is returned from this
// function to modify the original assignment statement. e.g.
// tint_symbol_1[uniforms.i]
auto* new_index_access =
b.IndexAccessor(tmp_var, ctx.Clone(index_access->index));
// Assign temp var back to array
// e.g. *(tint_symbol) = tint_symbol_1;
auto* assign_rhs_to_temp = b.Assign(b.Deref(mem_access_ptr), tmp_var);
s.insert_after_stmts.insert(s.insert_after_stmts.begin(),
assign_rhs_to_temp); // push_front
return new_index_access;
});
ctx.Clone();
}
};
LocalizeStructArrayAssignment::LocalizeStructArrayAssignment() = default;
LocalizeStructArrayAssignment::~LocalizeStructArrayAssignment() = default;
void LocalizeStructArrayAssignment::Run(CloneContext& ctx,
const DataMap&,
DataMap&) {
if (!Requires<SimplifyPointers>(ctx)) {
return;
}
State state(ctx);
state.Run();
// This transform may introduce pointers
ctx.dst->UnsetTransformApplied<transform::SimplifyPointers>();
}
} // namespace transform
} // namespace tint

View File

@ -0,0 +1,53 @@
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SRC_TRANSFORM_LOCALIZE_STRUCT_ARRAY_ASSIGNMENT_H_
#define SRC_TRANSFORM_LOCALIZE_STRUCT_ARRAY_ASSIGNMENT_H_
#include "src/transform/transform.h"
namespace tint {
namespace transform {
/// This transforms replaces assignment to dynamically-indexed fixed-size arrays
/// in structs on shader-local variables with code that copies the arrays to a
/// temporary local variable, assigns to the local variable, and copies the
/// array back. This is to work around FXC's compilation failure for these cases
/// (see crbug.com/tint/1206).
class LocalizeStructArrayAssignment
: public Castable<LocalizeStructArrayAssignment, Transform> {
public:
/// Constructor
LocalizeStructArrayAssignment();
/// Destructor
~LocalizeStructArrayAssignment() override;
protected:
/// Runs the transform using the CloneContext built for transforming a
/// program. Run() is responsible for calling Clone() on the CloneContext.
/// @param ctx the CloneContext primed with the input program and
/// ProgramBuilder
/// @param inputs optional extra transform-specific input data
/// @param outputs optional extra transform-specific output data
void Run(CloneContext& ctx, const DataMap& inputs, DataMap& outputs) override;
private:
class State;
};
} // namespace transform
} // namespace tint
#endif // SRC_TRANSFORM_LOCALIZE_STRUCT_ARRAY_ASSIGNMENT_H_

View File

@ -0,0 +1,620 @@
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/transform/localize_struct_array_assignment.h"
#include "src/transform/simplify_pointers.h"
#include "src/transform/unshadow.h"
#include "src/transform/test_helper.h"
namespace tint {
namespace transform {
namespace {
using LocalizeStructArrayAssignmentTest = TransformTest;
TEST_F(LocalizeStructArrayAssignmentTest, MissingSimplifyPointers) {
auto* src = R"()";
auto* expect =
"error: tint::transform::LocalizeStructArrayAssignment depends on "
"tint::transform::SimplifyPointers but the dependency was not run";
auto got = Run<LocalizeStructArrayAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(LocalizeStructArrayAssignmentTest, EmptyModule) {
auto* src = R"()";
auto* expect = src;
auto got =
Run<Unshadow, SimplifyPointers, LocalizeStructArrayAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(LocalizeStructArrayAssignmentTest, StructArray) {
auto* src = R"(
[[block]] struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<InnerS, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
s1.a1[uniforms.i] = v;
}
)";
auto* expect = R"(
[[block]]
struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<InnerS, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
{
let tint_symbol = &(s1.a1);
var tint_symbol_1 = *(tint_symbol);
tint_symbol_1[uniforms.i] = v;
*(tint_symbol) = tint_symbol_1;
}
}
)";
auto got =
Run<Unshadow, SimplifyPointers, LocalizeStructArrayAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(LocalizeStructArrayAssignmentTest, StructStructArray) {
auto* src = R"(
[[block]] struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct S1 {
a : array<InnerS, 8>;
};
struct OuterS {
s2 : S1;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
s1.s2.a[uniforms.i] = v;
}
)";
auto* expect = R"(
[[block]]
struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct S1 {
a : array<InnerS, 8>;
};
struct OuterS {
s2 : S1;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
{
let tint_symbol = &(s1.s2.a);
var tint_symbol_1 = *(tint_symbol);
tint_symbol_1[uniforms.i] = v;
*(tint_symbol) = tint_symbol_1;
}
}
)";
auto got =
Run<Unshadow, SimplifyPointers, LocalizeStructArrayAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(LocalizeStructArrayAssignmentTest, StructArrayArray) {
auto* src = R"(
[[block]] struct Uniforms {
i : u32;
j : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<array<InnerS, 8>, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
s1.a1[uniforms.i][uniforms.j] = v;
}
)";
auto* expect = R"(
[[block]]
struct Uniforms {
i : u32;
j : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<array<InnerS, 8>, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
{
let tint_symbol = &(s1.a1);
var tint_symbol_1 = *(tint_symbol);
tint_symbol_1[uniforms.i][uniforms.j] = v;
*(tint_symbol) = tint_symbol_1;
}
}
)";
auto got =
Run<Unshadow, SimplifyPointers, LocalizeStructArrayAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(LocalizeStructArrayAssignmentTest, StructArrayStruct) {
auto* src = R"(
[[block]] struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct S1 {
s2 : InnerS;
};
struct OuterS {
a1 : array<S1, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
s1.a1[uniforms.i].s2 = v;
}
)";
auto* expect = R"(
[[block]]
struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct S1 {
s2 : InnerS;
};
struct OuterS {
a1 : array<S1, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
{
let tint_symbol = &(s1.a1);
var tint_symbol_1 = *(tint_symbol);
tint_symbol_1[uniforms.i].s2 = v;
*(tint_symbol) = tint_symbol_1;
}
}
)";
auto got =
Run<Unshadow, SimplifyPointers, LocalizeStructArrayAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(LocalizeStructArrayAssignmentTest, StructArrayStructArray) {
auto* src = R"(
[[block]] struct Uniforms {
i : u32;
j : u32;
};
struct InnerS {
v : i32;
};
struct S1 {
a2 : array<InnerS, 8>;
};
struct OuterS {
a1 : array<S1, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s : OuterS;
s.a1[uniforms.i].a2[uniforms.j] = v;
}
)";
auto* expect = R"(
[[block]]
struct Uniforms {
i : u32;
j : u32;
};
struct InnerS {
v : i32;
};
struct S1 {
a2 : array<InnerS, 8>;
};
struct OuterS {
a1 : array<S1, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s : OuterS;
{
let tint_symbol = &(s.a1);
var tint_symbol_1 = *(tint_symbol);
let tint_symbol_2 = &(tint_symbol_1[uniforms.i].a2);
var tint_symbol_3 = *(tint_symbol_2);
tint_symbol_3[uniforms.j] = v;
*(tint_symbol_2) = tint_symbol_3;
*(tint_symbol) = tint_symbol_1;
}
}
)";
auto got =
Run<Unshadow, SimplifyPointers, LocalizeStructArrayAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(LocalizeStructArrayAssignmentTest, IndexingWithSideEffectFunc) {
auto* src = R"(
[[block]] struct Uniforms {
i : u32;
j : u32;
};
struct InnerS {
v : i32;
};
struct S1 {
a2 : array<InnerS, 8>;
};
struct OuterS {
a1 : array<S1, 8>;
};
var<private> nextIndex : u32;
fn getNextIndex() -> u32 {
nextIndex = nextIndex + 1u;
return nextIndex;
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s : OuterS;
s.a1[getNextIndex()].a2[uniforms.j] = v;
}
)";
auto* expect = R"(
[[block]]
struct Uniforms {
i : u32;
j : u32;
};
struct InnerS {
v : i32;
};
struct S1 {
a2 : array<InnerS, 8>;
};
struct OuterS {
a1 : array<S1, 8>;
};
var<private> nextIndex : u32;
fn getNextIndex() -> u32 {
nextIndex = (nextIndex + 1u);
return nextIndex;
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s : OuterS;
{
let tint_symbol = &(s.a1);
var tint_symbol_1 = *(tint_symbol);
let tint_symbol_2 = &(tint_symbol_1[getNextIndex()].a2);
var tint_symbol_3 = *(tint_symbol_2);
tint_symbol_3[uniforms.j] = v;
*(tint_symbol_2) = tint_symbol_3;
*(tint_symbol) = tint_symbol_1;
}
}
)";
auto got =
Run<Unshadow, SimplifyPointers, LocalizeStructArrayAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(LocalizeStructArrayAssignmentTest, ViaPointerArg) {
auto* src = R"(
[[block]] struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<InnerS, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
fn f(p : ptr<function, OuterS>) {
var v : InnerS;
(*p).a1[uniforms.i] = v;
}
[[stage(compute), workgroup_size(1)]]
fn main() {
var s1 : OuterS;
f(&s1);
}
)";
auto* expect = R"(
[[block]]
struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<InnerS, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
fn f(p : ptr<function, OuterS>) {
var v : InnerS;
{
let tint_symbol = &((*(p)).a1);
var tint_symbol_1 = *(tint_symbol);
tint_symbol_1[uniforms.i] = v;
*(tint_symbol) = tint_symbol_1;
}
}
[[stage(compute), workgroup_size(1)]]
fn main() {
var s1 : OuterS;
f(&(s1));
}
)";
auto got =
Run<Unshadow, SimplifyPointers, LocalizeStructArrayAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(LocalizeStructArrayAssignmentTest, ViaPointerVar) {
auto* src = R"(
[[block]]
struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<InnerS, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
fn f(p : ptr<function, InnerS>, v : InnerS) {
*(p) = v;
}
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
let p = &(s1.a1[uniforms.i]);
*(p) = v;
}
)";
auto* expect = R"(
[[block]]
struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<InnerS, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
fn f(p : ptr<function, InnerS>, v : InnerS) {
*(p) = v;
}
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
let p_save = uniforms.i;
{
let tint_symbol = &(s1.a1);
var tint_symbol_1 = *(tint_symbol);
tint_symbol_1[p_save] = v;
*(tint_symbol) = tint_symbol_1;
}
}
)";
auto got =
Run<Unshadow, SimplifyPointers, LocalizeStructArrayAssignment>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(LocalizeStructArrayAssignmentTest, VectorAssignment) {
auto* src = R"(
[[block]]
struct Uniforms {
i : u32;
};
[[block]]
struct OuterS {
a1 : array<u32, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
fn f(i : u32) -> u32 {
return (i + 1u);
}
[[stage(compute), workgroup_size(1)]]
fn main() {
var s1 : OuterS;
var v : vec3<f32>;
v[s1.a1[uniforms.i]] = 1.0;
v[f(s1.a1[uniforms.i])] = 1.0;
}
)";
// Transform does nothing here as we're not actually assigning to the array in
// the struct.
auto* expect = src;
auto got =
Run<Unshadow, SimplifyPointers, LocalizeStructArrayAssignment>(src);
EXPECT_EQ(expect, str(got));
}
} // namespace
} // namespace transform
} // namespace tint

View File

@ -51,6 +51,7 @@
#include "src/transform/decompose_memory_access.h"
#include "src/transform/external_texture_transform.h"
#include "src/transform/fold_trivial_single_use_lets.h"
#include "src/transform/localize_struct_array_assignment.h"
#include "src/transform/loop_to_for_loop.h"
#include "src/transform/manager.h"
#include "src/transform/num_workgroups_from_uniform.h"
@ -145,6 +146,15 @@ SanitizedResult Sanitize(
manager.Add<transform::Unshadow>();
// LocalizeStructArrayAssignment must come after:
// * SimplifyPointers, because it assumes assignment to arrays in structs are
// done directly, not indirectly.
// TODO(crbug.com/tint/1340): See if we can get rid of the duplicate
// SimplifyPointers transform. Can't do it right now because
// LocalizeStructArrayAssignment introduces pointers.
manager.Add<transform::SimplifyPointers>();
manager.Add<transform::LocalizeStructArrayAssignment>();
// Attempt to convert `loop`s into for-loops. This is to try and massage the
// output into something that will not cause FXC to choke or misbehave.
manager.Add<transform::FoldTrivialSingleUseLets>();

View File

@ -314,6 +314,7 @@ tint_unittests_source_set("tint_unittests_transform_src") {
"../src/transform/fold_constants_test.cc",
"../src/transform/fold_trivial_single_use_lets_test.cc",
"../src/transform/for_loop_to_loop_test.cc",
"../src/transform/localize_struct_array_assignment_test.cc",
"../src/transform/loop_to_for_loop_test.cc",
"../src/transform/module_scope_var_to_entry_point_param_test.cc",
"../src/transform/multiplanar_external_texture_test.cc",

View File

@ -1,21 +0,0 @@
SKIP: FAILED
cbuffer cbuffer_ubo : register(b0, space0) {
uint4 ubo[1];
};
struct S {
int data[64];
};
RWByteAddressBuffer result : register(u1, space0);
[numthreads(1, 1, 1)]
void f() {
S s = (S)0;
s.data[asint(ubo[0].x)] = 1;
result.Store(0u, asuint(s.data[3]));
return;
}
C:\src\tint\test\Shader@0x000002C587F87250(14,3-25): error X3500: array reference cannot be used as an l-value; not natively addressable

View File

@ -1,25 +0,0 @@
SKIP: FAILED
cbuffer cbuffer_ubo : register(b0, space0) {
uint4 ubo[1];
};
struct S {
int data[64];
};
RWByteAddressBuffer result : register(u1, space0);
void x(inout S p) {
p.data[asint(ubo[0].x)] = 1;
}
[numthreads(1, 1, 1)]
void f() {
S s = (S)0;
x(s);
result.Store(0u, asuint(s.data[3]));
return;
}
C:\src\tint\test\Shader@0x000002338E919910(12,3-25): error X3500: array reference cannot be used as an l-value; not natively addressable

View File

@ -1,21 +0,0 @@
SKIP: FAILED
cbuffer cbuffer_ubo : register(b0, space0) {
uint4 ubo[1];
};
struct S {
int data[64];
};
RWByteAddressBuffer result : register(u1, space0);
static S s = (S)0;
[numthreads(1, 1, 1)]
void f() {
s.data[asint(ubo[0].x)] = 1;
result.Store(0u, asuint(s.data[3]));
return;
}
C:\src\tint\test\Shader@0x000001D94063C630(14,3-25): error X3500: array reference cannot be used as an l-value; not natively addressable

View File

@ -1,25 +0,0 @@
SKIP: FAILED
cbuffer cbuffer_ubo : register(b0, space0) {
uint4 ubo[1];
};
struct S {
int data[64];
};
RWByteAddressBuffer result : register(u1, space0);
static S s = (S)0;
void x(inout S p) {
p.data[asint(ubo[0].x)] = 1;
}
[numthreads(1, 1, 1)]
void f() {
x(s);
result.Store(0u, asuint(s.data[3]));
return;
}
C:\src\tint\test\Shader@0x0000018B80081AA0(13,3-25): error X3500: array reference cannot be used as an l-value; not natively addressable

View File

@ -0,0 +1,23 @@
struct Simulation {
i : u32;
};
struct Particle {
position : array<vec3<f32>, 8>;
lifetime : f32;
color : vec4<f32>;
velocity : vec3<f32>;
};
struct Particles {
p : array<Particle>;
};
[[group(1), binding(3)]] var<storage, read> particles : Particles;
[[group(1), binding(4)]] var<uniform> sim : Simulation;
[[stage(compute), workgroup_size(1)]]
fn main() {
var particle = particles.p[0];
particle.position[sim.i] = particle.position[sim.i];
}

View File

@ -0,0 +1,38 @@
struct Particle {
float3 position[8];
float lifetime;
float4 color;
float3 velocity;
};
ByteAddressBuffer particles : register(t3, space1);
cbuffer cbuffer_sim : register(b4, space1) {
uint4 sim[1];
};
typedef float3 tint_symbol_3_ret[8];
tint_symbol_3_ret tint_symbol_3(ByteAddressBuffer buffer, uint offset) {
float3 arr[8] = (float3[8])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 8u); i_1 = (i_1 + 1u)) {
arr[i_1] = asfloat(buffer.Load3((offset + (i_1 * 16u))));
}
}
return arr;
}
Particle tint_symbol_2(ByteAddressBuffer buffer, uint offset) {
const Particle tint_symbol_8 = {tint_symbol_3(buffer, (offset + 0u)), asfloat(buffer.Load((offset + 128u))), asfloat(buffer.Load4((offset + 144u))), asfloat(buffer.Load3((offset + 160u)))};
return tint_symbol_8;
}
[numthreads(1, 1, 1)]
void main() {
Particle particle = tint_symbol_2(particles, (176u * uint(0)));
{
float3 tint_symbol_1[8] = particle.position;
tint_symbol_1[sim[0].x] = particle.position[sim[0].x];
particle.position = tint_symbol_1;
}
return;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +0,0 @@
SKIP: FAILED
cbuffer cbuffer_constants : register(b0, space1) {
uint4 constants[1];
};
RWByteAddressBuffer result : register(u1, space1);
struct S {
uint data[3];
};
static S s = (S)0;
[numthreads(1, 1, 1)]
void main() {
s.data[constants[0].x] = 0u;
return;
}
C:\src\tint\test\Shader@0x00000150124FBBE0(15,3-24): error X3500: array reference cannot be used as an l-value; not natively addressable

View File

@ -0,0 +1,22 @@
struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<InnerS, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
for (var i: i32 = 0; i < 4; i = i + 1) {
s1.a1[uniforms.i] = v;
}
}

View File

@ -0,0 +1,26 @@
struct InnerS {
int v;
};
struct OuterS {
InnerS a1[8];
};
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
[numthreads(1, 1, 1)]
void main() {
InnerS v = (InnerS)0;
OuterS s1 = (OuterS)0;
{
[loop] for(int i = 0; (i < 4); i = (i + 1)) {
{
InnerS tint_symbol_1[8] = s1.a1;
tint_symbol_1[uniforms[0].x] = v;
s1.a1 = tint_symbol_1;
}
}
}
return;
}

View File

@ -0,0 +1,22 @@
struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<InnerS, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
for (var i: i32 = 0; i < 4; s1.a1[uniforms.i] = v) {
i = i + 1;
}
}

View File

@ -0,0 +1,29 @@
struct InnerS {
int v;
};
struct OuterS {
InnerS a1[8];
};
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
[numthreads(1, 1, 1)]
void main() {
InnerS v = (InnerS)0;
OuterS s1 = (OuterS)0;
{
int i = 0;
[loop] while (true) {
if (!((i < 4))) { break; }
i = (i + 1);
{
InnerS tint_symbol_1[8] = s1.a1;
tint_symbol_1[uniforms[0].x] = v;
s1.a1 = tint_symbol_1;
}
}
}
return;
}

View File

@ -0,0 +1,22 @@
struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<InnerS, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
var i: i32 = 0;
for (s1.a1[uniforms.i] = v; i < 4; i = i + 1) {
}
}

View File

@ -0,0 +1,27 @@
struct InnerS {
int v;
};
struct OuterS {
InnerS a1[8];
};
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
[numthreads(1, 1, 1)]
void main() {
InnerS v = (InnerS)0;
OuterS s1 = (OuterS)0;
int i = 0;
{
{
InnerS tint_symbol_1[8] = s1.a1;
tint_symbol_1[uniforms[0].x] = v;
s1.a1 = tint_symbol_1;
}
[loop] for(; (i < 4); i = (i + 1)) {
}
}
return;
}

View File

@ -0,0 +1,31 @@
struct Uniforms {
i : u32;
j : u32;
};
struct InnerS {
v : i32;
};
struct S1 {
a2 : array<InnerS, 8>;
};
struct OuterS {
a1 : array<S1, 8>;
};
var<private> nextIndex : u32;
fn getNextIndex() -> u32 {
nextIndex = nextIndex + 1u;
return nextIndex;
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s : OuterS;
s.a1[getNextIndex()].a2[uniforms.j] = v;
}

View File

@ -0,0 +1,35 @@
struct InnerS {
int v;
};
struct S1 {
InnerS a2[8];
};
struct OuterS {
S1 a1[8];
};
static uint nextIndex = 0u;
uint getNextIndex() {
nextIndex = (nextIndex + 1u);
return nextIndex;
}
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
[numthreads(1, 1, 1)]
void main() {
InnerS v = (InnerS)0;
OuterS s = (OuterS)0;
{
S1 tint_symbol_1[8] = s.a1;
const uint tint_symbol_2_save = getNextIndex();
InnerS tint_symbol_3[8] = tint_symbol_1[tint_symbol_2_save].a2;
tint_symbol_3[uniforms[0].y] = v;
tint_symbol_1[tint_symbol_2_save].a2 = tint_symbol_3;
s.a1 = tint_symbol_1;
}
return;
}

View File

@ -0,0 +1,21 @@
struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<InnerS, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
s1.a1[uniforms.i] = v;
//s1.a1[0] = v;
}

View File

@ -0,0 +1,22 @@
struct InnerS {
int v;
};
struct OuterS {
InnerS a1[8];
};
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
[numthreads(1, 1, 1)]
void main() {
InnerS v = (InnerS)0;
OuterS s1 = (OuterS)0;
{
InnerS tint_symbol_1[8] = s1.a1;
tint_symbol_1[uniforms[0].x] = v;
s1.a1 = tint_symbol_1;
}
return;
}

View File

@ -0,0 +1,21 @@
struct Uniforms {
i : u32;
j : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<array<InnerS, 8>, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
s1.a1[uniforms.i][uniforms.j] = v;
}

View File

@ -0,0 +1,22 @@
struct InnerS {
int v;
};
struct OuterS {
InnerS a1[8][8];
};
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
[numthreads(1, 1, 1)]
void main() {
InnerS v = (InnerS)0;
OuterS s1 = (OuterS)0;
{
InnerS tint_symbol_1[8][8] = s1.a1;
tint_symbol_1[uniforms[0].x][uniforms[0].y] = v;
s1.a1 = tint_symbol_1;
}
return;
}

View File

@ -0,0 +1,24 @@
struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct S1 {
s2 : InnerS;
};
struct OuterS {
a1 : array<S1, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
s1.a1[uniforms.i].s2 = v;
}

View File

@ -0,0 +1,25 @@
struct InnerS {
int v;
};
struct S1 {
InnerS s2;
};
struct OuterS {
S1 a1[8];
};
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
[numthreads(1, 1, 1)]
void main() {
InnerS v = (InnerS)0;
OuterS s1 = (OuterS)0;
{
S1 tint_symbol_1[8] = s1.a1;
tint_symbol_1[uniforms[0].x].s2 = v;
s1.a1 = tint_symbol_1;
}
return;
}

View File

@ -0,0 +1,25 @@
struct Uniforms {
i : u32;
j : u32;
};
struct InnerS {
v : i32;
};
struct S1 {
a2 : array<InnerS, 8>;
};
struct OuterS {
a1 : array<S1, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s : OuterS;
s.a1[uniforms.i].a2[uniforms.j] = v;
}

View File

@ -0,0 +1,28 @@
struct InnerS {
int v;
};
struct S1 {
InnerS a2[8];
};
struct OuterS {
S1 a1[8];
};
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
[numthreads(1, 1, 1)]
void main() {
InnerS v = (InnerS)0;
OuterS s = (OuterS)0;
{
S1 tint_symbol_1[8] = s.a1;
const uint tint_symbol_2_save = uniforms[0].x;
InnerS tint_symbol_3[8] = tint_symbol_1[tint_symbol_2_save].a2;
tint_symbol_3[uniforms[0].y] = v;
tint_symbol_1[tint_symbol_2_save].a2 = tint_symbol_3;
s.a1 = tint_symbol_1;
}
return;
}

View File

@ -0,0 +1,20 @@
struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<InnerS>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[binding(0), group(0)]] var<storage, read_write> s1 : OuterS;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
s1.a1[uniforms.i] = v;
}

View File

@ -0,0 +1,19 @@
struct InnerS {
int v;
};
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
RWByteAddressBuffer s1 : register(u0, space0);
void tint_symbol_1(RWByteAddressBuffer buffer, uint offset, InnerS value) {
buffer.Store((offset + 0u), asuint(value.v));
}
[numthreads(1, 1, 1)]
void main() {
InnerS v = (InnerS)0;
tint_symbol_1(s1, (4u * uniforms[0].x), v);
return;
}

View File

@ -0,0 +1,25 @@
struct Uniforms {
i : u32;
j : u32;
};
struct InnerS {
v : i32;
};
struct S1 {
a2 : array<InnerS, 8>;
};
struct OuterS {
a1 : array<S1>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[binding(0), group(0)]] var<storage, read_write> s : OuterS;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
s.a1[uniforms.i].a2[uniforms.j] = v;
}

View File

@ -0,0 +1,19 @@
struct InnerS {
int v;
};
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
RWByteAddressBuffer s : register(u0, space0);
void tint_symbol_1(RWByteAddressBuffer buffer, uint offset, InnerS value) {
buffer.Store((offset + 0u), asuint(value.v));
}
[numthreads(1, 1, 1)]
void main() {
InnerS v = (InnerS)0;
tint_symbol_1(s, ((32u * uniforms[0].x) + (4u * uniforms[0].y)), v);
return;
}

View File

@ -0,0 +1,16 @@
struct Uniforms {
i : u32;
};
struct OuterS {
m1 : mat2x4<f32>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var s1 : OuterS;
s1.m1[uniforms.i] = vec4<f32>(1.0);
s1.m1[uniforms.i][uniforms.i] = 1.0;
}

View File

@ -0,0 +1,33 @@
void set_vector_float2x4(inout float2x4 mat, int col, float4 val) {
switch (col) {
case 0: mat[0] = val; break;
case 1: mat[1] = val; break;
}
}
void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) {
switch (col) {
case 0:
mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0];
break;
case 1:
mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1];
break;
}
}
struct OuterS {
float2x4 m1;
};
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
[numthreads(1, 1, 1)]
void main() {
OuterS s1 = (OuterS)0;
set_vector_float2x4(s1.m1, uniforms[0].x, float4((1.0f).xxxx));
set_scalar_float2x4(s1.m1, uniforms[0].x, uniforms[0].x, 1.0f);
return;
}

View File

@ -0,0 +1,22 @@
struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<InnerS, 8>;
a2 : array<InnerS, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
s1.a1[uniforms.i] = v;
s1.a2[uniforms.i] = v;
}

View File

@ -0,0 +1,28 @@
struct InnerS {
int v;
};
struct OuterS {
InnerS a1[8];
InnerS a2[8];
};
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
[numthreads(1, 1, 1)]
void main() {
InnerS v = (InnerS)0;
OuterS s1 = (OuterS)0;
{
InnerS tint_symbol_1[8] = s1.a1;
tint_symbol_1[uniforms[0].x] = v;
s1.a1 = tint_symbol_1;
}
{
InnerS tint_symbol_3[8] = s1.a2;
tint_symbol_3[uniforms[0].x] = v;
s1.a2 = tint_symbol_3;
}
return;
}

View File

@ -0,0 +1,24 @@
struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct S1 {
a : array<InnerS, 8>;
};
struct OuterS {
s2 : S1;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
s1.s2.a[uniforms.i] = v;
}

View File

@ -0,0 +1,25 @@
struct InnerS {
int v;
};
struct S1 {
InnerS a[8];
};
struct OuterS {
S1 s2;
};
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
[numthreads(1, 1, 1)]
void main() {
InnerS v = (InnerS)0;
OuterS s1 = (OuterS)0;
{
InnerS tint_symbol_1[8] = s1.s2.a;
tint_symbol_1[uniforms[0].x] = v;
s1.s2.a = tint_symbol_1;
}
return;
}

View File

@ -0,0 +1,15 @@
struct Uniforms {
i : u32;
};
struct OuterS {
v1 : vec3<f32>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var s1 : OuterS;
s1.v1[uniforms.i] = 1.0;
}

View File

@ -0,0 +1,18 @@
void set_float3(inout float3 vec, int idx, float val) {
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
}
struct OuterS {
float3 v1;
};
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
[numthreads(1, 1, 1)]
void main() {
OuterS s1 = (OuterS)0;
set_float3(s1.v1, uniforms[0].x, 1.0f);
return;
}

View File

@ -0,0 +1,21 @@
struct Uniforms {
i : u32;
};
struct OuterS {
a1 : array<u32, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
fn f(i: u32) -> u32 {
return i + 1u;
}
[[stage(compute), workgroup_size(1)]]
fn main() {
var s1 : OuterS;
var v : vec3<f32>;
v[s1.a1[uniforms.i]] = 1.0;
v[f(s1.a1[uniforms.i])] = 1.0;
}

View File

@ -0,0 +1,24 @@
void set_float3(inout float3 vec, int idx, float val) {
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
}
struct OuterS {
uint a1[8];
};
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
uint f(uint i) {
return (i + 1u);
}
[numthreads(1, 1, 1)]
void main() {
OuterS s1 = (OuterS)0;
float3 v = float3(0.0f, 0.0f, 0.0f);
set_float3(v, s1.a1[uniforms[0].x], 1.0f);
set_float3(v, f(s1.a1[uniforms[0].x]), 1.0f);
return;
}

View File

@ -0,0 +1,21 @@
struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<InnerS, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
[[stage(compute), workgroup_size(1)]]
fn main() {
var v : InnerS;
var s1 : OuterS;
let p = &(s1.a1[uniforms.i]);
*p = v;
}

View File

@ -0,0 +1,23 @@
struct InnerS {
int v;
};
struct OuterS {
InnerS a1[8];
};
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
[numthreads(1, 1, 1)]
void main() {
InnerS v = (InnerS)0;
OuterS s1 = (OuterS)0;
const uint p_save = uniforms[0].x;
{
InnerS tint_symbol_1[8] = s1.a1;
tint_symbol_1[p_save] = v;
s1.a1 = tint_symbol_1;
}
return;
}

View File

@ -0,0 +1,21 @@
struct Uniforms {
i : u32;
};
struct InnerS {
v : i32;
};
struct OuterS {
a1 : array<InnerS, 8>;
};
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
fn f(p : ptr<function, OuterS>) {
var v : InnerS;
(*p).a1[uniforms.i] = v;
}
[[stage(compute), workgroup_size(1)]]
fn main() {
var s1 : OuterS;
f(&s1);
}

View File

@ -0,0 +1,26 @@
struct InnerS {
int v;
};
struct OuterS {
InnerS a1[8];
};
cbuffer cbuffer_uniforms : register(b4, space1) {
uint4 uniforms[1];
};
void f(inout OuterS p) {
InnerS v = (InnerS)0;
{
InnerS tint_symbol_1[8] = p.a1;
tint_symbol_1[uniforms[0].x] = v;
p.a1 = tint_symbol_1;
}
}
[numthreads(1, 1, 1)]
void main() {
OuterS s1 = (OuterS)0;
f(s1);
return;
}

View File

@ -1,165 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_30 : register(b0, space0) {
uint4 x_30[1];
};
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_92 = i;
const int x_94 = obj.numbers[x_92];
temp = x_94;
const int x_95 = i;
const int x_96 = j;
const int x_98 = obj.numbers[x_96];
obj.numbers[x_95] = x_98;
const int x_100 = j;
obj.numbers[x_100] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_104 = h;
const int x_106 = obj.numbers[x_104];
pivot = x_106;
const int x_107 = l;
i_1 = (x_107 - 1);
const int x_109 = l;
j_1 = x_109;
[loop] while (true) {
const int x_114 = j_1;
const int x_115 = h;
if ((x_114 <= (x_115 - 1))) {
} else {
break;
}
const int x_121 = obj.numbers[j_1];
if ((x_121 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1);
}
{
j_1 = (j_1 + 1);
}
}
param_2 = (i_1 + 1);
const int x_135 = h;
param_3 = x_135;
swap_i1_i1_(param_2, param_3);
return (i_1 + 1);
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_141 = (top + 1);
top = x_141;
stack[x_141] = l_1;
const int x_145 = (top + 1);
top = x_145;
stack[x_145] = h_1;
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_155 = top;
top = (x_155 - 1);
const int x_158 = stack[x_155];
h_1 = x_158;
const int x_159 = top;
top = (x_159 - 1);
const int x_162 = stack[x_159];
l_1 = x_162;
param_4 = l_1;
param_5 = h_1;
const int x_165 = performPartition_i1_i1_(param_4, param_5);
p = x_165;
if (((p - 1) > l_1)) {
const int x_173 = (top + 1);
top = x_173;
stack[x_173] = l_1;
const int x_177 = (top + 1);
top = x_177;
stack[x_177] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_188 = (top + 1);
top = x_188;
stack[x_188] = (p + 1);
const int x_193 = (top + 1);
top = x_193;
stack[x_193] = h_1;
}
}
return;
}
void main_1() {
int i_2 = 0;
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_71 = i_2;
const int x_74 = obj.numbers[i_2];
const int x_77 = obj.numbers[i_2];
obj.numbers[x_71] = (x_74 * x_77);
}
}
quicksort_();
const int x_84 = obj.numbers[0];
const int x_86 = obj.numbers[4];
if ((x_84 < x_86)) {
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
x_GLF_color = float4(0.0f, 1.0f, 0.0f, 1.0f);
}
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner() {
main_1();
const main_out tint_symbol_1 = {x_GLF_color};
return tint_symbol_1;
}
tint_symbol main() {
const main_out inner_result = main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x00000246B5D89100(124,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x00000246B5D89100(123,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -1,165 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_30 : register(b0, space0) {
uint4 x_30[1];
};
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_92 = i;
const int x_94 = obj.numbers[x_92];
temp = x_94;
const int x_95 = i;
const int x_96 = j;
const int x_98 = obj.numbers[x_96];
obj.numbers[x_95] = x_98;
const int x_100 = j;
obj.numbers[x_100] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_104 = h;
const int x_106 = obj.numbers[x_104];
pivot = x_106;
const int x_107 = l;
i_1 = (x_107 - 1);
const int x_109 = l;
j_1 = x_109;
[loop] while (true) {
const int x_114 = j_1;
const int x_115 = h;
if ((x_114 <= (x_115 - 1))) {
} else {
break;
}
const int x_121 = obj.numbers[j_1];
if ((x_121 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1);
}
{
j_1 = (j_1 + 1);
}
}
param_2 = (i_1 + 1);
const int x_135 = h;
param_3 = x_135;
swap_i1_i1_(param_2, param_3);
return (i_1 + 1);
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_141 = (top + 1);
top = x_141;
stack[x_141] = l_1;
const int x_145 = (top + 1);
top = x_145;
stack[x_145] = h_1;
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_155 = top;
top = (x_155 - 1);
const int x_158 = stack[x_155];
h_1 = x_158;
const int x_159 = top;
top = (x_159 - 1);
const int x_162 = stack[x_159];
l_1 = x_162;
param_4 = l_1;
param_5 = h_1;
const int x_165 = performPartition_i1_i1_(param_4, param_5);
p = x_165;
if (((p - 1) > l_1)) {
const int x_173 = (top + 1);
top = x_173;
stack[x_173] = l_1;
const int x_177 = (top + 1);
top = x_177;
stack[x_177] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_188 = (top + 1);
top = x_188;
stack[x_188] = (p + 1);
const int x_193 = (top + 1);
top = x_193;
stack[x_193] = h_1;
}
}
return;
}
void main_1() {
int i_2 = 0;
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_71 = i_2;
const int x_74 = obj.numbers[i_2];
const int x_77 = obj.numbers[i_2];
obj.numbers[x_71] = (x_74 * x_77);
}
}
quicksort_();
const int x_84 = obj.numbers[0];
const int x_86 = obj.numbers[4];
if ((x_84 < x_86)) {
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
x_GLF_color = float4(0.0f, 1.0f, 0.0f, 1.0f);
}
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner() {
main_1();
const main_out tint_symbol_1 = {x_GLF_color};
return tint_symbol_1;
}
tint_symbol main() {
const main_out inner_result = main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x000001BEDA24CD50(124,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x000001BEDA24CD50(123,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -37,5 +37,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x000001F6BB717E80(9,19-22): error X3696: infinite loop detected - loop never exits
error: validation errors
C:\src\temp\ull0.0:31: error: Loop must have break.
Validation failed.

View File

@ -1,6 +1,6 @@
SKIP: FAILED
vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl:16:5 warning: code is unreachable
vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl:15:5 warning: code is unreachable
return;
^^^^^^
@ -40,5 +40,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x00000141CAFC4AB0(9,19-22): error X3696: infinite loop detected - loop never exits
error: validation errors
C:\src\temp\u1hm0.0:31: error: Loop must have break.
Validation failed.

View File

@ -1,49 +0,0 @@
SKIP: FAILED
struct Array {
int values[2];
};
cbuffer cbuffer_x_7 : register(b0, space0) {
uint4 x_7[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
Array a = (Array)0;
Array b = (Array)0;
float one = 0.0f;
const int x_10 = asint(x_7[0].x);
a.values[x_10] = 1;
b = a;
one = 0.0f;
const int x_11 = asint(x_7[0].x);
const int x_12 = b.values[x_11];
if ((x_12 == 1)) {
one = 1.0f;
}
x_GLF_color = float4(one, 0.0f, 0.0f, 1.0f);
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner() {
main_1();
const main_out tint_symbol_2 = {x_GLF_color};
return tint_symbol_2;
}
tint_symbol main() {
const main_out inner_result = main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x0000026DA3D26220(15,3-16): error X3500: array reference cannot be used as an l-value; not natively addressable

View File

@ -1,49 +0,0 @@
SKIP: FAILED
struct Array {
int values[2];
};
cbuffer cbuffer_x_7 : register(b0, space0) {
uint4 x_7[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
Array a = (Array)0;
Array b = (Array)0;
float one = 0.0f;
const int x_10 = asint(x_7[0].x);
a.values[x_10] = 1;
b = a;
one = 0.0f;
const int x_11 = asint(x_7[0].x);
const int x_12 = b.values[x_11];
if ((x_12 == 1)) {
one = 1.0f;
}
x_GLF_color = float4(one, 0.0f, 0.0f, 1.0f);
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner() {
main_1();
const main_out tint_symbol_2 = {x_GLF_color};
return tint_symbol_2;
}
tint_symbol main() {
const main_out inner_result = main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x0000024C52B7BDB0(15,3-16): error X3500: array reference cannot be used as an l-value; not natively addressable

View File

@ -82,18 +82,9 @@ tint_symbol_2 main(tint_symbol_1 tint_symbol) {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x000001BF7F9DDFF0(15,8-20): warning X3556: integer modulus may be much slower, try using uints if possible.
C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,25-28): error X3696: infinite loop detected - loop never exits
error: validation errors
C:\src\temp\u1jmg.0:77: error: Loop must have break.
Validation failed.

View File

@ -82,18 +82,9 @@ tint_symbol_2 main(tint_symbol_1 tint_symbol) {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x0000012C749BFE70(15,8-20): warning X3556: integer modulus may be much slower, try using uints if possible.
C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x0000012C749BFE70(24,25-28): error X3696: infinite loop detected - loop never exits
error: validation errors
C:\src\temp\u1v1c.0:77: error: Loop must have break.
Validation failed.

View File

@ -1,94 +0,0 @@
SKIP: FAILED
struct S {
float numbers[3];
};
cbuffer cbuffer_x_7 : register(b1, space0) {
uint4 x_7[5];
};
cbuffer cbuffer_x_9 : register(b2, space0) {
uint4 x_9[1];
};
cbuffer cbuffer_x_12 : register(b3, space0) {
uint4 x_12[1];
};
cbuffer cbuffer_x_15 : register(b0, space0) {
uint4 x_15[2];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
S obj = (S)0;
float a = 0.0f;
float2 x_49 = float2(0.0f, 0.0f);
float b = 0.0f;
const float x_51 = asfloat(x_7[3].x);
const float x_53 = asfloat(x_7[2].x);
const float x_55 = asfloat(x_7[4].x);
const float tint_symbol_6[3] = {x_51, x_53, x_55};
const S tint_symbol_7 = {tint_symbol_6};
obj = tint_symbol_7;
const float x_59 = asfloat(x_9[0].x);
const uint scalar_offset = ((16u * uint(0))) / 4;
const float x_62 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]);
obj.numbers[int(x_59)] = x_62;
const float x_65 = asfloat(x_9[0].x);
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
const float x_67 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]);
if ((x_65 > x_67)) {
const float2 x_73 = asfloat(x_9[0].xy);
x_49 = x_73;
} else {
const float2 x_75 = asfloat(x_12[0].xy);
x_49 = x_75;
}
const float x_77 = x_49.y;
a = x_77;
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
const float x_79 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]);
const float x_80 = a;
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
const int x_82 = asint(x_15[scalar_offset_3 / 4][scalar_offset_3 % 4]);
const float x_84 = obj.numbers[x_82];
b = lerp(x_79, x_80, x_84);
const float x_86 = b;
const float x_88 = asfloat(x_7[2].x);
const float x_91 = asfloat(x_7[1].x);
if ((distance(x_86, x_88) < x_91)) {
const uint scalar_offset_4 = ((16u * uint(0))) / 4;
const int x_97 = asint(x_15[scalar_offset_4 / 4][scalar_offset_4 % 4]);
const int x_100 = asint(x_15[1].x);
const int x_103 = asint(x_15[1].x);
const uint scalar_offset_5 = ((16u * uint(0))) / 4;
const int x_106 = asint(x_15[scalar_offset_5 / 4][scalar_offset_5 % 4]);
x_GLF_color = float4(float(x_97), float(x_100), float(x_103), float(x_106));
} else {
const int x_110 = asint(x_15[1].x);
const float x_111 = float(x_110);
x_GLF_color = float4(x_111, x_111, x_111, x_111);
}
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner() {
main_1();
const main_out tint_symbol_8 = {x_GLF_color};
return tint_symbol_8;
}
tint_symbol main() {
const main_out inner_result = main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x0000018BDF85D170(33,3-24): error X3500: array reference cannot be used as an l-value; not natively addressable

View File

@ -1,94 +0,0 @@
SKIP: FAILED
struct S {
float numbers[3];
};
cbuffer cbuffer_x_7 : register(b1, space0) {
uint4 x_7[5];
};
cbuffer cbuffer_x_9 : register(b2, space0) {
uint4 x_9[1];
};
cbuffer cbuffer_x_12 : register(b3, space0) {
uint4 x_12[1];
};
cbuffer cbuffer_x_15 : register(b0, space0) {
uint4 x_15[2];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
S obj = (S)0;
float a = 0.0f;
float2 x_49 = float2(0.0f, 0.0f);
float b = 0.0f;
const float x_51 = asfloat(x_7[3].x);
const float x_53 = asfloat(x_7[2].x);
const float x_55 = asfloat(x_7[4].x);
const float tint_symbol_6[3] = {x_51, x_53, x_55};
const S tint_symbol_7 = {tint_symbol_6};
obj = tint_symbol_7;
const float x_59 = asfloat(x_9[0].x);
const uint scalar_offset = ((16u * uint(0))) / 4;
const float x_62 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]);
obj.numbers[int(x_59)] = x_62;
const float x_65 = asfloat(x_9[0].x);
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
const float x_67 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]);
if ((x_65 > x_67)) {
const float2 x_73 = asfloat(x_9[0].xy);
x_49 = x_73;
} else {
const float2 x_75 = asfloat(x_12[0].xy);
x_49 = x_75;
}
const float x_77 = x_49.y;
a = x_77;
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
const float x_79 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]);
const float x_80 = a;
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
const int x_82 = asint(x_15[scalar_offset_3 / 4][scalar_offset_3 % 4]);
const float x_84 = obj.numbers[x_82];
b = lerp(x_79, x_80, x_84);
const float x_86 = b;
const float x_88 = asfloat(x_7[2].x);
const float x_91 = asfloat(x_7[1].x);
if ((distance(x_86, x_88) < x_91)) {
const uint scalar_offset_4 = ((16u * uint(0))) / 4;
const int x_97 = asint(x_15[scalar_offset_4 / 4][scalar_offset_4 % 4]);
const int x_100 = asint(x_15[1].x);
const int x_103 = asint(x_15[1].x);
const uint scalar_offset_5 = ((16u * uint(0))) / 4;
const int x_106 = asint(x_15[scalar_offset_5 / 4][scalar_offset_5 % 4]);
x_GLF_color = float4(float(x_97), float(x_100), float(x_103), float(x_106));
} else {
const int x_110 = asint(x_15[1].x);
const float x_111 = float(x_110);
x_GLF_color = float4(x_111, x_111, x_111, x_111);
}
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner() {
main_1();
const main_out tint_symbol_8 = {x_GLF_color};
return tint_symbol_8;
}
tint_symbol main() {
const main_out inner_result = main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x00000172CC1515F0(33,3-24): error X3500: array reference cannot be used as an l-value; not natively addressable

View File

@ -93,5 +93,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x000002502549E0E0(21,19-22): error X3696: infinite loop detected - loop never exits
error: validation errors
C:\src\temp\u1r54.0:88: error: Loop must have break.
Validation failed.

View File

@ -93,5 +93,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x000002497A3112E0(21,19-22): error X3696: infinite loop detected - loop never exits
error: validation errors
C:\src\temp\usgc.0:88: error: Loop must have break.
Validation failed.

View File

@ -67,5 +67,9 @@ tint_symbol_2 main(tint_symbol_1 tint_symbol) {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x000001DE747F22A0(13,17-20): error X3696: infinite loop detected - loop never exits
error: validation errors
C:\src\temp\u17p0.0:62: error: Loop must have break.
Validation failed.

View File

@ -67,5 +67,9 @@ tint_symbol_2 main(tint_symbol_1 tint_symbol) {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x0000024AE2EDC600(13,17-20): error X3696: infinite loop detected - loop never exits
error: validation errors
C:\src\temp\uvqg.0:62: error: Loop must have break.
Validation failed.

View File

@ -1,93 +0,0 @@
SKIP: FAILED
struct BinarySearchObject {
int prime_numbers[10];
};
cbuffer cbuffer_x_8 : register(b0, space0) {
uint4 x_8[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
int binarySearch_struct_BinarySearchObject_i1_10_1_(inout BinarySearchObject obj) {
int m = 0;
[loop] while (true) {
const float x_91 = asfloat(x_8[0].x);
if ((x_91 > 1.0f)) {
} else {
break;
}
const float x_95 = asfloat(x_8[0].x);
m = int(x_95);
const int x_15 = obj.prime_numbers[m];
if ((x_15 == 1)) {
return 1;
}
}
return 1;
}
void main_1() {
int i = 0;
BinarySearchObject obj_1 = (BinarySearchObject)0;
BinarySearchObject param = (BinarySearchObject)0;
i = 0;
{
[loop] for(; (i < 10); i = (i + 1)) {
if ((i != 3)) {
const int x_18 = i;
const float x_67 = asfloat(x_8[0].x);
if (((x_18 - int(x_67)) == 4)) {
obj_1.prime_numbers[i] = 11;
} else {
if ((i == 6)) {
obj_1.prime_numbers[i] = 17;
}
continue;
}
}
[loop] while (true) {
{
const float x_82 = asfloat(x_8[0].y);
if ((0.0f > x_82)) {
} else {
break;
}
}
}
}
}
param = obj_1;
const int x_26 = binarySearch_struct_BinarySearchObject_i1_10_1_(param);
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner() {
main_1();
const main_out tint_symbol_2 = {x_GLF_color};
return tint_symbol_2;
}
tint_symbol main() {
const main_out inner_result = main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x0000016C5E617FA0(47,14-25): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x0000016C5E617FA0(47,14-25): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x0000016C5E617FA0(47,14-25): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x0000016C5E617FA0(47,14-25): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x0000016C5E617FA0(47,14-25): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x0000016C5E617FA0(47,14-25): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x0000016C5E617FA0(39,11-32): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x0000016C5E617FA0(34,12-39): error X3531: can't unroll loops marked with loop attribute

View File

@ -1,93 +0,0 @@
SKIP: FAILED
struct BinarySearchObject {
int prime_numbers[10];
};
cbuffer cbuffer_x_8 : register(b0, space0) {
uint4 x_8[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
int binarySearch_struct_BinarySearchObject_i1_10_1_(inout BinarySearchObject obj) {
int m = 0;
[loop] while (true) {
const float x_91 = asfloat(x_8[0].x);
if ((x_91 > 1.0f)) {
} else {
break;
}
const float x_95 = asfloat(x_8[0].x);
m = int(x_95);
const int x_15 = obj.prime_numbers[m];
if ((x_15 == 1)) {
return 1;
}
}
return 1;
}
void main_1() {
int i = 0;
BinarySearchObject obj_1 = (BinarySearchObject)0;
BinarySearchObject param = (BinarySearchObject)0;
i = 0;
{
[loop] for(; (i < 10); i = (i + 1)) {
if ((i != 3)) {
const int x_18 = i;
const float x_67 = asfloat(x_8[0].x);
if (((x_18 - int(x_67)) == 4)) {
obj_1.prime_numbers[i] = 11;
} else {
if ((i == 6)) {
obj_1.prime_numbers[i] = 17;
}
continue;
}
}
[loop] while (true) {
{
const float x_82 = asfloat(x_8[0].y);
if ((0.0f > x_82)) {
} else {
break;
}
}
}
}
}
param = obj_1;
const int x_26 = binarySearch_struct_BinarySearchObject_i1_10_1_(param);
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner() {
main_1();
const main_out tint_symbol_2 = {x_GLF_color};
return tint_symbol_2;
}
tint_symbol main() {
const main_out inner_result = main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x0000022E4AE186A0(47,14-25): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x0000022E4AE186A0(47,14-25): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x0000022E4AE186A0(47,14-25): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x0000022E4AE186A0(47,14-25): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x0000022E4AE186A0(47,14-25): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x0000022E4AE186A0(47,14-25): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\test\Shader@0x0000022E4AE186A0(39,11-32): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x0000022E4AE186A0(34,12-39): error X3531: can't unroll loops marked with loop attribute

View File

@ -115,3 +115,5 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
Internal compiler error: access violation. Attempted to read from address 0x0000000000000048

View File

@ -115,3 +115,5 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
Internal compiler error: access violation. Attempted to read from address 0x0000000000000048

View File

@ -1,224 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_32 : register(b0, space0) {
uint4 x_32[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_225 = i;
const int x_227 = obj.numbers[x_225];
temp = x_227;
const int x_228 = i;
const int x_229 = j;
const int x_231 = obj.numbers[x_229];
obj.numbers[x_228] = x_231;
const int x_233 = j;
obj.numbers[x_233] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_237 = h;
const int x_239 = obj.numbers[x_237];
pivot = x_239;
const int x_240 = l;
i_1 = (x_240 - 1);
const int x_242 = l;
j_1 = x_242;
[loop] while (true) {
const int x_247 = j_1;
const int x_248 = h;
if ((x_247 <= (x_248 - 1))) {
} else {
break;
}
const int x_254 = obj.numbers[j_1];
if ((x_254 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1);
}
{
j_1 = (j_1 + 1);
}
}
i_1 = (i_1 + 1);
param_2 = i_1;
const int x_269 = h;
param_3 = x_269;
swap_i1_i1_(param_2, param_3);
return i_1;
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_274 = (top + 1);
top = x_274;
stack[x_274] = l_1;
const int x_278 = (top + 1);
top = x_278;
stack[x_278] = h_1;
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_288 = top;
top = (x_288 - 1);
const int x_291 = stack[x_288];
h_1 = x_291;
const int x_292 = top;
top = (x_292 - 1);
const int x_295 = stack[x_292];
l_1 = x_295;
param_4 = l_1;
param_5 = h_1;
const int x_298 = performPartition_i1_i1_(param_4, param_5);
p = x_298;
if (((p - 1) > l_1)) {
const int x_306 = (top + 1);
top = x_306;
stack[x_306] = l_1;
const int x_310 = (top + 1);
top = x_310;
stack[x_310] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_321 = (top + 1);
top = x_321;
stack[x_321] = (p + 1);
const int x_326 = (top + 1);
top = x_326;
stack[x_326] = h_1;
}
}
return;
}
void main_1() {
int i_2 = 0;
float2 uv = float2(0.0f, 0.0f);
float3 color = float3(0.0f, 0.0f, 0.0f);
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_92 = i_2;
const int x_95 = obj.numbers[i_2];
const int x_98 = obj.numbers[i_2];
obj.numbers[x_92] = (x_95 * x_98);
}
}
quicksort_();
const float4 x_104 = gl_FragCoord;
const float2 x_107 = asfloat(x_32[0].xy);
uv = (float2(x_104.x, x_104.y) / x_107);
color = float3(1.0f, 2.0f, 3.0f);
const int x_110 = obj.numbers[0];
const float x_113 = color.x;
color.x = (x_113 + float(x_110));
const float x_117 = uv.x;
if ((x_117 > 0.25f)) {
const int x_122 = obj.numbers[1];
const float x_125 = color.x;
color.x = (x_125 + float(x_122));
}
const float x_129 = uv.x;
if ((x_129 > 0.5f)) {
const int x_134 = obj.numbers[2];
const float x_137 = color.y;
color.y = (x_137 + float(x_134));
}
const float x_141 = uv.x;
if ((x_141 > 0.75f)) {
const int x_146 = obj.numbers[3];
const float x_149 = color.z;
color.z = (x_149 + float(x_146));
}
const int x_153 = obj.numbers[4];
const float x_156 = color.y;
color.y = (x_156 + float(x_153));
const float x_160 = uv.y;
if ((x_160 > 0.25f)) {
const int x_165 = obj.numbers[5];
const float x_168 = color.x;
color.x = (x_168 + float(x_165));
}
const float x_172 = uv.y;
if ((x_172 > 0.5f)) {
const int x_177 = obj.numbers[6];
const float x_180 = color.y;
color.y = (x_180 + float(x_177));
}
const float x_184 = uv.y;
if ((x_184 > 0.75f)) {
const int x_189 = obj.numbers[7];
const float x_192 = color.z;
color.z = (x_192 + float(x_189));
}
const int x_196 = obj.numbers[8];
const float x_199 = color.z;
color.z = (x_199 + float(x_196));
const float x_203 = uv.x;
const float x_205 = uv.y;
if ((abs((x_203 - x_205)) < 0.25f)) {
const int x_212 = obj.numbers[9];
const float x_215 = color.x;
color.x = (x_215 + float(x_212));
}
const float3 x_219 = normalize(color);
x_GLF_color = float4(x_219.x, x_219.y, x_219.z, 1.0f);
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 gl_FragCoord_param : SV_Position;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner(float4 gl_FragCoord_param) {
gl_FragCoord = gl_FragCoord_param;
main_1();
const main_out tint_symbol_4 = {x_GLF_color};
return tint_symbol_4;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x000001609F0E92A0(128,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x000001609F0E92A0(127,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -1,224 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_32 : register(b0, space0) {
uint4 x_32[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_225 = i;
const int x_227 = obj.numbers[x_225];
temp = x_227;
const int x_228 = i;
const int x_229 = j;
const int x_231 = obj.numbers[x_229];
obj.numbers[x_228] = x_231;
const int x_233 = j;
obj.numbers[x_233] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_237 = h;
const int x_239 = obj.numbers[x_237];
pivot = x_239;
const int x_240 = l;
i_1 = (x_240 - 1);
const int x_242 = l;
j_1 = x_242;
[loop] while (true) {
const int x_247 = j_1;
const int x_248 = h;
if ((x_247 <= (x_248 - 1))) {
} else {
break;
}
const int x_254 = obj.numbers[j_1];
if ((x_254 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1);
}
{
j_1 = (j_1 + 1);
}
}
i_1 = (i_1 + 1);
param_2 = i_1;
const int x_269 = h;
param_3 = x_269;
swap_i1_i1_(param_2, param_3);
return i_1;
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_274 = (top + 1);
top = x_274;
stack[x_274] = l_1;
const int x_278 = (top + 1);
top = x_278;
stack[x_278] = h_1;
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_288 = top;
top = (x_288 - 1);
const int x_291 = stack[x_288];
h_1 = x_291;
const int x_292 = top;
top = (x_292 - 1);
const int x_295 = stack[x_292];
l_1 = x_295;
param_4 = l_1;
param_5 = h_1;
const int x_298 = performPartition_i1_i1_(param_4, param_5);
p = x_298;
if (((p - 1) > l_1)) {
const int x_306 = (top + 1);
top = x_306;
stack[x_306] = l_1;
const int x_310 = (top + 1);
top = x_310;
stack[x_310] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_321 = (top + 1);
top = x_321;
stack[x_321] = (p + 1);
const int x_326 = (top + 1);
top = x_326;
stack[x_326] = h_1;
}
}
return;
}
void main_1() {
int i_2 = 0;
float2 uv = float2(0.0f, 0.0f);
float3 color = float3(0.0f, 0.0f, 0.0f);
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_92 = i_2;
const int x_95 = obj.numbers[i_2];
const int x_98 = obj.numbers[i_2];
obj.numbers[x_92] = (x_95 * x_98);
}
}
quicksort_();
const float4 x_104 = gl_FragCoord;
const float2 x_107 = asfloat(x_32[0].xy);
uv = (float2(x_104.x, x_104.y) / x_107);
color = float3(1.0f, 2.0f, 3.0f);
const int x_110 = obj.numbers[0];
const float x_113 = color.x;
color.x = (x_113 + float(x_110));
const float x_117 = uv.x;
if ((x_117 > 0.25f)) {
const int x_122 = obj.numbers[1];
const float x_125 = color.x;
color.x = (x_125 + float(x_122));
}
const float x_129 = uv.x;
if ((x_129 > 0.5f)) {
const int x_134 = obj.numbers[2];
const float x_137 = color.y;
color.y = (x_137 + float(x_134));
}
const float x_141 = uv.x;
if ((x_141 > 0.75f)) {
const int x_146 = obj.numbers[3];
const float x_149 = color.z;
color.z = (x_149 + float(x_146));
}
const int x_153 = obj.numbers[4];
const float x_156 = color.y;
color.y = (x_156 + float(x_153));
const float x_160 = uv.y;
if ((x_160 > 0.25f)) {
const int x_165 = obj.numbers[5];
const float x_168 = color.x;
color.x = (x_168 + float(x_165));
}
const float x_172 = uv.y;
if ((x_172 > 0.5f)) {
const int x_177 = obj.numbers[6];
const float x_180 = color.y;
color.y = (x_180 + float(x_177));
}
const float x_184 = uv.y;
if ((x_184 > 0.75f)) {
const int x_189 = obj.numbers[7];
const float x_192 = color.z;
color.z = (x_192 + float(x_189));
}
const int x_196 = obj.numbers[8];
const float x_199 = color.z;
color.z = (x_199 + float(x_196));
const float x_203 = uv.x;
const float x_205 = uv.y;
if ((abs((x_203 - x_205)) < 0.25f)) {
const int x_212 = obj.numbers[9];
const float x_215 = color.x;
color.x = (x_215 + float(x_212));
}
const float3 x_219 = normalize(color);
x_GLF_color = float4(x_219.x, x_219.y, x_219.z, 1.0f);
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 gl_FragCoord_param : SV_Position;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner(float4 gl_FragCoord_param) {
gl_FragCoord = gl_FragCoord_param;
main_1();
const main_out tint_symbol_4 = {x_GLF_color};
return tint_symbol_4;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x00000219A1C1C120(128,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x00000219A1C1C120(127,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -1,224 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_32 : register(b0, space0) {
uint4 x_32[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void swap_i1_i1_(inout int i, inout int j, float3x3 x_228) {
int temp = 0;
const int x_230 = i;
const int x_232 = obj.numbers[x_230];
temp = x_232;
const int x_233 = i;
const int x_234 = j;
const int x_236 = obj.numbers[x_234];
obj.numbers[x_233] = x_236;
const int x_238 = j;
obj.numbers[x_238] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_242 = h;
const int x_244 = obj.numbers[x_242];
pivot = x_244;
const int x_245 = l;
i_1 = (x_245 - 1);
const int x_247 = l;
j_1 = x_247;
[loop] while (true) {
const int x_252 = j_1;
const int x_253 = h;
if ((x_252 <= (x_253 - 1))) {
} else {
break;
}
const int x_259 = obj.numbers[j_1];
if ((x_259 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1, float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)));
}
{
j_1 = (j_1 + 1);
}
}
i_1 = (i_1 + 1);
param_2 = i_1;
const int x_274 = h;
param_3 = x_274;
swap_i1_i1_(param_2, param_3, float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)));
return i_1;
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_279 = (top + 1);
top = x_279;
stack[x_279] = l_1;
const int x_283 = (top + 1);
top = x_283;
stack[x_283] = h_1;
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_293 = top;
top = (x_293 - 1);
const int x_296 = stack[x_293];
h_1 = x_296;
const int x_297 = top;
top = (x_297 - 1);
const int x_300 = stack[x_297];
l_1 = x_300;
param_4 = l_1;
param_5 = h_1;
const int x_303 = performPartition_i1_i1_(param_4, param_5);
p = x_303;
if (((p - 1) > l_1)) {
const int x_311 = (top + 1);
top = x_311;
stack[x_311] = l_1;
const int x_315 = (top + 1);
top = x_315;
stack[x_315] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_326 = (top + 1);
top = x_326;
stack[x_326] = (p + 1);
const int x_331 = (top + 1);
top = x_331;
stack[x_331] = h_1;
}
}
return;
}
void main_1() {
int i_2 = 0;
float2 uv = float2(0.0f, 0.0f);
float3 color = float3(0.0f, 0.0f, 0.0f);
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_96 = i_2;
const int x_99 = obj.numbers[i_2];
const int x_102 = obj.numbers[i_2];
obj.numbers[x_96] = (x_99 * x_102);
}
}
quicksort_();
const float4 x_108 = gl_FragCoord;
const float2 x_111 = asfloat(x_32[0].xy);
uv = (float2(x_108.x, x_108.y) / x_111);
color = float3(1.0f, 2.0f, 3.0f);
const int x_114 = obj.numbers[0];
const float x_117 = color.x;
color.x = (x_117 + float(x_114));
const float x_121 = uv.x;
if ((x_121 > 0.25f)) {
const int x_126 = obj.numbers[1];
const float x_129 = color.x;
color.x = (x_129 + float(x_126));
}
const float x_133 = uv.x;
if ((x_133 > 0.5f)) {
const int x_138 = obj.numbers[2];
const float x_141 = color.y;
color.y = (x_141 + float(x_138));
}
const float x_145 = uv.x;
if ((x_145 > 0.75f)) {
const int x_150 = obj.numbers[3];
const float x_153 = color.z;
color.z = (x_153 + float(x_150));
}
const int x_157 = obj.numbers[4];
const float x_160 = color.y;
color.y = (x_160 + float(x_157));
const float x_164 = uv.y;
if ((x_164 > 0.25f)) {
const int x_169 = obj.numbers[5];
const float x_172 = color.x;
color.x = (x_172 + float(x_169));
}
const float x_176 = uv.y;
if ((x_176 > 0.5f)) {
const int x_181 = obj.numbers[6];
const float x_184 = color.y;
color.y = (x_184 + float(x_181));
}
const float x_188 = uv.y;
if ((x_188 > 0.75f)) {
const int x_193 = obj.numbers[7];
const float x_196 = color.z;
color.z = (x_196 + float(x_193));
}
const int x_200 = obj.numbers[8];
const float x_203 = color.z;
color.z = (x_203 + float(x_200));
const float x_207 = uv.x;
const float x_209 = uv.y;
if ((abs((x_207 - x_209)) < 0.25f)) {
const int x_216 = obj.numbers[9];
const float x_219 = color.x;
color.x = (x_219 + float(x_216));
}
const float3 x_223 = normalize(color);
x_GLF_color = float4(x_223.x, x_223.y, x_223.z, 1.0f);
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 gl_FragCoord_param : SV_Position;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner(float4 gl_FragCoord_param) {
gl_FragCoord = gl_FragCoord_param;
main_1();
const main_out tint_symbol_4 = {x_GLF_color};
return tint_symbol_4;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x0000029339D00EC0(128,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x0000029339D00EC0(127,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -1,224 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_32 : register(b0, space0) {
uint4 x_32[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void swap_i1_i1_(inout int i, inout int j, float3x3 x_228) {
int temp = 0;
const int x_230 = i;
const int x_232 = obj.numbers[x_230];
temp = x_232;
const int x_233 = i;
const int x_234 = j;
const int x_236 = obj.numbers[x_234];
obj.numbers[x_233] = x_236;
const int x_238 = j;
obj.numbers[x_238] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_242 = h;
const int x_244 = obj.numbers[x_242];
pivot = x_244;
const int x_245 = l;
i_1 = (x_245 - 1);
const int x_247 = l;
j_1 = x_247;
[loop] while (true) {
const int x_252 = j_1;
const int x_253 = h;
if ((x_252 <= (x_253 - 1))) {
} else {
break;
}
const int x_259 = obj.numbers[j_1];
if ((x_259 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1, float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)));
}
{
j_1 = (j_1 + 1);
}
}
i_1 = (i_1 + 1);
param_2 = i_1;
const int x_274 = h;
param_3 = x_274;
swap_i1_i1_(param_2, param_3, float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)));
return i_1;
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_279 = (top + 1);
top = x_279;
stack[x_279] = l_1;
const int x_283 = (top + 1);
top = x_283;
stack[x_283] = h_1;
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_293 = top;
top = (x_293 - 1);
const int x_296 = stack[x_293];
h_1 = x_296;
const int x_297 = top;
top = (x_297 - 1);
const int x_300 = stack[x_297];
l_1 = x_300;
param_4 = l_1;
param_5 = h_1;
const int x_303 = performPartition_i1_i1_(param_4, param_5);
p = x_303;
if (((p - 1) > l_1)) {
const int x_311 = (top + 1);
top = x_311;
stack[x_311] = l_1;
const int x_315 = (top + 1);
top = x_315;
stack[x_315] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_326 = (top + 1);
top = x_326;
stack[x_326] = (p + 1);
const int x_331 = (top + 1);
top = x_331;
stack[x_331] = h_1;
}
}
return;
}
void main_1() {
int i_2 = 0;
float2 uv = float2(0.0f, 0.0f);
float3 color = float3(0.0f, 0.0f, 0.0f);
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_96 = i_2;
const int x_99 = obj.numbers[i_2];
const int x_102 = obj.numbers[i_2];
obj.numbers[x_96] = (x_99 * x_102);
}
}
quicksort_();
const float4 x_108 = gl_FragCoord;
const float2 x_111 = asfloat(x_32[0].xy);
uv = (float2(x_108.x, x_108.y) / x_111);
color = float3(1.0f, 2.0f, 3.0f);
const int x_114 = obj.numbers[0];
const float x_117 = color.x;
color.x = (x_117 + float(x_114));
const float x_121 = uv.x;
if ((x_121 > 0.25f)) {
const int x_126 = obj.numbers[1];
const float x_129 = color.x;
color.x = (x_129 + float(x_126));
}
const float x_133 = uv.x;
if ((x_133 > 0.5f)) {
const int x_138 = obj.numbers[2];
const float x_141 = color.y;
color.y = (x_141 + float(x_138));
}
const float x_145 = uv.x;
if ((x_145 > 0.75f)) {
const int x_150 = obj.numbers[3];
const float x_153 = color.z;
color.z = (x_153 + float(x_150));
}
const int x_157 = obj.numbers[4];
const float x_160 = color.y;
color.y = (x_160 + float(x_157));
const float x_164 = uv.y;
if ((x_164 > 0.25f)) {
const int x_169 = obj.numbers[5];
const float x_172 = color.x;
color.x = (x_172 + float(x_169));
}
const float x_176 = uv.y;
if ((x_176 > 0.5f)) {
const int x_181 = obj.numbers[6];
const float x_184 = color.y;
color.y = (x_184 + float(x_181));
}
const float x_188 = uv.y;
if ((x_188 > 0.75f)) {
const int x_193 = obj.numbers[7];
const float x_196 = color.z;
color.z = (x_196 + float(x_193));
}
const int x_200 = obj.numbers[8];
const float x_203 = color.z;
color.z = (x_203 + float(x_200));
const float x_207 = uv.x;
const float x_209 = uv.y;
if ((abs((x_207 - x_209)) < 0.25f)) {
const int x_216 = obj.numbers[9];
const float x_219 = color.x;
color.x = (x_219 + float(x_216));
}
const float3 x_223 = normalize(color);
x_GLF_color = float4(x_223.x, x_223.y, x_223.z, 1.0f);
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 gl_FragCoord_param : SV_Position;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner(float4 gl_FragCoord_param) {
gl_FragCoord = gl_FragCoord_param;
main_1();
const main_out tint_symbol_4 = {x_GLF_color};
return tint_symbol_4;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x000001F0DC256BE0(128,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x000001F0DC256BE0(127,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -1108,6 +1108,77 @@ tint_symbol_2 main(tint_symbol_1 tint_symbol) {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x0000016CFDF12D00(123,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
C:\src\tint\test\Shader@0x0000016CFDF12D00(54,27-30): error X3696: infinite loop detected - loop never exits
C:\src\temp\u1p00.0:147:5: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1p00.0:1033:20: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((x_570 == asint(x_574))) {
~~~~~~^~~~~~~~~~~~~~~
C:\src\temp\u1p00.0:1033:20: note: remove extraneous parentheses around the comparison to silence this warning
if ((x_570 == asint(x_574))) {
~ ^ ~
C:\src\temp\u1p00.0:1033:20: note: use '=' to turn this equality comparison into an assignment
if ((x_570 == asint(x_574))) {
^~
=
C:\src\temp\u1p00.0:1043:20: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((x_570 == asint(-1))) {
~~~~~~^~~~~~~~~~~~
C:\src\temp\u1p00.0:1043:20: note: remove extraneous parentheses around the comparison to silence this warning
if ((x_570 == asint(-1))) {
~ ^ ~
C:\src\temp\u1p00.0:1043:20: note: use '=' to turn this equality comparison into an assignment
if ((x_570 == asint(-1))) {
^~
=
C:\src\temp\u1p00.0:983:5: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1p00.0:1060:14: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((x_572 == asint(20))) {
~~~~~~^~~~~~~~~~~~
C:\src\temp\u1p00.0:1060:14: note: remove extraneous parentheses around the comparison to silence this warning
if ((x_572 == asint(20))) {
~ ^ ~
C:\src\temp\u1p00.0:1060:14: note: use '=' to turn this equality comparison into an assignment
if ((x_572 == asint(20))) {
^~
=
C:\src\temp\u1p00.0:27:3: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1p00.0:254:3: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1p00.0:356:3: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1p00.0:458:3: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1p00.0:560:3: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1p00.0:662:3: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1p00.0:764:3: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1p00.0:866:3: warning: expression result unused [-Wunused-value]
0u;
^~
error: validation errors
C:\src\temp\u1p00.0:1085: error: Loop must have break.
C:\src\temp\u1p00.0:1085: error: Loop must have break.
C:\src\temp\u1p00.0:1085: error: Loop must have break.
C:\src\temp\u1p00.0:1085: error: Loop must have break.
C:\src\temp\u1p00.0:1085: error: Loop must have break.
C:\src\temp\u1p00.0:1085: error: Loop must have break.
C:\src\temp\u1p00.0:1085: error: Loop must have break.
C:\src\temp\u1p00.0:1085: error: Loop must have break.
C:\src\temp\u1p00.0:1085: error: Loop must have break.
Validation failed.

View File

@ -1,74 +1,74 @@
SKIP: FAILED
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:61:15 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:60:15 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:99:11 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:98:11 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:171:17 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:170:17 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:209:13 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:208:13 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:268:15 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:267:15 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:306:11 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:305:11 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:359:15 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:358:15 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:397:11 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:396:11 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:450:15 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:449:15 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:488:11 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:487:11 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:541:15 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:540:15 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:579:11 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:578:11 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:632:15 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:631:15 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:670:11 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:669:11 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:723:15 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:722:15 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:761:11 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:760:11 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:814:15 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:813:15 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:852:11 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:851:11 warning: code is unreachable
return;
^^^^^^
@ -1162,6 +1162,77 @@ tint_symbol_2 main(tint_symbol_1 tint_symbol) {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x0000023795628100(123,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
C:\src\tint\test\Shader@0x0000023795628100(54,27-30): error X3696: infinite loop detected - loop never exits
C:\src\temp\u1660.0:147:5: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1660.0:1033:20: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((x_570 == asint(x_574))) {
~~~~~~^~~~~~~~~~~~~~~
C:\src\temp\u1660.0:1033:20: note: remove extraneous parentheses around the comparison to silence this warning
if ((x_570 == asint(x_574))) {
~ ^ ~
C:\src\temp\u1660.0:1033:20: note: use '=' to turn this equality comparison into an assignment
if ((x_570 == asint(x_574))) {
^~
=
C:\src\temp\u1660.0:1043:20: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((x_570 == asint(-1))) {
~~~~~~^~~~~~~~~~~~
C:\src\temp\u1660.0:1043:20: note: remove extraneous parentheses around the comparison to silence this warning
if ((x_570 == asint(-1))) {
~ ^ ~
C:\src\temp\u1660.0:1043:20: note: use '=' to turn this equality comparison into an assignment
if ((x_570 == asint(-1))) {
^~
=
C:\src\temp\u1660.0:983:5: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1660.0:1060:14: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((x_572 == asint(20))) {
~~~~~~^~~~~~~~~~~~
C:\src\temp\u1660.0:1060:14: note: remove extraneous parentheses around the comparison to silence this warning
if ((x_572 == asint(20))) {
~ ^ ~
C:\src\temp\u1660.0:1060:14: note: use '=' to turn this equality comparison into an assignment
if ((x_572 == asint(20))) {
^~
=
C:\src\temp\u1660.0:27:3: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1660.0:254:3: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1660.0:356:3: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1660.0:458:3: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1660.0:560:3: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1660.0:662:3: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1660.0:764:3: warning: expression result unused [-Wunused-value]
0u;
^~
C:\src\temp\u1660.0:866:3: warning: expression result unused [-Wunused-value]
0u;
^~
error: validation errors
C:\src\temp\u1660.0:1085: error: Loop must have break.
C:\src\temp\u1660.0:1085: error: Loop must have break.
C:\src\temp\u1660.0:1085: error: Loop must have break.
C:\src\temp\u1660.0:1085: error: Loop must have break.
C:\src\temp\u1660.0:1085: error: Loop must have break.
C:\src\temp\u1660.0:1085: error: Loop must have break.
C:\src\temp\u1660.0:1085: error: Loop must have break.
C:\src\temp\u1660.0:1085: error: Loop must have break.
C:\src\temp\u1660.0:1085: error: Loop must have break.
Validation failed.

View File

@ -92,7 +92,11 @@ void insert_i1_i1_(inout int treeIndex, inout int data_1) {
int identity_i1_(inout int a) {
const int x_202 = a;
const int x_203 = a;
obj.numbers[x_202] = x_203;
{
int tint_symbol_1[10] = obj.numbers;
tint_symbol_1[x_202] = x_203;
obj.numbers = tint_symbol_1;
}
const int x_206 = obj.numbers[2];
return x_206;
}
@ -264,22 +268,22 @@ void main_1() {
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
struct tint_symbol_2 {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner() {
main_1();
const main_out tint_symbol_2 = {x_GLF_color};
return tint_symbol_2;
const main_out tint_symbol_4 = {x_GLF_color};
return tint_symbol_4;
}
tint_symbol main() {
tint_symbol_2 main() {
const main_out inner_result = main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x000002117DDC0DA0(32,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
C:\src\tint\test\Shader@0x000002117DDC0DA0(203,12-42): error X3531: can't unroll loops marked with loop attribute
C:\src\tint\test\Shader@0x0000019568397DE0(32,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
internal error: compilation aborted unexpectedly

View File

@ -1,14 +1,14 @@
SKIP: FAILED
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl:71:7 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl:70:7 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl:94:7 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl:93:7 warning: code is unreachable
return;
^^^^^^
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl:96:5 warning: code is unreachable
vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl:95:5 warning: code is unreachable
return;
^^^^^^
@ -101,7 +101,11 @@ void insert_i1_i1_(inout int treeIndex, inout int data_1) {
int identity_i1_(inout int a) {
const int x_202 = a;
const int x_203 = a;
obj.numbers[x_202] = x_203;
{
int tint_symbol_1[10] = obj.numbers;
tint_symbol_1[x_202] = x_203;
obj.numbers = tint_symbol_1;
}
const int x_206 = obj.numbers[2];
return x_206;
}
@ -273,22 +277,22 @@ void main_1() {
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
struct tint_symbol_2 {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner() {
main_1();
const main_out tint_symbol_2 = {x_GLF_color};
return tint_symbol_2;
const main_out tint_symbol_4 = {x_GLF_color};
return tint_symbol_4;
}
tint_symbol main() {
tint_symbol_2 main() {
const main_out inner_result = main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x00000219E1FE81C0(32,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
C:\src\tint\test\Shader@0x00000219E1FE81C0(203,12-42): error X3531: can't unroll loops marked with loop attribute
C:\src\tint\test\Shader@0x0000016D6EA06C40(32,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
internal error: compilation aborted unexpectedly

View File

@ -1,242 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_34 : register(b0, space0) {
uint4 x_34[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_230 = i;
const int x_232 = obj.numbers[x_230];
temp = x_232;
const int x_233 = i;
const int x_234 = j;
const int x_236 = obj.numbers[x_234];
obj.numbers[x_233] = x_236;
const int x_238 = j;
obj.numbers[x_238] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_242 = h;
const int x_244 = obj.numbers[x_242];
pivot = x_244;
const int x_245 = l;
i_1 = (x_245 - 1);
const int x_247 = l;
j_1 = x_247;
[loop] while (true) {
const int x_252 = j_1;
const int x_253 = h;
if ((x_252 <= (x_253 - 1))) {
} else {
break;
}
const int x_259 = obj.numbers[j_1];
if ((x_259 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1);
}
{
j_1 = (j_1 + 1);
}
}
i_1 = (i_1 + 1);
param_2 = i_1;
const int x_274 = h;
param_3 = x_274;
swap_i1_i1_(param_2, param_3);
return i_1;
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int int_a = 0;
int x_278 = 0;
int x_279 = 0;
int clamp_a = 0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_281 = (top + 1);
top = x_281;
stack[x_281] = l_1;
const float x_285 = gl_FragCoord.y;
if ((x_285 >= 0.0f)) {
const int x_290 = h_1;
if (false) {
x_279 = 1;
} else {
x_279 = (h_1 << asuint(0));
}
x_278 = (x_290 | x_279);
} else {
x_278 = 1;
}
int_a = x_278;
clamp_a = clamp(h_1, h_1, int_a);
const int x_304 = (top + 1);
top = x_304;
stack[x_304] = (clamp_a / 1);
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_315 = top;
top = (x_315 - 1);
const int x_318 = stack[x_315];
h_1 = x_318;
const int x_319 = top;
top = (x_319 - 1);
const int x_322 = stack[x_319];
l_1 = x_322;
param_4 = l_1;
param_5 = h_1;
const int x_325 = performPartition_i1_i1_(param_4, param_5);
p = x_325;
if (((p - 1) > l_1)) {
const int x_333 = (top + 1);
top = x_333;
stack[x_333] = l_1;
const int x_337 = (top + 1);
top = x_337;
stack[x_337] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_348 = (top + 1);
top = x_348;
stack[x_348] = (p + 1);
const int x_353 = (top + 1);
top = x_353;
stack[x_353] = h_1;
}
}
return;
}
void main_1() {
int i_2 = 0;
float2 uv = float2(0.0f, 0.0f);
float3 color = float3(0.0f, 0.0f, 0.0f);
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_97 = i_2;
const int x_100 = obj.numbers[i_2];
const int x_103 = obj.numbers[i_2];
obj.numbers[x_97] = (x_100 * x_103);
}
}
quicksort_();
const float4 x_109 = gl_FragCoord;
const float2 x_112 = asfloat(x_34[0].xy);
uv = (float2(x_109.x, x_109.y) / x_112);
color = float3(1.0f, 2.0f, 3.0f);
const int x_115 = obj.numbers[0];
const float x_118 = color.x;
color.x = (x_118 + float(x_115));
const float x_122 = uv.x;
if ((x_122 > 0.25f)) {
const int x_127 = obj.numbers[1];
const float x_130 = color.x;
color.x = (x_130 + float(x_127));
}
const float x_134 = uv.x;
if ((x_134 > 0.5f)) {
const int x_139 = obj.numbers[2];
const float x_142 = color.y;
color.y = (x_142 + float(x_139));
}
const float x_146 = uv.x;
if ((x_146 > 0.75f)) {
const int x_151 = obj.numbers[3];
const float x_154 = color.z;
color.z = (x_154 + float(x_151));
}
const int x_158 = obj.numbers[4];
const float x_161 = color.y;
color.y = (x_161 + float(x_158));
const float x_165 = uv.y;
if ((x_165 > 0.25f)) {
const int x_170 = obj.numbers[5];
const float x_173 = color.x;
color.x = (x_173 + float(x_170));
}
const float x_177 = uv.y;
if ((x_177 > 0.5f)) {
const int x_182 = obj.numbers[6];
const float x_185 = color.y;
color.y = (x_185 + float(x_182));
}
const float x_189 = uv.y;
if ((x_189 > 0.75f)) {
const int x_194 = obj.numbers[7];
const float x_197 = color.z;
color.z = (x_197 + float(x_194));
}
const int x_201 = obj.numbers[8];
const float x_204 = color.z;
color.z = (x_204 + float(x_201));
const float x_208 = uv.x;
const float x_210 = uv.y;
if ((abs((x_208 - x_210)) < 0.25f)) {
const int x_217 = obj.numbers[9];
const float x_220 = color.x;
color.x = (x_220 + float(x_217));
}
const float3 x_224 = normalize(color);
x_GLF_color = float4(x_224.x, x_224.y, x_224.z, 1.0f);
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 gl_FragCoord_param : SV_Position;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner(float4 gl_FragCoord_param) {
gl_FragCoord = gl_FragCoord_param;
main_1();
const main_out tint_symbol_4 = {x_GLF_color};
return tint_symbol_4;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x00000240D57880E0(146,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x00000240D57880E0(145,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -1,242 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_34 : register(b0, space0) {
uint4 x_34[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_230 = i;
const int x_232 = obj.numbers[x_230];
temp = x_232;
const int x_233 = i;
const int x_234 = j;
const int x_236 = obj.numbers[x_234];
obj.numbers[x_233] = x_236;
const int x_238 = j;
obj.numbers[x_238] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_242 = h;
const int x_244 = obj.numbers[x_242];
pivot = x_244;
const int x_245 = l;
i_1 = (x_245 - 1);
const int x_247 = l;
j_1 = x_247;
[loop] while (true) {
const int x_252 = j_1;
const int x_253 = h;
if ((x_252 <= (x_253 - 1))) {
} else {
break;
}
const int x_259 = obj.numbers[j_1];
if ((x_259 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1);
}
{
j_1 = (j_1 + 1);
}
}
i_1 = (i_1 + 1);
param_2 = i_1;
const int x_274 = h;
param_3 = x_274;
swap_i1_i1_(param_2, param_3);
return i_1;
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int int_a = 0;
int x_278 = 0;
int x_279 = 0;
int clamp_a = 0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_281 = (top + 1);
top = x_281;
stack[x_281] = l_1;
const float x_285 = gl_FragCoord.y;
if ((x_285 >= 0.0f)) {
const int x_290 = h_1;
if (false) {
x_279 = 1;
} else {
x_279 = (h_1 << asuint(0));
}
x_278 = (x_290 | x_279);
} else {
x_278 = 1;
}
int_a = x_278;
clamp_a = clamp(h_1, h_1, int_a);
const int x_304 = (top + 1);
top = x_304;
stack[x_304] = (clamp_a / 1);
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_315 = top;
top = (x_315 - 1);
const int x_318 = stack[x_315];
h_1 = x_318;
const int x_319 = top;
top = (x_319 - 1);
const int x_322 = stack[x_319];
l_1 = x_322;
param_4 = l_1;
param_5 = h_1;
const int x_325 = performPartition_i1_i1_(param_4, param_5);
p = x_325;
if (((p - 1) > l_1)) {
const int x_333 = (top + 1);
top = x_333;
stack[x_333] = l_1;
const int x_337 = (top + 1);
top = x_337;
stack[x_337] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_348 = (top + 1);
top = x_348;
stack[x_348] = (p + 1);
const int x_353 = (top + 1);
top = x_353;
stack[x_353] = h_1;
}
}
return;
}
void main_1() {
int i_2 = 0;
float2 uv = float2(0.0f, 0.0f);
float3 color = float3(0.0f, 0.0f, 0.0f);
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_97 = i_2;
const int x_100 = obj.numbers[i_2];
const int x_103 = obj.numbers[i_2];
obj.numbers[x_97] = (x_100 * x_103);
}
}
quicksort_();
const float4 x_109 = gl_FragCoord;
const float2 x_112 = asfloat(x_34[0].xy);
uv = (float2(x_109.x, x_109.y) / x_112);
color = float3(1.0f, 2.0f, 3.0f);
const int x_115 = obj.numbers[0];
const float x_118 = color.x;
color.x = (x_118 + float(x_115));
const float x_122 = uv.x;
if ((x_122 > 0.25f)) {
const int x_127 = obj.numbers[1];
const float x_130 = color.x;
color.x = (x_130 + float(x_127));
}
const float x_134 = uv.x;
if ((x_134 > 0.5f)) {
const int x_139 = obj.numbers[2];
const float x_142 = color.y;
color.y = (x_142 + float(x_139));
}
const float x_146 = uv.x;
if ((x_146 > 0.75f)) {
const int x_151 = obj.numbers[3];
const float x_154 = color.z;
color.z = (x_154 + float(x_151));
}
const int x_158 = obj.numbers[4];
const float x_161 = color.y;
color.y = (x_161 + float(x_158));
const float x_165 = uv.y;
if ((x_165 > 0.25f)) {
const int x_170 = obj.numbers[5];
const float x_173 = color.x;
color.x = (x_173 + float(x_170));
}
const float x_177 = uv.y;
if ((x_177 > 0.5f)) {
const int x_182 = obj.numbers[6];
const float x_185 = color.y;
color.y = (x_185 + float(x_182));
}
const float x_189 = uv.y;
if ((x_189 > 0.75f)) {
const int x_194 = obj.numbers[7];
const float x_197 = color.z;
color.z = (x_197 + float(x_194));
}
const int x_201 = obj.numbers[8];
const float x_204 = color.z;
color.z = (x_204 + float(x_201));
const float x_208 = uv.x;
const float x_210 = uv.y;
if ((abs((x_208 - x_210)) < 0.25f)) {
const int x_217 = obj.numbers[9];
const float x_220 = color.x;
color.x = (x_220 + float(x_217));
}
const float3 x_224 = normalize(color);
x_GLF_color = float4(x_224.x, x_224.y, x_224.z, 1.0f);
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 gl_FragCoord_param : SV_Position;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner(float4 gl_FragCoord_param) {
gl_FragCoord = gl_FragCoord_param;
main_1();
const main_out tint_symbol_4 = {x_GLF_color};
return tint_symbol_4;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x000001EE8601E080(146,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x000001EE8601E080(145,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -1,230 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_34 : register(b0, space0) {
uint4 x_34[1];
};
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_239 = i;
const int x_241 = obj.numbers[x_239];
temp = x_241;
const int x_242 = i;
const int x_243 = j;
const int x_245 = obj.numbers[x_243];
obj.numbers[x_242] = x_245;
const int x_247 = j;
obj.numbers[x_247] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_251 = h;
const int x_253 = obj.numbers[x_251];
pivot = x_253;
const int x_254 = l;
i_1 = (x_254 - 1);
const int x_256 = l;
j_1 = x_256;
[loop] while (true) {
const int x_261 = j_1;
const int x_262 = h;
if ((x_261 <= (x_262 - 1))) {
} else {
break;
}
const int x_268 = obj.numbers[j_1];
if ((x_268 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1);
}
{
j_1 = (j_1 + 1);
}
}
param_2 = (i_1 + 1);
const int x_282 = h;
param_3 = x_282;
swap_i1_i1_(param_2, param_3);
return (i_1 + 1);
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_288 = (top + 1);
top = x_288;
stack[x_288] = l_1;
const int x_292 = (top + 1);
top = x_292;
stack[x_292] = h_1;
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_302 = top;
top = (x_302 - 1);
const int x_305 = stack[x_302];
h_1 = x_305;
const int x_306 = top;
top = (x_306 - 1);
const int x_309 = stack[x_306];
l_1 = x_309;
param_4 = l_1;
param_5 = h_1;
const int x_312 = performPartition_i1_i1_(param_4, param_5);
p = x_312;
if (((p - 1) > l_1)) {
const int x_320 = (top + 1);
top = x_320;
stack[x_320] = l_1;
const int x_324 = (top + 1);
top = x_324;
stack[x_324] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_335 = (top + 1);
top = x_335;
stack[x_335] = (p + 1);
const int x_340 = (top + 1);
top = x_340;
stack[x_340] = h_1;
}
}
return;
}
void main_1() {
int i_2 = 0;
float2 uv = float2(0.0f, 0.0f);
float3 color = float3(0.0f, 0.0f, 0.0f);
x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_104 = i_2;
const int x_107 = obj.numbers[i_2];
const int x_110 = obj.numbers[i_2];
obj.numbers[x_104] = (x_107 * x_110);
}
}
quicksort_();
const float4 x_116 = x_GLF_FragCoord;
const float2 x_119 = asfloat(x_34[0].xy);
uv = (float2(x_116.x, x_116.y) / x_119);
color = float3(1.0f, 2.0f, 3.0f);
const int x_122 = obj.numbers[0];
const float x_125 = color.x;
color.x = (x_125 + float(x_122));
const float x_129 = uv.x;
if ((x_129 > 0.25f)) {
const int x_134 = obj.numbers[1];
const float x_137 = color.x;
color.x = (x_137 + float(x_134));
}
const float x_141 = uv.x;
if ((x_141 > 0.5f)) {
const int x_146 = obj.numbers[2];
const float x_149 = color.y;
color.y = (x_149 + float(x_146));
}
const float x_153 = uv.x;
if ((x_153 > 0.75f)) {
const int x_158 = obj.numbers[3];
const float x_161 = color.z;
color.z = (x_161 + float(x_158));
}
const int x_165 = obj.numbers[4];
const float x_168 = color.y;
color.y = (x_168 + float(x_165));
const float x_172 = uv.y;
if ((x_172 > 0.25f)) {
const int x_177 = obj.numbers[5];
const float x_180 = color.x;
color.x = (x_180 + float(x_177));
}
const float x_184 = uv.y;
if ((x_184 > 0.5f)) {
const int x_189 = obj.numbers[6];
const float x_192 = color.y;
color.y = (x_192 + float(x_189));
}
const float x_196 = uv.y;
if ((x_196 > 0.75f)) {
const int x_201 = obj.numbers[7];
const float x_204 = color.z;
color.z = (x_204 + float(x_201));
}
const int x_208 = obj.numbers[8];
const float x_211 = color.z;
color.z = (x_211 + float(x_208));
const float x_215 = uv.x;
const float x_217 = uv.y;
if ((abs((x_215 - x_217)) < 0.25f)) {
const int x_224 = obj.numbers[9];
const float x_227 = color.x;
color.x = (x_227 + float(x_224));
}
const float3 x_231 = normalize(color);
frag_color = float4(x_231.x, x_231.y, x_231.z, 1.0f);
gl_Position = x_GLF_pos;
return;
}
struct main_out {
float4 frag_color_1;
float4 gl_Position;
};
struct tint_symbol_1 {
float4 x_GLF_pos_param : TEXCOORD0;
};
struct tint_symbol_2 {
float4 frag_color_1 : TEXCOORD0;
float4 gl_Position : SV_Position;
};
main_out main_inner(float4 x_GLF_pos_param) {
x_GLF_pos = x_GLF_pos_param;
main_1();
const main_out tint_symbol_4 = {frag_color, gl_Position};
return tint_symbol_4;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.frag_color_1 = inner_result.frag_color_1;
wrapper_result.gl_Position = inner_result.gl_Position;
return wrapper_result;
}
C:\src\tint\test\Shader@0x000001E481EDD080(130,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x000001E481EDD080(129,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -1,230 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_34 : register(b0, space0) {
uint4 x_34[1];
};
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_239 = i;
const int x_241 = obj.numbers[x_239];
temp = x_241;
const int x_242 = i;
const int x_243 = j;
const int x_245 = obj.numbers[x_243];
obj.numbers[x_242] = x_245;
const int x_247 = j;
obj.numbers[x_247] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_251 = h;
const int x_253 = obj.numbers[x_251];
pivot = x_253;
const int x_254 = l;
i_1 = (x_254 - 1);
const int x_256 = l;
j_1 = x_256;
[loop] while (true) {
const int x_261 = j_1;
const int x_262 = h;
if ((x_261 <= (x_262 - 1))) {
} else {
break;
}
const int x_268 = obj.numbers[j_1];
if ((x_268 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1);
}
{
j_1 = (j_1 + 1);
}
}
param_2 = (i_1 + 1);
const int x_282 = h;
param_3 = x_282;
swap_i1_i1_(param_2, param_3);
return (i_1 + 1);
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_288 = (top + 1);
top = x_288;
stack[x_288] = l_1;
const int x_292 = (top + 1);
top = x_292;
stack[x_292] = h_1;
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_302 = top;
top = (x_302 - 1);
const int x_305 = stack[x_302];
h_1 = x_305;
const int x_306 = top;
top = (x_306 - 1);
const int x_309 = stack[x_306];
l_1 = x_309;
param_4 = l_1;
param_5 = h_1;
const int x_312 = performPartition_i1_i1_(param_4, param_5);
p = x_312;
if (((p - 1) > l_1)) {
const int x_320 = (top + 1);
top = x_320;
stack[x_320] = l_1;
const int x_324 = (top + 1);
top = x_324;
stack[x_324] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_335 = (top + 1);
top = x_335;
stack[x_335] = (p + 1);
const int x_340 = (top + 1);
top = x_340;
stack[x_340] = h_1;
}
}
return;
}
void main_1() {
int i_2 = 0;
float2 uv = float2(0.0f, 0.0f);
float3 color = float3(0.0f, 0.0f, 0.0f);
x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_104 = i_2;
const int x_107 = obj.numbers[i_2];
const int x_110 = obj.numbers[i_2];
obj.numbers[x_104] = (x_107 * x_110);
}
}
quicksort_();
const float4 x_116 = x_GLF_FragCoord;
const float2 x_119 = asfloat(x_34[0].xy);
uv = (float2(x_116.x, x_116.y) / x_119);
color = float3(1.0f, 2.0f, 3.0f);
const int x_122 = obj.numbers[0];
const float x_125 = color.x;
color.x = (x_125 + float(x_122));
const float x_129 = uv.x;
if ((x_129 > 0.25f)) {
const int x_134 = obj.numbers[1];
const float x_137 = color.x;
color.x = (x_137 + float(x_134));
}
const float x_141 = uv.x;
if ((x_141 > 0.5f)) {
const int x_146 = obj.numbers[2];
const float x_149 = color.y;
color.y = (x_149 + float(x_146));
}
const float x_153 = uv.x;
if ((x_153 > 0.75f)) {
const int x_158 = obj.numbers[3];
const float x_161 = color.z;
color.z = (x_161 + float(x_158));
}
const int x_165 = obj.numbers[4];
const float x_168 = color.y;
color.y = (x_168 + float(x_165));
const float x_172 = uv.y;
if ((x_172 > 0.25f)) {
const int x_177 = obj.numbers[5];
const float x_180 = color.x;
color.x = (x_180 + float(x_177));
}
const float x_184 = uv.y;
if ((x_184 > 0.5f)) {
const int x_189 = obj.numbers[6];
const float x_192 = color.y;
color.y = (x_192 + float(x_189));
}
const float x_196 = uv.y;
if ((x_196 > 0.75f)) {
const int x_201 = obj.numbers[7];
const float x_204 = color.z;
color.z = (x_204 + float(x_201));
}
const int x_208 = obj.numbers[8];
const float x_211 = color.z;
color.z = (x_211 + float(x_208));
const float x_215 = uv.x;
const float x_217 = uv.y;
if ((abs((x_215 - x_217)) < 0.25f)) {
const int x_224 = obj.numbers[9];
const float x_227 = color.x;
color.x = (x_227 + float(x_224));
}
const float3 x_231 = normalize(color);
frag_color = float4(x_231.x, x_231.y, x_231.z, 1.0f);
gl_Position = x_GLF_pos;
return;
}
struct main_out {
float4 frag_color_1;
float4 gl_Position;
};
struct tint_symbol_1 {
float4 x_GLF_pos_param : TEXCOORD0;
};
struct tint_symbol_2 {
float4 frag_color_1 : TEXCOORD0;
float4 gl_Position : SV_Position;
};
main_out main_inner(float4 x_GLF_pos_param) {
x_GLF_pos = x_GLF_pos_param;
main_1();
const main_out tint_symbol_4 = {frag_color, gl_Position};
return tint_symbol_4;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.frag_color_1 = inner_result.frag_color_1;
wrapper_result.gl_Position = inner_result.gl_Position;
return wrapper_result;
}
C:\src\tint\test\Shader@0x000001D05546D140(130,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x000001D05546D140(129,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -1,238 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_33 : register(b0, space0) {
uint4 x_33[1];
};
cbuffer cbuffer_x_36 : register(b1, space0) {
uint4 x_36[1];
};
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_250 = i;
const int x_252 = obj.numbers[x_250];
temp = x_252;
const int x_253 = i;
const int x_254 = j;
const int x_256 = obj.numbers[x_254];
obj.numbers[x_253] = x_256;
const int x_258 = j;
obj.numbers[x_258] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_262 = h;
const int x_264 = obj.numbers[x_262];
pivot = x_264;
const int x_265 = l;
i_1 = (x_265 - 1);
const int x_267 = l;
j_1 = x_267;
[loop] while (true) {
const int x_272 = j_1;
const int x_273 = h;
if ((x_272 <= (x_273 - 1))) {
} else {
break;
}
const int x_279 = obj.numbers[j_1];
if ((x_279 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1);
}
{
j_1 = (j_1 + 1);
}
}
param_2 = (i_1 + 1);
const int x_293 = h;
param_3 = x_293;
swap_i1_i1_(param_2, param_3);
return (i_1 + 1);
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_299 = (top + 1);
top = x_299;
stack[x_299] = l_1;
const int x_303 = (top + 1);
top = x_303;
stack[x_303] = h_1;
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_313 = top;
top = (x_313 - 1);
const int x_316 = stack[x_313];
h_1 = x_316;
const int x_317 = top;
top = (x_317 - 1);
const int x_320 = stack[x_317];
l_1 = x_320;
param_4 = l_1;
param_5 = h_1;
const int x_323 = performPartition_i1_i1_(param_4, param_5);
p = x_323;
if (((p - 1) > l_1)) {
const int x_331 = (top + 1);
top = x_331;
stack[x_331] = l_1;
const int x_335 = (top + 1);
top = x_335;
stack[x_335] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_346 = (top + 1);
top = x_346;
stack[x_346] = (p + 1);
const int x_351 = (top + 1);
top = x_351;
stack[x_351] = h_1;
}
}
return;
}
void main_1() {
int i_2 = 0;
float2 uv = float2(0.0f, 0.0f);
float3 color = float3(0.0f, 0.0f, 0.0f);
x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const float x_109 = asfloat(x_33[0].x);
const float x_111 = asfloat(x_33[0].y);
if ((x_109 > x_111)) {
break;
}
const int x_115 = i_2;
const int x_118 = obj.numbers[i_2];
const int x_121 = obj.numbers[i_2];
obj.numbers[x_115] = (x_118 * x_121);
}
}
quicksort_();
const float4 x_127 = x_GLF_FragCoord;
const float2 x_130 = asfloat(x_36[0].xy);
uv = (float2(x_127.x, x_127.y) / x_130);
color = float3(1.0f, 2.0f, 3.0f);
const int x_133 = obj.numbers[0];
const float x_136 = color.x;
color.x = (x_136 + float(x_133));
const float x_140 = uv.x;
if ((x_140 > 0.25f)) {
const int x_145 = obj.numbers[1];
const float x_148 = color.x;
color.x = (x_148 + float(x_145));
}
const float x_152 = uv.x;
if ((x_152 > 0.5f)) {
const int x_157 = obj.numbers[2];
const float x_160 = color.y;
color.y = (x_160 + float(x_157));
}
const float x_164 = uv.x;
if ((x_164 > 0.75f)) {
const int x_169 = obj.numbers[3];
const float x_172 = color.z;
color.z = (x_172 + float(x_169));
}
const int x_176 = obj.numbers[4];
const float x_179 = color.y;
color.y = (x_179 + float(x_176));
const float x_183 = uv.y;
if ((x_183 > 0.25f)) {
const int x_188 = obj.numbers[5];
const float x_191 = color.x;
color.x = (x_191 + float(x_188));
}
const float x_195 = uv.y;
if ((x_195 > 0.5f)) {
const int x_200 = obj.numbers[6];
const float x_203 = color.y;
color.y = (x_203 + float(x_200));
}
const float x_207 = uv.y;
if ((x_207 > 0.75f)) {
const int x_212 = obj.numbers[7];
const float x_215 = color.z;
color.z = (x_215 + float(x_212));
}
const int x_219 = obj.numbers[8];
const float x_222 = color.z;
color.z = (x_222 + float(x_219));
const float x_226 = uv.x;
const float x_228 = uv.y;
if ((abs((x_226 - x_228)) < 0.25f)) {
const int x_235 = obj.numbers[9];
const float x_238 = color.x;
color.x = (x_238 + float(x_235));
}
const float3 x_242 = normalize(color);
frag_color = float4(x_242.x, x_242.y, x_242.z, 1.0f);
gl_Position = x_GLF_pos;
return;
}
struct main_out {
float4 frag_color_1;
float4 gl_Position;
};
struct tint_symbol_1 {
float4 x_GLF_pos_param : TEXCOORD0;
};
struct tint_symbol_2 {
float4 frag_color_1 : TEXCOORD0;
float4 gl_Position : SV_Position;
};
main_out main_inner(float4 x_GLF_pos_param) {
x_GLF_pos = x_GLF_pos_param;
main_1();
const main_out tint_symbol_5 = {frag_color, gl_Position};
return tint_symbol_5;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.frag_color_1 = inner_result.frag_color_1;
wrapper_result.gl_Position = inner_result.gl_Position;
return wrapper_result;
}
C:\src\tint\test\Shader@0x00000277FFA71560(133,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x00000277FFA71560(132,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -1,238 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_33 : register(b0, space0) {
uint4 x_33[1];
};
cbuffer cbuffer_x_36 : register(b1, space0) {
uint4 x_36[1];
};
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_250 = i;
const int x_252 = obj.numbers[x_250];
temp = x_252;
const int x_253 = i;
const int x_254 = j;
const int x_256 = obj.numbers[x_254];
obj.numbers[x_253] = x_256;
const int x_258 = j;
obj.numbers[x_258] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_262 = h;
const int x_264 = obj.numbers[x_262];
pivot = x_264;
const int x_265 = l;
i_1 = (x_265 - 1);
const int x_267 = l;
j_1 = x_267;
[loop] while (true) {
const int x_272 = j_1;
const int x_273 = h;
if ((x_272 <= (x_273 - 1))) {
} else {
break;
}
const int x_279 = obj.numbers[j_1];
if ((x_279 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1);
}
{
j_1 = (j_1 + 1);
}
}
param_2 = (i_1 + 1);
const int x_293 = h;
param_3 = x_293;
swap_i1_i1_(param_2, param_3);
return (i_1 + 1);
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_299 = (top + 1);
top = x_299;
stack[x_299] = l_1;
const int x_303 = (top + 1);
top = x_303;
stack[x_303] = h_1;
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_313 = top;
top = (x_313 - 1);
const int x_316 = stack[x_313];
h_1 = x_316;
const int x_317 = top;
top = (x_317 - 1);
const int x_320 = stack[x_317];
l_1 = x_320;
param_4 = l_1;
param_5 = h_1;
const int x_323 = performPartition_i1_i1_(param_4, param_5);
p = x_323;
if (((p - 1) > l_1)) {
const int x_331 = (top + 1);
top = x_331;
stack[x_331] = l_1;
const int x_335 = (top + 1);
top = x_335;
stack[x_335] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_346 = (top + 1);
top = x_346;
stack[x_346] = (p + 1);
const int x_351 = (top + 1);
top = x_351;
stack[x_351] = h_1;
}
}
return;
}
void main_1() {
int i_2 = 0;
float2 uv = float2(0.0f, 0.0f);
float3 color = float3(0.0f, 0.0f, 0.0f);
x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const float x_109 = asfloat(x_33[0].x);
const float x_111 = asfloat(x_33[0].y);
if ((x_109 > x_111)) {
break;
}
const int x_115 = i_2;
const int x_118 = obj.numbers[i_2];
const int x_121 = obj.numbers[i_2];
obj.numbers[x_115] = (x_118 * x_121);
}
}
quicksort_();
const float4 x_127 = x_GLF_FragCoord;
const float2 x_130 = asfloat(x_36[0].xy);
uv = (float2(x_127.x, x_127.y) / x_130);
color = float3(1.0f, 2.0f, 3.0f);
const int x_133 = obj.numbers[0];
const float x_136 = color.x;
color.x = (x_136 + float(x_133));
const float x_140 = uv.x;
if ((x_140 > 0.25f)) {
const int x_145 = obj.numbers[1];
const float x_148 = color.x;
color.x = (x_148 + float(x_145));
}
const float x_152 = uv.x;
if ((x_152 > 0.5f)) {
const int x_157 = obj.numbers[2];
const float x_160 = color.y;
color.y = (x_160 + float(x_157));
}
const float x_164 = uv.x;
if ((x_164 > 0.75f)) {
const int x_169 = obj.numbers[3];
const float x_172 = color.z;
color.z = (x_172 + float(x_169));
}
const int x_176 = obj.numbers[4];
const float x_179 = color.y;
color.y = (x_179 + float(x_176));
const float x_183 = uv.y;
if ((x_183 > 0.25f)) {
const int x_188 = obj.numbers[5];
const float x_191 = color.x;
color.x = (x_191 + float(x_188));
}
const float x_195 = uv.y;
if ((x_195 > 0.5f)) {
const int x_200 = obj.numbers[6];
const float x_203 = color.y;
color.y = (x_203 + float(x_200));
}
const float x_207 = uv.y;
if ((x_207 > 0.75f)) {
const int x_212 = obj.numbers[7];
const float x_215 = color.z;
color.z = (x_215 + float(x_212));
}
const int x_219 = obj.numbers[8];
const float x_222 = color.z;
color.z = (x_222 + float(x_219));
const float x_226 = uv.x;
const float x_228 = uv.y;
if ((abs((x_226 - x_228)) < 0.25f)) {
const int x_235 = obj.numbers[9];
const float x_238 = color.x;
color.x = (x_238 + float(x_235));
}
const float3 x_242 = normalize(color);
frag_color = float4(x_242.x, x_242.y, x_242.z, 1.0f);
gl_Position = x_GLF_pos;
return;
}
struct main_out {
float4 frag_color_1;
float4 gl_Position;
};
struct tint_symbol_1 {
float4 x_GLF_pos_param : TEXCOORD0;
};
struct tint_symbol_2 {
float4 frag_color_1 : TEXCOORD0;
float4 gl_Position : SV_Position;
};
main_out main_inner(float4 x_GLF_pos_param) {
x_GLF_pos = x_GLF_pos_param;
main_1();
const main_out tint_symbol_5 = {frag_color, gl_Position};
return tint_symbol_5;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.frag_color_1 = inner_result.frag_color_1;
wrapper_result.gl_Position = inner_result.gl_Position;
return wrapper_result;
}
C:\src\tint\test\Shader@0x000001A3B2C08520(133,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x000001A3B2C08520(132,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -1,317 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_34 : register(b0, space0) {
uint4 x_34[1];
};
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
int x_90 = 0;
int x_91 = 0;
int x_92 = 0;
int x_93 = 0;
int x_94 = 0;
int x_95 = 0;
int x_96 = 0;
int x_97 = 0;
int x_98 = 0;
int x_99 = 0;
int x_100 = 0;
int x_101 = 0;
int x_102 = 0;
int x_103[10] = (int[10])0;
int x_104 = 0;
int x_105 = 0;
int x_106 = 0;
int i_2 = 0;
float2 uv = float2(0.0f, 0.0f);
float3 color = float3(0.0f, 0.0f, 0.0f);
x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_121 = i_2;
const int x_124 = obj.numbers[i_2];
const int x_127 = obj.numbers[i_2];
obj.numbers[x_121] = (x_124 * x_127);
}
}
x_100 = 0;
x_101 = 9;
x_102 = -1;
const int x_133 = (x_102 + 1);
x_102 = x_133;
x_103[x_133] = x_100;
const int x_137 = (x_102 + 1);
x_102 = x_137;
x_103[x_137] = x_101;
[loop] while (true) {
if ((x_102 >= 0)) {
} else {
break;
}
const int x_147 = x_102;
x_102 = (x_147 - 1);
const int x_150 = x_103[x_147];
x_101 = x_150;
const int x_151 = x_102;
x_102 = (x_151 - 1);
const int x_154 = x_103[x_151];
x_100 = x_154;
x_105 = x_100;
x_106 = x_101;
const int x_159 = obj.numbers[x_106];
x_92 = x_159;
x_93 = (x_105 - 1);
x_94 = x_105;
{
[loop] for(; (x_94 <= (x_106 - 1)); x_94 = (x_94 + 1)) {
const int x_174 = obj.numbers[x_94];
if ((x_174 <= x_92)) {
x_93 = (x_93 + 1);
x_95 = x_93;
x_96 = x_94;
const int x_185 = obj.numbers[x_95];
x_91 = x_185;
const int x_186 = x_95;
const int x_189 = obj.numbers[x_96];
obj.numbers[x_186] = x_189;
obj.numbers[x_96] = x_91;
}
}
}
x_97 = (x_93 + 1);
x_98 = x_106;
const int x_201 = obj.numbers[x_97];
x_90 = x_201;
const int x_202 = x_97;
const int x_205 = obj.numbers[x_98];
obj.numbers[x_202] = x_205;
obj.numbers[x_98] = x_90;
x_99 = (x_93 + 1);
x_104 = x_99;
if (((x_104 - 1) > x_100)) {
const int x_220 = (x_102 + 1);
x_102 = x_220;
x_103[x_220] = x_100;
const int x_224 = (x_102 + 1);
x_102 = x_224;
x_103[x_224] = (x_104 - 1);
}
if (((x_104 + 1) < x_101)) {
const int x_235 = (x_102 + 1);
x_102 = x_235;
x_103[x_235] = (x_104 + 1);
const int x_240 = (x_102 + 1);
x_102 = x_240;
x_103[x_240] = x_101;
}
}
const float4 x_243 = x_GLF_FragCoord;
const float2 x_246 = asfloat(x_34[0].xy);
uv = (float2(x_243.x, x_243.y) / x_246);
color = float3(1.0f, 2.0f, 3.0f);
const int x_249 = obj.numbers[0];
const float x_252 = color.x;
color.x = (x_252 + float(x_249));
const float x_256 = uv.x;
if ((x_256 > 0.25f)) {
const int x_261 = obj.numbers[1];
const float x_264 = color.x;
color.x = (x_264 + float(x_261));
}
const float x_268 = uv.x;
if ((x_268 > 0.5f)) {
const int x_273 = obj.numbers[2];
const float x_276 = color.y;
color.y = (x_276 + float(x_273));
}
const float x_280 = uv.x;
if ((x_280 > 0.75f)) {
const int x_285 = obj.numbers[3];
const float x_288 = color.z;
color.z = (x_288 + float(x_285));
}
const int x_292 = obj.numbers[4];
const float x_295 = color.y;
color.y = (x_295 + float(x_292));
const float x_299 = uv.y;
if ((x_299 > 0.25f)) {
const int x_304 = obj.numbers[5];
const float x_307 = color.x;
color.x = (x_307 + float(x_304));
}
const float x_311 = uv.y;
if ((x_311 > 0.5f)) {
const int x_316 = obj.numbers[6];
const float x_319 = color.y;
color.y = (x_319 + float(x_316));
}
const float x_323 = uv.y;
if ((x_323 > 0.75f)) {
const int x_328 = obj.numbers[7];
const float x_331 = color.z;
color.z = (x_331 + float(x_328));
}
const int x_335 = obj.numbers[8];
const float x_338 = color.z;
color.z = (x_338 + float(x_335));
const float x_342 = uv.x;
const float x_344 = uv.y;
if ((abs((x_342 - x_344)) < 0.25f)) {
const int x_351 = obj.numbers[9];
const float x_354 = color.x;
color.x = (x_354 + float(x_351));
}
const float3 x_358 = normalize(color);
frag_color = float4(x_358.x, x_358.y, x_358.z, 1.0f);
gl_Position = x_GLF_pos;
return;
}
struct main_out {
float4 frag_color_1;
float4 gl_Position;
};
struct tint_symbol_1 {
float4 x_GLF_pos_param : TEXCOORD0;
};
struct tint_symbol_2 {
float4 frag_color_1 : TEXCOORD0;
float4 gl_Position : SV_Position;
};
main_out main_inner(float4 x_GLF_pos_param) {
x_GLF_pos = x_GLF_pos_param;
main_1();
const main_out tint_symbol_4 = {frag_color, gl_Position};
return tint_symbol_4;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.frag_color_1 = inner_result.frag_color_1;
wrapper_result.gl_Position = inner_result.gl_Position;
return wrapper_result;
}
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_366 = i;
const int x_368 = obj.numbers[x_366];
temp = x_368;
const int x_369 = i;
const int x_370 = j;
const int x_372 = obj.numbers[x_370];
obj.numbers[x_369] = x_372;
const int x_374 = j;
obj.numbers[x_374] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_378 = h;
const int x_380 = obj.numbers[x_378];
pivot = x_380;
const int x_381 = l;
i_1 = (x_381 - 1);
const int x_383 = l;
j_1 = x_383;
[loop] while (true) {
const int x_388 = j_1;
const int x_389 = h;
if ((x_388 <= (x_389 - 1))) {
} else {
break;
}
const int x_395 = obj.numbers[j_1];
if ((x_395 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1);
}
{
j_1 = (j_1 + 1);
}
}
param_2 = (i_1 + 1);
const int x_409 = h;
param_3 = x_409;
swap_i1_i1_(param_2, param_3);
return (i_1 + 1);
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_415 = (top + 1);
top = x_415;
stack[x_415] = l_1;
const int x_419 = (top + 1);
top = x_419;
stack[x_419] = h_1;
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_429 = top;
top = (x_429 - 1);
const int x_432 = stack[x_429];
h_1 = x_432;
const int x_433 = top;
top = (x_433 - 1);
const int x_436 = stack[x_433];
l_1 = x_436;
param_4 = l_1;
param_5 = h_1;
const int x_439 = performPartition_i1_i1_(param_4, param_5);
p = x_439;
if (((p - 1) > l_1)) {
const int x_447 = (top + 1);
top = x_447;
stack[x_447] = l_1;
const int x_451 = (top + 1);
top = x_451;
stack[x_451] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_462 = (top + 1);
top = x_462;
stack[x_462] = (p + 1);
const int x_467 = (top + 1);
top = x_467;
stack[x_467] = h_1;
}
}
return;
}
C:\src\tint\test\Shader@0x0000028832314060(39,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x0000028832314060(38,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -1,317 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_34 : register(b0, space0) {
uint4 x_34[1];
};
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
int x_90 = 0;
int x_91 = 0;
int x_92 = 0;
int x_93 = 0;
int x_94 = 0;
int x_95 = 0;
int x_96 = 0;
int x_97 = 0;
int x_98 = 0;
int x_99 = 0;
int x_100 = 0;
int x_101 = 0;
int x_102 = 0;
int x_103[10] = (int[10])0;
int x_104 = 0;
int x_105 = 0;
int x_106 = 0;
int i_2 = 0;
float2 uv = float2(0.0f, 0.0f);
float3 color = float3(0.0f, 0.0f, 0.0f);
x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_121 = i_2;
const int x_124 = obj.numbers[i_2];
const int x_127 = obj.numbers[i_2];
obj.numbers[x_121] = (x_124 * x_127);
}
}
x_100 = 0;
x_101 = 9;
x_102 = -1;
const int x_133 = (x_102 + 1);
x_102 = x_133;
x_103[x_133] = x_100;
const int x_137 = (x_102 + 1);
x_102 = x_137;
x_103[x_137] = x_101;
[loop] while (true) {
if ((x_102 >= 0)) {
} else {
break;
}
const int x_147 = x_102;
x_102 = (x_147 - 1);
const int x_150 = x_103[x_147];
x_101 = x_150;
const int x_151 = x_102;
x_102 = (x_151 - 1);
const int x_154 = x_103[x_151];
x_100 = x_154;
x_105 = x_100;
x_106 = x_101;
const int x_159 = obj.numbers[x_106];
x_92 = x_159;
x_93 = (x_105 - 1);
x_94 = x_105;
{
[loop] for(; (x_94 <= (x_106 - 1)); x_94 = (x_94 + 1)) {
const int x_174 = obj.numbers[x_94];
if ((x_174 <= x_92)) {
x_93 = (x_93 + 1);
x_95 = x_93;
x_96 = x_94;
const int x_185 = obj.numbers[x_95];
x_91 = x_185;
const int x_186 = x_95;
const int x_189 = obj.numbers[x_96];
obj.numbers[x_186] = x_189;
obj.numbers[x_96] = x_91;
}
}
}
x_97 = (x_93 + 1);
x_98 = x_106;
const int x_201 = obj.numbers[x_97];
x_90 = x_201;
const int x_202 = x_97;
const int x_205 = obj.numbers[x_98];
obj.numbers[x_202] = x_205;
obj.numbers[x_98] = x_90;
x_99 = (x_93 + 1);
x_104 = x_99;
if (((x_104 - 1) > x_100)) {
const int x_220 = (x_102 + 1);
x_102 = x_220;
x_103[x_220] = x_100;
const int x_224 = (x_102 + 1);
x_102 = x_224;
x_103[x_224] = (x_104 - 1);
}
if (((x_104 + 1) < x_101)) {
const int x_235 = (x_102 + 1);
x_102 = x_235;
x_103[x_235] = (x_104 + 1);
const int x_240 = (x_102 + 1);
x_102 = x_240;
x_103[x_240] = x_101;
}
}
const float4 x_243 = x_GLF_FragCoord;
const float2 x_246 = asfloat(x_34[0].xy);
uv = (float2(x_243.x, x_243.y) / x_246);
color = float3(1.0f, 2.0f, 3.0f);
const int x_249 = obj.numbers[0];
const float x_252 = color.x;
color.x = (x_252 + float(x_249));
const float x_256 = uv.x;
if ((x_256 > 0.25f)) {
const int x_261 = obj.numbers[1];
const float x_264 = color.x;
color.x = (x_264 + float(x_261));
}
const float x_268 = uv.x;
if ((x_268 > 0.5f)) {
const int x_273 = obj.numbers[2];
const float x_276 = color.y;
color.y = (x_276 + float(x_273));
}
const float x_280 = uv.x;
if ((x_280 > 0.75f)) {
const int x_285 = obj.numbers[3];
const float x_288 = color.z;
color.z = (x_288 + float(x_285));
}
const int x_292 = obj.numbers[4];
const float x_295 = color.y;
color.y = (x_295 + float(x_292));
const float x_299 = uv.y;
if ((x_299 > 0.25f)) {
const int x_304 = obj.numbers[5];
const float x_307 = color.x;
color.x = (x_307 + float(x_304));
}
const float x_311 = uv.y;
if ((x_311 > 0.5f)) {
const int x_316 = obj.numbers[6];
const float x_319 = color.y;
color.y = (x_319 + float(x_316));
}
const float x_323 = uv.y;
if ((x_323 > 0.75f)) {
const int x_328 = obj.numbers[7];
const float x_331 = color.z;
color.z = (x_331 + float(x_328));
}
const int x_335 = obj.numbers[8];
const float x_338 = color.z;
color.z = (x_338 + float(x_335));
const float x_342 = uv.x;
const float x_344 = uv.y;
if ((abs((x_342 - x_344)) < 0.25f)) {
const int x_351 = obj.numbers[9];
const float x_354 = color.x;
color.x = (x_354 + float(x_351));
}
const float3 x_358 = normalize(color);
frag_color = float4(x_358.x, x_358.y, x_358.z, 1.0f);
gl_Position = x_GLF_pos;
return;
}
struct main_out {
float4 frag_color_1;
float4 gl_Position;
};
struct tint_symbol_1 {
float4 x_GLF_pos_param : TEXCOORD0;
};
struct tint_symbol_2 {
float4 frag_color_1 : TEXCOORD0;
float4 gl_Position : SV_Position;
};
main_out main_inner(float4 x_GLF_pos_param) {
x_GLF_pos = x_GLF_pos_param;
main_1();
const main_out tint_symbol_4 = {frag_color, gl_Position};
return tint_symbol_4;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.frag_color_1 = inner_result.frag_color_1;
wrapper_result.gl_Position = inner_result.gl_Position;
return wrapper_result;
}
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_366 = i;
const int x_368 = obj.numbers[x_366];
temp = x_368;
const int x_369 = i;
const int x_370 = j;
const int x_372 = obj.numbers[x_370];
obj.numbers[x_369] = x_372;
const int x_374 = j;
obj.numbers[x_374] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_378 = h;
const int x_380 = obj.numbers[x_378];
pivot = x_380;
const int x_381 = l;
i_1 = (x_381 - 1);
const int x_383 = l;
j_1 = x_383;
[loop] while (true) {
const int x_388 = j_1;
const int x_389 = h;
if ((x_388 <= (x_389 - 1))) {
} else {
break;
}
const int x_395 = obj.numbers[j_1];
if ((x_395 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1);
}
{
j_1 = (j_1 + 1);
}
}
param_2 = (i_1 + 1);
const int x_409 = h;
param_3 = x_409;
swap_i1_i1_(param_2, param_3);
return (i_1 + 1);
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_415 = (top + 1);
top = x_415;
stack[x_415] = l_1;
const int x_419 = (top + 1);
top = x_419;
stack[x_419] = h_1;
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_429 = top;
top = (x_429 - 1);
const int x_432 = stack[x_429];
h_1 = x_432;
const int x_433 = top;
top = (x_433 - 1);
const int x_436 = stack[x_433];
l_1 = x_436;
param_4 = l_1;
param_5 = h_1;
const int x_439 = performPartition_i1_i1_(param_4, param_5);
p = x_439;
if (((p - 1) > l_1)) {
const int x_447 = (top + 1);
top = x_447;
stack[x_447] = l_1;
const int x_451 = (top + 1);
top = x_451;
stack[x_451] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_462 = (top + 1);
top = x_462;
stack[x_462] = (p + 1);
const int x_467 = (top + 1);
top = x_467;
stack[x_467] = h_1;
}
}
return;
}
C:\src\tint\test\Shader@0x0000028832C83FA0(39,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x0000028832C83FA0(38,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -1,295 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_34 : register(b0, space0) {
uint4 x_34[1];
};
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
int performPartition_i1_i1_(inout int l, inout int h) {
int x_314 = 0;
int x_315 = 0;
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_316 = h;
const int x_318 = obj.numbers[x_316];
pivot = x_318;
const int x_319 = l;
i_1 = (x_319 - 1);
const int x_321 = l;
j_1 = x_321;
[loop] while (true) {
const int x_326 = j_1;
const int x_327 = h;
if ((x_326 <= (x_327 - 1))) {
} else {
break;
}
const int x_333 = obj.numbers[j_1];
if ((x_333 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
const int x_344 = obj.numbers[param];
x_315 = x_344;
const int x_345 = param;
const int x_348 = obj.numbers[param_1];
obj.numbers[x_345] = x_348;
obj.numbers[param_1] = x_315;
}
{
j_1 = (j_1 + 1);
}
}
param_2 = (i_1 + 1);
const int x_357 = h;
param_3 = x_357;
const int x_360 = obj.numbers[param_2];
x_314 = x_360;
const int x_361 = param_2;
const int x_364 = obj.numbers[param_3];
obj.numbers[x_361] = x_364;
obj.numbers[param_3] = x_314;
if (false) {
} else {
return (i_1 + 1);
}
return 0;
}
void main_1() {
int x_91 = 0;
int x_92 = 0;
int x_93 = 0;
int x_94[10] = (int[10])0;
int x_95 = 0;
int x_96 = 0;
int x_97 = 0;
int i_2 = 0;
float2 uv = float2(0.0f, 0.0f);
float3 color = float3(0.0f, 0.0f, 0.0f);
x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_112 = i_2;
const int x_115 = obj.numbers[i_2];
const int x_118 = obj.numbers[i_2];
obj.numbers[x_112] = (x_115 * x_118);
}
}
x_91 = 0;
x_92 = 9;
x_93 = -1;
const int x_124 = (x_93 + 1);
x_93 = x_124;
x_94[x_124] = x_91;
const int x_128 = (x_93 + 1);
x_93 = x_128;
x_94[x_128] = x_92;
[loop] while (true) {
if ((x_93 >= 0)) {
} else {
break;
}
const int x_138 = x_93;
x_93 = (x_138 - 1);
const int x_141 = x_94[x_138];
x_92 = x_141;
const int x_142 = x_93;
x_93 = (x_142 - 1);
const int x_145 = x_94[x_142];
x_91 = x_145;
x_96 = x_91;
x_97 = x_92;
const int x_148 = performPartition_i1_i1_(x_96, x_97);
x_95 = x_148;
if (((x_95 - 1) > x_91)) {
const int x_156 = (x_93 + 1);
x_93 = x_156;
x_94[x_156] = x_91;
const int x_160 = (x_93 + 1);
x_93 = x_160;
x_94[x_160] = (x_95 - 1);
}
if (((x_95 + 1) < x_92)) {
const int x_171 = (x_93 + 1);
x_93 = x_171;
x_94[x_171] = (x_95 + 1);
const int x_176 = (x_93 + 1);
x_93 = x_176;
x_94[x_176] = x_92;
}
}
const float4 x_179 = x_GLF_FragCoord;
const float2 x_182 = asfloat(x_34[0].xy);
uv = (float2(x_179.x, x_179.y) / x_182);
color = float3(1.0f, 2.0f, 3.0f);
const int x_185 = obj.numbers[0];
const float x_188 = color.x;
color.x = (x_188 + float(x_185));
const float x_192 = uv.x;
if ((x_192 > 0.25f)) {
const int x_197 = obj.numbers[1];
const float x_200 = color.x;
color.x = (x_200 + float(x_197));
}
const float x_204 = uv.x;
if ((x_204 > 0.5f)) {
const int x_209 = obj.numbers[2];
const float x_212 = color.y;
color.y = (x_212 + float(x_209));
}
const float x_216 = uv.x;
if ((x_216 > 0.75f)) {
const int x_221 = obj.numbers[3];
const float x_224 = color.z;
color.z = (x_224 + float(x_221));
}
const int x_228 = obj.numbers[4];
const float x_231 = color.y;
color.y = (x_231 + float(x_228));
const float x_235 = uv.y;
if ((x_235 > 0.25f)) {
const int x_240 = obj.numbers[5];
const float x_243 = color.x;
color.x = (x_243 + float(x_240));
}
const float x_247 = uv.y;
if ((x_247 > 0.5f)) {
const int x_252 = obj.numbers[6];
const float x_255 = color.y;
color.y = (x_255 + float(x_252));
}
const float x_259 = uv.y;
if ((x_259 > 0.75f)) {
const int x_264 = obj.numbers[7];
const float x_267 = color.z;
color.z = (x_267 + float(x_264));
}
const int x_271 = obj.numbers[8];
const float x_274 = color.z;
color.z = (x_274 + float(x_271));
const float x_278 = uv.x;
const float x_280 = uv.y;
if ((abs((x_278 - x_280)) < 0.25f)) {
const int x_287 = obj.numbers[9];
const float x_290 = color.x;
color.x = (x_290 + float(x_287));
}
const float3 x_294 = normalize(color);
frag_color = float4(x_294.x, x_294.y, x_294.z, 1.0f);
gl_Position = x_GLF_pos;
return;
}
struct main_out {
float4 frag_color_1;
float4 gl_Position;
};
struct tint_symbol_1 {
float4 x_GLF_pos_param : TEXCOORD0;
};
struct tint_symbol_2 {
float4 frag_color_1 : TEXCOORD0;
float4 gl_Position : SV_Position;
};
main_out main_inner(float4 x_GLF_pos_param) {
x_GLF_pos = x_GLF_pos_param;
main_1();
const main_out tint_symbol_4 = {frag_color, gl_Position};
return tint_symbol_4;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.frag_color_1 = inner_result.frag_color_1;
wrapper_result.gl_Position = inner_result.gl_Position;
return wrapper_result;
}
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_302 = i;
const int x_304 = obj.numbers[x_302];
temp = x_304;
const int x_305 = i;
const int x_306 = j;
const int x_308 = obj.numbers[x_306];
obj.numbers[x_305] = x_308;
const int x_310 = j;
obj.numbers[x_310] = temp;
return;
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_377 = (top + 1);
top = x_377;
stack[x_377] = l_1;
const int x_381 = (top + 1);
top = x_381;
stack[x_381] = h_1;
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_391 = top;
top = (x_391 - 1);
const int x_394 = stack[x_391];
h_1 = x_394;
const int x_395 = top;
top = (x_395 - 1);
const int x_398 = stack[x_395];
l_1 = x_398;
param_4 = l_1;
param_5 = h_1;
const int x_401 = performPartition_i1_i1_(param_4, param_5);
p = x_401;
if (((p - 1) > l_1)) {
const int x_409 = (top + 1);
top = x_409;
stack[x_409] = l_1;
const int x_413 = (top + 1);
top = x_413;
stack[x_413] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_424 = (top + 1);
top = x_424;
stack[x_424] = (p + 1);
const int x_429 = (top + 1);
top = x_429;
stack[x_429] = h_1;
}
}
return;
}
C:\src\tint\test\Shader@0x000002B401B06060(85,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x000002B401B06060(84,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -1,295 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_34 : register(b0, space0) {
uint4 x_34[1];
};
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
int performPartition_i1_i1_(inout int l, inout int h) {
int x_314 = 0;
int x_315 = 0;
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_316 = h;
const int x_318 = obj.numbers[x_316];
pivot = x_318;
const int x_319 = l;
i_1 = (x_319 - 1);
const int x_321 = l;
j_1 = x_321;
[loop] while (true) {
const int x_326 = j_1;
const int x_327 = h;
if ((x_326 <= (x_327 - 1))) {
} else {
break;
}
const int x_333 = obj.numbers[j_1];
if ((x_333 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
const int x_344 = obj.numbers[param];
x_315 = x_344;
const int x_345 = param;
const int x_348 = obj.numbers[param_1];
obj.numbers[x_345] = x_348;
obj.numbers[param_1] = x_315;
}
{
j_1 = (j_1 + 1);
}
}
param_2 = (i_1 + 1);
const int x_357 = h;
param_3 = x_357;
const int x_360 = obj.numbers[param_2];
x_314 = x_360;
const int x_361 = param_2;
const int x_364 = obj.numbers[param_3];
obj.numbers[x_361] = x_364;
obj.numbers[param_3] = x_314;
if (false) {
} else {
return (i_1 + 1);
}
return 0;
}
void main_1() {
int x_91 = 0;
int x_92 = 0;
int x_93 = 0;
int x_94[10] = (int[10])0;
int x_95 = 0;
int x_96 = 0;
int x_97 = 0;
int i_2 = 0;
float2 uv = float2(0.0f, 0.0f);
float3 color = float3(0.0f, 0.0f, 0.0f);
x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_112 = i_2;
const int x_115 = obj.numbers[i_2];
const int x_118 = obj.numbers[i_2];
obj.numbers[x_112] = (x_115 * x_118);
}
}
x_91 = 0;
x_92 = 9;
x_93 = -1;
const int x_124 = (x_93 + 1);
x_93 = x_124;
x_94[x_124] = x_91;
const int x_128 = (x_93 + 1);
x_93 = x_128;
x_94[x_128] = x_92;
[loop] while (true) {
if ((x_93 >= 0)) {
} else {
break;
}
const int x_138 = x_93;
x_93 = (x_138 - 1);
const int x_141 = x_94[x_138];
x_92 = x_141;
const int x_142 = x_93;
x_93 = (x_142 - 1);
const int x_145 = x_94[x_142];
x_91 = x_145;
x_96 = x_91;
x_97 = x_92;
const int x_148 = performPartition_i1_i1_(x_96, x_97);
x_95 = x_148;
if (((x_95 - 1) > x_91)) {
const int x_156 = (x_93 + 1);
x_93 = x_156;
x_94[x_156] = x_91;
const int x_160 = (x_93 + 1);
x_93 = x_160;
x_94[x_160] = (x_95 - 1);
}
if (((x_95 + 1) < x_92)) {
const int x_171 = (x_93 + 1);
x_93 = x_171;
x_94[x_171] = (x_95 + 1);
const int x_176 = (x_93 + 1);
x_93 = x_176;
x_94[x_176] = x_92;
}
}
const float4 x_179 = x_GLF_FragCoord;
const float2 x_182 = asfloat(x_34[0].xy);
uv = (float2(x_179.x, x_179.y) / x_182);
color = float3(1.0f, 2.0f, 3.0f);
const int x_185 = obj.numbers[0];
const float x_188 = color.x;
color.x = (x_188 + float(x_185));
const float x_192 = uv.x;
if ((x_192 > 0.25f)) {
const int x_197 = obj.numbers[1];
const float x_200 = color.x;
color.x = (x_200 + float(x_197));
}
const float x_204 = uv.x;
if ((x_204 > 0.5f)) {
const int x_209 = obj.numbers[2];
const float x_212 = color.y;
color.y = (x_212 + float(x_209));
}
const float x_216 = uv.x;
if ((x_216 > 0.75f)) {
const int x_221 = obj.numbers[3];
const float x_224 = color.z;
color.z = (x_224 + float(x_221));
}
const int x_228 = obj.numbers[4];
const float x_231 = color.y;
color.y = (x_231 + float(x_228));
const float x_235 = uv.y;
if ((x_235 > 0.25f)) {
const int x_240 = obj.numbers[5];
const float x_243 = color.x;
color.x = (x_243 + float(x_240));
}
const float x_247 = uv.y;
if ((x_247 > 0.5f)) {
const int x_252 = obj.numbers[6];
const float x_255 = color.y;
color.y = (x_255 + float(x_252));
}
const float x_259 = uv.y;
if ((x_259 > 0.75f)) {
const int x_264 = obj.numbers[7];
const float x_267 = color.z;
color.z = (x_267 + float(x_264));
}
const int x_271 = obj.numbers[8];
const float x_274 = color.z;
color.z = (x_274 + float(x_271));
const float x_278 = uv.x;
const float x_280 = uv.y;
if ((abs((x_278 - x_280)) < 0.25f)) {
const int x_287 = obj.numbers[9];
const float x_290 = color.x;
color.x = (x_290 + float(x_287));
}
const float3 x_294 = normalize(color);
frag_color = float4(x_294.x, x_294.y, x_294.z, 1.0f);
gl_Position = x_GLF_pos;
return;
}
struct main_out {
float4 frag_color_1;
float4 gl_Position;
};
struct tint_symbol_1 {
float4 x_GLF_pos_param : TEXCOORD0;
};
struct tint_symbol_2 {
float4 frag_color_1 : TEXCOORD0;
float4 gl_Position : SV_Position;
};
main_out main_inner(float4 x_GLF_pos_param) {
x_GLF_pos = x_GLF_pos_param;
main_1();
const main_out tint_symbol_4 = {frag_color, gl_Position};
return tint_symbol_4;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.frag_color_1 = inner_result.frag_color_1;
wrapper_result.gl_Position = inner_result.gl_Position;
return wrapper_result;
}
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_302 = i;
const int x_304 = obj.numbers[x_302];
temp = x_304;
const int x_305 = i;
const int x_306 = j;
const int x_308 = obj.numbers[x_306];
obj.numbers[x_305] = x_308;
const int x_310 = j;
obj.numbers[x_310] = temp;
return;
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_377 = (top + 1);
top = x_377;
stack[x_377] = l_1;
const int x_381 = (top + 1);
top = x_381;
stack[x_381] = h_1;
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_391 = top;
top = (x_391 - 1);
const int x_394 = stack[x_391];
h_1 = x_394;
const int x_395 = top;
top = (x_395 - 1);
const int x_398 = stack[x_395];
l_1 = x_398;
param_4 = l_1;
param_5 = h_1;
const int x_401 = performPartition_i1_i1_(param_4, param_5);
p = x_401;
if (((p - 1) > l_1)) {
const int x_409 = (top + 1);
top = x_409;
stack[x_409] = l_1;
const int x_413 = (top + 1);
top = x_413;
stack[x_413] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_424 = (top + 1);
top = x_424;
stack[x_424] = (p + 1);
const int x_429 = (top + 1);
top = x_429;
stack[x_429] = h_1;
}
}
return;
}
C:\src\tint\test\Shader@0x000001381E0F76E0(85,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x000001381E0F76E0(84,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -1,236 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_34 : register(b1, space0) {
uint4 x_34[1];
};
cbuffer cbuffer_x_37 : register(b0, space0) {
uint4 x_37[1];
};
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_257 = i;
const int x_259 = obj.numbers[x_257];
temp = x_259;
const int x_260 = i;
const int x_261 = j;
const int x_263 = obj.numbers[x_261];
obj.numbers[x_260] = x_263;
const int x_265 = j;
obj.numbers[x_265] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_269 = h;
const int x_271 = obj.numbers[x_269];
pivot = x_271;
const int x_272 = l;
i_1 = (x_272 - 1);
const int x_274 = l;
j_1 = x_274;
[loop] while (true) {
const int x_279 = j_1;
const int x_280 = h;
if ((x_279 <= (x_280 - 1))) {
} else {
break;
}
const int x_286 = obj.numbers[j_1];
if ((x_286 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1);
}
{
j_1 = (j_1 + 1);
}
}
param_2 = (i_1 + 1);
const int x_300 = h;
param_3 = x_300;
swap_i1_i1_(param_2, param_3);
return (i_1 + 1);
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_306 = (top + 1);
top = x_306;
stack[x_306] = l_1;
const int x_310 = (top + 1);
top = x_310;
stack[x_310] = h_1;
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_320 = top;
top = (x_320 - 1);
const int x_323 = stack[x_320];
h_1 = x_323;
const int x_324 = top;
top = (x_324 - 1);
const int x_327 = stack[x_324];
l_1 = x_327;
param_4 = l_1;
param_5 = h_1;
const int x_330 = performPartition_i1_i1_(param_4, param_5);
p = x_330;
if (((p - 1) > l_1)) {
const int x_338 = (top + 1);
top = x_338;
stack[x_338] = l_1;
const int x_342 = (top + 1);
top = x_342;
stack[x_342] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_353 = (top + 1);
top = x_353;
stack[x_353] = (p + 1);
const int x_358 = (top + 1);
top = x_358;
stack[x_358] = h_1;
}
}
return;
}
void main_1() {
int i_2 = 0;
float2 uv = float2(0.0f, 0.0f);
float3 color = float3(0.0f, 0.0f, 0.0f);
x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_108 = i_2;
const int x_111 = obj.numbers[i_2];
const int x_114 = obj.numbers[i_2];
obj.numbers[x_108] = (x_111 * x_114);
}
}
quicksort_();
const float4 x_120 = x_GLF_FragCoord;
const float2 x_123 = asfloat(x_34[0].xy);
uv = (float2(x_120.x, x_120.y) / x_123);
color = float3(1.0f, 2.0f, 3.0f);
const int x_126 = obj.numbers[0];
const float x_129 = color.x;
color.x = (x_129 + float(x_126));
const float x_133 = uv.x;
if ((x_133 > 0.25f)) {
const int x_138 = obj.numbers[1];
const float x_141 = color.x;
color.x = (x_141 + float(x_138));
}
const float x_145 = uv.x;
if ((x_145 > 0.5f)) {
const float x_150 = asfloat(x_37[0].y);
const int x_155 = obj.numbers[max((2 * int(x_150)), 2)];
const float x_158 = asfloat(x_37[0].y);
const int x_163 = obj.numbers[max((2 * int(x_158)), 2)];
const float x_167 = color.y;
color.y = (x_167 + max(float(x_155), float(x_163)));
}
const float x_171 = uv.x;
if ((x_171 > 0.75f)) {
const int x_176 = obj.numbers[3];
const float x_179 = color.z;
color.z = (x_179 + float(x_176));
}
const int x_183 = obj.numbers[4];
const float x_186 = color.y;
color.y = (x_186 + float(x_183));
const float x_190 = uv.y;
if ((x_190 > 0.25f)) {
const int x_195 = obj.numbers[5];
const float x_198 = color.x;
color.x = (x_198 + float(x_195));
}
const float x_202 = uv.y;
if ((x_202 > 0.5f)) {
const int x_207 = obj.numbers[6];
const float x_210 = color.y;
color.y = (x_210 + float(x_207));
}
const float x_214 = uv.y;
if ((x_214 > 0.75f)) {
const int x_219 = obj.numbers[7];
const float x_222 = color.z;
color.z = (x_222 + float(x_219));
}
const int x_226 = obj.numbers[8];
const float x_229 = color.z;
color.z = (x_229 + float(x_226));
const float x_233 = uv.x;
const float x_235 = uv.y;
if ((abs((x_233 - x_235)) < 0.25f)) {
const int x_242 = obj.numbers[9];
const float x_245 = color.x;
color.x = (x_245 + float(x_242));
}
const float3 x_249 = normalize(color);
frag_color = float4(x_249.x, x_249.y, x_249.z, 1.0f);
gl_Position = x_GLF_pos;
return;
}
struct main_out {
float4 frag_color_1;
float4 gl_Position;
};
struct tint_symbol_1 {
float4 x_GLF_pos_param : TEXCOORD0;
};
struct tint_symbol_2 {
float4 frag_color_1 : TEXCOORD0;
float4 gl_Position : SV_Position;
};
main_out main_inner(float4 x_GLF_pos_param) {
x_GLF_pos = x_GLF_pos_param;
main_1();
const main_out tint_symbol_5 = {frag_color, gl_Position};
return tint_symbol_5;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.frag_color_1 = inner_result.frag_color_1;
wrapper_result.gl_Position = inner_result.gl_Position;
return wrapper_result;
}
C:\src\tint\test\Shader@0x0000015776479900(133,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x0000015776479900(132,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -1,236 +0,0 @@
SKIP: FAILED
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_34 : register(b1, space0) {
uint4 x_34[1];
};
cbuffer cbuffer_x_37 : register(b0, space0) {
uint4 x_37[1];
};
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_257 = i;
const int x_259 = obj.numbers[x_257];
temp = x_259;
const int x_260 = i;
const int x_261 = j;
const int x_263 = obj.numbers[x_261];
obj.numbers[x_260] = x_263;
const int x_265 = j;
obj.numbers[x_265] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_269 = h;
const int x_271 = obj.numbers[x_269];
pivot = x_271;
const int x_272 = l;
i_1 = (x_272 - 1);
const int x_274 = l;
j_1 = x_274;
[loop] while (true) {
const int x_279 = j_1;
const int x_280 = h;
if ((x_279 <= (x_280 - 1))) {
} else {
break;
}
const int x_286 = obj.numbers[j_1];
if ((x_286 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1);
}
{
j_1 = (j_1 + 1);
}
}
param_2 = (i_1 + 1);
const int x_300 = h;
param_3 = x_300;
swap_i1_i1_(param_2, param_3);
return (i_1 + 1);
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_306 = (top + 1);
top = x_306;
stack[x_306] = l_1;
const int x_310 = (top + 1);
top = x_310;
stack[x_310] = h_1;
[loop] while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_320 = top;
top = (x_320 - 1);
const int x_323 = stack[x_320];
h_1 = x_323;
const int x_324 = top;
top = (x_324 - 1);
const int x_327 = stack[x_324];
l_1 = x_327;
param_4 = l_1;
param_5 = h_1;
const int x_330 = performPartition_i1_i1_(param_4, param_5);
p = x_330;
if (((p - 1) > l_1)) {
const int x_338 = (top + 1);
top = x_338;
stack[x_338] = l_1;
const int x_342 = (top + 1);
top = x_342;
stack[x_342] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_353 = (top + 1);
top = x_353;
stack[x_353] = (p + 1);
const int x_358 = (top + 1);
top = x_358;
stack[x_358] = h_1;
}
}
return;
}
void main_1() {
int i_2 = 0;
float2 uv = float2(0.0f, 0.0f);
float3 color = float3(0.0f, 0.0f, 0.0f);
x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
i_2 = 0;
{
[loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_108 = i_2;
const int x_111 = obj.numbers[i_2];
const int x_114 = obj.numbers[i_2];
obj.numbers[x_108] = (x_111 * x_114);
}
}
quicksort_();
const float4 x_120 = x_GLF_FragCoord;
const float2 x_123 = asfloat(x_34[0].xy);
uv = (float2(x_120.x, x_120.y) / x_123);
color = float3(1.0f, 2.0f, 3.0f);
const int x_126 = obj.numbers[0];
const float x_129 = color.x;
color.x = (x_129 + float(x_126));
const float x_133 = uv.x;
if ((x_133 > 0.25f)) {
const int x_138 = obj.numbers[1];
const float x_141 = color.x;
color.x = (x_141 + float(x_138));
}
const float x_145 = uv.x;
if ((x_145 > 0.5f)) {
const float x_150 = asfloat(x_37[0].y);
const int x_155 = obj.numbers[max((2 * int(x_150)), 2)];
const float x_158 = asfloat(x_37[0].y);
const int x_163 = obj.numbers[max((2 * int(x_158)), 2)];
const float x_167 = color.y;
color.y = (x_167 + max(float(x_155), float(x_163)));
}
const float x_171 = uv.x;
if ((x_171 > 0.75f)) {
const int x_176 = obj.numbers[3];
const float x_179 = color.z;
color.z = (x_179 + float(x_176));
}
const int x_183 = obj.numbers[4];
const float x_186 = color.y;
color.y = (x_186 + float(x_183));
const float x_190 = uv.y;
if ((x_190 > 0.25f)) {
const int x_195 = obj.numbers[5];
const float x_198 = color.x;
color.x = (x_198 + float(x_195));
}
const float x_202 = uv.y;
if ((x_202 > 0.5f)) {
const int x_207 = obj.numbers[6];
const float x_210 = color.y;
color.y = (x_210 + float(x_207));
}
const float x_214 = uv.y;
if ((x_214 > 0.75f)) {
const int x_219 = obj.numbers[7];
const float x_222 = color.z;
color.z = (x_222 + float(x_219));
}
const int x_226 = obj.numbers[8];
const float x_229 = color.z;
color.z = (x_229 + float(x_226));
const float x_233 = uv.x;
const float x_235 = uv.y;
if ((abs((x_233 - x_235)) < 0.25f)) {
const int x_242 = obj.numbers[9];
const float x_245 = color.x;
color.x = (x_245 + float(x_242));
}
const float3 x_249 = normalize(color);
frag_color = float4(x_249.x, x_249.y, x_249.z, 1.0f);
gl_Position = x_GLF_pos;
return;
}
struct main_out {
float4 frag_color_1;
float4 gl_Position;
};
struct tint_symbol_1 {
float4 x_GLF_pos_param : TEXCOORD0;
};
struct tint_symbol_2 {
float4 frag_color_1 : TEXCOORD0;
float4 gl_Position : SV_Position;
};
main_out main_inner(float4 x_GLF_pos_param) {
x_GLF_pos = x_GLF_pos_param;
main_1();
const main_out tint_symbol_5 = {frag_color, gl_Position};
return tint_symbol_5;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.frag_color_1 = inner_result.frag_color_1;
wrapper_result.gl_Position = inner_result.gl_Position;
return wrapper_result;
}
C:\src\tint\test\Shader@0x00000203506D3380(133,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x00000203506D3380(132,12-45): error X3531: can't unroll loops marked with loop attribute

View File

@ -45,5 +45,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x00000256420D6A10(14,19-22): error X3696: infinite loop detected - loop never exits
error: validation errors
C:\src\temp\u11r8.0:40: error: Loop must have break.
Validation failed.

View File

@ -45,5 +45,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x000001BA0B4E7BF0(14,19-22): error X3696: infinite loop detected - loop never exits
error: validation errors
C:\src\temp\u1v50.0:40: error: Loop must have break.
Validation failed.

View File

@ -50,7 +50,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x00000252CFFF6880(12,12-23): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
C:\src\tint\test\Shader@0x00000252CFFF6880(12,12-23): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x00000252CFFF6880(21,19-22): error X3696: infinite loop detected - loop never exits
error: validation errors
C:\src\temp\u1f84.0:45: error: Loop must have break.
Validation failed.

View File

@ -50,7 +50,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x00000229EC6CE4C0(12,12-23): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
C:\src\tint\test\Shader@0x00000229EC6CE4C0(12,12-23): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\test\Shader@0x00000229EC6CE4C0(21,19-22): error X3696: infinite loop detected - loop never exits
error: validation errors
C:\src\temp\uk3k.0:45: error: Loop must have break.
Validation failed.

View File

@ -54,3 +54,5 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
Internal compiler error: access violation. Attempted to read from address 0x0000000000000048

View File

@ -54,3 +54,5 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
Internal compiler error: access violation. Attempted to read from address 0x0000000000000048

View File

@ -1,7 +1,20 @@
SKIP: FAILED
void set_float3(inout float3 vec, int idx, float val) {
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
void set_scalar_float4x3(inout float4x3 mat, int col, int row, float val) {
switch (col) {
case 0:
mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0];
break;
case 1:
mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1];
break;
case 2:
mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2];
break;
case 3:
mat[3] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[3];
break;
}
}
cbuffer cbuffer_x_9 : register(b0, space0) {
@ -52,7 +65,7 @@ void main_1() {
{
[loop] for(; (1 < z); c = (c + 1)) {
d = 0;
set_float3(tempm43[(((c >= 0) & (c < 4)) ? c : 0)], (((d >= 0) & (d < 3)) ? d : 0), 1.0f);
set_scalar_float4x3(tempm43, (((d >= 0) & (d < 3)) ? d : 0), (((c >= 0) & (c < 4)) ? c : 0), 1.0f);
}
}
const int x_117 = (((idx >= 0) & (idx < 9)) ? idx : 0);
@ -85,5 +98,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x0000027C57A9E460(51,18-44): error X3531: can't unroll loops marked with loop attribute
error: validation errors
C:\src\temp\umdw.0:93: error: Loop must have break.
Validation failed.

View File

@ -1,7 +1,20 @@
SKIP: FAILED
void set_float3(inout float3 vec, int idx, float val) {
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
void set_scalar_float4x3(inout float4x3 mat, int col, int row, float val) {
switch (col) {
case 0:
mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0];
break;
case 1:
mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1];
break;
case 2:
mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2];
break;
case 3:
mat[3] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[3];
break;
}
}
cbuffer cbuffer_x_9 : register(b0, space0) {
@ -52,15 +65,15 @@ void main_1() {
{
[loop] for(; (1 < z); c = (c + 1)) {
d = 0;
bool tint_tmp = (c >= 0);
bool tint_tmp = (d >= 0);
if (tint_tmp) {
tint_tmp = (c < 4);
tint_tmp = (d < 3);
}
bool tint_tmp_1 = (d >= 0);
bool tint_tmp_1 = (c >= 0);
if (tint_tmp_1) {
tint_tmp_1 = (d < 3);
tint_tmp_1 = (c < 4);
}
set_float3(tempm43[((tint_tmp) ? c : 0)], ((tint_tmp_1) ? d : 0), 1.0f);
set_scalar_float4x3(tempm43, ((tint_tmp) ? d : 0), ((tint_tmp_1) ? c : 0), 1.0f);
}
}
bool tint_tmp_2 = (idx >= 0);
@ -97,5 +110,9 @@ tint_symbol main() {
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x0000011E3650E4B0(51,18-44): error X3531: can't unroll loops marked with loop attribute
error: validation errors
C:\src\temp\u1tig.0:105: error: Loop must have break.
Validation failed.

View File

@ -268,8 +268,19 @@ void main_1() {
const int x_145 = GLF_live4index;
const int x_146 = GLF_live4index;
const float x_269 = GLF_live4obj.even_numbers[1];
GLF_live4obj.even_numbers[(((x_144 >= 0) & (x_145 < 10)) ? x_146 : 0)] = x_269;
GLF_live4obj.even_numbers[(((GLF_live4i >= 0) & (GLF_live4i < 10)) ? GLF_live4i : 0)] = 1.0f;
{
float tint_symbol_1[10] = GLF_live4obj.even_numbers;
tint_symbol_1[(((x_144 >= 0) & (x_145 < 10)) ? x_146 : 0)] = x_269;
GLF_live4obj.even_numbers = tint_symbol_1;
}
const int x_147 = GLF_live4i;
const int x_148 = GLF_live4i;
const int x_149 = GLF_live4i;
{
float tint_symbol_3[10] = GLF_live4obj.even_numbers;
tint_symbol_3[(((x_147 >= 0) & (x_148 < 10)) ? x_149 : 0)] = 1.0f;
GLF_live4obj.even_numbers = tint_symbol_3;
}
}
}
param_24 = treeIndex_1;
@ -337,27 +348,27 @@ void main_1() {
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
struct tint_symbol_5 {
float4 gl_FragCoord_param : SV_Position;
};
struct tint_symbol_2 {
struct tint_symbol_6 {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner(float4 gl_FragCoord_param) {
gl_FragCoord = gl_FragCoord_param;
main_1();
const main_out tint_symbol_4 = {x_GLF_color};
return tint_symbol_4;
const main_out tint_symbol_8 = {x_GLF_color};
return tint_symbol_8;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
tint_symbol_6 main(tint_symbol_5 tint_symbol_4) {
const main_out inner_result = main_inner(tint_symbol_4.gl_FragCoord_param);
tint_symbol_6 wrapper_result = (tint_symbol_6)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x0000028F1D72B060(35,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
C:\src\tint\test\Shader@0x0000028F1D72B060(270,7-91): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x0000028F1D72B060(259,12-53): error X3531: can't unroll loops marked with loop attribute
C:\src\tint\test\Shader@0x000001F7677BB400(35,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
C:\src\tint\test\Shader@0x000001F7677BB400(145,3): warning X4000: use of potentially uninitialized variable (makeFrame_f1_)
internal error: compilation aborted unexpectedly

View File

@ -272,16 +272,27 @@ void main_1() {
const int x_145 = GLF_live4index;
const int x_146 = GLF_live4index;
const float x_269 = GLF_live4obj.even_numbers[1];
bool tint_tmp_1 = (x_144 >= 0);
if (tint_tmp_1) {
tint_tmp_1 = (x_145 < 10);
{
float tint_symbol_1[10] = GLF_live4obj.even_numbers;
bool tint_tmp_1 = (x_144 >= 0);
if (tint_tmp_1) {
tint_tmp_1 = (x_145 < 10);
}
tint_symbol_1[((tint_tmp_1) ? x_146 : 0)] = x_269;
GLF_live4obj.even_numbers = tint_symbol_1;
}
GLF_live4obj.even_numbers[((tint_tmp_1) ? x_146 : 0)] = x_269;
bool tint_tmp_2 = (GLF_live4i >= 0);
if (tint_tmp_2) {
tint_tmp_2 = (GLF_live4i < 10);
const int x_147 = GLF_live4i;
const int x_148 = GLF_live4i;
const int x_149 = GLF_live4i;
{
float tint_symbol_3[10] = GLF_live4obj.even_numbers;
bool tint_tmp_2 = (x_147 >= 0);
if (tint_tmp_2) {
tint_tmp_2 = (x_148 < 10);
}
tint_symbol_3[((tint_tmp_2) ? x_149 : 0)] = 1.0f;
GLF_live4obj.even_numbers = tint_symbol_3;
}
GLF_live4obj.even_numbers[((tint_tmp_2) ? GLF_live4i : 0)] = 1.0f;
}
}
param_24 = treeIndex_1;
@ -349,27 +360,27 @@ void main_1() {
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
struct tint_symbol_5 {
float4 gl_FragCoord_param : SV_Position;
};
struct tint_symbol_2 {
struct tint_symbol_6 {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner(float4 gl_FragCoord_param) {
gl_FragCoord = gl_FragCoord_param;
main_1();
const main_out tint_symbol_4 = {x_GLF_color};
return tint_symbol_4;
const main_out tint_symbol_8 = {x_GLF_color};
return tint_symbol_8;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
tint_symbol_6 main(tint_symbol_5 tint_symbol_4) {
const main_out inner_result = main_inner(tint_symbol_4.gl_FragCoord_param);
tint_symbol_6 wrapper_result = (tint_symbol_6)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
C:\src\tint\test\Shader@0x000001C987F87080(35,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
C:\src\tint\test\Shader@0x000001C987F87080(282,7-64): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\src\tint\test\Shader@0x000001C987F87080(263,12-53): error X3531: can't unroll loops marked with loop attribute
C:\src\tint\test\Shader@0x000001C9889DF080(35,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
C:\src\tint\test\Shader@0x000001C9889DF080(149,3): warning X4000: use of potentially uninitialized variable (makeFrame_f1_)
internal error: compilation aborted unexpectedly