Have TypesBuilder::sampler() return ast::Sampler
Bug: tint:724
Change-Id: Ifdba69a24d65e2f874ea8bdb3984d36a8cfa2bd7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51663
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/intrinsic_table_test.cc b/src/intrinsic_table_test.cc
index 9cad7dd..3b1c527 100644
--- a/src/intrinsic_table_test.cc
+++ b/src/intrinsic_table_test.cc
@@ -242,7 +242,7 @@
auto* vec2_f32 = create<sem::Vector>(f32, 2);
auto* vec4_f32 = create<sem::Vector>(f32, 4);
auto* tex = create<sem::SampledTexture>(ast::TextureDimension::k2d, f32);
- auto sampler = ty.sampler(ast::SamplerKind::kSampler);
+ auto* sampler = create<sem::Sampler>(ast::SamplerKind::kSampler);
auto result = table->Lookup(*this, IntrinsicType::kTextureSample,
{tex, sampler, vec2_f32}, Source{});
ASSERT_NE(result.intrinsic, nullptr);
diff --git a/src/program_builder.h b/src/program_builder.h
index da8aa40..8313c57 100644
--- a/src/program_builder.h
+++ b/src/program_builder.h
@@ -751,16 +751,14 @@
/// @param kind the kind of sampler
/// @returns the sampler
typ::Sampler sampler(ast::SamplerKind kind) const {
- return {builder->create<ast::Sampler>(kind),
- builder->create<sem::Sampler>(kind)};
+ return {builder->create<ast::Sampler>(kind)};
}
/// @param source the Source of the node
/// @param kind the kind of sampler
/// @returns the sampler
typ::Sampler sampler(const Source& source, ast::SamplerKind kind) const {
- return {builder->create<ast::Sampler>(source, kind),
- builder->create<sem::Sampler>(kind)};
+ return {builder->create<ast::Sampler>(source, kind)};
}
/// @param dims the dimensionality of the texture
diff --git a/src/typepair.h b/src/typepair.h
index 61dfe06..31c3c50 100644
--- a/src/typepair.h
+++ b/src/typepair.h
@@ -239,7 +239,6 @@
using Matrix = TypePair<ast::Matrix, sem::Matrix>;
using Pointer = TypePair<ast::Pointer, sem::Pointer>;
-using Sampler = TypePair<ast::Sampler, sem::Sampler>;
using Struct = TypePair<ast::Struct, sem::Struct>;
using Vector = TypePair<ast::Vector, sem::Vector>;
@@ -254,6 +253,7 @@
using SampledTexture = Ptr<ast::SampledTexture>;
using StorageTexture = Ptr<ast::StorageTexture>;
using Texture = Ptr<ast::Texture>;
+using Sampler = Ptr<ast::Sampler>;
// Helpers
diff --git a/src/writer/msl/generator_impl_type_test.cc b/src/writer/msl/generator_impl_type_test.cc
index e9becc1..cf3f141 100644
--- a/src/writer/msl/generator_impl_type_test.cc
+++ b/src/writer/msl/generator_impl_type_test.cc
@@ -656,7 +656,7 @@
}
TEST_F(MslGeneratorImplTest, EmitType_Sampler) {
- auto sampler = ty.sampler(ast::SamplerKind::kSampler);
+ auto* sampler = create<sem::Sampler>(ast::SamplerKind::kSampler);
GeneratorImpl& gen = Build();
@@ -665,7 +665,7 @@
}
TEST_F(MslGeneratorImplTest, EmitType_SamplerComparison) {
- auto sampler = ty.sampler(ast::SamplerKind::kComparisonSampler);
+ auto* sampler = create<sem::Sampler>(ast::SamplerKind::kComparisonSampler);
GeneratorImpl& gen = Build();