Rename all type UnwrapXXX() methods

Give them sensible names.
Make them act consistently.
Remove those that were not used.

Change-Id: Ib043a4093cfae9f81630643e1a0e4eae7bca2440
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50305
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Ben Clayton
2021-05-10 18:06:31 +00:00
committed by Commit Bot service account
parent fcda15ef67
commit f14e0e1c8c
17 changed files with 103 additions and 233 deletions

View File

@@ -387,7 +387,7 @@ std::vector<ResourceBinding> Inspector::GetUniformBufferResourceBindings(
auto* var = ruv.first;
auto binding_info = ruv.second;
auto* unwrapped_type = var->Type()->UnwrapIfNeeded();
auto* unwrapped_type = var->Type()->UnwrapAccess();
auto* str = unwrapped_type->As<sem::Struct>();
if (str == nullptr) {
continue;
@@ -509,7 +509,7 @@ std::vector<ResourceBinding> Inspector::GetDepthTextureResourceBindings(
entry.bind_group = binding_info.group->value();
entry.binding = binding_info.binding->value();
auto* texture_type = var->Type()->UnwrapIfNeeded()->As<sem::Texture>();
auto* texture_type = var->Type()->UnwrapAccess()->As<sem::Texture>();
entry.dim = TypeTextureDimensionToResourceBindingTextureDimension(
texture_type->dim());
@@ -602,7 +602,7 @@ std::vector<ResourceBinding> Inspector::GetStorageBufferResourceBindingsImpl(
continue;
}
auto* str = var->Type()->UnwrapIfNeeded()->As<sem::Struct>();
auto* str = var->Type()->UnwrapAccess()->As<sem::Struct>();
if (!str) {
continue;
}
@@ -646,18 +646,15 @@ std::vector<ResourceBinding> Inspector::GetSampledTextureResourceBindingsImpl(
entry.bind_group = binding_info.group->value();
entry.binding = binding_info.binding->value();
auto* texture_type = var->Type()->UnwrapIfNeeded()->As<sem::Texture>();
auto* texture_type = var->Type()->UnwrapAccess()->As<sem::Texture>();
entry.dim = TypeTextureDimensionToResourceBindingTextureDimension(
texture_type->dim());
const sem::Type* base_type = nullptr;
if (multisampled_only) {
base_type = texture_type->As<sem::MultisampledTexture>()
->type()
->UnwrapIfNeeded();
base_type = texture_type->As<sem::MultisampledTexture>()->type();
} else {
base_type =
texture_type->As<sem::SampledTexture>()->type()->UnwrapIfNeeded();
base_type = texture_type->As<sem::SampledTexture>()->type();
}
entry.sampled_kind = BaseTypeToSampledKind(base_type);
@@ -697,12 +694,11 @@ std::vector<ResourceBinding> Inspector::GetStorageTextureResourceBindingsImpl(
entry.bind_group = binding_info.group->value();
entry.binding = binding_info.binding->value();
auto* texture_type =
var->Type()->UnwrapIfNeeded()->As<sem::StorageTexture>();
auto* texture_type = var->Type()->UnwrapAccess()->As<sem::StorageTexture>();
entry.dim = TypeTextureDimensionToResourceBindingTextureDimension(
texture_type->dim());
auto* base_type = texture_type->type()->UnwrapIfNeeded();
auto* base_type = texture_type->type();
entry.sampled_kind = BaseTypeToSampledKind(base_type);
entry.image_format = TypeImageFormatToResourceBindingImageFormat(
texture_type->image_format());