Sync some WGSL grammar names to spec
This CL updates some of the names used in the WGSL parser to match the grammar rules in the spec. Bug: tint:1633 Change-Id: I489e1c6a945bdd6063d400cfdbd87aa81a97c5f0 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99200 Kokoro: Kokoro <noreply+kokoro@google.com> Auto-Submit: Dan Sinclair <dsinclair@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
f8a34d08dd
commit
6e716c77ac
|
@ -690,20 +690,20 @@ Maybe<ParserImpl::VarDeclInfo> ParserImpl::variable_decl() {
|
|||
return VarDeclInfo{decl->source, decl->name, vq.storage_class, vq.access, decl->type};
|
||||
}
|
||||
|
||||
// texture_samplers
|
||||
// : sampler
|
||||
// | depth_texture
|
||||
// | sampled_texture LESS_THAN type_decl GREATER_THAN
|
||||
// | multisampled_texture LESS_THAN type_decl GREATER_THAN
|
||||
// | storage_texture LESS_THAN texel_format
|
||||
// COMMA access GREATER_THAN
|
||||
Maybe<const ast::Type*> ParserImpl::texture_samplers() {
|
||||
auto type = sampler();
|
||||
// texture_and_sampler_types
|
||||
// : sampler_type
|
||||
// | depth_texture_type
|
||||
// | sampled_texture_type LESS_THAN type_decl GREATER_THAN
|
||||
// | multisampled_texture_type LESS_THAN type_decl GREATER_THAN
|
||||
// | storage_texture_type LESS_THAN texel_format
|
||||
// COMMA access_mode GREATER_THAN
|
||||
Maybe<const ast::Type*> ParserImpl::texture_and_sampler_types() {
|
||||
auto type = sampler_type();
|
||||
if (type.matched) {
|
||||
return type;
|
||||
}
|
||||
|
||||
type = depth_texture();
|
||||
type = depth_texture_type();
|
||||
if (type.matched) {
|
||||
return type;
|
||||
}
|
||||
|
@ -715,7 +715,7 @@ Maybe<const ast::Type*> ParserImpl::texture_samplers() {
|
|||
|
||||
auto source_range = make_source_range();
|
||||
|
||||
auto dim = sampled_texture();
|
||||
auto dim = sampled_texture_type();
|
||||
if (dim.matched) {
|
||||
const char* use = "sampled texture type";
|
||||
|
||||
|
@ -727,7 +727,7 @@ Maybe<const ast::Type*> ParserImpl::texture_samplers() {
|
|||
return builder_.ty.sampled_texture(source_range, dim.value, subtype.value);
|
||||
}
|
||||
|
||||
auto ms_dim = multisampled_texture();
|
||||
auto ms_dim = multisampled_texture_type();
|
||||
if (ms_dim.matched) {
|
||||
const char* use = "multisampled texture type";
|
||||
|
||||
|
@ -739,7 +739,7 @@ Maybe<const ast::Type*> ParserImpl::texture_samplers() {
|
|||
return builder_.ty.multisampled_texture(source_range, ms_dim.value, subtype.value);
|
||||
}
|
||||
|
||||
auto storage = storage_texture();
|
||||
auto storage = storage_texture_type();
|
||||
if (storage.matched) {
|
||||
const char* use = "storage texture type";
|
||||
using StorageTextureInfo = std::pair<tint::ast::TexelFormat, tint::ast::Access>;
|
||||
|
@ -753,7 +753,7 @@ Maybe<const ast::Type*> ParserImpl::texture_samplers() {
|
|||
return Failure::kErrored;
|
||||
}
|
||||
|
||||
auto access = expect_access("access control");
|
||||
auto access = expect_access_mode("access control");
|
||||
if (access.errored) {
|
||||
return Failure::kErrored;
|
||||
}
|
||||
|
@ -772,10 +772,10 @@ Maybe<const ast::Type*> ParserImpl::texture_samplers() {
|
|||
return Failure::kNoMatch;
|
||||
}
|
||||
|
||||
// sampler
|
||||
// sampler_type
|
||||
// : SAMPLER
|
||||
// | SAMPLER_COMPARISON
|
||||
Maybe<const ast::Type*> ParserImpl::sampler() {
|
||||
Maybe<const ast::Type*> ParserImpl::sampler_type() {
|
||||
Source source;
|
||||
if (match(Token::Type::kSampler, &source)) {
|
||||
return builder_.ty.sampler(source, ast::SamplerKind::kSampler);
|
||||
|
@ -788,14 +788,14 @@ Maybe<const ast::Type*> ParserImpl::sampler() {
|
|||
return Failure::kNoMatch;
|
||||
}
|
||||
|
||||
// sampled_texture
|
||||
// sampled_texture_type
|
||||
// : TEXTURE_SAMPLED_1D
|
||||
// | TEXTURE_SAMPLED_2D
|
||||
// | TEXTURE_SAMPLED_2D_ARRAY
|
||||
// | TEXTURE_SAMPLED_3D
|
||||
// | TEXTURE_SAMPLED_CUBE
|
||||
// | TEXTURE_SAMPLED_CUBE_ARRAY
|
||||
Maybe<const ast::TextureDimension> ParserImpl::sampled_texture() {
|
||||
Maybe<const ast::TextureDimension> ParserImpl::sampled_texture_type() {
|
||||
if (match(Token::Type::kTextureSampled1d)) {
|
||||
return ast::TextureDimension::k1d;
|
||||
}
|
||||
|
@ -834,9 +834,9 @@ Maybe<const ast::Type*> ParserImpl::external_texture() {
|
|||
return Failure::kNoMatch;
|
||||
}
|
||||
|
||||
// multisampled_texture
|
||||
// multisampled_texture_type
|
||||
// : TEXTURE_MULTISAMPLED_2D
|
||||
Maybe<const ast::TextureDimension> ParserImpl::multisampled_texture() {
|
||||
Maybe<const ast::TextureDimension> ParserImpl::multisampled_texture_type() {
|
||||
if (match(Token::Type::kTextureMultisampled2d)) {
|
||||
return ast::TextureDimension::k2d;
|
||||
}
|
||||
|
@ -844,12 +844,12 @@ Maybe<const ast::TextureDimension> ParserImpl::multisampled_texture() {
|
|||
return Failure::kNoMatch;
|
||||
}
|
||||
|
||||
// storage_texture
|
||||
// storage_texture_type
|
||||
// : TEXTURE_STORAGE_1D
|
||||
// | TEXTURE_STORAGE_2D
|
||||
// | TEXTURE_STORAGE_2D_ARRAY
|
||||
// | TEXTURE_STORAGE_3D
|
||||
Maybe<const ast::TextureDimension> ParserImpl::storage_texture() {
|
||||
Maybe<const ast::TextureDimension> ParserImpl::storage_texture_type() {
|
||||
if (match(Token::Type::kTextureStorage1d)) {
|
||||
return ast::TextureDimension::k1d;
|
||||
}
|
||||
|
@ -866,13 +866,13 @@ Maybe<const ast::TextureDimension> ParserImpl::storage_texture() {
|
|||
return Failure::kNoMatch;
|
||||
}
|
||||
|
||||
// depth_texture
|
||||
// depth_texture_type
|
||||
// : TEXTURE_DEPTH_2D
|
||||
// | TEXTURE_DEPTH_2D_ARRAY
|
||||
// | TEXTURE_DEPTH_CUBE
|
||||
// | TEXTURE_DEPTH_CUBE_ARRAY
|
||||
// | TEXTURE_DEPTH_MULTISAMPLED_2D
|
||||
Maybe<const ast::Type*> ParserImpl::depth_texture() {
|
||||
Maybe<const ast::Type*> ParserImpl::depth_texture_type() {
|
||||
Source source;
|
||||
if (match(Token::Type::kTextureDepth2d, &source)) {
|
||||
return builder_.ty.depth_texture(source, ast::TextureDimension::k2d);
|
||||
|
@ -962,7 +962,7 @@ Expect<ParserImpl::TypedIdentifier> ParserImpl::expect_variable_ident_decl(std::
|
|||
// : 'read'
|
||||
// | 'write'
|
||||
// | 'read_write'
|
||||
Expect<ast::Access> ParserImpl::expect_access(std::string_view use) {
|
||||
Expect<ast::Access> ParserImpl::expect_access_mode(std::string_view use) {
|
||||
auto ident = expect_ident(use);
|
||||
if (ident.errored) {
|
||||
return Failure::kErrored;
|
||||
|
@ -996,7 +996,7 @@ Maybe<ParserImpl::VariableQualifier> ParserImpl::variable_qualifier() {
|
|||
return Failure::kErrored;
|
||||
}
|
||||
if (match(Token::Type::kComma)) {
|
||||
auto ac = expect_access(use);
|
||||
auto ac = expect_access_mode(use);
|
||||
if (ac.errored) {
|
||||
return Failure::kErrored;
|
||||
}
|
||||
|
@ -1064,7 +1064,7 @@ Maybe<const ast::Alias*> ParserImpl::type_alias_decl() {
|
|||
// | MAT4x2 LESS_THAN type_decl GREATER_THAN
|
||||
// | MAT4x3 LESS_THAN type_decl GREATER_THAN
|
||||
// | MAT4x4 LESS_THAN type_decl GREATER_THAN
|
||||
// | texture_samplers
|
||||
// | texture_and_sampler_types
|
||||
Maybe<const ast::Type*> ParserImpl::type_decl() {
|
||||
auto& t = peek();
|
||||
Source source;
|
||||
|
@ -1114,7 +1114,7 @@ Maybe<const ast::Type*> ParserImpl::type_decl() {
|
|||
return expect_type_decl_matrix(t);
|
||||
}
|
||||
|
||||
auto texture_or_sampler = texture_samplers();
|
||||
auto texture_or_sampler = texture_and_sampler_types();
|
||||
if (texture_or_sampler.errored) {
|
||||
return Failure::kErrored;
|
||||
}
|
||||
|
@ -1159,7 +1159,7 @@ Expect<const ast::Type*> ParserImpl::expect_type_decl_pointer(const Token& t) {
|
|||
}
|
||||
|
||||
if (match(Token::Type::kComma)) {
|
||||
auto ac = expect_access("access control");
|
||||
auto ac = expect_access_mode("access control");
|
||||
if (ac.errored) {
|
||||
return Failure::kErrored;
|
||||
}
|
||||
|
@ -1603,18 +1603,18 @@ Expect<ast::InterpolationType> ParserImpl::expect_interpolation_type_name() {
|
|||
}
|
||||
|
||||
// builtin_value_name
|
||||
// : 'vertex_index'
|
||||
// | 'instance_index'
|
||||
// | 'position'
|
||||
// | 'front_facing'
|
||||
// | 'frag_depth'
|
||||
// | 'local_invocation_id'
|
||||
// | 'local_invocation_index'
|
||||
// | 'global_invocation_id'
|
||||
// | 'workgroup_id'
|
||||
// | 'num_workgroups'
|
||||
// | 'sample_index'
|
||||
// | 'sample_mask'
|
||||
// : frag_depth
|
||||
// | front_facing
|
||||
// | global_invocation_id
|
||||
// | instance_index
|
||||
// | local_invocation_id
|
||||
// | local_invocation_index
|
||||
// | num_workgroups
|
||||
// | position
|
||||
// | sample_index
|
||||
// | sample_mask
|
||||
// | vertex_index
|
||||
// | workgroup_id
|
||||
Expect<ast::BuiltinValue> ParserImpl::expect_builtin() {
|
||||
auto ident = expect_ident("builtin");
|
||||
if (ident.errored) {
|
||||
|
@ -3186,8 +3186,8 @@ Maybe<const ast::Statement*> ParserImpl::assignment_statement() {
|
|||
// | FLOAT_LITERAL
|
||||
// | bool_literal
|
||||
//
|
||||
// bool_literal:
|
||||
// | TRUE
|
||||
// bool_literal
|
||||
// : TRUE
|
||||
// | FALSE
|
||||
Maybe<const ast::LiteralExpression*> ParserImpl::const_literal() {
|
||||
auto& t = peek();
|
||||
|
|
|
@ -453,26 +453,26 @@ class ParserImpl {
|
|||
/// by the declaration, then this vector is cleared before returning.
|
||||
/// @returns the parsed function, nullptr otherwise
|
||||
Maybe<const ast::Function*> function_decl(AttributeList& attrs);
|
||||
/// Parses a `texture_samplers` grammar element
|
||||
/// Parses a `texture_and_sampler_types` grammar element
|
||||
/// @returns the parsed Type or nullptr if none matched.
|
||||
Maybe<const ast::Type*> texture_samplers();
|
||||
/// Parses a `sampler` grammar element
|
||||
Maybe<const ast::Type*> texture_and_sampler_types();
|
||||
/// Parses a `sampler_type` grammar element
|
||||
/// @returns the parsed Type or nullptr if none matched.
|
||||
Maybe<const ast::Type*> sampler();
|
||||
/// Parses a `multisampled_texture` grammar element
|
||||
Maybe<const ast::Type*> sampler_type();
|
||||
/// Parses a `multisampled_texture_type` grammar element
|
||||
/// @returns returns the multisample texture dimension or kNone if none
|
||||
/// matched.
|
||||
Maybe<const ast::TextureDimension> multisampled_texture();
|
||||
/// Parses a `sampled_texture` grammar element
|
||||
Maybe<const ast::TextureDimension> multisampled_texture_type();
|
||||
/// Parses a `sampled_texture_type` grammar element
|
||||
/// @returns returns the sample texture dimension or kNone if none matched.
|
||||
Maybe<const ast::TextureDimension> sampled_texture();
|
||||
/// Parses a `storage_texture` grammar element
|
||||
Maybe<const ast::TextureDimension> sampled_texture_type();
|
||||
/// Parses a `storage_texture_type` grammar element
|
||||
/// @returns returns the storage texture dimension.
|
||||
/// Returns kNone if none matched.
|
||||
Maybe<const ast::TextureDimension> storage_texture();
|
||||
/// Parses a `depth_texture` grammar element
|
||||
Maybe<const ast::TextureDimension> storage_texture_type();
|
||||
/// Parses a `depth_texture_type` grammar element
|
||||
/// @returns the parsed Type or nullptr if none matched.
|
||||
Maybe<const ast::Type*> depth_texture();
|
||||
Maybe<const ast::Type*> depth_texture_type();
|
||||
/// Parses a 'texture_external_type' grammar element
|
||||
/// @returns the parsed Type or nullptr if none matched
|
||||
Maybe<const ast::Type*> external_texture();
|
||||
|
@ -500,7 +500,7 @@ class ParserImpl {
|
|||
/// match a valid access control.
|
||||
/// @param use a description of what was being parsed if an error was raised
|
||||
/// @returns the parsed access control.
|
||||
Expect<ast::Access> expect_access(std::string_view use);
|
||||
Expect<ast::Access> expect_access_mode(std::string_view use);
|
||||
/// Parses an interpolation sample name identifier, erroring if the next token does not match a
|
||||
/// valid sample name.
|
||||
/// @returns the parsed sample name.
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace {
|
|||
|
||||
TEST_F(ParserImplTest, DepthTextureType_Invalid) {
|
||||
auto p = parser("1234");
|
||||
auto t = p->depth_texture();
|
||||
auto t = p->depth_texture_type();
|
||||
EXPECT_FALSE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
EXPECT_FALSE(p->has_error());
|
||||
|
@ -28,7 +28,7 @@ TEST_F(ParserImplTest, DepthTextureType_Invalid) {
|
|||
|
||||
TEST_F(ParserImplTest, DepthTextureType_2d) {
|
||||
auto p = parser("texture_depth_2d");
|
||||
auto t = p->depth_texture();
|
||||
auto t = p->depth_texture_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
ASSERT_NE(t.value, nullptr);
|
||||
|
@ -41,7 +41,7 @@ TEST_F(ParserImplTest, DepthTextureType_2d) {
|
|||
|
||||
TEST_F(ParserImplTest, DepthTextureType_2dArray) {
|
||||
auto p = parser("texture_depth_2d_array");
|
||||
auto t = p->depth_texture();
|
||||
auto t = p->depth_texture_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
ASSERT_NE(t.value, nullptr);
|
||||
|
@ -54,7 +54,7 @@ TEST_F(ParserImplTest, DepthTextureType_2dArray) {
|
|||
|
||||
TEST_F(ParserImplTest, DepthTextureType_Cube) {
|
||||
auto p = parser("texture_depth_cube");
|
||||
auto t = p->depth_texture();
|
||||
auto t = p->depth_texture_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
ASSERT_NE(t.value, nullptr);
|
||||
|
@ -67,7 +67,7 @@ TEST_F(ParserImplTest, DepthTextureType_Cube) {
|
|||
|
||||
TEST_F(ParserImplTest, DepthTextureType_CubeArray) {
|
||||
auto p = parser("texture_depth_cube_array");
|
||||
auto t = p->depth_texture();
|
||||
auto t = p->depth_texture_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
ASSERT_NE(t.value, nullptr);
|
||||
|
@ -80,7 +80,7 @@ TEST_F(ParserImplTest, DepthTextureType_CubeArray) {
|
|||
|
||||
TEST_F(ParserImplTest, DepthTextureType_Multisampled2d) {
|
||||
auto p = parser("texture_depth_multisampled_2d");
|
||||
auto t = p->depth_texture();
|
||||
auto t = p->depth_texture_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
ASSERT_NE(t.value, nullptr);
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace {
|
|||
|
||||
TEST_F(ParserImplTest, SampledTextureType_Invalid) {
|
||||
auto p = parser("1234");
|
||||
auto t = p->sampled_texture();
|
||||
auto t = p->sampled_texture_type();
|
||||
EXPECT_FALSE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
EXPECT_FALSE(p->has_error());
|
||||
|
@ -27,7 +27,7 @@ TEST_F(ParserImplTest, SampledTextureType_Invalid) {
|
|||
|
||||
TEST_F(ParserImplTest, SampledTextureType_1d) {
|
||||
auto p = parser("texture_1d");
|
||||
auto t = p->sampled_texture();
|
||||
auto t = p->sampled_texture_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
EXPECT_EQ(t.value, ast::TextureDimension::k1d);
|
||||
|
@ -36,7 +36,7 @@ TEST_F(ParserImplTest, SampledTextureType_1d) {
|
|||
|
||||
TEST_F(ParserImplTest, SampledTextureType_2d) {
|
||||
auto p = parser("texture_2d");
|
||||
auto t = p->sampled_texture();
|
||||
auto t = p->sampled_texture_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
EXPECT_EQ(t.value, ast::TextureDimension::k2d);
|
||||
|
@ -45,7 +45,7 @@ TEST_F(ParserImplTest, SampledTextureType_2d) {
|
|||
|
||||
TEST_F(ParserImplTest, SampledTextureType_2dArray) {
|
||||
auto p = parser("texture_2d_array");
|
||||
auto t = p->sampled_texture();
|
||||
auto t = p->sampled_texture_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
EXPECT_EQ(t.value, ast::TextureDimension::k2dArray);
|
||||
|
@ -54,7 +54,7 @@ TEST_F(ParserImplTest, SampledTextureType_2dArray) {
|
|||
|
||||
TEST_F(ParserImplTest, SampledTextureType_3d) {
|
||||
auto p = parser("texture_3d");
|
||||
auto t = p->sampled_texture();
|
||||
auto t = p->sampled_texture_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
EXPECT_EQ(t.value, ast::TextureDimension::k3d);
|
||||
|
@ -63,7 +63,7 @@ TEST_F(ParserImplTest, SampledTextureType_3d) {
|
|||
|
||||
TEST_F(ParserImplTest, SampledTextureType_Cube) {
|
||||
auto p = parser("texture_cube");
|
||||
auto t = p->sampled_texture();
|
||||
auto t = p->sampled_texture_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
EXPECT_EQ(t.value, ast::TextureDimension::kCube);
|
||||
|
@ -72,7 +72,7 @@ TEST_F(ParserImplTest, SampledTextureType_Cube) {
|
|||
|
||||
TEST_F(ParserImplTest, SampledTextureType_kCubeArray) {
|
||||
auto p = parser("texture_cube_array");
|
||||
auto t = p->sampled_texture();
|
||||
auto t = p->sampled_texture_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
EXPECT_EQ(t.value, ast::TextureDimension::kCubeArray);
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace {
|
|||
|
||||
TEST_F(ParserImplTest, SamplerType_Invalid) {
|
||||
auto p = parser("1234");
|
||||
auto t = p->sampler();
|
||||
auto t = p->sampler_type();
|
||||
EXPECT_FALSE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
EXPECT_EQ(t.value, nullptr);
|
||||
|
@ -28,7 +28,7 @@ TEST_F(ParserImplTest, SamplerType_Invalid) {
|
|||
|
||||
TEST_F(ParserImplTest, SamplerType_Sampler) {
|
||||
auto p = parser("sampler");
|
||||
auto t = p->sampler();
|
||||
auto t = p->sampler_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
ASSERT_NE(t.value, nullptr);
|
||||
|
@ -40,7 +40,7 @@ TEST_F(ParserImplTest, SamplerType_Sampler) {
|
|||
|
||||
TEST_F(ParserImplTest, SamplerType_ComparisonSampler) {
|
||||
auto p = parser("sampler_comparison");
|
||||
auto t = p->sampler();
|
||||
auto t = p->sampler_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
ASSERT_NE(t.value, nullptr);
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace {
|
|||
|
||||
TEST_F(ParserImplTest, StorageTextureType_Invalid) {
|
||||
auto p = parser("abc");
|
||||
auto t = p->storage_texture();
|
||||
auto t = p->storage_texture_type();
|
||||
EXPECT_FALSE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
EXPECT_FALSE(p->has_error());
|
||||
|
@ -27,7 +27,7 @@ TEST_F(ParserImplTest, StorageTextureType_Invalid) {
|
|||
|
||||
TEST_F(ParserImplTest, StorageTextureType_1d) {
|
||||
auto p = parser("texture_storage_1d");
|
||||
auto t = p->storage_texture();
|
||||
auto t = p->storage_texture_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
EXPECT_EQ(t.value, ast::TextureDimension::k1d);
|
||||
|
@ -36,7 +36,7 @@ TEST_F(ParserImplTest, StorageTextureType_1d) {
|
|||
|
||||
TEST_F(ParserImplTest, StorageTextureType_2d) {
|
||||
auto p = parser("texture_storage_2d");
|
||||
auto t = p->storage_texture();
|
||||
auto t = p->storage_texture_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
EXPECT_EQ(t.value, ast::TextureDimension::k2d);
|
||||
|
@ -45,7 +45,7 @@ TEST_F(ParserImplTest, StorageTextureType_2d) {
|
|||
|
||||
TEST_F(ParserImplTest, StorageTextureType_2dArray) {
|
||||
auto p = parser("texture_storage_2d_array");
|
||||
auto t = p->storage_texture();
|
||||
auto t = p->storage_texture_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
EXPECT_EQ(t.value, ast::TextureDimension::k2dArray);
|
||||
|
@ -54,7 +54,7 @@ TEST_F(ParserImplTest, StorageTextureType_2dArray) {
|
|||
|
||||
TEST_F(ParserImplTest, StorageTextureType_3d) {
|
||||
auto p = parser("texture_storage_3d");
|
||||
auto t = p->storage_texture();
|
||||
auto t = p->storage_texture_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
EXPECT_EQ(t.value, ast::TextureDimension::k3d);
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_Invalid) {
|
||||
auto p = parser("1234");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
EXPECT_EQ(t.value, nullptr);
|
||||
EXPECT_FALSE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
|
@ -31,7 +31,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_Invalid) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_Sampler) {
|
||||
auto p = parser("sampler");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
ASSERT_FALSE(p->has_error()) << p->error();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
|
@ -43,7 +43,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_Sampler) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_SamplerComparison) {
|
||||
auto p = parser("sampler_comparison");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
ASSERT_FALSE(p->has_error()) << p->error();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
|
@ -55,7 +55,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SamplerComparison) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_DepthTexture) {
|
||||
auto p = parser("texture_depth_2d");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
ASSERT_FALSE(p->has_error()) << p->error();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
|
@ -68,7 +68,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_DepthTexture) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_F32) {
|
||||
auto p = parser("texture_1d<f32>");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
ASSERT_FALSE(p->has_error()) << p->error();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
|
@ -82,7 +82,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_F32) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_I32) {
|
||||
auto p = parser("texture_2d<i32>");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
ASSERT_FALSE(p->has_error()) << p->error();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
|
@ -96,7 +96,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_I32) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_U32) {
|
||||
auto p = parser("texture_3d<u32>");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
ASSERT_FALSE(p->has_error()) << p->error();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
|
@ -110,7 +110,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_U32) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingType) {
|
||||
auto p = parser("texture_1d<>");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
ASSERT_TRUE(p->has_error());
|
||||
EXPECT_EQ(t.value, nullptr);
|
||||
EXPECT_FALSE(t.matched);
|
||||
|
@ -120,7 +120,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingType) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingLessThan) {
|
||||
auto p = parser("texture_1d");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
ASSERT_TRUE(p->has_error());
|
||||
EXPECT_EQ(t.value, nullptr);
|
||||
EXPECT_FALSE(t.matched);
|
||||
|
@ -130,7 +130,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingLessThan) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingGreaterThan) {
|
||||
auto p = parser("texture_1d<u32");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
ASSERT_TRUE(p->has_error());
|
||||
EXPECT_EQ(t.value, nullptr);
|
||||
EXPECT_FALSE(t.matched);
|
||||
|
@ -140,7 +140,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingGreaterThan) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_I32) {
|
||||
auto p = parser("texture_multisampled_2d<i32>");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
ASSERT_FALSE(p->has_error()) << p->error();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
|
@ -154,7 +154,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_I32) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingType) {
|
||||
auto p = parser("texture_multisampled_2d<>");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
ASSERT_TRUE(p->has_error());
|
||||
EXPECT_EQ(t.value, nullptr);
|
||||
EXPECT_FALSE(t.matched);
|
||||
|
@ -164,7 +164,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingType) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingLessThan) {
|
||||
auto p = parser("texture_multisampled_2d");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
EXPECT_EQ(t.value, nullptr);
|
||||
EXPECT_FALSE(t.matched);
|
||||
EXPECT_TRUE(t.errored);
|
||||
|
@ -173,7 +173,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingLessThan)
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingGreaterThan) {
|
||||
auto p = parser("texture_multisampled_2d<u32");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
EXPECT_EQ(t.value, nullptr);
|
||||
EXPECT_FALSE(t.matched);
|
||||
EXPECT_TRUE(t.errored);
|
||||
|
@ -182,7 +182,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingGreaterTha
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Readonly1dRg32Float) {
|
||||
auto p = parser("texture_storage_1d<rg32float, read>");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
ASSERT_FALSE(p->has_error()) << p->error();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
|
@ -198,7 +198,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Readonly1dRg32Float) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Writeonly2dR32Uint) {
|
||||
auto p = parser("texture_storage_2d<r32uint, write>");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
ASSERT_FALSE(p->has_error()) << p->error();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
|
@ -214,7 +214,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Writeonly2dR32Uint) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidType) {
|
||||
auto p = parser("texture_storage_1d<abc, read>");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
EXPECT_EQ(t.value, nullptr);
|
||||
EXPECT_FALSE(t.matched);
|
||||
EXPECT_TRUE(t.errored);
|
||||
|
@ -223,7 +223,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidType) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidAccess) {
|
||||
auto p = parser("texture_storage_1d<r32float, abc>");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
EXPECT_EQ(t.value, nullptr);
|
||||
EXPECT_FALSE(t.matched);
|
||||
EXPECT_TRUE(t.errored);
|
||||
|
@ -232,7 +232,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidAccess) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingType) {
|
||||
auto p = parser("texture_storage_1d<>");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
EXPECT_EQ(t.value, nullptr);
|
||||
EXPECT_FALSE(t.matched);
|
||||
EXPECT_TRUE(t.errored);
|
||||
|
@ -241,7 +241,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingType) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingLessThan) {
|
||||
auto p = parser("texture_storage_1d");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
EXPECT_EQ(t.value, nullptr);
|
||||
EXPECT_FALSE(t.matched);
|
||||
EXPECT_TRUE(t.errored);
|
||||
|
@ -250,7 +250,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingLessThan) {
|
|||
|
||||
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingGreaterThan) {
|
||||
auto p = parser("texture_storage_1d<r32uint, read");
|
||||
auto t = p->texture_samplers();
|
||||
auto t = p->texture_and_sampler_types();
|
||||
EXPECT_EQ(t.value, nullptr);
|
||||
EXPECT_FALSE(t.matched);
|
||||
EXPECT_TRUE(t.errored);
|
||||
|
|
Loading…
Reference in New Issue