Remove old texture type support.
This CL removes all of the old texture type names in favour of the new variants. Change-Id: Icb3c9ed8e39c8d7320fd6a6706b8029fcb3e5947 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38826 Auto-Submit: dan sinclair <dsinclair@chromium.org> Reviewed-by: David Neto <dneto@google.com> Commit-Queue: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
c2972cfa60
commit
34ac1afd99
|
@ -677,40 +677,6 @@ Token Lexer::check_keyword(const Source& source, const std::string& str) {
|
||||||
return {Token::Type::kTextureMultisampled2d, source,
|
return {Token::Type::kTextureMultisampled2d, source,
|
||||||
"texture_multisampled_2d"};
|
"texture_multisampled_2d"};
|
||||||
}
|
}
|
||||||
if (str == "texture_ro_1d")
|
|
||||||
return {Token::Type::kTextureStorageReadonly1d, source, "texture_ro_1d"};
|
|
||||||
if (str == "texture_ro_1d_array") {
|
|
||||||
return {Token::Type::kTextureStorageReadonly1dArray, source,
|
|
||||||
"texture_ro_1d_array"};
|
|
||||||
}
|
|
||||||
if (str == "texture_ro_2d")
|
|
||||||
return {Token::Type::kTextureStorageReadonly2d, source, "texture_ro_2d"};
|
|
||||||
if (str == "texture_ro_2d_array") {
|
|
||||||
return {Token::Type::kTextureStorageReadonly2dArray, source,
|
|
||||||
"texture_ro_2d_array"};
|
|
||||||
}
|
|
||||||
if (str == "texture_ro_3d")
|
|
||||||
return {Token::Type::kTextureStorageReadonly3d, source, "texture_ro_3d"};
|
|
||||||
if (str == "texture_sampled_1d")
|
|
||||||
return {Token::Type::kTextureSampled1d, source, "texture_sampled_1d"};
|
|
||||||
if (str == "texture_sampled_1d_array") {
|
|
||||||
return {Token::Type::kTextureSampled1dArray, source,
|
|
||||||
"texture_sampled_1d_array"};
|
|
||||||
}
|
|
||||||
if (str == "texture_sampled_2d")
|
|
||||||
return {Token::Type::kTextureSampled2d, source, "texture_sampled_2d"};
|
|
||||||
if (str == "texture_sampled_2d_array") {
|
|
||||||
return {Token::Type::kTextureSampled2dArray, source,
|
|
||||||
"texture_sampled_2d_array"};
|
|
||||||
}
|
|
||||||
if (str == "texture_sampled_3d")
|
|
||||||
return {Token::Type::kTextureSampled3d, source, "texture_sampled_3d"};
|
|
||||||
if (str == "texture_sampled_cube")
|
|
||||||
return {Token::Type::kTextureSampledCube, source, "texture_sampled_cube"};
|
|
||||||
if (str == "texture_sampled_cube_array") {
|
|
||||||
return {Token::Type::kTextureSampledCubeArray, source,
|
|
||||||
"texture_sampled_cube_array"};
|
|
||||||
}
|
|
||||||
if (str == "texture_storage_1d") {
|
if (str == "texture_storage_1d") {
|
||||||
return {Token::Type::kTextureStorage1d, source, "texture_storage_1d"};
|
return {Token::Type::kTextureStorage1d, source, "texture_storage_1d"};
|
||||||
}
|
}
|
||||||
|
@ -728,60 +694,6 @@ Token Lexer::check_keyword(const Source& source, const std::string& str) {
|
||||||
if (str == "texture_storage_3d") {
|
if (str == "texture_storage_3d") {
|
||||||
return {Token::Type::kTextureStorage3d, source, "texture_storage_3d"};
|
return {Token::Type::kTextureStorage3d, source, "texture_storage_3d"};
|
||||||
}
|
}
|
||||||
if (str == "texture_storage_wo_1d") {
|
|
||||||
return {Token::Type::kTextureStorageWriteonly1d, source,
|
|
||||||
"texture_storage_wo_1d"};
|
|
||||||
}
|
|
||||||
if (str == "texture_storage_wo_1d_array") {
|
|
||||||
return {Token::Type::kTextureStorageWriteonly1dArray, source,
|
|
||||||
"texture_storage_wo_1d_array"};
|
|
||||||
}
|
|
||||||
if (str == "texture_storage_wo_2d") {
|
|
||||||
return {Token::Type::kTextureStorageWriteonly2d, source,
|
|
||||||
"texture_storage_wo_2d"};
|
|
||||||
}
|
|
||||||
if (str == "texture_storage_wo_2d_array") {
|
|
||||||
return {Token::Type::kTextureStorageWriteonly2dArray, source,
|
|
||||||
"texture_storage_wo_2d_array"};
|
|
||||||
}
|
|
||||||
if (str == "texture_storage_wo_3d") {
|
|
||||||
return {Token::Type::kTextureStorageWriteonly3d, source,
|
|
||||||
"texture_storage_wo_3d"};
|
|
||||||
}
|
|
||||||
if (str == "texture_storage_ro_1d") {
|
|
||||||
return {Token::Type::kTextureStorageReadonly1d, source,
|
|
||||||
"texture_storage_ro_1d"};
|
|
||||||
}
|
|
||||||
if (str == "texture_storage_ro_1d_array") {
|
|
||||||
return {Token::Type::kTextureStorageReadonly1dArray, source,
|
|
||||||
"texture_storage_ro_1d_array"};
|
|
||||||
}
|
|
||||||
if (str == "texture_storage_ro_2d") {
|
|
||||||
return {Token::Type::kTextureStorageReadonly2d, source,
|
|
||||||
"texture_storage_ro_2d"};
|
|
||||||
}
|
|
||||||
if (str == "texture_storage_ro_2d_array") {
|
|
||||||
return {Token::Type::kTextureStorageReadonly2dArray, source,
|
|
||||||
"texture_storage_ro_2d_array"};
|
|
||||||
}
|
|
||||||
if (str == "texture_storage_ro_3d") {
|
|
||||||
return {Token::Type::kTextureStorageReadonly3d, source,
|
|
||||||
"texture_storage_ro_3d"};
|
|
||||||
}
|
|
||||||
if (str == "texture_wo_1d")
|
|
||||||
return {Token::Type::kTextureStorageWriteonly1d, source, "texture_wo_1d"};
|
|
||||||
if (str == "texture_wo_1d_array") {
|
|
||||||
return {Token::Type::kTextureStorageWriteonly1dArray, source,
|
|
||||||
"texture_wo_1d_array"};
|
|
||||||
}
|
|
||||||
if (str == "texture_wo_2d")
|
|
||||||
return {Token::Type::kTextureStorageWriteonly2d, source, "texture_wo_2d"};
|
|
||||||
if (str == "texture_wo_2d_array") {
|
|
||||||
return {Token::Type::kTextureStorageWriteonly2dArray, source,
|
|
||||||
"texture_wo_2d_array"};
|
|
||||||
}
|
|
||||||
if (str == "texture_wo_3d")
|
|
||||||
return {Token::Type::kTextureStorageWriteonly3d, source, "texture_wo_3d"};
|
|
||||||
if (str == "true")
|
if (str == "true")
|
||||||
return {Token::Type::kTrue, source, "true"};
|
return {Token::Type::kTrue, source, "true"};
|
||||||
if (str == "type")
|
if (str == "type")
|
||||||
|
|
|
@ -558,13 +558,6 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
Token::Type::kTextureDepthCubeArray},
|
Token::Type::kTextureDepthCubeArray},
|
||||||
TokenData{"texture_multisampled_2d",
|
TokenData{"texture_multisampled_2d",
|
||||||
Token::Type::kTextureMultisampled2d},
|
Token::Type::kTextureMultisampled2d},
|
||||||
TokenData{"texture_ro_1d", Token::Type::kTextureStorageReadonly1d},
|
|
||||||
TokenData{"texture_ro_1d_array",
|
|
||||||
Token::Type::kTextureStorageReadonly1dArray},
|
|
||||||
TokenData{"texture_ro_2d", Token::Type::kTextureStorageReadonly2d},
|
|
||||||
TokenData{"texture_ro_2d_array",
|
|
||||||
Token::Type::kTextureStorageReadonly2dArray},
|
|
||||||
TokenData{"texture_ro_3d", Token::Type::kTextureStorageReadonly3d},
|
|
||||||
TokenData{"texture_storage_1d", Token::Type::kTextureStorage1d},
|
TokenData{"texture_storage_1d", Token::Type::kTextureStorage1d},
|
||||||
TokenData{"texture_storage_1d_array",
|
TokenData{"texture_storage_1d_array",
|
||||||
Token::Type::kTextureStorage1dArray},
|
Token::Type::kTextureStorage1dArray},
|
||||||
|
@ -572,43 +565,6 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
TokenData{"texture_storage_2d_array",
|
TokenData{"texture_storage_2d_array",
|
||||||
Token::Type::kTextureStorage2dArray},
|
Token::Type::kTextureStorage2dArray},
|
||||||
TokenData{"texture_storage_3d", Token::Type::kTextureStorage3d},
|
TokenData{"texture_storage_3d", Token::Type::kTextureStorage3d},
|
||||||
TokenData{"texture_storage_ro_1d",
|
|
||||||
Token::Type::kTextureStorageReadonly1d},
|
|
||||||
TokenData{"texture_storage_ro_1d_array",
|
|
||||||
Token::Type::kTextureStorageReadonly1dArray},
|
|
||||||
TokenData{"texture_storage_ro_2d",
|
|
||||||
Token::Type::kTextureStorageReadonly2d},
|
|
||||||
TokenData{"texture_storage_ro_2d_array",
|
|
||||||
Token::Type::kTextureStorageReadonly2dArray},
|
|
||||||
TokenData{"texture_storage_ro_3d",
|
|
||||||
Token::Type::kTextureStorageReadonly3d},
|
|
||||||
TokenData{"texture_storage_wo_1d",
|
|
||||||
Token::Type::kTextureStorageWriteonly1d},
|
|
||||||
TokenData{"texture_storage_wo_1d_array",
|
|
||||||
Token::Type::kTextureStorageWriteonly1dArray},
|
|
||||||
TokenData{"texture_storage_wo_2d",
|
|
||||||
Token::Type::kTextureStorageWriteonly2d},
|
|
||||||
TokenData{"texture_storage_wo_2d_array",
|
|
||||||
Token::Type::kTextureStorageWriteonly2dArray},
|
|
||||||
TokenData{"texture_storage_wo_3d",
|
|
||||||
Token::Type::kTextureStorageWriteonly3d},
|
|
||||||
TokenData{"texture_sampled_1d", Token::Type::kTextureSampled1d},
|
|
||||||
TokenData{"texture_sampled_1d_array",
|
|
||||||
Token::Type::kTextureSampled1dArray},
|
|
||||||
TokenData{"texture_sampled_2d", Token::Type::kTextureSampled2d},
|
|
||||||
TokenData{"texture_sampled_2d_array",
|
|
||||||
Token::Type::kTextureSampled2dArray},
|
|
||||||
TokenData{"texture_sampled_3d", Token::Type::kTextureSampled3d},
|
|
||||||
TokenData{"texture_sampled_cube", Token::Type::kTextureSampledCube},
|
|
||||||
TokenData{"texture_sampled_cube_array",
|
|
||||||
Token::Type::kTextureSampledCubeArray},
|
|
||||||
TokenData{"texture_wo_1d", Token::Type::kTextureStorageWriteonly1d},
|
|
||||||
TokenData{"texture_wo_1d_array",
|
|
||||||
Token::Type::kTextureStorageWriteonly1dArray},
|
|
||||||
TokenData{"texture_wo_2d", Token::Type::kTextureStorageWriteonly2d},
|
|
||||||
TokenData{"texture_wo_2d_array",
|
|
||||||
Token::Type::kTextureStorageWriteonly2dArray},
|
|
||||||
TokenData{"texture_wo_3d", Token::Type::kTextureStorageWriteonly3d},
|
|
||||||
TokenData{"true", Token::Type::kTrue},
|
TokenData{"true", Token::Type::kTrue},
|
||||||
TokenData{"type", Token::Type::kType},
|
TokenData{"type", Token::Type::kType},
|
||||||
TokenData{"u32", Token::Type::kU32},
|
TokenData{"u32", Token::Type::kU32},
|
||||||
|
|
|
@ -537,22 +537,6 @@ Maybe<type::Type*> ParserImpl::texture_sampler_types() {
|
||||||
return builder_.create<type::StorageTexture>(storage.value, format.value);
|
return builder_.create<type::StorageTexture>(storage.value, format.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEPRECATED
|
|
||||||
auto ac_storage = storage_texture_type_access_control();
|
|
||||||
if (ac_storage.matched) {
|
|
||||||
const char* use = "storage texture type";
|
|
||||||
|
|
||||||
auto format =
|
|
||||||
expect_lt_gt_block(use, [&] { return expect_image_storage_type(use); });
|
|
||||||
|
|
||||||
if (format.errored)
|
|
||||||
return Failure::kErrored;
|
|
||||||
|
|
||||||
return builder_.create<type::AccessControl>(
|
|
||||||
ac_storage->second,
|
|
||||||
builder_.create<type::StorageTexture>(ac_storage->first, format.value));
|
|
||||||
}
|
|
||||||
|
|
||||||
return Failure::kNoMatch;
|
return Failure::kNoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,76 +617,6 @@ Maybe<type::TextureDimension> ParserImpl::storage_texture_type() {
|
||||||
return Failure::kNoMatch;
|
return Failure::kNoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEPRECATED
|
|
||||||
// storage_texture_type
|
|
||||||
// | TEXTURE_RO_1D
|
|
||||||
// | TEXTURE_RO_1D_ARRAY
|
|
||||||
// | TEXTURE_RO_2D
|
|
||||||
// | TEXTURE_RO_2D_ARRAY
|
|
||||||
// | TEXTURE_RO_3D
|
|
||||||
// | TEXTURE_WO_1D
|
|
||||||
// | TEXTURE_WO_1D_ARRAY
|
|
||||||
// | TEXTURE_WO_2D
|
|
||||||
// | TEXTURE_WO_2D_ARRAY
|
|
||||||
// | TEXTURE_WO_3D
|
|
||||||
// | TEXTURE_STORAGE_RO_1D
|
|
||||||
// | TEXTURE_STORAGE_RO_1D_ARRAY
|
|
||||||
// | TEXTURE_STORAGE_RO_2D
|
|
||||||
// | TEXTURE_STORAGE_RO_2D_ARRAY
|
|
||||||
// | TEXTURE_STORAGE_RO_3D
|
|
||||||
// | TEXTURE_STORAGE_WO_1D
|
|
||||||
// | TEXTURE_STORAGE_WO_1D_ARRAY
|
|
||||||
// | TEXTURE_STORAGE_WO_2D
|
|
||||||
// | TEXTURE_STORAGE_WO_2D_ARRAY
|
|
||||||
// | TEXTURE_STORAGE_WO_3D
|
|
||||||
Maybe<std::pair<type::TextureDimension, ast::AccessControl>>
|
|
||||||
ParserImpl::storage_texture_type_access_control() {
|
|
||||||
using Ret = std::pair<type::TextureDimension, ast::AccessControl>;
|
|
||||||
if (match(Token::Type::kTextureStorageReadonly1d)) {
|
|
||||||
return Ret{type::TextureDimension::k1d, ast::AccessControl::kReadOnly};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match(Token::Type::kTextureStorageReadonly1dArray)) {
|
|
||||||
return Ret{type::TextureDimension::k1dArray, ast::AccessControl::kReadOnly};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match(Token::Type::kTextureStorageReadonly2d)) {
|
|
||||||
return Ret{type::TextureDimension::k2d, ast::AccessControl::kReadOnly};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match(Token::Type::kTextureStorageReadonly2dArray)) {
|
|
||||||
return Ret{type::TextureDimension::k2dArray, ast::AccessControl::kReadOnly};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match(Token::Type::kTextureStorageReadonly3d)) {
|
|
||||||
return Ret{type::TextureDimension::k3d, ast::AccessControl::kReadOnly};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match(Token::Type::kTextureStorageWriteonly1d)) {
|
|
||||||
return Ret{type::TextureDimension::k1d, ast::AccessControl::kWriteOnly};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match(Token::Type::kTextureStorageWriteonly1dArray)) {
|
|
||||||
return Ret{type::TextureDimension::k1dArray,
|
|
||||||
ast::AccessControl::kWriteOnly};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match(Token::Type::kTextureStorageWriteonly2d)) {
|
|
||||||
return Ret{type::TextureDimension::k2d, ast::AccessControl::kWriteOnly};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match(Token::Type::kTextureStorageWriteonly2dArray)) {
|
|
||||||
return Ret{type::TextureDimension::k2dArray,
|
|
||||||
ast::AccessControl::kWriteOnly};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match(Token::Type::kTextureStorageWriteonly3d)) {
|
|
||||||
return Ret{type::TextureDimension::k3d, ast::AccessControl::kWriteOnly};
|
|
||||||
}
|
|
||||||
|
|
||||||
return Failure::kNoMatch;
|
|
||||||
}
|
|
||||||
|
|
||||||
// depth_texture_type
|
// depth_texture_type
|
||||||
// : TEXTURE_DEPTH_2D
|
// : TEXTURE_DEPTH_2D
|
||||||
// | TEXTURE_DEPTH_2D_ARRAY
|
// | TEXTURE_DEPTH_2D_ARRAY
|
||||||
|
|
|
@ -430,11 +430,6 @@ class ParserImpl {
|
||||||
/// @returns returns the storage texture dimension.
|
/// @returns returns the storage texture dimension.
|
||||||
/// Returns kNone if none matched.
|
/// Returns kNone if none matched.
|
||||||
Maybe<type::TextureDimension> storage_texture_type();
|
Maybe<type::TextureDimension> storage_texture_type();
|
||||||
/// Parses a deprecated `storage_texture_type` grammar element
|
|
||||||
/// @returns returns the storage texture dimension and the storage access.
|
|
||||||
/// Returns kNone and kRead if none matched.
|
|
||||||
Maybe<std::pair<type::TextureDimension, ast::AccessControl>>
|
|
||||||
storage_texture_type_access_control();
|
|
||||||
/// Parses a `depth_texture_type` grammar element
|
/// Parses a `depth_texture_type` grammar element
|
||||||
/// @returns the parsed Type or nullptr if none matched.
|
/// @returns the parsed Type or nullptr if none matched.
|
||||||
Maybe<type::Type*> depth_texture_type();
|
Maybe<type::Type*> depth_texture_type();
|
||||||
|
|
|
@ -566,27 +566,6 @@ TEST_F(ParserImplErrorTest, GlobalDeclConstExprMissingRParen) {
|
||||||
" ^\n");
|
" ^\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplErrorTest, GlobalDeclSampledTextureMissingLessThan_Old) {
|
|
||||||
EXPECT("var x : texture_sampled_1d;",
|
|
||||||
"test.wgsl:1:27 error: expected '<' for sampled texture type\n"
|
|
||||||
"var x : texture_sampled_1d;\n"
|
|
||||||
" ^\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplErrorTest, GlobalDeclSampledTextureMissingGreaterThan_Old) {
|
|
||||||
EXPECT("var x : texture_sampled_1d<f32;",
|
|
||||||
"test.wgsl:1:31 error: expected '>' for sampled texture type\n"
|
|
||||||
"var x : texture_sampled_1d<f32;\n"
|
|
||||||
" ^\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplErrorTest, GlobalDeclSampledTextureInvalidSubtype_Old) {
|
|
||||||
EXPECT("var x : texture_sampled_1d<1>;",
|
|
||||||
"test.wgsl:1:28 error: invalid type for sampled texture type\n"
|
|
||||||
"var x : texture_sampled_1d<1>;\n"
|
|
||||||
" ^\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplErrorTest, GlobalDeclSampledTextureMissingLessThan) {
|
TEST_F(ParserImplErrorTest, GlobalDeclSampledTextureMissingLessThan) {
|
||||||
EXPECT("var x : texture_1d;",
|
EXPECT("var x : texture_1d;",
|
||||||
"test.wgsl:1:19 error: expected '<' for sampled texture type\n"
|
"test.wgsl:1:19 error: expected '<' for sampled texture type\n"
|
||||||
|
@ -629,27 +608,6 @@ TEST_F(ParserImplErrorTest, GlobalDeclMultisampledTextureInvalidSubtype) {
|
||||||
" ^\n");
|
" ^\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingLessThan_Old) {
|
|
||||||
EXPECT("var x : texture_ro_2d;",
|
|
||||||
"test.wgsl:1:22 error: expected '<' for storage texture type\n"
|
|
||||||
"var x : texture_ro_2d;\n"
|
|
||||||
" ^\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingGreaterThan_Old) {
|
|
||||||
EXPECT("var x : texture_ro_2d<r8uint;",
|
|
||||||
"test.wgsl:1:29 error: expected '>' for storage texture type\n"
|
|
||||||
"var x : texture_ro_2d<r8uint;\n"
|
|
||||||
" ^\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingInvalidSubtype_Old) {
|
|
||||||
EXPECT("var x : texture_ro_2d<1>;",
|
|
||||||
"test.wgsl:1:23 error: invalid format for storage texture type\n"
|
|
||||||
"var x : texture_ro_2d<1>;\n"
|
|
||||||
" ^\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingLessThan) {
|
TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingLessThan) {
|
||||||
EXPECT("var x : [[access(read)]] texture_storage_2d;",
|
EXPECT("var x : [[access(read)]] texture_storage_2d;",
|
||||||
"test.wgsl:1:44 error: expected '<' for storage texture type\n"
|
"test.wgsl:1:44 error: expected '<' for storage texture type\n"
|
||||||
|
@ -678,34 +636,6 @@ TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingInvalidSubtype) {
|
||||||
" ^\n");
|
" ^\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingLessThan_old) {
|
|
||||||
EXPECT("var x : texture_storage_ro_2d;",
|
|
||||||
"test.wgsl:1:30 error: expected '<' for storage texture type\n"
|
|
||||||
"var x : texture_storage_ro_2d;\n"
|
|
||||||
" ^\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingGreaterThan_old) {
|
|
||||||
EXPECT("var x : texture_storage_ro_2d<r8uint;",
|
|
||||||
"test.wgsl:1:37 error: expected '>' for storage texture type\n"
|
|
||||||
"var x : texture_storage_ro_2d<r8uint;\n"
|
|
||||||
" ^\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingSubtype_old) {
|
|
||||||
EXPECT("var x : texture_storage_ro_2d<>;",
|
|
||||||
"test.wgsl:1:31 error: invalid format for storage texture type\n"
|
|
||||||
"var x : texture_storage_ro_2d<>;\n"
|
|
||||||
" ^\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingInvalidSubtype_old) {
|
|
||||||
EXPECT("var x : texture_storage_ro_2d<1>;",
|
|
||||||
"test.wgsl:1:31 error: invalid format for storage texture type\n"
|
|
||||||
"var x : texture_storage_ro_2d<1>;\n"
|
|
||||||
" ^\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplErrorTest, GlobalDeclStructDecoMissingStruct) {
|
TEST_F(ParserImplErrorTest, GlobalDeclStructDecoMissingStruct) {
|
||||||
EXPECT("[[block]];",
|
EXPECT("[[block]];",
|
||||||
"test.wgsl:1:10 error: expected declaration after decorations\n"
|
"test.wgsl:1:10 error: expected declaration after decorations\n"
|
||||||
|
|
|
@ -30,69 +30,6 @@ TEST_F(ParserImplTest, SampledTextureType_Invalid) {
|
||||||
EXPECT_FALSE(p->has_error());
|
EXPECT_FALSE(p->has_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest, SampledTextureType_1d_Old) {
|
|
||||||
auto p = parser("texture_sampled_1d");
|
|
||||||
auto t = p->sampled_texture_type();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(t.value, type::TextureDimension::k1d);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, SampledTextureType_1dArray_Old) {
|
|
||||||
auto p = parser("texture_sampled_1d_array");
|
|
||||||
auto t = p->sampled_texture_type();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(t.value, type::TextureDimension::k1dArray);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, SampledTextureType_2d_Old) {
|
|
||||||
auto p = parser("texture_sampled_2d");
|
|
||||||
auto t = p->sampled_texture_type();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(t.value, type::TextureDimension::k2d);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, SampledTextureType_2dArray_Old) {
|
|
||||||
auto p = parser("texture_sampled_2d_array");
|
|
||||||
auto t = p->sampled_texture_type();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(t.value, type::TextureDimension::k2dArray);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, SampledTextureType_3d_Old) {
|
|
||||||
auto p = parser("texture_sampled_3d");
|
|
||||||
auto t = p->sampled_texture_type();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(t.value, type::TextureDimension::k3d);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, SampledTextureType_Cube_Old) {
|
|
||||||
auto p = parser("texture_sampled_cube");
|
|
||||||
auto t = p->sampled_texture_type();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(t.value, type::TextureDimension::kCube);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, SampledTextureType_kCubeArray_Old) {
|
|
||||||
auto p = parser("texture_sampled_cube_array");
|
|
||||||
auto t = p->sampled_texture_type();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(t.value, type::TextureDimension::kCubeArray);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, SampledTextureType_1d) {
|
TEST_F(ParserImplTest, SampledTextureType_1d) {
|
||||||
auto p = parser("texture_1d");
|
auto p = parser("texture_1d");
|
||||||
auto t = p->sampled_texture_type();
|
auto t = p->sampled_texture_type();
|
||||||
|
|
|
@ -75,213 +75,6 @@ TEST_F(ParserImplTest, StorageTextureType_3d) {
|
||||||
EXPECT_FALSE(p->has_error());
|
EXPECT_FALSE(p->has_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_Invalid_old) {
|
|
||||||
auto p = parser("abc");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_FALSE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_Readonly1d_Old) {
|
|
||||||
auto p = parser("texture_ro_1d");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k1d);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kReadOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_Readonly1dArray_Old) {
|
|
||||||
auto p = parser("texture_ro_1d_array");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k1dArray);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kReadOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_Readonly2d_Old) {
|
|
||||||
auto p = parser("texture_ro_2d");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k2d);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kReadOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_Readonly2dArray_Old) {
|
|
||||||
auto p = parser("texture_ro_2d_array");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k2dArray);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kReadOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_Readonly3d_Old) {
|
|
||||||
auto p = parser("texture_ro_3d");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k3d);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kReadOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_Writeonly1d_Old) {
|
|
||||||
auto p = parser("texture_wo_1d");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k1d);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kWriteOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_Writeonly1dArray_Old) {
|
|
||||||
auto p = parser("texture_wo_1d_array");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k1dArray);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kWriteOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_Writeonly2d_Old) {
|
|
||||||
auto p = parser("texture_wo_2d");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k2d);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kWriteOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_Writeonly2dArray_Old) {
|
|
||||||
auto p = parser("texture_wo_2d_array");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k2dArray);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kWriteOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_Writeonly3d_Old) {
|
|
||||||
auto p = parser("texture_wo_3d");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k3d);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kWriteOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_ro_1d) {
|
|
||||||
auto p = parser("texture_storage_ro_1d");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k1d);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kReadOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_ro_1dArray) {
|
|
||||||
auto p = parser("texture_storage_ro_1d_array");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k1dArray);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kReadOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_ro_2d) {
|
|
||||||
auto p = parser("texture_storage_ro_2d");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k2d);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kReadOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_ro_2dArray) {
|
|
||||||
auto p = parser("texture_storage_ro_2d_array");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k2dArray);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kReadOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_ro_3d) {
|
|
||||||
auto p = parser("texture_storage_ro_3d");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k3d);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kReadOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_wo_1d) {
|
|
||||||
auto p = parser("texture_storage_wo_1d");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k1d);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kWriteOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_wo_1dArray) {
|
|
||||||
auto p = parser("texture_storage_wo_1d_array");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k1dArray);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kWriteOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_wo_2d) {
|
|
||||||
auto p = parser("texture_storage_wo_2d");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k2d);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kWriteOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_wo_2dArray) {
|
|
||||||
auto p = parser("texture_storage_wo_2d_array");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k2dArray);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kWriteOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, StorageTextureType_wo_3d) {
|
|
||||||
auto p = parser("texture_storage_wo_3d");
|
|
||||||
auto t = p->storage_texture_type_access_control();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
EXPECT_EQ(std::get<0>(t.value), type::TextureDimension::k3d);
|
|
||||||
EXPECT_EQ(std::get<1>(t.value), ast::AccessControl::kWriteOnly);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
}
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace wgsl
|
} // namespace wgsl
|
||||||
} // namespace reader
|
} // namespace reader
|
||||||
|
|
|
@ -72,86 +72,6 @@ TEST_F(ParserImplTest, TextureSamplerTypes_DepthTexture) {
|
||||||
EXPECT_EQ(t->As<type::Texture>()->dim(), type::TextureDimension::k2d);
|
EXPECT_EQ(t->As<type::Texture>()->dim(), type::TextureDimension::k2d);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_F32_Old) {
|
|
||||||
auto p = parser("texture_sampled_1d<f32>");
|
|
||||||
auto t = p->texture_sampler_types();
|
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
ASSERT_NE(t.value, nullptr);
|
|
||||||
ASSERT_TRUE(t->Is<type::Texture>());
|
|
||||||
ASSERT_TRUE(t->Is<type::SampledTexture>());
|
|
||||||
ASSERT_TRUE(t->As<type::SampledTexture>()->type()->Is<type::F32>());
|
|
||||||
EXPECT_EQ(t->As<type::Texture>()->dim(), type::TextureDimension::k1d);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_I32_Old) {
|
|
||||||
auto p = parser("texture_sampled_2d<i32>");
|
|
||||||
auto t = p->texture_sampler_types();
|
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
ASSERT_NE(t.value, nullptr);
|
|
||||||
ASSERT_TRUE(t->Is<type::Texture>());
|
|
||||||
ASSERT_TRUE(t->Is<type::SampledTexture>());
|
|
||||||
ASSERT_TRUE(t->As<type::SampledTexture>()->type()->Is<type::I32>());
|
|
||||||
EXPECT_EQ(t->As<type::Texture>()->dim(), type::TextureDimension::k2d);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_U32_Old) {
|
|
||||||
auto p = parser("texture_sampled_3d<u32>");
|
|
||||||
auto t = p->texture_sampler_types();
|
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
ASSERT_NE(t.value, nullptr);
|
|
||||||
ASSERT_TRUE(t->Is<type::Texture>());
|
|
||||||
ASSERT_TRUE(t->Is<type::SampledTexture>());
|
|
||||||
ASSERT_TRUE(t->As<type::SampledTexture>()->type()->Is<type::U32>());
|
|
||||||
EXPECT_EQ(t->As<type::Texture>()->dim(), type::TextureDimension::k3d);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_Invalid_Old) {
|
|
||||||
auto p = parser("texture_sampled_1d<abc>");
|
|
||||||
auto t = p->texture_sampler_types();
|
|
||||||
ASSERT_TRUE(p->has_error());
|
|
||||||
EXPECT_EQ(t.value, nullptr);
|
|
||||||
EXPECT_FALSE(t.matched);
|
|
||||||
EXPECT_TRUE(t.errored);
|
|
||||||
EXPECT_EQ(p->error(), "1:20: unknown constructed type 'abc'");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingType_Old) {
|
|
||||||
auto p = parser("texture_sampled_1d<>");
|
|
||||||
auto t = p->texture_sampler_types();
|
|
||||||
ASSERT_TRUE(p->has_error());
|
|
||||||
EXPECT_EQ(t.value, nullptr);
|
|
||||||
EXPECT_FALSE(t.matched);
|
|
||||||
EXPECT_TRUE(t.errored);
|
|
||||||
EXPECT_EQ(p->error(), "1:20: invalid type for sampled texture type");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingLessThan_Old) {
|
|
||||||
auto p = parser("texture_sampled_1d");
|
|
||||||
auto t = p->texture_sampler_types();
|
|
||||||
ASSERT_TRUE(p->has_error());
|
|
||||||
EXPECT_EQ(t.value, nullptr);
|
|
||||||
EXPECT_FALSE(t.matched);
|
|
||||||
EXPECT_TRUE(t.errored);
|
|
||||||
EXPECT_EQ(p->error(), "1:19: expected '<' for sampled texture type");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest,
|
|
||||||
TextureSamplerTypes_SampledTexture_MissingGreaterThan_Old) {
|
|
||||||
auto p = parser("texture_sampled_1d<u32");
|
|
||||||
auto t = p->texture_sampler_types();
|
|
||||||
ASSERT_TRUE(p->has_error());
|
|
||||||
EXPECT_EQ(t.value, nullptr);
|
|
||||||
EXPECT_FALSE(t.matched);
|
|
||||||
EXPECT_TRUE(t.errored);
|
|
||||||
EXPECT_EQ(p->error(), "1:23: expected '>' for sampled texture type");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_F32) {
|
TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_F32) {
|
||||||
auto p = parser("texture_1d<f32>");
|
auto p = parser("texture_1d<f32>");
|
||||||
auto t = p->texture_sampler_types();
|
auto t = p->texture_sampler_types();
|
||||||
|
@ -284,164 +204,6 @@ TEST_F(ParserImplTest,
|
||||||
EXPECT_EQ(p->error(), "1:28: expected '>' for multisampled texture type");
|
EXPECT_EQ(p->error(), "1:28: expected '>' for multisampled texture type");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest,
|
|
||||||
TextureSamplerTypes_StorageTexture_Readonly1dR8Unorm_Old) {
|
|
||||||
auto p = parser("texture_ro_1d<r8unorm>");
|
|
||||||
auto ac = p->texture_sampler_types();
|
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
|
||||||
EXPECT_TRUE(ac.matched);
|
|
||||||
EXPECT_FALSE(ac.errored);
|
|
||||||
ASSERT_NE(ac.value, nullptr);
|
|
||||||
|
|
||||||
ASSERT_TRUE(ac->Is<type::AccessControl>());
|
|
||||||
EXPECT_EQ(ac->As<type::AccessControl>()->access_control(),
|
|
||||||
ast::AccessControl::kReadOnly);
|
|
||||||
|
|
||||||
auto* t = ac->As<type::AccessControl>()->type();
|
|
||||||
ASSERT_TRUE(t->Is<type::Texture>());
|
|
||||||
ASSERT_TRUE(t->Is<type::StorageTexture>());
|
|
||||||
EXPECT_EQ(t->As<type::StorageTexture>()->image_format(),
|
|
||||||
type::ImageFormat::kR8Unorm);
|
|
||||||
EXPECT_EQ(t->As<type::Texture>()->dim(), type::TextureDimension::k1d);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest,
|
|
||||||
TextureSamplerTypes_StorageTexture_Writeonly2dR16Float_Old) {
|
|
||||||
auto p = parser("texture_wo_2d<r16float>");
|
|
||||||
auto ac = p->texture_sampler_types();
|
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
|
||||||
EXPECT_TRUE(ac.matched);
|
|
||||||
EXPECT_FALSE(ac.errored);
|
|
||||||
ASSERT_NE(ac.value, nullptr);
|
|
||||||
|
|
||||||
ASSERT_TRUE(ac->Is<type::AccessControl>());
|
|
||||||
EXPECT_EQ(ac->As<type::AccessControl>()->access_control(),
|
|
||||||
ast::AccessControl::kWriteOnly);
|
|
||||||
|
|
||||||
auto* t = ac->As<type::AccessControl>()->type();
|
|
||||||
ASSERT_TRUE(t->Is<type::Texture>());
|
|
||||||
ASSERT_TRUE(t->Is<type::StorageTexture>());
|
|
||||||
EXPECT_EQ(t->As<type::StorageTexture>()->image_format(),
|
|
||||||
type::ImageFormat::kR16Float);
|
|
||||||
EXPECT_EQ(t->As<type::Texture>()->dim(), type::TextureDimension::k2d);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidType_Old) {
|
|
||||||
auto p = parser("texture_ro_1d<abc>");
|
|
||||||
auto t = p->texture_sampler_types();
|
|
||||||
EXPECT_EQ(t.value, nullptr);
|
|
||||||
EXPECT_FALSE(t.matched);
|
|
||||||
EXPECT_TRUE(t.errored);
|
|
||||||
EXPECT_EQ(p->error(), "1:15: invalid format for storage texture type");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingType_Old) {
|
|
||||||
auto p = parser("texture_wo_1d<>");
|
|
||||||
auto t = p->texture_sampler_types();
|
|
||||||
EXPECT_EQ(t.value, nullptr);
|
|
||||||
EXPECT_FALSE(t.matched);
|
|
||||||
EXPECT_TRUE(t.errored);
|
|
||||||
EXPECT_EQ(p->error(), "1:15: invalid format for storage texture type");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingLessThan_Old) {
|
|
||||||
auto p = parser("texture_ro_1d");
|
|
||||||
auto t = p->texture_sampler_types();
|
|
||||||
EXPECT_EQ(t.value, nullptr);
|
|
||||||
EXPECT_FALSE(t.matched);
|
|
||||||
EXPECT_TRUE(t.errored);
|
|
||||||
EXPECT_EQ(p->error(), "1:14: expected '<' for storage texture type");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest,
|
|
||||||
TextureSamplerTypes_StorageTexture_MissingGreaterThan_Old) {
|
|
||||||
auto p = parser("texture_wo_1d<r8unorm");
|
|
||||||
auto t = p->texture_sampler_types();
|
|
||||||
EXPECT_EQ(t.value, nullptr);
|
|
||||||
EXPECT_FALSE(t.matched);
|
|
||||||
EXPECT_TRUE(t.errored);
|
|
||||||
EXPECT_EQ(p->error(), "1:22: expected '>' for storage texture type");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest,
|
|
||||||
TextureSamplerTypes_StorageTexture_Readonly1dR8Unorm_old) {
|
|
||||||
auto p = parser("texture_storage_ro_1d<r8unorm>");
|
|
||||||
auto ac = p->texture_sampler_types();
|
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
|
||||||
EXPECT_TRUE(ac.matched);
|
|
||||||
EXPECT_FALSE(ac.errored);
|
|
||||||
ASSERT_NE(ac.value, nullptr);
|
|
||||||
|
|
||||||
ASSERT_TRUE(ac->Is<type::AccessControl>());
|
|
||||||
EXPECT_EQ(ac->As<type::AccessControl>()->access_control(),
|
|
||||||
ast::AccessControl::kReadOnly);
|
|
||||||
|
|
||||||
auto* t = ac->As<type::AccessControl>()->type();
|
|
||||||
ASSERT_TRUE(t->Is<type::Texture>());
|
|
||||||
ASSERT_TRUE(t->Is<type::StorageTexture>());
|
|
||||||
EXPECT_EQ(t->As<type::StorageTexture>()->image_format(),
|
|
||||||
type::ImageFormat::kR8Unorm);
|
|
||||||
EXPECT_EQ(t->As<type::Texture>()->dim(), type::TextureDimension::k1d);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest,
|
|
||||||
TextureSamplerTypes_StorageTexture_Writeonly2dR16Float_old) {
|
|
||||||
auto p = parser("texture_storage_wo_2d<r16float>");
|
|
||||||
auto ac = p->texture_sampler_types();
|
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
|
||||||
EXPECT_TRUE(ac.matched);
|
|
||||||
EXPECT_FALSE(ac.errored);
|
|
||||||
ASSERT_NE(ac.value, nullptr);
|
|
||||||
|
|
||||||
ASSERT_TRUE(ac->Is<type::AccessControl>());
|
|
||||||
EXPECT_EQ(ac->As<type::AccessControl>()->access_control(),
|
|
||||||
ast::AccessControl::kWriteOnly);
|
|
||||||
|
|
||||||
auto* t = ac->As<type::AccessControl>()->type();
|
|
||||||
ASSERT_TRUE(t->Is<type::Texture>());
|
|
||||||
ASSERT_TRUE(t->Is<type::StorageTexture>());
|
|
||||||
EXPECT_EQ(t->As<type::StorageTexture>()->image_format(),
|
|
||||||
type::ImageFormat::kR16Float);
|
|
||||||
EXPECT_EQ(t->As<type::Texture>()->dim(), type::TextureDimension::k2d);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidType_old) {
|
|
||||||
auto p = parser("texture_storage_ro_1d<abc>");
|
|
||||||
auto t = p->texture_sampler_types();
|
|
||||||
EXPECT_EQ(t.value, nullptr);
|
|
||||||
EXPECT_FALSE(t.matched);
|
|
||||||
EXPECT_TRUE(t.errored);
|
|
||||||
EXPECT_EQ(p->error(), "1:23: invalid format for storage texture type");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingType_old) {
|
|
||||||
auto p = parser("texture_storage_ro_1d<>");
|
|
||||||
auto t = p->texture_sampler_types();
|
|
||||||
EXPECT_EQ(t.value, nullptr);
|
|
||||||
EXPECT_FALSE(t.matched);
|
|
||||||
EXPECT_TRUE(t.errored);
|
|
||||||
EXPECT_EQ(p->error(), "1:23: invalid format for storage texture type");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingLessThan_old) {
|
|
||||||
auto p = parser("texture_storage_ro_1d");
|
|
||||||
auto t = p->texture_sampler_types();
|
|
||||||
EXPECT_EQ(t.value, nullptr);
|
|
||||||
EXPECT_FALSE(t.matched);
|
|
||||||
EXPECT_TRUE(t.errored);
|
|
||||||
EXPECT_EQ(p->error(), "1:22: expected '<' for storage texture type");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest,
|
|
||||||
TextureSamplerTypes_StorageTexture_MissingGreaterThan_old) {
|
|
||||||
auto p = parser("texture_storage_ro_1d<r8unorm");
|
|
||||||
auto t = p->texture_sampler_types();
|
|
||||||
EXPECT_EQ(t.value, nullptr);
|
|
||||||
EXPECT_FALSE(t.matched);
|
|
||||||
EXPECT_TRUE(t.errored);
|
|
||||||
EXPECT_EQ(p->error(), "1:30: expected '>' for storage texture type");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Readonly1dR8Unorm) {
|
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Readonly1dR8Unorm) {
|
||||||
auto p = parser("texture_storage_1d<r8unorm>");
|
auto p = parser("texture_storage_1d<r8unorm>");
|
||||||
auto t = p->texture_sampler_types();
|
auto t = p->texture_sampler_types();
|
||||||
|
|
|
@ -751,23 +751,6 @@ TEST_F(ParserImplTest, TypeDecl_Sampler) {
|
||||||
ASSERT_FALSE(t->As<type::Sampler>()->IsComparison());
|
ASSERT_FALSE(t->As<type::Sampler>()->IsComparison());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Texture_Old) {
|
|
||||||
auto p = parser("texture_sampled_cube<f32>");
|
|
||||||
|
|
||||||
auto& builder = p->builder();
|
|
||||||
auto* type = builder.create<type::SampledTexture>(
|
|
||||||
type::TextureDimension::kCube, ty.f32());
|
|
||||||
|
|
||||||
auto t = p->type_decl();
|
|
||||||
EXPECT_TRUE(t.matched);
|
|
||||||
EXPECT_FALSE(t.errored);
|
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
|
||||||
EXPECT_EQ(t.value, type);
|
|
||||||
ASSERT_TRUE(t->Is<type::Texture>());
|
|
||||||
ASSERT_TRUE(t->Is<type::SampledTexture>());
|
|
||||||
ASSERT_TRUE(t->As<type::SampledTexture>()->type()->Is<type::F32>());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ParserImplTest, TypeDecl_Texture) {
|
TEST_F(ParserImplTest, TypeDecl_Texture) {
|
||||||
auto p = parser("texture_cube<f32>");
|
auto p = parser("texture_cube<f32>");
|
||||||
|
|
||||||
|
|
|
@ -267,16 +267,6 @@ std::string Token::TypeToName(Type type) {
|
||||||
return "texture_depth_cube_array";
|
return "texture_depth_cube_array";
|
||||||
case Token::Type::kTextureMultisampled2d:
|
case Token::Type::kTextureMultisampled2d:
|
||||||
return "texture_multisampled_2d";
|
return "texture_multisampled_2d";
|
||||||
case Token::Type::kTextureStorageReadonly1d:
|
|
||||||
return "texture_storage_ro_1d";
|
|
||||||
case Token::Type::kTextureStorageReadonly1dArray:
|
|
||||||
return "texture_storage_ro_1d_array";
|
|
||||||
case Token::Type::kTextureStorageReadonly2d:
|
|
||||||
return "texture_storage_ro_2d";
|
|
||||||
case Token::Type::kTextureStorageReadonly2dArray:
|
|
||||||
return "texture_storage_ro_2d_array";
|
|
||||||
case Token::Type::kTextureStorageReadonly3d:
|
|
||||||
return "texture_storage_ro_3d";
|
|
||||||
case Token::Type::kTextureSampled1d:
|
case Token::Type::kTextureSampled1d:
|
||||||
return "texture_1d";
|
return "texture_1d";
|
||||||
case Token::Type::kTextureSampled1dArray:
|
case Token::Type::kTextureSampled1dArray:
|
||||||
|
@ -301,16 +291,6 @@ std::string Token::TypeToName(Type type) {
|
||||||
return "texture_storage_2d_array";
|
return "texture_storage_2d_array";
|
||||||
case Token::Type::kTextureStorage3d:
|
case Token::Type::kTextureStorage3d:
|
||||||
return "texture_storage_3d";
|
return "texture_storage_3d";
|
||||||
case Token::Type::kTextureStorageWriteonly1d:
|
|
||||||
return "texture_storage_wo_1d";
|
|
||||||
case Token::Type::kTextureStorageWriteonly1dArray:
|
|
||||||
return "texture_storage_wo_1d_array";
|
|
||||||
case Token::Type::kTextureStorageWriteonly2d:
|
|
||||||
return "texture_storage_wo_2d";
|
|
||||||
case Token::Type::kTextureStorageWriteonly2dArray:
|
|
||||||
return "texture_storage_wo_2d_array";
|
|
||||||
case Token::Type::kTextureStorageWriteonly3d:
|
|
||||||
return "texture_storage_wo_3d";
|
|
||||||
case Token::Type::kTrue:
|
case Token::Type::kTrue:
|
||||||
return "true";
|
return "true";
|
||||||
case Token::Type::kType:
|
case Token::Type::kType:
|
||||||
|
|
|
@ -278,16 +278,6 @@ class Token {
|
||||||
kTextureDepthCubeArray,
|
kTextureDepthCubeArray,
|
||||||
/// A 'texture_multisampled_2d'
|
/// A 'texture_multisampled_2d'
|
||||||
kTextureMultisampled2d,
|
kTextureMultisampled2d,
|
||||||
/// A 'texture_storage_ro_1d'
|
|
||||||
kTextureStorageReadonly1d,
|
|
||||||
/// A 'texture_storage_ro_2d_array'
|
|
||||||
kTextureStorageReadonly1dArray,
|
|
||||||
/// A 'texture_storage_ro_2d'
|
|
||||||
kTextureStorageReadonly2d,
|
|
||||||
/// A 'texture_storage_ro_2d_array'
|
|
||||||
kTextureStorageReadonly2dArray,
|
|
||||||
/// A 'texture_storage_ro_3d'
|
|
||||||
kTextureStorageReadonly3d,
|
|
||||||
/// A 'texture_1d'
|
/// A 'texture_1d'
|
||||||
kTextureSampled1d,
|
kTextureSampled1d,
|
||||||
/// A 'texture_1d_array'
|
/// A 'texture_1d_array'
|
||||||
|
@ -312,16 +302,6 @@ class Token {
|
||||||
kTextureStorage2dArray,
|
kTextureStorage2dArray,
|
||||||
/// A 'texture_storage_3d'
|
/// A 'texture_storage_3d'
|
||||||
kTextureStorage3d,
|
kTextureStorage3d,
|
||||||
/// A 'texture_wo_1d'
|
|
||||||
kTextureStorageWriteonly1d,
|
|
||||||
/// A 'texture_wo_2d_array'
|
|
||||||
kTextureStorageWriteonly1dArray,
|
|
||||||
/// A 'texture_wo_2d'
|
|
||||||
kTextureStorageWriteonly2d,
|
|
||||||
/// A 'texture_wo_2d_array'
|
|
||||||
kTextureStorageWriteonly2dArray,
|
|
||||||
/// A 'texture_wo_3d'
|
|
||||||
kTextureStorageWriteonly3d,
|
|
||||||
/// A 'true'
|
/// A 'true'
|
||||||
kTrue,
|
kTrue,
|
||||||
/// A 'type'
|
/// A 'type'
|
||||||
|
@ -665,26 +645,6 @@ class Token {
|
||||||
}
|
}
|
||||||
/// @returns true if token is a 'texture_storage_3d'
|
/// @returns true if token is a 'texture_storage_3d'
|
||||||
bool IsTextureStorage3d() const { return type_ == Type::kTextureStorage3d; }
|
bool IsTextureStorage3d() const { return type_ == Type::kTextureStorage3d; }
|
||||||
/// @returns true if token is a 'texture_storage_ro_1d'
|
|
||||||
bool IsTextureStorageReadonly1d() const {
|
|
||||||
return type_ == Type::kTextureStorageReadonly1d;
|
|
||||||
}
|
|
||||||
/// @returns true if token is a 'texture_storage_ro_1d_array'
|
|
||||||
bool IsTextureStorageReadonly1dArray() const {
|
|
||||||
return type_ == Type::kTextureStorageReadonly1dArray;
|
|
||||||
}
|
|
||||||
/// @returns true if token is a 'texture_storage_ro_2d'
|
|
||||||
bool IsTextureStorageReadonly2d() const {
|
|
||||||
return type_ == Type::kTextureStorageReadonly2d;
|
|
||||||
}
|
|
||||||
/// @returns true if token is a 'texture_storage_ro_2d_array'
|
|
||||||
bool IsTextureStorageReadonly2dArray() const {
|
|
||||||
return type_ == Type::kTextureStorageReadonly2dArray;
|
|
||||||
}
|
|
||||||
/// @returns true if token is a 'texture_storage_ro_3d'
|
|
||||||
bool IsTextureStorageReadonly3d() const {
|
|
||||||
return type_ == Type::kTextureStorageReadonly3d;
|
|
||||||
}
|
|
||||||
/// @returns true if token is a 'texture_1d'
|
/// @returns true if token is a 'texture_1d'
|
||||||
bool IsTextureSampled1d() const { return type_ == Type::kTextureSampled1d; }
|
bool IsTextureSampled1d() const { return type_ == Type::kTextureSampled1d; }
|
||||||
/// @returns true if token is a 'texture_1d_array'
|
/// @returns true if token is a 'texture_1d_array'
|
||||||
|
@ -707,26 +667,6 @@ class Token {
|
||||||
bool IsTextureSampledCubeArray() const {
|
bool IsTextureSampledCubeArray() const {
|
||||||
return type_ == Type::kTextureSampledCubeArray;
|
return type_ == Type::kTextureSampledCubeArray;
|
||||||
}
|
}
|
||||||
/// @returns true if token is a 'texture_storage_wo_1d'
|
|
||||||
bool IsTextureStorageWriteonly1d() const {
|
|
||||||
return type_ == Type::kTextureStorageWriteonly1d;
|
|
||||||
}
|
|
||||||
/// @returns true if token is a 'texture_storage_wo_1d_array'
|
|
||||||
bool IsTextureStorageWriteonly1dArray() const {
|
|
||||||
return type_ == Type::kTextureStorageWriteonly1dArray;
|
|
||||||
}
|
|
||||||
/// @returns true if token is a 'texture_storage_wo_2d'
|
|
||||||
bool IsTextureStorageWriteonly2d() const {
|
|
||||||
return type_ == Type::kTextureStorageWriteonly2d;
|
|
||||||
}
|
|
||||||
/// @returns true if token is a 'texture_storage_wo_2d_array'
|
|
||||||
bool IsTextureStorageWriteonly2dArray() const {
|
|
||||||
return type_ == Type::kTextureStorageWriteonly2dArray;
|
|
||||||
}
|
|
||||||
/// @returns true if token is a 'texture_storage_wo_3d'
|
|
||||||
bool IsTextureStorageWriteonly3d() const {
|
|
||||||
return type_ == Type::kTextureStorageWriteonly3d;
|
|
||||||
}
|
|
||||||
/// @returns true if token is a 'true'
|
/// @returns true if token is a 'true'
|
||||||
bool IsTrue() const { return type_ == Type::kTrue; }
|
bool IsTrue() const { return type_ == Type::kTrue; }
|
||||||
/// @returns true if token is a 'type'
|
/// @returns true if token is a 'type'
|
||||||
|
|
Loading…
Reference in New Issue