Move SamplerKind out of ast and into type.

This CL moves the SamplerKind enum out of ast/sampler and into
type/sampler_kind. This breaks the dependency on ast from type.

Change-Id: Icaf82dd1cca5782bf66993441c7b478332bb76a2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117607
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
2023-01-23 16:24:12 +00:00
committed by Dawn LUCI CQ
parent 7f3d54c4fa
commit 3085e23fc7
47 changed files with 301 additions and 249 deletions

View File

@@ -640,7 +640,7 @@ struct BuiltinPolyfill::State {
b.Func(name,
utils::Vector{
b.Param("t", b.ty.sampled_texture(type::TextureDimension::k2d, b.ty.f32())),
b.Param("s", b.ty.sampler(ast::SamplerKind::kSampler)),
b.Param("s", b.ty.sampler(type::SamplerKind::kSampler)),
b.Param("coord", b.ty.vec2<f32>()),
},
b.ty.vec4<f32>(), body);

View File

@@ -123,9 +123,9 @@ struct CombineSamplers::State {
/// Creates placeholder global sampler variables.
/// @param kind the sampler kind to create for
/// @returns the newly-created global variable
const ast::Variable* CreatePlaceholder(ast::SamplerKind kind) {
const ast::Variable* CreatePlaceholder(type::SamplerKind kind) {
const ast::Type* type = ctx.dst->ty.sampler(kind);
const char* name = kind == ast::SamplerKind::kComparisonSampler
const char* name = kind == type::SamplerKind::kComparisonSampler
? "placeholder_comparison_sampler"
: "placeholder_sampler";
Symbol symbol = ctx.dst->Symbols().New(name);
@@ -265,8 +265,8 @@ struct CombineSamplers::State {
[new_pair];
args.Push(ctx.dst->Expr(var->symbol));
} else if (auto* sampler_type = type->As<type::Sampler>()) {
ast::SamplerKind kind = sampler_type->kind();
int index = (kind == ast::SamplerKind::kSampler) ? 0 : 1;
type::SamplerKind kind = sampler_type->kind();
int index = (kind == type::SamplerKind::kSampler) ? 0 : 1;
const ast::Variable*& p = placeholder_samplers_[index];
if (!p) {
p = CreatePlaceholder(kind);

View File

@@ -426,7 +426,7 @@ struct MultiplanarExternalTexture::State {
b.ty.sampled_texture(type::TextureDimension::k2d, b.ty.f32())),
b.Param("plane1",
b.ty.sampled_texture(type::TextureDimension::k2d, b.ty.f32())),
b.Param("smp", b.ty.sampler(ast::SamplerKind::kSampler)),
b.Param("smp", b.ty.sampler(type::SamplerKind::kSampler)),
b.Param("coord", b.ty.vec2(b.ty.f32())),
b.Param("params", b.ty.type_name(params_struct_sym)),
},