wsgl parser: Use match() for more trivial patterns
Keeps error message consistent. Reduces code. Bug: tint:282 Change-Id: I75ac50ef4a2435cfd42e95e851fa1f3524d1dd63 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31733 Reviewed-by: dan sinclair <dsinclair@chromium.org> Commit-Queue: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
a7e1492a6a
commit
53e619f7e9
|
@ -432,11 +432,8 @@ bool ParserImpl::variable_decoration_list(ast::VariableDecorationList& decos) {
|
||||||
// | BINDING PAREN_LEFT INT_LITERAL PAREN_RIGHT
|
// | BINDING PAREN_LEFT INT_LITERAL PAREN_RIGHT
|
||||||
// | SET INT PAREN_LEFT_LITERAL PAREN_RIGHT
|
// | SET INT PAREN_LEFT_LITERAL PAREN_RIGHT
|
||||||
std::unique_ptr<ast::VariableDecoration> ParserImpl::variable_decoration() {
|
std::unique_ptr<ast::VariableDecoration> ParserImpl::variable_decoration() {
|
||||||
auto t = peek();
|
Source source;
|
||||||
auto source = t.source();
|
if (match(Token::Type::kLocation, &source)) {
|
||||||
if (t.IsLocation()) {
|
|
||||||
next(); // consume the peek
|
|
||||||
|
|
||||||
const char* use = "location decoration";
|
const char* use = "location decoration";
|
||||||
|
|
||||||
if (!expect(use, Token::Type::kParenLeft))
|
if (!expect(use, Token::Type::kParenLeft))
|
||||||
|
@ -451,9 +448,7 @@ std::unique_ptr<ast::VariableDecoration> ParserImpl::variable_decoration() {
|
||||||
|
|
||||||
return std::make_unique<ast::LocationDecoration>(val, source);
|
return std::make_unique<ast::LocationDecoration>(val, source);
|
||||||
}
|
}
|
||||||
if (t.IsBuiltin()) {
|
if (match(Token::Type::kBuiltin, &source)) {
|
||||||
next(); // consume the peek
|
|
||||||
|
|
||||||
if (!expect("builtin decoration", Token::Type::kParenLeft))
|
if (!expect("builtin decoration", Token::Type::kParenLeft))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
@ -472,9 +467,7 @@ std::unique_ptr<ast::VariableDecoration> ParserImpl::variable_decoration() {
|
||||||
|
|
||||||
return std::make_unique<ast::BuiltinDecoration>(builtin, source);
|
return std::make_unique<ast::BuiltinDecoration>(builtin, source);
|
||||||
}
|
}
|
||||||
if (t.IsBinding()) {
|
if (match(Token::Type::kBinding, &source)) {
|
||||||
next(); // consume the peek
|
|
||||||
|
|
||||||
const char* use = "binding decoration";
|
const char* use = "binding decoration";
|
||||||
|
|
||||||
if (!expect(use, Token::Type::kParenLeft))
|
if (!expect(use, Token::Type::kParenLeft))
|
||||||
|
@ -489,9 +482,7 @@ std::unique_ptr<ast::VariableDecoration> ParserImpl::variable_decoration() {
|
||||||
|
|
||||||
return std::make_unique<ast::BindingDecoration>(val, source);
|
return std::make_unique<ast::BindingDecoration>(val, source);
|
||||||
}
|
}
|
||||||
if (t.IsSet()) {
|
if (match(Token::Type::kSet, &source)) {
|
||||||
next(); // consume the peek
|
|
||||||
|
|
||||||
const char* use = "set decoration";
|
const char* use = "set decoration";
|
||||||
|
|
||||||
if (!expect(use, Token::Type::kParenLeft))
|
if (!expect(use, Token::Type::kParenLeft))
|
||||||
|
@ -635,17 +626,14 @@ ast::type::Type* ParserImpl::texture_sampler_types() {
|
||||||
// : SAMPLER
|
// : SAMPLER
|
||||||
// | SAMPLER_COMPARISON
|
// | SAMPLER_COMPARISON
|
||||||
ast::type::Type* ParserImpl::sampler_type() {
|
ast::type::Type* ParserImpl::sampler_type() {
|
||||||
auto t = peek();
|
if (match(Token::Type::kSampler))
|
||||||
if (t.IsSampler()) {
|
|
||||||
next(); // Consume the peek
|
|
||||||
return ctx_.type_mgr().Get(std::make_unique<ast::type::SamplerType>(
|
return ctx_.type_mgr().Get(std::make_unique<ast::type::SamplerType>(
|
||||||
ast::type::SamplerKind::kSampler));
|
ast::type::SamplerKind::kSampler));
|
||||||
}
|
|
||||||
if (t.IsComparisonSampler()) {
|
if (match(Token::Type::kComparisonSampler))
|
||||||
next(); // Consume the peek
|
|
||||||
return ctx_.type_mgr().Get(std::make_unique<ast::type::SamplerType>(
|
return ctx_.type_mgr().Get(std::make_unique<ast::type::SamplerType>(
|
||||||
ast::type::SamplerKind::kComparisonSampler));
|
ast::type::SamplerKind::kComparisonSampler));
|
||||||
}
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -658,46 +646,36 @@ ast::type::Type* ParserImpl::sampler_type() {
|
||||||
// | TEXTURE_SAMPLED_CUBE
|
// | TEXTURE_SAMPLED_CUBE
|
||||||
// | TEXTURE_SAMPLED_CUBE_ARRAY
|
// | TEXTURE_SAMPLED_CUBE_ARRAY
|
||||||
ast::type::TextureDimension ParserImpl::sampled_texture_type() {
|
ast::type::TextureDimension ParserImpl::sampled_texture_type() {
|
||||||
auto t = peek();
|
if (match(Token::Type::kTextureSampled1d))
|
||||||
if (t.IsTextureSampled1d()) {
|
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::TextureDimension::k1d;
|
return ast::type::TextureDimension::k1d;
|
||||||
}
|
|
||||||
if (t.IsTextureSampled1dArray()) {
|
if (match(Token::Type::kTextureSampled1dArray))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::TextureDimension::k1dArray;
|
return ast::type::TextureDimension::k1dArray;
|
||||||
}
|
|
||||||
if (t.IsTextureSampled2d()) {
|
if (match(Token::Type::kTextureSampled2d))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::TextureDimension::k2d;
|
return ast::type::TextureDimension::k2d;
|
||||||
}
|
|
||||||
if (t.IsTextureSampled2dArray()) {
|
if (match(Token::Type::kTextureSampled2dArray))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::TextureDimension::k2dArray;
|
return ast::type::TextureDimension::k2dArray;
|
||||||
}
|
|
||||||
if (t.IsTextureSampled3d()) {
|
if (match(Token::Type::kTextureSampled3d))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::TextureDimension::k3d;
|
return ast::type::TextureDimension::k3d;
|
||||||
}
|
|
||||||
if (t.IsTextureSampledCube()) {
|
if (match(Token::Type::kTextureSampledCube))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::TextureDimension::kCube;
|
return ast::type::TextureDimension::kCube;
|
||||||
}
|
|
||||||
if (t.IsTextureSampledCubeArray()) {
|
if (match(Token::Type::kTextureSampledCubeArray))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::TextureDimension::kCubeArray;
|
return ast::type::TextureDimension::kCubeArray;
|
||||||
}
|
|
||||||
return ast::type::TextureDimension::kNone;
|
return ast::type::TextureDimension::kNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
// multisampled_texture_type
|
// multisampled_texture_type
|
||||||
// : TEXTURE_MULTISAMPLED_2D
|
// : TEXTURE_MULTISAMPLED_2D
|
||||||
ast::type::TextureDimension ParserImpl::multisampled_texture_type() {
|
ast::type::TextureDimension ParserImpl::multisampled_texture_type() {
|
||||||
auto t = peek();
|
if (match(Token::Type::kTextureMultisampled2d))
|
||||||
if (t.IsTextureMultisampled2d()) {
|
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::TextureDimension::k2d;
|
return ast::type::TextureDimension::k2d;
|
||||||
}
|
|
||||||
return ast::type::TextureDimension::kNone;
|
return ast::type::TextureDimension::kNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -714,51 +692,40 @@ ast::type::TextureDimension ParserImpl::multisampled_texture_type() {
|
||||||
// | TEXTURE_WO_3D
|
// | TEXTURE_WO_3D
|
||||||
std::pair<ast::type::TextureDimension, ast::AccessControl>
|
std::pair<ast::type::TextureDimension, ast::AccessControl>
|
||||||
ParserImpl::storage_texture_type() {
|
ParserImpl::storage_texture_type() {
|
||||||
auto t = peek();
|
if (match(Token::Type::kTextureStorageReadonly1d))
|
||||||
if (t.IsTextureStorageReadonly1d()) {
|
|
||||||
next(); // Consume the peek
|
|
||||||
return {ast::type::TextureDimension::k1d, ast::AccessControl::kReadOnly};
|
return {ast::type::TextureDimension::k1d, ast::AccessControl::kReadOnly};
|
||||||
}
|
|
||||||
if (t.IsTextureStorageReadonly1dArray()) {
|
if (match(Token::Type::kTextureStorageReadonly1dArray))
|
||||||
next(); // Consume the peek
|
|
||||||
return {ast::type::TextureDimension::k1dArray,
|
return {ast::type::TextureDimension::k1dArray,
|
||||||
ast::AccessControl::kReadOnly};
|
ast::AccessControl::kReadOnly};
|
||||||
}
|
|
||||||
if (t.IsTextureStorageReadonly2d()) {
|
if (match(Token::Type::kTextureStorageReadonly2d))
|
||||||
next(); // Consume the peek
|
|
||||||
return {ast::type::TextureDimension::k2d, ast::AccessControl::kReadOnly};
|
return {ast::type::TextureDimension::k2d, ast::AccessControl::kReadOnly};
|
||||||
}
|
|
||||||
if (t.IsTextureStorageReadonly2dArray()) {
|
if (match(Token::Type::kTextureStorageReadonly2dArray))
|
||||||
next(); // Consume the peek
|
|
||||||
return {ast::type::TextureDimension::k2dArray,
|
return {ast::type::TextureDimension::k2dArray,
|
||||||
ast::AccessControl::kReadOnly};
|
ast::AccessControl::kReadOnly};
|
||||||
}
|
|
||||||
if (t.IsTextureStorageReadonly3d()) {
|
if (match(Token::Type::kTextureStorageReadonly3d))
|
||||||
next(); // Consume the peek
|
|
||||||
return {ast::type::TextureDimension::k3d, ast::AccessControl::kReadOnly};
|
return {ast::type::TextureDimension::k3d, ast::AccessControl::kReadOnly};
|
||||||
}
|
|
||||||
if (t.IsTextureStorageWriteonly1d()) {
|
if (match(Token::Type::kTextureStorageWriteonly1d))
|
||||||
next(); // Consume the peek
|
|
||||||
return {ast::type::TextureDimension::k1d, ast::AccessControl::kWriteOnly};
|
return {ast::type::TextureDimension::k1d, ast::AccessControl::kWriteOnly};
|
||||||
}
|
|
||||||
if (t.IsTextureStorageWriteonly1dArray()) {
|
if (match(Token::Type::kTextureStorageWriteonly1dArray))
|
||||||
next(); // Consume the peek
|
|
||||||
return {ast::type::TextureDimension::k1dArray,
|
return {ast::type::TextureDimension::k1dArray,
|
||||||
ast::AccessControl::kWriteOnly};
|
ast::AccessControl::kWriteOnly};
|
||||||
}
|
|
||||||
if (t.IsTextureStorageWriteonly2d()) {
|
if (match(Token::Type::kTextureStorageWriteonly2d))
|
||||||
next(); // Consume the peek
|
|
||||||
return {ast::type::TextureDimension::k2d, ast::AccessControl::kWriteOnly};
|
return {ast::type::TextureDimension::k2d, ast::AccessControl::kWriteOnly};
|
||||||
}
|
|
||||||
if (t.IsTextureStorageWriteonly2dArray()) {
|
if (match(Token::Type::kTextureStorageWriteonly2dArray))
|
||||||
next(); // Consume the peek
|
|
||||||
return {ast::type::TextureDimension::k2dArray,
|
return {ast::type::TextureDimension::k2dArray,
|
||||||
ast::AccessControl::kWriteOnly};
|
ast::AccessControl::kWriteOnly};
|
||||||
}
|
|
||||||
if (t.IsTextureStorageWriteonly3d()) {
|
if (match(Token::Type::kTextureStorageWriteonly3d))
|
||||||
next(); // Consume the peek
|
|
||||||
return {ast::type::TextureDimension::k3d, ast::AccessControl::kWriteOnly};
|
return {ast::type::TextureDimension::k3d, ast::AccessControl::kWriteOnly};
|
||||||
}
|
|
||||||
return {ast::type::TextureDimension::kNone, ast::AccessControl::kReadOnly};
|
return {ast::type::TextureDimension::kNone, ast::AccessControl::kReadOnly};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -768,27 +735,22 @@ ParserImpl::storage_texture_type() {
|
||||||
// | TEXTURE_DEPTH_CUBE
|
// | TEXTURE_DEPTH_CUBE
|
||||||
// | TEXTURE_DEPTH_CUBE_ARRAY
|
// | TEXTURE_DEPTH_CUBE_ARRAY
|
||||||
ast::type::Type* ParserImpl::depth_texture_type() {
|
ast::type::Type* ParserImpl::depth_texture_type() {
|
||||||
auto t = peek();
|
if (match(Token::Type::kTextureDepth2d))
|
||||||
if (t.IsTextureDepth2d()) {
|
|
||||||
next(); // Consume the peek
|
|
||||||
return ctx_.type_mgr().Get(std::make_unique<ast::type::DepthTextureType>(
|
return ctx_.type_mgr().Get(std::make_unique<ast::type::DepthTextureType>(
|
||||||
ast::type::TextureDimension::k2d));
|
ast::type::TextureDimension::k2d));
|
||||||
}
|
|
||||||
if (t.IsTextureDepth2dArray()) {
|
if (match(Token::Type::kTextureDepth2dArray))
|
||||||
next(); // Consume the peek
|
|
||||||
return ctx_.type_mgr().Get(std::make_unique<ast::type::DepthTextureType>(
|
return ctx_.type_mgr().Get(std::make_unique<ast::type::DepthTextureType>(
|
||||||
ast::type::TextureDimension::k2dArray));
|
ast::type::TextureDimension::k2dArray));
|
||||||
}
|
|
||||||
if (t.IsTextureDepthCube()) {
|
if (match(Token::Type::kTextureDepthCube))
|
||||||
next(); // Consume the peek
|
|
||||||
return ctx_.type_mgr().Get(std::make_unique<ast::type::DepthTextureType>(
|
return ctx_.type_mgr().Get(std::make_unique<ast::type::DepthTextureType>(
|
||||||
ast::type::TextureDimension::kCube));
|
ast::type::TextureDimension::kCube));
|
||||||
}
|
|
||||||
if (t.IsTextureDepthCubeArray()) {
|
if (match(Token::Type::kTextureDepthCubeArray))
|
||||||
next(); // Consume the peek
|
|
||||||
return ctx_.type_mgr().Get(std::make_unique<ast::type::DepthTextureType>(
|
return ctx_.type_mgr().Get(std::make_unique<ast::type::DepthTextureType>(
|
||||||
ast::type::TextureDimension::kCubeArray));
|
ast::type::TextureDimension::kCubeArray));
|
||||||
}
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -829,147 +791,111 @@ ast::type::Type* ParserImpl::depth_texture_type() {
|
||||||
// | RGBA32SINT
|
// | RGBA32SINT
|
||||||
// | RGBA32FLOAT
|
// | RGBA32FLOAT
|
||||||
ast::type::ImageFormat ParserImpl::image_storage_type() {
|
ast::type::ImageFormat ParserImpl::image_storage_type() {
|
||||||
auto t = peek();
|
if (match(Token::Type::kFormatR8Unorm))
|
||||||
if (t.IsFormatR8Unorm()) {
|
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kR8Unorm;
|
return ast::type::ImageFormat::kR8Unorm;
|
||||||
}
|
|
||||||
if (t.IsFormatR8Snorm()) {
|
if (match(Token::Type::kFormatR8Snorm))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kR8Snorm;
|
return ast::type::ImageFormat::kR8Snorm;
|
||||||
}
|
|
||||||
if (t.IsFormatR8Uint()) {
|
if (match(Token::Type::kFormatR8Uint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kR8Uint;
|
return ast::type::ImageFormat::kR8Uint;
|
||||||
}
|
|
||||||
if (t.IsFormatR8Sint()) {
|
if (match(Token::Type::kFormatR8Sint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kR8Sint;
|
return ast::type::ImageFormat::kR8Sint;
|
||||||
}
|
|
||||||
if (t.IsFormatR16Uint()) {
|
if (match(Token::Type::kFormatR16Uint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kR16Uint;
|
return ast::type::ImageFormat::kR16Uint;
|
||||||
}
|
|
||||||
if (t.IsFormatR16Sint()) {
|
if (match(Token::Type::kFormatR16Sint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kR16Sint;
|
return ast::type::ImageFormat::kR16Sint;
|
||||||
}
|
|
||||||
if (t.IsFormatR16Float()) {
|
if (match(Token::Type::kFormatR16Float))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kR16Float;
|
return ast::type::ImageFormat::kR16Float;
|
||||||
}
|
|
||||||
if (t.IsFormatRg8Unorm()) {
|
if (match(Token::Type::kFormatRg8Unorm))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRg8Unorm;
|
return ast::type::ImageFormat::kRg8Unorm;
|
||||||
}
|
|
||||||
if (t.IsFormatRg8Snorm()) {
|
if (match(Token::Type::kFormatRg8Snorm))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRg8Snorm;
|
return ast::type::ImageFormat::kRg8Snorm;
|
||||||
}
|
|
||||||
if (t.IsFormatRg8Uint()) {
|
if (match(Token::Type::kFormatRg8Uint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRg8Uint;
|
return ast::type::ImageFormat::kRg8Uint;
|
||||||
}
|
|
||||||
if (t.IsFormatRg8Sint()) {
|
if (match(Token::Type::kFormatRg8Sint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRg8Sint;
|
return ast::type::ImageFormat::kRg8Sint;
|
||||||
}
|
|
||||||
if (t.IsFormatR32Uint()) {
|
if (match(Token::Type::kFormatR32Uint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kR32Uint;
|
return ast::type::ImageFormat::kR32Uint;
|
||||||
}
|
|
||||||
if (t.IsFormatR32Sint()) {
|
if (match(Token::Type::kFormatR32Sint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kR32Sint;
|
return ast::type::ImageFormat::kR32Sint;
|
||||||
}
|
|
||||||
if (t.IsFormatR32Float()) {
|
if (match(Token::Type::kFormatR32Float))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kR32Float;
|
return ast::type::ImageFormat::kR32Float;
|
||||||
}
|
|
||||||
if (t.IsFormatRg16Uint()) {
|
if (match(Token::Type::kFormatRg16Uint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRg16Uint;
|
return ast::type::ImageFormat::kRg16Uint;
|
||||||
}
|
|
||||||
if (t.IsFormatRg16Sint()) {
|
if (match(Token::Type::kFormatRg16Sint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRg16Sint;
|
return ast::type::ImageFormat::kRg16Sint;
|
||||||
}
|
|
||||||
if (t.IsFormatRg16Float()) {
|
if (match(Token::Type::kFormatRg16Float))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRg16Float;
|
return ast::type::ImageFormat::kRg16Float;
|
||||||
}
|
|
||||||
if (t.IsFormatRgba8Unorm()) {
|
if (match(Token::Type::kFormatRgba8Unorm))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRgba8Unorm;
|
return ast::type::ImageFormat::kRgba8Unorm;
|
||||||
}
|
|
||||||
if (t.IsFormatRgba8UnormSrgb()) {
|
if (match(Token::Type::kFormatRgba8UnormSrgb))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRgba8UnormSrgb;
|
return ast::type::ImageFormat::kRgba8UnormSrgb;
|
||||||
}
|
|
||||||
if (t.IsFormatRgba8Snorm()) {
|
if (match(Token::Type::kFormatRgba8Snorm))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRgba8Snorm;
|
return ast::type::ImageFormat::kRgba8Snorm;
|
||||||
}
|
|
||||||
if (t.IsFormatRgba8Uint()) {
|
if (match(Token::Type::kFormatRgba8Uint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRgba8Uint;
|
return ast::type::ImageFormat::kRgba8Uint;
|
||||||
}
|
|
||||||
if (t.IsFormatRgba8Sint()) {
|
if (match(Token::Type::kFormatRgba8Sint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRgba8Sint;
|
return ast::type::ImageFormat::kRgba8Sint;
|
||||||
}
|
|
||||||
if (t.IsFormatBgra8Unorm()) {
|
if (match(Token::Type::kFormatBgra8Unorm))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kBgra8Unorm;
|
return ast::type::ImageFormat::kBgra8Unorm;
|
||||||
}
|
|
||||||
if (t.IsFormatBgra8UnormSrgb()) {
|
if (match(Token::Type::kFormatBgra8UnormSrgb))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kBgra8UnormSrgb;
|
return ast::type::ImageFormat::kBgra8UnormSrgb;
|
||||||
}
|
|
||||||
if (t.IsFormatRgb10A2Unorm()) {
|
if (match(Token::Type::kFormatRgb10A2Unorm))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRgb10A2Unorm;
|
return ast::type::ImageFormat::kRgb10A2Unorm;
|
||||||
}
|
|
||||||
if (t.IsFormatRg11B10Float()) {
|
if (match(Token::Type::kFormatRg11B10Float))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRg11B10Float;
|
return ast::type::ImageFormat::kRg11B10Float;
|
||||||
}
|
|
||||||
if (t.IsFormatRg32Uint()) {
|
if (match(Token::Type::kFormatRg32Uint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRg32Uint;
|
return ast::type::ImageFormat::kRg32Uint;
|
||||||
}
|
|
||||||
if (t.IsFormatRg32Sint()) {
|
if (match(Token::Type::kFormatRg32Sint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRg32Sint;
|
return ast::type::ImageFormat::kRg32Sint;
|
||||||
}
|
|
||||||
if (t.IsFormatRg32Float()) {
|
if (match(Token::Type::kFormatRg32Float))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRg32Float;
|
return ast::type::ImageFormat::kRg32Float;
|
||||||
}
|
|
||||||
if (t.IsFormatRgba16Uint()) {
|
if (match(Token::Type::kFormatRgba16Uint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRgba16Uint;
|
return ast::type::ImageFormat::kRgba16Uint;
|
||||||
}
|
|
||||||
if (t.IsFormatRgba16Sint()) {
|
if (match(Token::Type::kFormatRgba16Sint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRgba16Sint;
|
return ast::type::ImageFormat::kRgba16Sint;
|
||||||
}
|
|
||||||
if (t.IsFormatRgba16Float()) {
|
if (match(Token::Type::kFormatRgba16Float))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRgba16Float;
|
return ast::type::ImageFormat::kRgba16Float;
|
||||||
}
|
|
||||||
if (t.IsFormatRgba32Uint()) {
|
if (match(Token::Type::kFormatRgba32Uint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRgba32Uint;
|
return ast::type::ImageFormat::kRgba32Uint;
|
||||||
}
|
|
||||||
if (t.IsFormatRgba32Sint()) {
|
if (match(Token::Type::kFormatRgba32Sint))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRgba32Sint;
|
return ast::type::ImageFormat::kRgba32Sint;
|
||||||
}
|
|
||||||
if (t.IsFormatRgba32Float()) {
|
if (match(Token::Type::kFormatRgba32Float))
|
||||||
next(); // Consume the peek
|
|
||||||
return ast::type::ImageFormat::kRgba32Float;
|
return ast::type::ImageFormat::kRgba32Float;
|
||||||
}
|
|
||||||
return ast::type::ImageFormat::kNone;
|
return ast::type::ImageFormat::kNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue