mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 10:49:14 +00:00
Remove ArrayCount helpers.
This CL removes the helpers in sem::Array to determine the type of ArrayCount. Instead the `Is` and `As` functions from Castable are used at the call sites. Bug: tint:1718 Change-Id: Ie666bfbfca6bb1be8ead613266a7221d88f7a76d Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112442 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
a5d3d16b1d
commit
15e7f94b76
@@ -146,7 +146,8 @@ struct ModuleScopeVarToEntryPointParam::State {
|
||||
attributes.Push(ctx.dst->Disable(ast::DisabledValidation::kIgnoreAddressSpace));
|
||||
|
||||
auto* param_type = store_type();
|
||||
if (auto* arr = ty->As<sem::Array>(); arr && arr->IsRuntimeSized()) {
|
||||
if (auto* arr = ty->As<sem::Array>();
|
||||
arr && arr->Count()->Is<sem::RuntimeArrayCount>()) {
|
||||
// Wrap runtime-sized arrays in structures, so that we can declare pointers to
|
||||
// them. Ideally we'd just emit the array itself as a pointer, but this is not
|
||||
// representable in Tint's AST.
|
||||
|
||||
@@ -84,7 +84,7 @@ Transform::ApplyResult PadStructs::Apply(const Program* src, const DataMap&, Dat
|
||||
// std140 structs should be padded out to 16 bytes.
|
||||
size = utils::RoundUp(16u, size);
|
||||
} else if (auto* array_ty = ty->As<sem::Array>()) {
|
||||
if (array_ty->IsRuntimeSized()) {
|
||||
if (array_ty->Count()->Is<sem::RuntimeArrayCount>()) {
|
||||
has_runtime_sized_array = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ struct Robustness::State {
|
||||
},
|
||||
[&](const sem::Array* arr) -> const ast::Expression* {
|
||||
const ast::Expression* max = nullptr;
|
||||
if (arr->IsRuntimeSized()) {
|
||||
if (arr->Count()->Is<sem::RuntimeArrayCount>()) {
|
||||
// Size is unknown until runtime.
|
||||
// Must clamp, even if the index is constant.
|
||||
auto* arr_ptr = b.AddressOf(ctx.Clone(expr->object));
|
||||
|
||||
@@ -202,7 +202,7 @@ struct SpirvAtomic::State {
|
||||
[&](const sem::U32*) { return b.ty.atomic(CreateASTTypeFor(ctx, ty)); },
|
||||
[&](const sem::Struct* str) { return b.ty.type_name(Fork(str->Declaration()).name); },
|
||||
[&](const sem::Array* arr) -> const ast::Type* {
|
||||
if (arr->IsRuntimeSized()) {
|
||||
if (arr->Count()->Is<sem::RuntimeArrayCount>()) {
|
||||
return b.ty.array(AtomicTypeFor(arr->ElemType()));
|
||||
}
|
||||
auto count = arr->ConstantCount();
|
||||
|
||||
@@ -106,7 +106,7 @@ const ast::Type* Transform::CreateASTTypeFor(CloneContext& ctx, const sem::Type*
|
||||
if (!a->IsStrideImplicit()) {
|
||||
attrs.Push(ctx.dst->create<ast::StrideAttribute>(a->Stride()));
|
||||
}
|
||||
if (a->IsRuntimeSized()) {
|
||||
if (a->Count()->Is<sem::RuntimeArrayCount>()) {
|
||||
return ctx.dst->ty.array(el, nullptr, std::move(attrs));
|
||||
}
|
||||
if (auto* override = a->Count()->As<sem::NamedOverrideArrayCount>()) {
|
||||
|
||||
Reference in New Issue
Block a user