Move sampler to type.

This CL moves the sampler from sem to type and updates the namespace.

Bug: tint:1718
Change-Id: I22d228df5d24e154dbebecb43e7c6730475e08d2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113283
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
dan sinclair
2022-12-08 15:25:18 +00:00
committed by Dawn LUCI CQ
parent 4595fb7989
commit 5ee58b60a8
23 changed files with 70 additions and 70 deletions

View File

@@ -159,7 +159,7 @@ struct CombineSamplers::State {
for (auto* global : ctx.src->AST().GlobalVariables()) {
auto* global_sem = sem.Get(global)->As<sem::GlobalVariable>();
auto* type = sem.Get(global->type);
if (tint::IsAnyOf<type::Texture, sem::Sampler>(type) &&
if (tint::IsAnyOf<type::Texture, type::Sampler>(type) &&
!type->Is<type::StorageTexture>()) {
ctx.Remove(ctx.src->AST().GlobalDeclarations(), global);
} else if (global->HasBindingPoint()) {
@@ -208,7 +208,7 @@ struct CombineSamplers::State {
// Filter out separate textures and samplers from the original
// function signature.
for (auto* param : fn->Parameters()) {
if (!param->Type()->IsAnyOf<type::Texture, sem::Sampler>()) {
if (!param->Type()->IsAnyOf<type::Texture, type::Sampler>()) {
params.Push(ctx.Clone(param->Declaration()));
}
}
@@ -263,7 +263,7 @@ struct CombineSamplers::State {
: function_combined_texture_samplers_[call->Stmt()->Function()]
[new_pair];
args.Push(ctx.dst->Expr(var->symbol));
} else if (auto* sampler_type = type->As<sem::Sampler>()) {
} else if (auto* sampler_type = type->As<type::Sampler>()) {
ast::SamplerKind kind = sampler_type->kind();
int index = (kind == ast::SamplerKind::kSampler) ? 0 : 1;
const ast::Variable*& p = placeholder_samplers_[index];
@@ -321,7 +321,7 @@ struct CombineSamplers::State {
for (auto* arg : expr->args) {
if (!ctx.src->TypeOf(arg)
->UnwrapRef()
->IsAnyOf<type::Texture, sem::Sampler>()) {
->IsAnyOf<type::Texture, type::Sampler>()) {
args.Push(ctx.Clone(arg));
}
}

View File

@@ -287,7 +287,7 @@ class DecomposeSideEffects::CollectHoistsState : public StateBase {
}
// Don't hoist textures / samplers as they can't be placed into a let, nor
// can they have side effects.
if (var_user->Variable()->Type()->IsAnyOf<type::Texture, sem::Sampler>()) {
if (var_user->Variable()->Type()->IsAnyOf<type::Texture, type::Sampler>()) {
return false;
}
return true;

View File

@@ -22,9 +22,9 @@
#include "src/tint/sem/block_statement.h"
#include "src/tint/sem/for_loop_statement.h"
#include "src/tint/sem/reference.h"
#include "src/tint/sem/sampler.h"
#include "src/tint/sem/variable.h"
#include "src/tint/type/depth_multisampled_texture.h"
#include "src/tint/type/sampler.h"
TINT_INSTANTIATE_TYPEINFO(tint::transform::Transform);
TINT_INSTANTIATE_TYPEINFO(tint::transform::Data);
@@ -165,7 +165,7 @@ const ast::Type* Transform::CreateASTTypeFor(CloneContext& ctx, const type::Type
return ctx.dst->create<ast::StorageTexture>(t->dim(), t->texel_format(),
CreateASTTypeFor(ctx, t->type()), t->access());
}
if (auto* s = ty->As<sem::Sampler>()) {
if (auto* s = ty->As<type::Sampler>()) {
return ctx.dst->create<ast::Sampler>(s->kind());
}
TINT_UNREACHABLE(Transform, ctx.dst->Diagnostics())