[tint] Change ast::builtin::test to ast::test
There is no `builtin` subdirectory of `ast`, and this additional `builtin` namespaces causes awkward conflicts in a subsequent patch that moves AST transforms under the `ast` namespace. Change-Id: I54b11f37b686875f1dab7deb9781e978a639d6e9 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132422 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
fd60f17236
commit
f7a4d9fe59
|
@ -22,7 +22,7 @@
|
|||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
namespace tint::ast::builtin::test {
|
||||
namespace tint::ast::test {
|
||||
namespace {
|
||||
|
||||
utils::StringStream& operator<<(utils::StringStream& out, const TextureKind& kind) {
|
||||
|
@ -142,11 +142,11 @@ std::ostream& operator<<(std::ostream& out, const TextureOverloadCase& data) {
|
|||
|
||||
Type TextureOverloadCase::BuildResultVectorComponentType(ProgramBuilder* b) const {
|
||||
switch (texture_data_type) {
|
||||
case builtin::test::TextureDataType::kF32:
|
||||
case test::TextureDataType::kF32:
|
||||
return b->ty.f32();
|
||||
case builtin::test::TextureDataType::kU32:
|
||||
case test::TextureDataType::kU32:
|
||||
return b->ty.u32();
|
||||
case builtin::test::TextureDataType::kI32:
|
||||
case test::TextureDataType::kI32:
|
||||
return b->ty.i32();
|
||||
}
|
||||
|
||||
|
@ -160,25 +160,25 @@ const Variable* TextureOverloadCase::BuildTextureVariable(ProgramBuilder* b) con
|
|||
b->Binding(0_a),
|
||||
};
|
||||
switch (texture_kind) {
|
||||
case builtin::test::TextureKind::kRegular:
|
||||
case test::TextureKind::kRegular:
|
||||
return b->GlobalVar(
|
||||
kTextureName,
|
||||
b->ty.sampled_texture(texture_dimension, BuildResultVectorComponentType(b)), attrs);
|
||||
|
||||
case builtin::test::TextureKind::kDepth:
|
||||
case test::TextureKind::kDepth:
|
||||
return b->GlobalVar(kTextureName, b->ty.depth_texture(texture_dimension), attrs);
|
||||
|
||||
case builtin::test::TextureKind::kDepthMultisampled:
|
||||
case test::TextureKind::kDepthMultisampled:
|
||||
return b->GlobalVar(kTextureName, b->ty.depth_multisampled_texture(texture_dimension),
|
||||
attrs);
|
||||
|
||||
case builtin::test::TextureKind::kMultisampled:
|
||||
case test::TextureKind::kMultisampled:
|
||||
return b->GlobalVar(
|
||||
kTextureName,
|
||||
b->ty.multisampled_texture(texture_dimension, BuildResultVectorComponentType(b)),
|
||||
attrs);
|
||||
|
||||
case builtin::test::TextureKind::kStorage: {
|
||||
case test::TextureKind::kStorage: {
|
||||
auto st = b->ty.storage_texture(texture_dimension, texel_format, access);
|
||||
return b->GlobalVar(kTextureName, st, attrs);
|
||||
}
|
||||
|
@ -2554,4 +2554,4 @@ bool ReturnsVoid(ValidTextureOverload texture_overload) {
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace tint::ast::builtin::test
|
||||
} // namespace tint::ast::test
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "src/tint/type/storage_texture.h"
|
||||
#include "src/tint/type/texture_dimension.h"
|
||||
|
||||
namespace tint::ast::builtin::test {
|
||||
namespace tint::ast::test {
|
||||
|
||||
/// The name of the texture global variable used by the tests.
|
||||
static constexpr const char* kTextureName = "Texture";
|
||||
|
@ -268,6 +268,6 @@ struct TextureOverloadCase {
|
|||
|
||||
std::ostream& operator<<(std::ostream& out, const TextureOverloadCase& data);
|
||||
|
||||
} // namespace tint::ast::builtin::test
|
||||
} // namespace tint::ast::test
|
||||
|
||||
#endif // SRC_TINT_AST_BUILTIN_TEXTURE_HELPER_TEST_H_
|
||||
|
|
|
@ -2182,11 +2182,11 @@ INSTANTIATE_TEST_SUITE_P(ResolverTest,
|
|||
TextureTestParams{type::TextureDimension::k2dArray},
|
||||
TextureTestParams{type::TextureDimension::k3d}));
|
||||
|
||||
using ResolverBuiltinTest_Texture = ResolverTestWithParam<ast::builtin::test::TextureOverloadCase>;
|
||||
using ResolverBuiltinTest_Texture = ResolverTestWithParam<ast::test::TextureOverloadCase>;
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(ResolverTest,
|
||||
ResolverBuiltinTest_Texture,
|
||||
testing::ValuesIn(ast::builtin::test::TextureOverloadCase::ValidCases()));
|
||||
testing::ValuesIn(ast::test::TextureOverloadCase::ValidCases()));
|
||||
|
||||
static std::string to_str(const std::string& function,
|
||||
utils::VectorRef<const sem::Parameter*> params) {
|
||||
|
@ -2204,8 +2204,8 @@ static std::string to_str(const std::string& function,
|
|||
return out.str();
|
||||
}
|
||||
|
||||
static const char* expected_texture_overload(ast::builtin::test::ValidTextureOverload overload) {
|
||||
using ValidTextureOverload = ast::builtin::test::ValidTextureOverload;
|
||||
static const char* expected_texture_overload(ast::test::ValidTextureOverload overload) {
|
||||
using ValidTextureOverload = ast::test::ValidTextureOverload;
|
||||
switch (overload) {
|
||||
case ValidTextureOverload::kDimensions1d:
|
||||
case ValidTextureOverload::kDimensions2d:
|
||||
|
@ -2491,13 +2491,13 @@ TEST_P(ResolverBuiltinTest_Texture, Call) {
|
|||
ASSERT_NE(vec, nullptr);
|
||||
EXPECT_EQ(vec->Width(), 4u);
|
||||
switch (param.texture_data_type) {
|
||||
case ast::builtin::test::TextureDataType::kF32:
|
||||
case ast::test::TextureDataType::kF32:
|
||||
EXPECT_TRUE(vec->type()->Is<type::F32>());
|
||||
break;
|
||||
case ast::builtin::test::TextureDataType::kU32:
|
||||
case ast::test::TextureDataType::kU32:
|
||||
EXPECT_TRUE(vec->type()->Is<type::U32>());
|
||||
break;
|
||||
case ast::builtin::test::TextureDataType::kI32:
|
||||
case ast::test::TextureDataType::kI32:
|
||||
EXPECT_TRUE(vec->type()->Is<type::I32>());
|
||||
break;
|
||||
}
|
||||
|
@ -2508,26 +2508,26 @@ TEST_P(ResolverBuiltinTest_Texture, Call) {
|
|||
EXPECT_TRUE(vec->type()->Is<type::F32>());
|
||||
} else {
|
||||
switch (param.texture_kind) {
|
||||
case ast::builtin::test::TextureKind::kRegular:
|
||||
case ast::builtin::test::TextureKind::kMultisampled:
|
||||
case ast::builtin::test::TextureKind::kStorage: {
|
||||
case ast::test::TextureKind::kRegular:
|
||||
case ast::test::TextureKind::kMultisampled:
|
||||
case ast::test::TextureKind::kStorage: {
|
||||
auto* vec = TypeOf(call)->As<type::Vector>();
|
||||
ASSERT_NE(vec, nullptr);
|
||||
switch (param.texture_data_type) {
|
||||
case ast::builtin::test::TextureDataType::kF32:
|
||||
case ast::test::TextureDataType::kF32:
|
||||
EXPECT_TRUE(vec->type()->Is<type::F32>());
|
||||
break;
|
||||
case ast::builtin::test::TextureDataType::kU32:
|
||||
case ast::test::TextureDataType::kU32:
|
||||
EXPECT_TRUE(vec->type()->Is<type::U32>());
|
||||
break;
|
||||
case ast::builtin::test::TextureDataType::kI32:
|
||||
case ast::test::TextureDataType::kI32:
|
||||
EXPECT_TRUE(vec->type()->Is<type::I32>());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ast::builtin::test::TextureKind::kDepth:
|
||||
case ast::builtin::test::TextureKind::kDepthMultisampled: {
|
||||
case ast::test::TextureKind::kDepth:
|
||||
case ast::test::TextureKind::kDepthMultisampled: {
|
||||
EXPECT_TRUE(TypeOf(call)->Is<type::F32>());
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -196,10 +196,10 @@ TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsStructUsedAsType) {
|
|||
|
||||
namespace texture_constexpr_args {
|
||||
|
||||
using TextureOverloadCase = ast::builtin::test::TextureOverloadCase;
|
||||
using ValidTextureOverload = ast::builtin::test::ValidTextureOverload;
|
||||
using TextureKind = ast::builtin::test::TextureKind;
|
||||
using TextureDataType = ast::builtin::test::TextureDataType;
|
||||
using TextureOverloadCase = ast::test::TextureOverloadCase;
|
||||
using ValidTextureOverload = ast::test::ValidTextureOverload;
|
||||
using TextureKind = ast::test::TextureKind;
|
||||
using TextureDataType = ast::test::TextureDataType;
|
||||
|
||||
static std::vector<TextureOverloadCase> TextureCases(
|
||||
std::unordered_set<ValidTextureOverload> overloads) {
|
||||
|
|
|
@ -30,8 +30,8 @@ struct ExpectedResult {
|
|||
std::string out;
|
||||
};
|
||||
|
||||
ExpectedResult expected_texture_overload(ast::builtin::test::ValidTextureOverload overload) {
|
||||
using ValidTextureOverload = ast::builtin::test::ValidTextureOverload;
|
||||
ExpectedResult expected_texture_overload(ast::test::ValidTextureOverload overload) {
|
||||
using ValidTextureOverload = ast::test::ValidTextureOverload;
|
||||
switch (overload) {
|
||||
case ValidTextureOverload::kDimensions1d:
|
||||
case ValidTextureOverload::kDimensions2d:
|
||||
|
@ -271,8 +271,7 @@ ExpectedResult expected_texture_overload(ast::builtin::test::ValidTextureOverloa
|
|||
return "<unmatched texture overload>";
|
||||
} // NOLINT - Ignore the length of this function
|
||||
|
||||
class GlslGeneratorBuiltinTextureTest
|
||||
: public TestParamHelper<ast::builtin::test::TextureOverloadCase> {};
|
||||
class GlslGeneratorBuiltinTextureTest : public TestParamHelper<ast::test::TextureOverloadCase> {};
|
||||
|
||||
TEST_P(GlslGeneratorBuiltinTextureTest, Call) {
|
||||
auto param = GetParam();
|
||||
|
@ -300,7 +299,7 @@ TEST_P(GlslGeneratorBuiltinTextureTest, Call) {
|
|||
|
||||
INSTANTIATE_TEST_SUITE_P(GlslGeneratorBuiltinTextureTest,
|
||||
GlslGeneratorBuiltinTextureTest,
|
||||
testing::ValuesIn(ast::builtin::test::TextureOverloadCase::ValidCases()));
|
||||
testing::ValuesIn(ast::test::TextureOverloadCase::ValidCases()));
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::writer::glsl
|
||||
|
|
|
@ -31,8 +31,8 @@ struct ExpectedResult {
|
|||
std::string out;
|
||||
};
|
||||
|
||||
ExpectedResult expected_texture_overload(ast::builtin::test::ValidTextureOverload overload) {
|
||||
using ValidTextureOverload = ast::builtin::test::ValidTextureOverload;
|
||||
ExpectedResult expected_texture_overload(ast::test::ValidTextureOverload overload) {
|
||||
using ValidTextureOverload = ast::test::ValidTextureOverload;
|
||||
switch (overload) {
|
||||
case ValidTextureOverload::kDimensions1d:
|
||||
case ValidTextureOverload::kDimensionsStorageWO1d:
|
||||
|
@ -363,8 +363,7 @@ ExpectedResult expected_texture_overload(ast::builtin::test::ValidTextureOverloa
|
|||
return "<unmatched texture overload>";
|
||||
} // NOLINT - Ignore the length of this function
|
||||
|
||||
class HlslGeneratorBuiltinTextureTest
|
||||
: public TestParamHelper<ast::builtin::test::TextureOverloadCase> {};
|
||||
class HlslGeneratorBuiltinTextureTest : public TestParamHelper<ast::test::TextureOverloadCase> {};
|
||||
|
||||
TEST_P(HlslGeneratorBuiltinTextureTest, Call) {
|
||||
auto param = GetParam();
|
||||
|
@ -391,7 +390,7 @@ TEST_P(HlslGeneratorBuiltinTextureTest, Call) {
|
|||
|
||||
INSTANTIATE_TEST_SUITE_P(HlslGeneratorBuiltinTextureTest,
|
||||
HlslGeneratorBuiltinTextureTest,
|
||||
testing::ValuesIn(ast::builtin::test::TextureOverloadCase::ValidCases()));
|
||||
testing::ValuesIn(ast::test::TextureOverloadCase::ValidCases()));
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::writer::hlsl
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
namespace tint::writer::msl {
|
||||
namespace {
|
||||
|
||||
std::string expected_texture_overload(ast::builtin::test::ValidTextureOverload overload) {
|
||||
using ValidTextureOverload = ast::builtin::test::ValidTextureOverload;
|
||||
std::string expected_texture_overload(ast::test::ValidTextureOverload overload) {
|
||||
using ValidTextureOverload = ast::test::ValidTextureOverload;
|
||||
switch (overload) {
|
||||
case ValidTextureOverload::kDimensions1d:
|
||||
case ValidTextureOverload::kDimensionsStorageWO1d:
|
||||
|
@ -268,8 +268,7 @@ std::string expected_texture_overload(ast::builtin::test::ValidTextureOverload o
|
|||
return "<unmatched texture overload>";
|
||||
} // NOLINT - Ignore the length of this function
|
||||
|
||||
class MslGeneratorBuiltinTextureTest
|
||||
: public TestParamHelper<ast::builtin::test::TextureOverloadCase> {};
|
||||
class MslGeneratorBuiltinTextureTest : public TestParamHelper<ast::test::TextureOverloadCase> {};
|
||||
|
||||
TEST_P(MslGeneratorBuiltinTextureTest, Call) {
|
||||
auto param = GetParam();
|
||||
|
@ -295,7 +294,7 @@ TEST_P(MslGeneratorBuiltinTextureTest, Call) {
|
|||
|
||||
INSTANTIATE_TEST_SUITE_P(MslGeneratorBuiltinTextureTest,
|
||||
MslGeneratorBuiltinTextureTest,
|
||||
testing::ValuesIn(ast::builtin::test::TextureOverloadCase::ValidCases()));
|
||||
testing::ValuesIn(ast::test::TextureOverloadCase::ValidCases()));
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::writer::msl
|
||||
|
|
|
@ -29,8 +29,8 @@ struct expected_texture_overload_spirv {
|
|||
};
|
||||
|
||||
expected_texture_overload_spirv expected_texture_overload(
|
||||
ast::builtin::test::ValidTextureOverload overload) {
|
||||
using ValidTextureOverload = ast::builtin::test::ValidTextureOverload;
|
||||
ast::test::ValidTextureOverload overload) {
|
||||
using ValidTextureOverload = ast::test::ValidTextureOverload;
|
||||
switch (overload) {
|
||||
case ValidTextureOverload::kDimensions1d:
|
||||
return {
|
||||
|
@ -3704,11 +3704,11 @@ OpImageWrite %10 %16 %22
|
|||
"<unmatched texture overload>"};
|
||||
} // NOLINT - Ignore the length of this function
|
||||
|
||||
using BuiltinTextureTest = TestParamHelper<ast::builtin::test::TextureOverloadCase>;
|
||||
using BuiltinTextureTest = TestParamHelper<ast::test::TextureOverloadCase>;
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(BuiltinTextureTest,
|
||||
BuiltinTextureTest,
|
||||
testing::ValuesIn(ast::builtin::test::TextureOverloadCase::ValidCases()));
|
||||
testing::ValuesIn(ast::test::TextureOverloadCase::ValidCases()));
|
||||
|
||||
TEST_P(BuiltinTextureTest, Call) {
|
||||
auto param = GetParam();
|
||||
|
|
Loading…
Reference in New Issue