intrinsics: Remove deprected arrayLength instrinsic
Fixed: tint:806 Change-Id: I1d4ad27af73a1f64b926af64a123e2c0c2941e29 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55240 Kokoro: Kokoro <noreply+kokoro@google.com> Auto-Submit: Ben Clayton <bclayton@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
165512c57e
commit
094930433d
File diff suppressed because it is too large
Load Diff
|
@ -216,13 +216,18 @@ TEST_F(IntrinsicTableTest, MismatchPointer) {
|
|||
|
||||
TEST_F(IntrinsicTableTest, MatchArray) {
|
||||
auto* arr = create<sem::Array>(create<sem::U32>(), 0, 4, 4, 4, true);
|
||||
auto* result = table->Lookup(IntrinsicType::kArrayLength, {arr}, Source{});
|
||||
auto* arr_ptr = create<sem::Pointer>(arr, ast::StorageClass::kStorage,
|
||||
ast::Access::kReadWrite);
|
||||
auto* result =
|
||||
table->Lookup(IntrinsicType::kArrayLength, {arr_ptr}, Source{});
|
||||
ASSERT_NE(result, nullptr) << Diagnostics().str();
|
||||
ASSERT_EQ(Diagnostics().str(), "");
|
||||
EXPECT_THAT(result->Type(), IntrinsicType::kArrayLength);
|
||||
EXPECT_TRUE(result->ReturnType()->Is<sem::U32>());
|
||||
ASSERT_EQ(result->Parameters().size(), 1u);
|
||||
EXPECT_TRUE(result->Parameters()[0].type->Is<sem::Array>());
|
||||
auto* param_type = result->Parameters()[0].type;
|
||||
ASSERT_TRUE(param_type->Is<sem::Pointer>());
|
||||
EXPECT_TRUE(param_type->As<sem::Pointer>()->StoreType()->Is<sem::Array>());
|
||||
}
|
||||
|
||||
TEST_F(IntrinsicTableTest, MismatchArray) {
|
||||
|
|
|
@ -263,7 +263,6 @@ fn acos(f32) -> f32
|
|||
fn acos<N: num>(vec<N, f32>) -> vec<N, f32>
|
||||
fn all<N: num>(vec<N, bool>) -> bool
|
||||
fn any<N: num>(vec<N, bool>) -> bool
|
||||
[[deprecated]] fn arrayLength<T>(array<T>) -> u32
|
||||
fn arrayLength<T, A: access>(ptr<storage, array<T>, A>) -> u32
|
||||
fn asin(f32) -> f32
|
||||
fn asin<N: num>(vec<N, f32>) -> vec<N, f32>
|
||||
|
|
|
@ -774,7 +774,7 @@ TEST_F(ResolverIntrinsicDataTest, ArrayLength_Vector) {
|
|||
create<ast::GroupDecoration>(0),
|
||||
});
|
||||
|
||||
auto* call = Call("arrayLength", MemberAccessor("a", "x"));
|
||||
auto* call = Call("arrayLength", AddressOf(MemberAccessor("a", "x")));
|
||||
WrapInFunction(call);
|
||||
|
||||
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -785,15 +785,16 @@ TEST_F(ResolverIntrinsicDataTest, ArrayLength_Vector) {
|
|||
|
||||
TEST_F(ResolverIntrinsicDataTest, ArrayLength_Error_ArraySized) {
|
||||
Global("arr", ty.array<int, 4>(), ast::StorageClass::kInput);
|
||||
auto* call = Call("arrayLength", "arr");
|
||||
auto* call = Call("arrayLength", AddressOf("arr"));
|
||||
WrapInFunction(call);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
|
||||
EXPECT_EQ(r()->error(), R"(error: no matching call to arrayLength(array<i32, 4>)
|
||||
EXPECT_EQ(
|
||||
r()->error(),
|
||||
R"(error: no matching call to arrayLength(ptr<in, array<i32, 4>, read_write>)
|
||||
|
||||
2 candidate functions:
|
||||
arrayLength(array<T>) -> u32
|
||||
1 candidate function:
|
||||
arrayLength(ptr<storage, array<T>, A>) -> u32
|
||||
)");
|
||||
}
|
||||
|
|
|
@ -608,7 +608,7 @@ let c : u32 = 1u;
|
|||
fn f() {
|
||||
let b : f32 = s.b[c];
|
||||
let x : i32 = min(1, 2);
|
||||
let y : u32 = arrayLength(s.b);
|
||||
let y : u32 = arrayLength(&s.b);
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -626,7 +626,7 @@ let c : u32 = 1u;
|
|||
fn f() {
|
||||
let b : f32 = s.b[min(u32(c), (arrayLength(&(s.b)) - 1u))];
|
||||
let x : i32 = min(1, 2);
|
||||
let y : u32 = arrayLength(s.b);
|
||||
let y : u32 = arrayLength(&(s.b));
|
||||
}
|
||||
)";
|
||||
|
||||
|
|
|
@ -129,23 +129,22 @@ Output CalculateArrayLength::Run(const Program* in, const DataMap&) {
|
|||
// * An expression must not evaluate to a runtime-sized array type.
|
||||
//
|
||||
// We can assume that the arrayLength() call has a single argument of
|
||||
// the form: arrayLength(&X.Y) or the now deprecated form
|
||||
// arrayLength(X.Y) where X is an expression that resolves to the
|
||||
// storage buffer structure, and Y is the runtime sized array.
|
||||
auto* array_expr = call_expr->params()[0];
|
||||
|
||||
// TODO(crbug.com/tint/806): Once the deprecated arrayLength()
|
||||
// overload is removed, this can safely assume a pointer arg.
|
||||
if (auto* address_of = array_expr->As<ast::UnaryOpExpression>()) {
|
||||
if (address_of->op() == ast::UnaryOp::kAddressOf) {
|
||||
array_expr = address_of->expr();
|
||||
}
|
||||
// the form: arrayLength(&X.Y) where X is an expression that resolves
|
||||
// to the storage buffer structure, and Y is the runtime sized array.
|
||||
auto* arg = call_expr->params()[0];
|
||||
auto* address_of = arg->As<ast::UnaryOpExpression>();
|
||||
if (!address_of || address_of->op() != ast::UnaryOp::kAddressOf) {
|
||||
TINT_ICE(ctx.dst->Diagnostics())
|
||||
<< "arrayLength() expected pointer to member access, got "
|
||||
<< address_of->TypeInfo().name;
|
||||
}
|
||||
auto* array_expr = address_of->expr();
|
||||
|
||||
auto* accessor = array_expr->As<ast::MemberAccessorExpression>();
|
||||
if (!accessor) {
|
||||
TINT_ICE(ctx.dst->Diagnostics())
|
||||
<< "arrayLength() expected ast::MemberAccessorExpression, got "
|
||||
<< "arrayLength() expected pointer to member access, got "
|
||||
"pointer to "
|
||||
<< array_expr->TypeInfo().name;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -22,268 +22,6 @@ namespace {
|
|||
|
||||
using CalculateArrayLengthTest = TransformTest;
|
||||
|
||||
// TODO(crbug.com/tint/806): Remove
|
||||
TEST_F(CalculateArrayLengthTest, Basic_DEPRECATED) {
|
||||
auto* src = R"(
|
||||
[[block]]
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<storage, read> sb : SB;
|
||||
|
||||
[[stage(compute)]]
|
||||
fn main() {
|
||||
var len : u32 = arrayLength(sb.arr);
|
||||
}
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
[[block]]
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
};
|
||||
|
||||
[[internal(intrinsic_buffer_size)]]
|
||||
fn tint_symbol(buffer : SB, result : ptr<function, u32>)
|
||||
|
||||
[[group(0), binding(0)]] var<storage, read> sb : SB;
|
||||
|
||||
[[stage(compute)]]
|
||||
fn main() {
|
||||
var tint_symbol_1 : u32 = 0u;
|
||||
tint_symbol(sb, &(tint_symbol_1));
|
||||
let tint_symbol_2 : u32 = ((tint_symbol_1 - 4u) / 4u);
|
||||
var len : u32 = tint_symbol_2;
|
||||
}
|
||||
)";
|
||||
|
||||
auto got = Run<CalculateArrayLength>(src);
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// TODO(crbug.com/tint/806): Remove
|
||||
TEST_F(CalculateArrayLengthTest, InSameBlock_DEPRECATED) {
|
||||
auto* src = R"(
|
||||
[[block]]
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<storage, read> sb : SB;
|
||||
|
||||
[[stage(compute)]]
|
||||
fn main() {
|
||||
var a : u32 = arrayLength(sb.arr);
|
||||
var b : u32 = arrayLength(sb.arr);
|
||||
var c : u32 = arrayLength(sb.arr);
|
||||
}
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
[[block]]
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
};
|
||||
|
||||
[[internal(intrinsic_buffer_size)]]
|
||||
fn tint_symbol(buffer : SB, result : ptr<function, u32>)
|
||||
|
||||
[[group(0), binding(0)]] var<storage, read> sb : SB;
|
||||
|
||||
[[stage(compute)]]
|
||||
fn main() {
|
||||
var tint_symbol_1 : u32 = 0u;
|
||||
tint_symbol(sb, &(tint_symbol_1));
|
||||
let tint_symbol_2 : u32 = ((tint_symbol_1 - 4u) / 4u);
|
||||
var a : u32 = tint_symbol_2;
|
||||
var b : u32 = tint_symbol_2;
|
||||
var c : u32 = tint_symbol_2;
|
||||
}
|
||||
)";
|
||||
|
||||
auto got = Run<CalculateArrayLength>(src);
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// TODO(crbug.com/tint/806): Remove
|
||||
TEST_F(CalculateArrayLengthTest, WithStride_DEPRECATED) {
|
||||
auto* src = R"(
|
||||
[[block]]
|
||||
struct SB {
|
||||
x : i32;
|
||||
y : f32;
|
||||
arr : [[stride(64)]] array<i32>;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<storage, read> sb : SB;
|
||||
|
||||
[[stage(compute)]]
|
||||
fn main() {
|
||||
var len : u32 = arrayLength(sb.arr);
|
||||
}
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
[[block]]
|
||||
struct SB {
|
||||
x : i32;
|
||||
y : f32;
|
||||
arr : [[stride(64)]] array<i32>;
|
||||
};
|
||||
|
||||
[[internal(intrinsic_buffer_size)]]
|
||||
fn tint_symbol(buffer : SB, result : ptr<function, u32>)
|
||||
|
||||
[[group(0), binding(0)]] var<storage, read> sb : SB;
|
||||
|
||||
[[stage(compute)]]
|
||||
fn main() {
|
||||
var tint_symbol_1 : u32 = 0u;
|
||||
tint_symbol(sb, &(tint_symbol_1));
|
||||
let tint_symbol_2 : u32 = ((tint_symbol_1 - 8u) / 64u);
|
||||
var len : u32 = tint_symbol_2;
|
||||
}
|
||||
)";
|
||||
|
||||
auto got = Run<CalculateArrayLength>(src);
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// TODO(crbug.com/tint/806): Remove
|
||||
TEST_F(CalculateArrayLengthTest, Nested_DEPRECATED) {
|
||||
auto* src = R"(
|
||||
[[block]]
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<storage, read> sb : SB;
|
||||
|
||||
[[stage(compute)]]
|
||||
fn main() {
|
||||
if (true) {
|
||||
var len : u32 = arrayLength(sb.arr);
|
||||
} else {
|
||||
if (true) {
|
||||
var len : u32 = arrayLength(sb.arr);
|
||||
}
|
||||
}
|
||||
}
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
[[block]]
|
||||
struct SB {
|
||||
x : i32;
|
||||
arr : array<i32>;
|
||||
};
|
||||
|
||||
[[internal(intrinsic_buffer_size)]]
|
||||
fn tint_symbol(buffer : SB, result : ptr<function, u32>)
|
||||
|
||||
[[group(0), binding(0)]] var<storage, read> sb : SB;
|
||||
|
||||
[[stage(compute)]]
|
||||
fn main() {
|
||||
if (true) {
|
||||
var tint_symbol_1 : u32 = 0u;
|
||||
tint_symbol(sb, &(tint_symbol_1));
|
||||
let tint_symbol_2 : u32 = ((tint_symbol_1 - 4u) / 4u);
|
||||
var len : u32 = tint_symbol_2;
|
||||
} else {
|
||||
if (true) {
|
||||
var tint_symbol_3 : u32 = 0u;
|
||||
tint_symbol(sb, &(tint_symbol_3));
|
||||
let tint_symbol_4 : u32 = ((tint_symbol_3 - 4u) / 4u);
|
||||
var len : u32 = tint_symbol_4;
|
||||
}
|
||||
}
|
||||
}
|
||||
)";
|
||||
|
||||
auto got = Run<CalculateArrayLength>(src);
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// TODO(crbug.com/tint/806): Remove
|
||||
TEST_F(CalculateArrayLengthTest, MultipleStorageBuffers_DEPRECATED) {
|
||||
auto* src = R"(
|
||||
[[block]]
|
||||
struct SB1 {
|
||||
x : i32;
|
||||
arr1 : array<i32>;
|
||||
};
|
||||
|
||||
[[block]]
|
||||
struct SB2 {
|
||||
x : i32;
|
||||
arr2 : array<vec4<f32>>;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<storage, read> sb1 : SB1;
|
||||
|
||||
[[group(0), binding(1)]] var<storage, read> sb2 : SB2;
|
||||
|
||||
[[stage(compute)]]
|
||||
fn main() {
|
||||
var len1 : u32 = arrayLength(sb1.arr1);
|
||||
var len2 : u32 = arrayLength(sb2.arr2);
|
||||
var x : u32 = (len1 + len2);
|
||||
}
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
[[block]]
|
||||
struct SB1 {
|
||||
x : i32;
|
||||
arr1 : array<i32>;
|
||||
};
|
||||
|
||||
[[internal(intrinsic_buffer_size)]]
|
||||
fn tint_symbol(buffer : SB1, result : ptr<function, u32>)
|
||||
|
||||
[[block]]
|
||||
struct SB2 {
|
||||
x : i32;
|
||||
arr2 : array<vec4<f32>>;
|
||||
};
|
||||
|
||||
[[internal(intrinsic_buffer_size)]]
|
||||
fn tint_symbol_3(buffer : SB2, result : ptr<function, u32>)
|
||||
|
||||
[[group(0), binding(0)]] var<storage, read> sb1 : SB1;
|
||||
|
||||
[[group(0), binding(1)]] var<storage, read> sb2 : SB2;
|
||||
|
||||
[[stage(compute)]]
|
||||
fn main() {
|
||||
var tint_symbol_1 : u32 = 0u;
|
||||
tint_symbol(sb1, &(tint_symbol_1));
|
||||
let tint_symbol_2 : u32 = ((tint_symbol_1 - 4u) / 4u);
|
||||
var tint_symbol_4 : u32 = 0u;
|
||||
tint_symbol_3(sb2, &(tint_symbol_4));
|
||||
let tint_symbol_5 : u32 = ((tint_symbol_4 - 16u) / 16u);
|
||||
var len1 : u32 = tint_symbol_2;
|
||||
var len2 : u32 = tint_symbol_5;
|
||||
var x : u32 = (len1 + len2);
|
||||
}
|
||||
)";
|
||||
|
||||
auto got = Run<CalculateArrayLength>(src);
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
TEST_F(CalculateArrayLengthTest, Basic) {
|
||||
auto* src = R"(
|
||||
[[block]]
|
||||
|
|
|
@ -25,50 +25,6 @@ namespace {
|
|||
|
||||
using HlslSanitizerTest = TestHelper;
|
||||
|
||||
// TODO(crbug.com/tint/806): Remove
|
||||
TEST_F(HlslSanitizerTest, ArrayLength_DEPRECATED) {
|
||||
auto* sb_ty = Structure("SB",
|
||||
{
|
||||
Member("x", ty.f32()),
|
||||
Member("arr", ty.array(ty.vec4<f32>())),
|
||||
},
|
||||
{
|
||||
create<ast::StructBlockDecoration>(),
|
||||
});
|
||||
|
||||
Global("sb", ty.Of(sb_ty), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::DecorationList{
|
||||
create<ast::BindingDecoration>(0),
|
||||
create<ast::GroupDecoration>(1),
|
||||
});
|
||||
|
||||
Func("main", ast::VariableList{}, ty.void_(),
|
||||
{
|
||||
Decl(Var("len", ty.u32(), ast::StorageClass::kNone,
|
||||
Call("arrayLength", MemberAccessor("sb", "arr")))),
|
||||
},
|
||||
{
|
||||
Stage(ast::PipelineStage::kFragment),
|
||||
});
|
||||
|
||||
GeneratorImpl& gen = SanitizeAndBuild();
|
||||
|
||||
ASSERT_TRUE(gen.Generate(out)) << gen.error();
|
||||
|
||||
auto got = result();
|
||||
auto* expect = R"(ByteAddressBuffer sb : register(t0, space1);
|
||||
|
||||
void main() {
|
||||
uint tint_symbol_1 = 0u;
|
||||
sb.GetDimensions(tint_symbol_1);
|
||||
const uint tint_symbol_2 = ((tint_symbol_1 - 16u) / 16u);
|
||||
uint len = tint_symbol_2;
|
||||
return;
|
||||
}
|
||||
)";
|
||||
EXPECT_EQ(expect, got);
|
||||
}
|
||||
|
||||
TEST_F(HlslSanitizerTest, Call_ArrayLength) {
|
||||
auto* s = Structure("my_struct", {Member(0, "a", ty.array<f32>(4))},
|
||||
{create<ast::StructBlockDecoration>()});
|
||||
|
|
|
@ -2230,17 +2230,19 @@ uint32_t Builder::GenerateIntrinsic(ast::CallExpression* call,
|
|||
}
|
||||
auto* arg = call->params()[0];
|
||||
|
||||
// TODO(crbug.com/tint/806): Once the deprecated arrayLength()
|
||||
// overload is removed, this can safely assume a pointer arg.
|
||||
if (auto* address_of = arg->As<ast::UnaryOpExpression>()) {
|
||||
arg = address_of->expr();
|
||||
auto* address_of = arg->As<ast::UnaryOpExpression>();
|
||||
if (!address_of || address_of->op() != ast::UnaryOp::kAddressOf) {
|
||||
error_ = "arrayLength() expected pointer to member access, got " +
|
||||
std::string(address_of->TypeInfo().name);
|
||||
return 0;
|
||||
}
|
||||
auto* array_expr = address_of->expr();
|
||||
|
||||
auto* accessor = arg->As<ast::MemberAccessorExpression>();
|
||||
if (accessor == nullptr) {
|
||||
// The InlinePtrLets and Simplify transforms should have sanitized any
|
||||
// lets, or &*&*& noise.
|
||||
error_ = "expected argument to arrayLength() to be a member accessor";
|
||||
auto* accessor = array_expr->As<ast::MemberAccessorExpression>();
|
||||
if (!accessor) {
|
||||
error_ =
|
||||
"arrayLength() expected pointer to member access, got pointer to " +
|
||||
std::string(array_expr->TypeInfo().name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1570,102 +1570,6 @@ OpFunctionEnd
|
|||
)");
|
||||
}
|
||||
|
||||
// TODO(crbug.com/tint/806): Remove
|
||||
TEST_F(IntrinsicBuilderTest, Call_ArrayLength_DEPRECATED) {
|
||||
auto* s = Structure("my_struct", {Member("a", ty.array<f32>(4))},
|
||||
{create<ast::StructBlockDecoration>()});
|
||||
Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::DecorationList{
|
||||
create<ast::BindingDecoration>(1),
|
||||
create<ast::GroupDecoration>(2),
|
||||
});
|
||||
|
||||
auto* expr = Call("arrayLength", MemberAccessor("b", "a"));
|
||||
|
||||
Func("a_func", ast::VariableList{}, ty.void_(),
|
||||
ast::StatementList{
|
||||
Ignore(expr),
|
||||
},
|
||||
ast::DecorationList{
|
||||
Stage(ast::PipelineStage::kFragment),
|
||||
});
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
||||
ASSERT_TRUE(b.Build()) << b.error();
|
||||
|
||||
ASSERT_EQ(b.functions().size(), 1u);
|
||||
|
||||
auto* expected_types = R"(%5 = OpTypeFloat 32
|
||||
%4 = OpTypeRuntimeArray %5
|
||||
%3 = OpTypeStruct %4
|
||||
%2 = OpTypePointer StorageBuffer %3
|
||||
%1 = OpVariable %2 StorageBuffer
|
||||
%7 = OpTypeVoid
|
||||
%6 = OpTypeFunction %7
|
||||
%12 = OpTypeInt 32 0
|
||||
)";
|
||||
auto got_types = DumpInstructions(b.types());
|
||||
EXPECT_EQ(expected_types, got_types);
|
||||
|
||||
auto* expected_instructions = R"(%11 = OpArrayLength %12 %1 0
|
||||
)";
|
||||
auto got_instructions = DumpInstructions(b.functions()[0].instructions());
|
||||
EXPECT_EQ(expected_instructions, got_instructions);
|
||||
|
||||
Validate(b);
|
||||
}
|
||||
|
||||
// TODO(crbug.com/tint/806): Remove
|
||||
TEST_F(IntrinsicBuilderTest, Call_ArrayLength_OtherMembersInStruct_DEPRECATED) {
|
||||
auto* s = Structure("my_struct",
|
||||
{
|
||||
Member("z", ty.f32()),
|
||||
Member(4, "a", ty.array<f32>(4)),
|
||||
},
|
||||
{create<ast::StructBlockDecoration>()});
|
||||
Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::DecorationList{
|
||||
create<ast::BindingDecoration>(1),
|
||||
create<ast::GroupDecoration>(2),
|
||||
});
|
||||
|
||||
auto* expr = Call("arrayLength", MemberAccessor("b", "a"));
|
||||
|
||||
Func("a_func", ast::VariableList{}, ty.void_(),
|
||||
ast::StatementList{
|
||||
Ignore(expr),
|
||||
},
|
||||
ast::DecorationList{
|
||||
Stage(ast::PipelineStage::kFragment),
|
||||
});
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
||||
ASSERT_TRUE(b.Build()) << b.error();
|
||||
|
||||
ASSERT_EQ(b.functions().size(), 1u);
|
||||
|
||||
auto* expected_types = R"(%4 = OpTypeFloat 32
|
||||
%5 = OpTypeRuntimeArray %4
|
||||
%3 = OpTypeStruct %4 %5
|
||||
%2 = OpTypePointer StorageBuffer %3
|
||||
%1 = OpVariable %2 StorageBuffer
|
||||
%7 = OpTypeVoid
|
||||
%6 = OpTypeFunction %7
|
||||
%12 = OpTypeInt 32 0
|
||||
)";
|
||||
auto got_types = DumpInstructions(b.types());
|
||||
EXPECT_EQ(expected_types, got_types);
|
||||
|
||||
auto* expected_instructions = R"(%11 = OpArrayLength %12 %1 1
|
||||
)";
|
||||
auto got_instructions = DumpInstructions(b.functions()[0].instructions());
|
||||
EXPECT_EQ(expected_instructions, got_instructions);
|
||||
|
||||
Validate(b);
|
||||
}
|
||||
|
||||
TEST_F(IntrinsicBuilderTest, Call_ArrayLength) {
|
||||
auto* s = Structure("my_struct", {Member("a", ty.array<f32>(4))},
|
||||
{create<ast::StructBlockDecoration>()});
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
// 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.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[block]]
|
||||
struct SB_RO {
|
||||
arg_0: array<u32>;
|
||||
};
|
||||
[[group(0), binding(1)]] var<storage, read> sb_ro : SB_RO;
|
||||
|
||||
// fn arrayLength(array<u32>) -> u32
|
||||
fn arrayLength_647a40() {
|
||||
var res: u32 = arrayLength(sb_ro.arg_0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
arrayLength_647a40();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
arrayLength_647a40();
|
||||
}
|
||||
|
||||
[[stage(compute)]]
|
||||
fn compute_main() {
|
||||
arrayLength_647a40();
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
intrinsics/gen/arrayLength/647a40.wgsl:33:18 warning: use of deprecated intrinsic
|
||||
var res: u32 = arrayLength(sb_ro.arg_0);
|
||||
^^^^^^^^^^^
|
||||
|
||||
ByteAddressBuffer sb_ro : register(t1, space0);
|
||||
|
||||
void arrayLength_647a40() {
|
||||
uint tint_symbol_2 = 0u;
|
||||
sb_ro.GetDimensions(tint_symbol_2);
|
||||
const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u);
|
||||
uint res = tint_symbol_3;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
arrayLength_647a40();
|
||||
const tint_symbol tint_symbol_4 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
arrayLength_647a40();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
arrayLength_647a40();
|
||||
return;
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
SKIP: FAILED
|
||||
|
||||
intrinsics/gen/arrayLength/647a40.wgsl:33:18 warning: use of deprecated intrinsic
|
||||
var res: u32 = arrayLength(sb_ro.arg_0);
|
||||
^^^^^^^^^^^
|
||||
|
||||
|
||||
[[block]]
|
||||
struct SB_RO {
|
||||
arg_0 : array<u32>;
|
||||
};
|
||||
|
||||
[[group(0), binding(1)]] var<storage, read> sb_ro : SB_RO;
|
||||
|
||||
fn arrayLength_647a40() {
|
||||
var res : u32 = arrayLength(sb_ro.arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
[[builtin(position)]]
|
||||
value : vec4<f32>;
|
||||
};
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> tint_symbol {
|
||||
arrayLength_647a40();
|
||||
let tint_symbol_1 : tint_symbol = tint_symbol(vec4<f32>());
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
arrayLength_647a40();
|
||||
}
|
||||
|
||||
[[stage(compute)]]
|
||||
fn compute_main() {
|
||||
arrayLength_647a40();
|
||||
}
|
||||
|
||||
Failed to generate: error: Unknown import method: arrayLength
|
|
@ -1,85 +0,0 @@
|
|||
intrinsics/gen/arrayLength/647a40.wgsl:33:18 warning: use of deprecated intrinsic
|
||||
var res: u32 = arrayLength(sb_ro.arg_0);
|
||||
^^^^^^^^^^^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 37
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %tint_pointsize "tint_pointsize"
|
||||
OpName %SB_RO "SB_RO"
|
||||
OpMemberName %SB_RO 0 "arg_0"
|
||||
OpName %sb_ro "sb_ro"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %arrayLength_647a40 "arrayLength_647a40"
|
||||
OpName %res "res"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %tint_pointsize BuiltIn PointSize
|
||||
OpDecorate %SB_RO Block
|
||||
OpMemberDecorate %SB_RO 0 Offset 0
|
||||
OpDecorate %_runtimearr_uint ArrayStride 4
|
||||
OpDecorate %sb_ro NonWritable
|
||||
OpDecorate %sb_ro DescriptorSet 0
|
||||
OpDecorate %sb_ro Binding 1
|
||||
OpDecorate %tint_symbol_1 BuiltIn Position
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%4 = OpConstantNull %float
|
||||
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
|
||||
%uint = OpTypeInt 32 0
|
||||
%_runtimearr_uint = OpTypeRuntimeArray %uint
|
||||
%SB_RO = OpTypeStruct %_runtimearr_uint
|
||||
%_ptr_StorageBuffer_SB_RO = OpTypePointer StorageBuffer %SB_RO
|
||||
%sb_ro = OpVariable %_ptr_StorageBuffer_SB_RO StorageBuffer
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%13 = OpConstantNull %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %13
|
||||
%void = OpTypeVoid
|
||||
%14 = OpTypeFunction %void
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%21 = OpConstantNull %uint
|
||||
%22 = OpTypeFunction %void %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%arrayLength_647a40 = OpFunction %void None %14
|
||||
%17 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_uint Function %21
|
||||
%18 = OpArrayLength %uint %sb_ro 0
|
||||
OpStore %res %18
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %22
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%25 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %14
|
||||
%27 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%29 = OpFunctionCall %void %arrayLength_647a40
|
||||
%30 = OpFunctionCall %void %tint_symbol_2 %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %14
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %arrayLength_647a40
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %14
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %void %arrayLength_647a40
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -1,30 +0,0 @@
|
|||
intrinsics/gen/arrayLength/647a40.wgsl:33:18 warning: use of deprecated intrinsic
|
||||
var res: u32 = arrayLength(sb_ro.arg_0);
|
||||
^^^^^^^^^^^
|
||||
|
||||
[[block]]
|
||||
struct SB_RO {
|
||||
arg_0 : array<u32>;
|
||||
};
|
||||
|
||||
[[group(0), binding(1)]] var<storage, read> sb_ro : SB_RO;
|
||||
|
||||
fn arrayLength_647a40() {
|
||||
var res : u32 = arrayLength(sb_ro.arg_0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
arrayLength_647a40();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
arrayLength_647a40();
|
||||
}
|
||||
|
||||
[[stage(compute)]]
|
||||
fn compute_main() {
|
||||
arrayLength_647a40();
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
// 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.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[block]]
|
||||
struct SB_RO {
|
||||
arg_0: array<i32>;
|
||||
};
|
||||
[[group(0), binding(1)]] var<storage, read> sb_ro : SB_RO;
|
||||
|
||||
// fn arrayLength(array<i32>) -> u32
|
||||
fn arrayLength_721c9d() {
|
||||
var res: u32 = arrayLength(sb_ro.arg_0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
arrayLength_721c9d();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
arrayLength_721c9d();
|
||||
}
|
||||
|
||||
[[stage(compute)]]
|
||||
fn compute_main() {
|
||||
arrayLength_721c9d();
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
intrinsics/gen/arrayLength/721c9d.wgsl:33:18 warning: use of deprecated intrinsic
|
||||
var res: u32 = arrayLength(sb_ro.arg_0);
|
||||
^^^^^^^^^^^
|
||||
|
||||
ByteAddressBuffer sb_ro : register(t1, space0);
|
||||
|
||||
void arrayLength_721c9d() {
|
||||
uint tint_symbol_2 = 0u;
|
||||
sb_ro.GetDimensions(tint_symbol_2);
|
||||
const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u);
|
||||
uint res = tint_symbol_3;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
arrayLength_721c9d();
|
||||
const tint_symbol tint_symbol_4 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
arrayLength_721c9d();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
arrayLength_721c9d();
|
||||
return;
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
SKIP: FAILED
|
||||
|
||||
intrinsics/gen/arrayLength/721c9d.wgsl:33:18 warning: use of deprecated intrinsic
|
||||
var res: u32 = arrayLength(sb_ro.arg_0);
|
||||
^^^^^^^^^^^
|
||||
|
||||
|
||||
[[block]]
|
||||
struct SB_RO {
|
||||
arg_0 : array<i32>;
|
||||
};
|
||||
|
||||
[[group(0), binding(1)]] var<storage, read> sb_ro : SB_RO;
|
||||
|
||||
fn arrayLength_721c9d() {
|
||||
var res : u32 = arrayLength(sb_ro.arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
[[builtin(position)]]
|
||||
value : vec4<f32>;
|
||||
};
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> tint_symbol {
|
||||
arrayLength_721c9d();
|
||||
let tint_symbol_1 : tint_symbol = tint_symbol(vec4<f32>());
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
arrayLength_721c9d();
|
||||
}
|
||||
|
||||
[[stage(compute)]]
|
||||
fn compute_main() {
|
||||
arrayLength_721c9d();
|
||||
}
|
||||
|
||||
Failed to generate: error: Unknown import method: arrayLength
|
|
@ -1,86 +0,0 @@
|
|||
intrinsics/gen/arrayLength/721c9d.wgsl:33:18 warning: use of deprecated intrinsic
|
||||
var res: u32 = arrayLength(sb_ro.arg_0);
|
||||
^^^^^^^^^^^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 38
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %tint_pointsize "tint_pointsize"
|
||||
OpName %SB_RO "SB_RO"
|
||||
OpMemberName %SB_RO 0 "arg_0"
|
||||
OpName %sb_ro "sb_ro"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %arrayLength_721c9d "arrayLength_721c9d"
|
||||
OpName %res "res"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %tint_pointsize BuiltIn PointSize
|
||||
OpDecorate %SB_RO Block
|
||||
OpMemberDecorate %SB_RO 0 Offset 0
|
||||
OpDecorate %_runtimearr_int ArrayStride 4
|
||||
OpDecorate %sb_ro NonWritable
|
||||
OpDecorate %sb_ro DescriptorSet 0
|
||||
OpDecorate %sb_ro Binding 1
|
||||
OpDecorate %tint_symbol_1 BuiltIn Position
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%4 = OpConstantNull %float
|
||||
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
|
||||
%int = OpTypeInt 32 1
|
||||
%_runtimearr_int = OpTypeRuntimeArray %int
|
||||
%SB_RO = OpTypeStruct %_runtimearr_int
|
||||
%_ptr_StorageBuffer_SB_RO = OpTypePointer StorageBuffer %SB_RO
|
||||
%sb_ro = OpVariable %_ptr_StorageBuffer_SB_RO StorageBuffer
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%13 = OpConstantNull %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %13
|
||||
%void = OpTypeVoid
|
||||
%14 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%22 = OpConstantNull %uint
|
||||
%23 = OpTypeFunction %void %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%arrayLength_721c9d = OpFunction %void None %14
|
||||
%17 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_uint Function %22
|
||||
%18 = OpArrayLength %uint %sb_ro 0
|
||||
OpStore %res %18
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %23
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%26 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %14
|
||||
%28 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%30 = OpFunctionCall %void %arrayLength_721c9d
|
||||
%31 = OpFunctionCall %void %tint_symbol_2 %13
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %14
|
||||
%33 = OpLabel
|
||||
%34 = OpFunctionCall %void %arrayLength_721c9d
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %14
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %arrayLength_721c9d
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -1,30 +0,0 @@
|
|||
intrinsics/gen/arrayLength/721c9d.wgsl:33:18 warning: use of deprecated intrinsic
|
||||
var res: u32 = arrayLength(sb_ro.arg_0);
|
||||
^^^^^^^^^^^
|
||||
|
||||
[[block]]
|
||||
struct SB_RO {
|
||||
arg_0 : array<i32>;
|
||||
};
|
||||
|
||||
[[group(0), binding(1)]] var<storage, read> sb_ro : SB_RO;
|
||||
|
||||
fn arrayLength_721c9d() {
|
||||
var res : u32 = arrayLength(sb_ro.arg_0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
arrayLength_721c9d();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
arrayLength_721c9d();
|
||||
}
|
||||
|
||||
[[stage(compute)]]
|
||||
fn compute_main() {
|
||||
arrayLength_721c9d();
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
// 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.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[block]]
|
||||
struct SB_RO {
|
||||
arg_0: array<f32>;
|
||||
};
|
||||
[[group(0), binding(1)]] var<storage, read> sb_ro : SB_RO;
|
||||
|
||||
// fn arrayLength(array<f32>) -> u32
|
||||
fn arrayLength_b083be() {
|
||||
var res: u32 = arrayLength(sb_ro.arg_0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
arrayLength_b083be();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
arrayLength_b083be();
|
||||
}
|
||||
|
||||
[[stage(compute)]]
|
||||
fn compute_main() {
|
||||
arrayLength_b083be();
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
intrinsics/gen/arrayLength/b083be.wgsl:33:18 warning: use of deprecated intrinsic
|
||||
var res: u32 = arrayLength(sb_ro.arg_0);
|
||||
^^^^^^^^^^^
|
||||
|
||||
ByteAddressBuffer sb_ro : register(t1, space0);
|
||||
|
||||
void arrayLength_b083be() {
|
||||
uint tint_symbol_2 = 0u;
|
||||
sb_ro.GetDimensions(tint_symbol_2);
|
||||
const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u);
|
||||
uint res = tint_symbol_3;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
arrayLength_b083be();
|
||||
const tint_symbol tint_symbol_4 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
arrayLength_b083be();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
arrayLength_b083be();
|
||||
return;
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
SKIP: FAILED
|
||||
|
||||
intrinsics/gen/arrayLength/b083be.wgsl:33:18 warning: use of deprecated intrinsic
|
||||
var res: u32 = arrayLength(sb_ro.arg_0);
|
||||
^^^^^^^^^^^
|
||||
|
||||
|
||||
[[block]]
|
||||
struct SB_RO {
|
||||
arg_0 : array<f32>;
|
||||
};
|
||||
|
||||
[[group(0), binding(1)]] var<storage, read> sb_ro : SB_RO;
|
||||
|
||||
fn arrayLength_b083be() {
|
||||
var res : u32 = arrayLength(sb_ro.arg_0);
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
[[builtin(position)]]
|
||||
value : vec4<f32>;
|
||||
};
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> tint_symbol {
|
||||
arrayLength_b083be();
|
||||
let tint_symbol_1 : tint_symbol = tint_symbol(vec4<f32>());
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
arrayLength_b083be();
|
||||
}
|
||||
|
||||
[[stage(compute)]]
|
||||
fn compute_main() {
|
||||
arrayLength_b083be();
|
||||
}
|
||||
|
||||
Failed to generate: error: Unknown import method: arrayLength
|
|
@ -1,85 +0,0 @@
|
|||
intrinsics/gen/arrayLength/b083be.wgsl:33:18 warning: use of deprecated intrinsic
|
||||
var res: u32 = arrayLength(sb_ro.arg_0);
|
||||
^^^^^^^^^^^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 37
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %tint_pointsize "tint_pointsize"
|
||||
OpName %SB_RO "SB_RO"
|
||||
OpMemberName %SB_RO 0 "arg_0"
|
||||
OpName %sb_ro "sb_ro"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %arrayLength_b083be "arrayLength_b083be"
|
||||
OpName %res "res"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %tint_pointsize BuiltIn PointSize
|
||||
OpDecorate %SB_RO Block
|
||||
OpMemberDecorate %SB_RO 0 Offset 0
|
||||
OpDecorate %_runtimearr_float ArrayStride 4
|
||||
OpDecorate %sb_ro NonWritable
|
||||
OpDecorate %sb_ro DescriptorSet 0
|
||||
OpDecorate %sb_ro Binding 1
|
||||
OpDecorate %tint_symbol_1 BuiltIn Position
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%4 = OpConstantNull %float
|
||||
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
|
||||
%_runtimearr_float = OpTypeRuntimeArray %float
|
||||
%SB_RO = OpTypeStruct %_runtimearr_float
|
||||
%_ptr_StorageBuffer_SB_RO = OpTypePointer StorageBuffer %SB_RO
|
||||
%sb_ro = OpVariable %_ptr_StorageBuffer_SB_RO StorageBuffer
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%12 = OpConstantNull %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12
|
||||
%void = OpTypeVoid
|
||||
%13 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%21 = OpConstantNull %uint
|
||||
%22 = OpTypeFunction %void %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%arrayLength_b083be = OpFunction %void None %13
|
||||
%16 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_uint Function %21
|
||||
%17 = OpArrayLength %uint %sb_ro 0
|
||||
OpStore %res %17
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %22
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%25 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %13
|
||||
%27 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%29 = OpFunctionCall %void %arrayLength_b083be
|
||||
%30 = OpFunctionCall %void %tint_symbol_2 %12
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %13
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %arrayLength_b083be
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %13
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %void %arrayLength_b083be
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -1,30 +0,0 @@
|
|||
intrinsics/gen/arrayLength/b083be.wgsl:33:18 warning: use of deprecated intrinsic
|
||||
var res: u32 = arrayLength(sb_ro.arg_0);
|
||||
^^^^^^^^^^^
|
||||
|
||||
[[block]]
|
||||
struct SB_RO {
|
||||
arg_0 : array<f32>;
|
||||
};
|
||||
|
||||
[[group(0), binding(1)]] var<storage, read> sb_ro : SB_RO;
|
||||
|
||||
fn arrayLength_b083be() {
|
||||
var res : u32 = arrayLength(sb_ro.arg_0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
arrayLength_b083be();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
arrayLength_b083be();
|
||||
}
|
||||
|
||||
[[stage(compute)]]
|
||||
fn compute_main() {
|
||||
arrayLength_b083be();
|
||||
}
|
Loading…
Reference in New Issue