Prepare for having TypesBuilder return ast::Types

Instead of a typ::TypePair.

Bug: tint:724
Change-Id: Ife8fac86093eb128bc98974e1f6614a73c42a9e6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49753
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Ben Clayton
2021-05-05 16:19:22 +00:00
committed by Commit Bot service account
parent dee76fff44
commit c9ee7ebd93
10 changed files with 357 additions and 323 deletions

View File

@@ -132,7 +132,7 @@ std::ostream& operator<<(std::ostream& out, const TextureOverloadCase& data) {
return out;
}
ast::Type* TextureOverloadCase::resultVectorComponentType(
ast::Type* TextureOverloadCase::buildResultVectorComponentType(
ProgramBuilder* b) const {
switch (texture_data_type) {
case ast::intrinsic::test::TextureDataType::kF32:
@@ -149,8 +149,6 @@ ast::Type* TextureOverloadCase::resultVectorComponentType(
ast::Variable* TextureOverloadCase::buildTextureVariable(
ProgramBuilder* b) const {
auto* datatype = resultVectorComponentType(b);
DecorationList decos = {
b->create<ast::GroupDecoration>(0),
b->create<ast::BindingDecoration>(0),
@@ -158,7 +156,8 @@ ast::Variable* TextureOverloadCase::buildTextureVariable(
switch (texture_kind) {
case ast::intrinsic::test::TextureKind::kRegular:
return b->Global("texture",
b->ty.sampled_texture(texture_dimension, datatype),
b->ty.sampled_texture(texture_dimension,
buildResultVectorComponentType(b)),
ast::StorageClass::kUniformConstant, nullptr, decos);
case ast::intrinsic::test::TextureKind::kDepth:
@@ -166,9 +165,11 @@ ast::Variable* TextureOverloadCase::buildTextureVariable(
ast::StorageClass::kUniformConstant, nullptr, decos);
case ast::intrinsic::test::TextureKind::kMultisampled:
return b->Global("texture",
b->ty.multisampled_texture(texture_dimension, datatype),
ast::StorageClass::kUniformConstant, nullptr, decos);
return b->Global(
"texture",
b->ty.multisampled_texture(texture_dimension,
buildResultVectorComponentType(b)),
ast::StorageClass::kUniformConstant, nullptr, decos);
case ast::intrinsic::test::TextureKind::kStorage: {
auto st = b->ty.storage_texture(texture_dimension, image_format);

View File

@@ -209,7 +209,7 @@ struct TextureOverloadCase {
/// @param builder the AST builder used for the test
/// @returns the vector component type of the texture function return value
ast::Type* resultVectorComponentType(ProgramBuilder* builder) const;
ast::Type* buildResultVectorComponentType(ProgramBuilder* builder) const;
/// @param builder the AST builder used for the test
/// @returns a variable holding the test texture, automatically registered as
/// a global variable.