tint/ast: Generate ast::Extension from intrinsics.def

Emit unit tests for parsing and printing.
Emit benchmarks for parsing.
Uses intrinsics.def as a single-source-of-truth.
The generators provide a way to optimize the enum parsers.

Change-Id: I7f13128f510b2156c2ef724c89df7bb85dae17ed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97151
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton 2022-07-27 18:32:19 +00:00 committed by Dawn LUCI CQ
parent 9e5415dbeb
commit f50d56aa05
18 changed files with 383 additions and 153 deletions

View File

@ -1278,6 +1278,7 @@ if(TINT_BUILD_BENCHMARKS)
set(TINT_BENCHMARK_SRC set(TINT_BENCHMARK_SRC
"castable_bench.cc" "castable_bench.cc"
"ast/extension_bench.cc"
"ast/storage_class_bench.cc" "ast/storage_class_bench.cc"
"bench/benchmark.cc" "bench/benchmark.cc"
"reader/wgsl/parser_bench.cc" "reader/wgsl/parser_bench.cc"

View File

@ -12,40 +12,46 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// src/tint/ast/extension.cc.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
#include "src/tint/ast/extension.h" #include "src/tint/ast/extension.h"
namespace tint::ast { namespace tint::ast {
Extension ParseExtension(const std::string& name) { /// ParseExtension parses a Extension from a string.
if (name == "chromium_experimental_dp4a") { /// @param str the string to parse
return Extension::kChromiumExperimentalDP4a; /// @returns the parsed enum, or Extension::kInvalid if the string could not be parsed.
} Extension ParseExtension(std::string_view str) {
if (name == "chromium_disable_uniformity_analysis") { if (str == "f16") {
return Extension::kChromiumDisableUniformityAnalysis;
}
if (name == "f16") {
return Extension::kF16; return Extension::kF16;
} }
return Extension::kNone; if (str == "chromium_experimental_dp4a") {
} return Extension::kChromiumExperimentalDp4A;
const char* str(Extension ext) {
switch (ext) {
case Extension::kChromiumExperimentalDP4a:
return "chromium_experimental_dp4a";
case Extension::kChromiumDisableUniformityAnalysis:
return "chromium_disable_uniformity_analysis";
case Extension::kF16:
return "f16";
case Extension::kNone:
return "<none>";
} }
return "<unknown>"; if (str == "chromium_disable_uniformity_analysis") {
return Extension::kChromiumDisableUniformityAnalysis;
}
return Extension::kInvalid;
} }
std::ostream& operator<<(std::ostream& out, Extension i) { std::ostream& operator<<(std::ostream& out, Extension value) {
out << str(i); switch (value) {
return out; case Extension::kInvalid:
return out << "invalid";
case Extension::kF16:
return out << "f16";
case Extension::kChromiumExperimentalDp4A:
return out << "chromium_experimental_dp4a";
case Extension::kChromiumDisableUniformityAnalysis:
return out << "chromium_disable_uniformity_analysis";
}
return out << "<unknown>";
} }
} // namespace tint::ast } // namespace tint::ast

View File

@ -0,0 +1,22 @@
{{- /*
--------------------------------------------------------------------------------
Template file for use with tools/src/cmd/gen to generate extension.cc
See:
* tools/src/cmd/gen for structures used by this template
* https://golang.org/pkg/text/template/ for documentation on the template syntax
--------------------------------------------------------------------------------
*/ -}}
{{- Import "src/tint/templates/enums.tmpl.inc" -}}
{{- $enum := (Sem.Enum "extension") -}}
#include "src/tint/ast/extension.h"
namespace tint::ast {
{{ Eval "ParseEnum" $enum}}
{{ Eval "EnumOStream" $enum}}
} // namespace tint::ast

View File

@ -12,53 +12,41 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// src/tint/ast/extension.h.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
#ifndef SRC_TINT_AST_EXTENSION_H_ #ifndef SRC_TINT_AST_EXTENSION_H_
#define SRC_TINT_AST_EXTENSION_H_ #define SRC_TINT_AST_EXTENSION_H_
#include <sstream> #include <ostream>
#include <string>
#include "src/tint/utils/unique_vector.h" #include "src/tint/utils/unique_vector.h"
namespace tint::ast { namespace tint::ast {
/// An enumerator of WGSL extensions /// An enumerator of WGSL extensions
/// @see src/tint/intrinsics.def for extension descriptions
enum class Extension { enum class Extension {
/// WGSL Extension "f16" kInvalid,
kF16, kF16,
kChromiumExperimentalDp4A,
/// An extension for the experimental feature
/// "chromium_experimental_dp4a".
/// See crbug.com/tint/1497 for more details
kChromiumExperimentalDP4a,
/// A Chromium-specific extension for disabling uniformity analysis.
kChromiumDisableUniformityAnalysis, kChromiumDisableUniformityAnalysis,
/// Reserved for representing "No extension required" or "Not a valid extension".
kNone,
}; };
/// Convert a string of extension name into one of Extension enum value, the result will be /// @param out the std::ostream to write to
/// Extension::kNone if the name is not a known extension name. A extension node of kind /// @param value the Extension
/// kNone must not exist in the AST tree, and using a unknown extension name in WGSL code /// @returns `out` so calls can be chained
/// should result in a shader-creation error. std::ostream& operator<<(std::ostream& out, Extension value);
/// @param name string of the extension name
/// @return the Extension enum value for the extension of given name, or kNone if no known extension
/// has the given name
Extension ParseExtension(const std::string& name);
/// Convert the Extension enum value to corresponding extension name string. /// ParseExtension parses a Extension from a string.
/// @param ext the Extension enum value /// @param str the string to parse
/// @return string of the extension name corresponding to the given kind, or /// @returns the parsed enum, or Extension::kInvalid if the string could not be parsed.
/// an empty string if the given enum value is kNone or don't have a Extension ParseExtension(std::string_view str);
/// known corresponding name
const char* ExtensionName(Extension ext);
/// @returns the name of the extension.
const char* str(Extension i);
/// Emits the name of the extension type.
std::ostream& operator<<(std::ostream& out, Extension i);
// A unique vector of extensions // A unique vector of extensions
using Extensions = utils::UniqueVector<Extension>; using Extensions = utils::UniqueVector<Extension>;

View File

@ -0,0 +1,32 @@
{{- /*
--------------------------------------------------------------------------------
Template file for use with tools/src/cmd/gen to generate extension.h
See:
* tools/src/cmd/gen for structures used by this template
* https://golang.org/pkg/text/template/ for documentation on the template syntax
--------------------------------------------------------------------------------
*/ -}}
{{- Import "src/tint/templates/enums.tmpl.inc" -}}
{{- $enum := (Sem.Enum "extension") -}}
#ifndef SRC_TINT_AST_EXTENSION_H_
#define SRC_TINT_AST_EXTENSION_H_
#include <ostream>
#include "src/tint/utils/unique_vector.h"
namespace tint::ast {
/// An enumerator of WGSL extensions
/// @see src/tint/intrinsics.def for extension descriptions
{{ Eval "DeclareEnum" $enum}}
// A unique vector of extensions
using Extensions = utils::UniqueVector<Extension>;
} // namespace tint::ast
#endif // SRC_TINT_AST_EXTENSION_H_

View File

@ -0,0 +1,67 @@
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// src/tint/ast/extension_bench.cc.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
#include "src/tint/ast/extension.h"
#include <array>
#include "benchmark/benchmark.h"
namespace tint::ast {
namespace {
void ExtensionParser(::benchmark::State& state) {
std::array kStrings{
"cc6",
"s",
"HH6",
"f16",
"116",
"qJ6",
"f17ll",
"chromippHm_experqqmetal_dp4a",
"chrmium_expecimntal_dp4",
"chrmiumGexpebimental_dp4a",
"chromium_experimental_dp4a",
"chromium_exverimentiil_dp4a",
"chro8ium_experimenWWal_dp4a",
"chromiMm_eperimxxntal_dp4a",
"chXggmium_disable_uniformity_aalysis",
"Xhomiuu_disale_uniformity_analysis",
"chromium_3isable_uniformity_analysis",
"chromium_disable_uniformity_analysis",
"chromiuE_disable_uniformity_analysis",
"chromium_disable_uniTTormity_aPPalsis",
"ddhromium_disabexxuniformity_analysis",
};
for (auto _ : state) {
for (auto& str : kStrings) {
auto result = ParseExtension(str);
benchmark::DoNotOptimize(result);
}
}
}
BENCHMARK(ExtensionParser);
} // namespace
} // namespace tint::ast

View File

@ -0,0 +1,26 @@
{{- /*
--------------------------------------------------------------------------------
Template file for use with tools/src/cmd/gen to generate extension_bench.cc
See:
* tools/src/cmd/gen for structures used by this template
* https://golang.org/pkg/text/template/ for documentation on the template syntax
--------------------------------------------------------------------------------
*/ -}}
{{- Import "src/tint/templates/enums.tmpl.inc" -}}
{{- $enum := (Sem.Enum "extension") -}}
#include "src/tint/ast/extension.h"
#include <array>
#include "benchmark/benchmark.h"
namespace tint::ast {
namespace {
{{ Eval "BenchmarkParseEnum" $enum }}
} // namespace
} // namespace tint::ast

View File

@ -1,4 +1,3 @@
// Copyright 2021 The Tint Authors. // Copyright 2021 The Tint Authors.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
@ -13,24 +12,75 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// src/tint/ast/extension_test.cc.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
#include "src/tint/ast/extension.h" #include "src/tint/ast/extension.h"
#include "gtest/gtest.h" #include <string>
#include "src/tint/ast/test_helper.h"
#include "src/tint/utils/string.h"
namespace tint::ast { namespace tint::ast {
namespace { namespace {
TEST(ExtensionTest, NameToKind_InvalidName) { namespace parse_print_tests {
EXPECT_EQ(ParseExtension("f16"), Extension::kF16);
EXPECT_EQ(ParseExtension(""), Extension::kNone); struct Case {
EXPECT_EQ(ParseExtension("__ImpossibleExtensionName"), Extension::kNone); const char* string;
EXPECT_EQ(ParseExtension("123"), Extension::kNone); Extension value;
};
inline std::ostream& operator<<(std::ostream& out, Case c) {
return out << "'" << std::string(c.string) << "'";
} }
TEST(ExtensionTest, KindToName) { static constexpr Case kValidCases[] = {
EXPECT_EQ(std::string(str(Extension::kF16)), "f16"); {"f16", Extension::kF16},
EXPECT_EQ(std::string(str(Extension::kNone)), "<none>"); {"chromium_experimental_dp4a", Extension::kChromiumExperimentalDp4A},
{"chromium_disable_uniformity_analysis", Extension::kChromiumDisableUniformityAnalysis},
};
static constexpr Case kInvalidCases[] = {
{"cc6", Extension::kInvalid},
{"s", Extension::kInvalid},
{"HH6", Extension::kInvalid},
{"chro1ium_experimental_dp4a", Extension::kInvalid},
{"chrJmium_experiqqetal_dp4a", Extension::kInvalid},
{"chromium_experimenll77l_dp4a", Extension::kInvalid},
{"chromiumppdisableqquniformity_aalysHHs", Extension::kInvalid},
{"chromiu_disable_unifovmitc_analyi", Extension::kInvalid},
{"chromium_diable_uGbformity_analysis", Extension::kInvalid},
};
using ExtensionParseTest = testing::TestWithParam<Case>;
TEST_P(ExtensionParseTest, Parse) {
const char* string = GetParam().string;
Extension expect = GetParam().value;
EXPECT_EQ(expect, ParseExtension(string));
} }
INSTANTIATE_TEST_SUITE_P(ValidCases, ExtensionParseTest, testing::ValuesIn(kValidCases));
INSTANTIATE_TEST_SUITE_P(InvalidCases, ExtensionParseTest, testing::ValuesIn(kInvalidCases));
using ExtensionPrintTest = testing::TestWithParam<Case>;
TEST_P(ExtensionPrintTest, Print) {
Extension value = GetParam().value;
const char* expect = GetParam().string;
EXPECT_EQ(expect, utils::ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidCases, ExtensionPrintTest, testing::ValuesIn(kValidCases));
} // namespace parse_print_tests
} // namespace } // namespace
} // namespace tint::ast } // namespace tint::ast

View File

@ -0,0 +1,27 @@
{{- /*
--------------------------------------------------------------------------------
Template file for use with tools/src/cmd/gen to generate extension_test.cc
See:
* tools/src/cmd/gen for structures used by this template
* https://golang.org/pkg/text/template/ for documentation on the template syntax
--------------------------------------------------------------------------------
*/ -}}
{{- Import "src/tint/templates/enums.tmpl.inc" -}}
{{- $enum := (Sem.Enum "extension") -}}
#include "src/tint/ast/extension.h"
#include <string>
#include "src/tint/ast/test_helper.h"
#include "src/tint/utils/string.h"
namespace tint::ast {
namespace {
{{ Eval "TestParsePrintEnum" $enum}}
} // namespace
} // namespace tint::ast

View File

@ -23,6 +23,17 @@
// Enumerators // // Enumerators //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// https://gpuweb.github.io/gpuweb/wgsl/#extension
enum extension {
// WGSL Extension "f16"
f16
// An extension for the experimental feature "chromium_experimental_dp4a".
// See crbug.com/tint/1497 for more details
chromium_experimental_dp4a
// A Chromium-specific extension for disabling uniformity analysis.
chromium_disable_uniformity_analysis
}
// https://gpuweb.github.io/gpuweb/wgsl/#storage-class // https://gpuweb.github.io/gpuweb/wgsl/#storage-class
enum storage_class { enum storage_class {
@internal none @internal none

View File

@ -418,7 +418,7 @@ Maybe<bool> ParserImpl::enable_directive() {
} }
auto extension = ast::ParseExtension(name.value); auto extension = ast::ParseExtension(name.value);
if (extension == ast::Extension::kNone) { if (extension == ast::Extension::kInvalid) {
return add_error(name.source, "unsupported extension: '" + name.value + "'"); return add_error(name.source, "unsupported extension: '" + name.value + "'");
} }
builder_.AST().AddEnable(create<ast::Enable>(name.source, extension)); builder_.AST().AddEnable(create<ast::Enable>(name.source, extension));

View File

@ -384,7 +384,7 @@ using ResolverDP4aExtensionValidationTest = ResolverTest;
TEST_F(ResolverDP4aExtensionValidationTest, Dot4I8PackedWithExtension) { TEST_F(ResolverDP4aExtensionValidationTest, Dot4I8PackedWithExtension) {
// enable chromium_experimental_dp4a; // enable chromium_experimental_dp4a;
// fn func { return dot4I8Packed(1u, 2u); } // fn func { return dot4I8Packed(1u, 2u); }
Enable(ast::Extension::kChromiumExperimentalDP4a); Enable(ast::Extension::kChromiumExperimentalDp4A);
Func("func", {}, ty.i32(), Func("func", {}, ty.i32(),
{ {
@ -412,7 +412,7 @@ TEST_F(ResolverDP4aExtensionValidationTest, Dot4I8PackedWithoutExtension) {
TEST_F(ResolverDP4aExtensionValidationTest, Dot4U8PackedWithExtension) { TEST_F(ResolverDP4aExtensionValidationTest, Dot4U8PackedWithExtension) {
// enable chromium_experimental_dp4a; // enable chromium_experimental_dp4a;
// fn func { return dot4U8Packed(1u, 2u); } // fn func { return dot4U8Packed(1u, 2u); }
Enable(ast::Extension::kChromiumExperimentalDP4a); Enable(ast::Extension::kChromiumExperimentalDp4A);
Func("func", {}, ty.u32(), Func("func", {}, ty.u32(),
{ {

View File

@ -23,7 +23,7 @@
// clang-format off // clang-format off
/// TypeMatcher for 'type bool' /// TypeMatcher for 'type bool'
/// @see src/tint/intrinsics.def:76:6 /// @see src/tint/intrinsics.def:87:6
class Bool : public TypeMatcher { class Bool : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -50,7 +50,7 @@ std::string Bool::String(MatchState*) const {
} }
/// TypeMatcher for 'type fa' /// TypeMatcher for 'type fa'
/// @see src/tint/intrinsics.def:77:48 /// @see src/tint/intrinsics.def:88:48
class Fa : public TypeMatcher { class Fa : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -79,7 +79,7 @@ std::string Fa::String(MatchState*) const {
} }
/// TypeMatcher for 'type ia' /// TypeMatcher for 'type ia'
/// @see src/tint/intrinsics.def:78:48 /// @see src/tint/intrinsics.def:89:48
class Ia : public TypeMatcher { class Ia : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -108,7 +108,7 @@ std::string Ia::String(MatchState*) const {
} }
/// TypeMatcher for 'type i32' /// TypeMatcher for 'type i32'
/// @see src/tint/intrinsics.def:79:21 /// @see src/tint/intrinsics.def:90:21
class I32 : public TypeMatcher { class I32 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -135,7 +135,7 @@ std::string I32::String(MatchState*) const {
} }
/// TypeMatcher for 'type u32' /// TypeMatcher for 'type u32'
/// @see src/tint/intrinsics.def:80:21 /// @see src/tint/intrinsics.def:91:21
class U32 : public TypeMatcher { class U32 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -162,7 +162,7 @@ std::string U32::String(MatchState*) const {
} }
/// TypeMatcher for 'type f32' /// TypeMatcher for 'type f32'
/// @see src/tint/intrinsics.def:81:21 /// @see src/tint/intrinsics.def:92:21
class F32 : public TypeMatcher { class F32 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -189,7 +189,7 @@ std::string F32::String(MatchState*) const {
} }
/// TypeMatcher for 'type f16' /// TypeMatcher for 'type f16'
/// @see src/tint/intrinsics.def:82:21 /// @see src/tint/intrinsics.def:93:21
class F16 : public TypeMatcher { class F16 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -216,7 +216,7 @@ std::string F16::String(MatchState*) const {
} }
/// TypeMatcher for 'type vec2' /// TypeMatcher for 'type vec2'
/// @see src/tint/intrinsics.def:83:6 /// @see src/tint/intrinsics.def:94:6
class Vec2 : public TypeMatcher { class Vec2 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -249,7 +249,7 @@ std::string Vec2::String(MatchState* state) const {
} }
/// TypeMatcher for 'type vec3' /// TypeMatcher for 'type vec3'
/// @see src/tint/intrinsics.def:84:6 /// @see src/tint/intrinsics.def:95:6
class Vec3 : public TypeMatcher { class Vec3 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -282,7 +282,7 @@ std::string Vec3::String(MatchState* state) const {
} }
/// TypeMatcher for 'type vec4' /// TypeMatcher for 'type vec4'
/// @see src/tint/intrinsics.def:85:6 /// @see src/tint/intrinsics.def:96:6
class Vec4 : public TypeMatcher { class Vec4 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -315,7 +315,7 @@ std::string Vec4::String(MatchState* state) const {
} }
/// TypeMatcher for 'type mat2x2' /// TypeMatcher for 'type mat2x2'
/// @see src/tint/intrinsics.def:86:6 /// @see src/tint/intrinsics.def:97:6
class Mat2X2 : public TypeMatcher { class Mat2X2 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -348,7 +348,7 @@ std::string Mat2X2::String(MatchState* state) const {
} }
/// TypeMatcher for 'type mat2x3' /// TypeMatcher for 'type mat2x3'
/// @see src/tint/intrinsics.def:87:6 /// @see src/tint/intrinsics.def:98:6
class Mat2X3 : public TypeMatcher { class Mat2X3 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -381,7 +381,7 @@ std::string Mat2X3::String(MatchState* state) const {
} }
/// TypeMatcher for 'type mat2x4' /// TypeMatcher for 'type mat2x4'
/// @see src/tint/intrinsics.def:88:6 /// @see src/tint/intrinsics.def:99:6
class Mat2X4 : public TypeMatcher { class Mat2X4 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -414,7 +414,7 @@ std::string Mat2X4::String(MatchState* state) const {
} }
/// TypeMatcher for 'type mat3x2' /// TypeMatcher for 'type mat3x2'
/// @see src/tint/intrinsics.def:89:6 /// @see src/tint/intrinsics.def:100:6
class Mat3X2 : public TypeMatcher { class Mat3X2 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -447,7 +447,7 @@ std::string Mat3X2::String(MatchState* state) const {
} }
/// TypeMatcher for 'type mat3x3' /// TypeMatcher for 'type mat3x3'
/// @see src/tint/intrinsics.def:90:6 /// @see src/tint/intrinsics.def:101:6
class Mat3X3 : public TypeMatcher { class Mat3X3 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -480,7 +480,7 @@ std::string Mat3X3::String(MatchState* state) const {
} }
/// TypeMatcher for 'type mat3x4' /// TypeMatcher for 'type mat3x4'
/// @see src/tint/intrinsics.def:91:6 /// @see src/tint/intrinsics.def:102:6
class Mat3X4 : public TypeMatcher { class Mat3X4 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -513,7 +513,7 @@ std::string Mat3X4::String(MatchState* state) const {
} }
/// TypeMatcher for 'type mat4x2' /// TypeMatcher for 'type mat4x2'
/// @see src/tint/intrinsics.def:92:6 /// @see src/tint/intrinsics.def:103:6
class Mat4X2 : public TypeMatcher { class Mat4X2 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -546,7 +546,7 @@ std::string Mat4X2::String(MatchState* state) const {
} }
/// TypeMatcher for 'type mat4x3' /// TypeMatcher for 'type mat4x3'
/// @see src/tint/intrinsics.def:93:6 /// @see src/tint/intrinsics.def:104:6
class Mat4X3 : public TypeMatcher { class Mat4X3 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -579,7 +579,7 @@ std::string Mat4X3::String(MatchState* state) const {
} }
/// TypeMatcher for 'type mat4x4' /// TypeMatcher for 'type mat4x4'
/// @see src/tint/intrinsics.def:94:6 /// @see src/tint/intrinsics.def:105:6
class Mat4X4 : public TypeMatcher { class Mat4X4 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -612,7 +612,7 @@ std::string Mat4X4::String(MatchState* state) const {
} }
/// TypeMatcher for 'type vec' /// TypeMatcher for 'type vec'
/// @see src/tint/intrinsics.def:95:34 /// @see src/tint/intrinsics.def:106:34
class Vec : public TypeMatcher { class Vec : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -653,7 +653,7 @@ std::string Vec::String(MatchState* state) const {
} }
/// TypeMatcher for 'type mat' /// TypeMatcher for 'type mat'
/// @see src/tint/intrinsics.def:96:34 /// @see src/tint/intrinsics.def:107:34
class Mat : public TypeMatcher { class Mat : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -700,7 +700,7 @@ std::string Mat::String(MatchState* state) const {
} }
/// TypeMatcher for 'type ptr' /// TypeMatcher for 'type ptr'
/// @see src/tint/intrinsics.def:97:6 /// @see src/tint/intrinsics.def:108:6
class Ptr : public TypeMatcher { class Ptr : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -745,7 +745,7 @@ std::string Ptr::String(MatchState* state) const {
} }
/// TypeMatcher for 'type atomic' /// TypeMatcher for 'type atomic'
/// @see src/tint/intrinsics.def:98:6 /// @see src/tint/intrinsics.def:109:6
class Atomic : public TypeMatcher { class Atomic : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -778,7 +778,7 @@ std::string Atomic::String(MatchState* state) const {
} }
/// TypeMatcher for 'type array' /// TypeMatcher for 'type array'
/// @see src/tint/intrinsics.def:99:6 /// @see src/tint/intrinsics.def:110:6
class Array : public TypeMatcher { class Array : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -811,7 +811,7 @@ std::string Array::String(MatchState* state) const {
} }
/// TypeMatcher for 'type sampler' /// TypeMatcher for 'type sampler'
/// @see src/tint/intrinsics.def:100:6 /// @see src/tint/intrinsics.def:111:6
class Sampler : public TypeMatcher { class Sampler : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -838,7 +838,7 @@ std::string Sampler::String(MatchState*) const {
} }
/// TypeMatcher for 'type sampler_comparison' /// TypeMatcher for 'type sampler_comparison'
/// @see src/tint/intrinsics.def:101:6 /// @see src/tint/intrinsics.def:112:6
class SamplerComparison : public TypeMatcher { class SamplerComparison : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -865,7 +865,7 @@ std::string SamplerComparison::String(MatchState*) const {
} }
/// TypeMatcher for 'type texture_1d' /// TypeMatcher for 'type texture_1d'
/// @see src/tint/intrinsics.def:102:6 /// @see src/tint/intrinsics.def:113:6
class Texture1D : public TypeMatcher { class Texture1D : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -898,7 +898,7 @@ std::string Texture1D::String(MatchState* state) const {
} }
/// TypeMatcher for 'type texture_2d' /// TypeMatcher for 'type texture_2d'
/// @see src/tint/intrinsics.def:103:6 /// @see src/tint/intrinsics.def:114:6
class Texture2D : public TypeMatcher { class Texture2D : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -931,7 +931,7 @@ std::string Texture2D::String(MatchState* state) const {
} }
/// TypeMatcher for 'type texture_2d_array' /// TypeMatcher for 'type texture_2d_array'
/// @see src/tint/intrinsics.def:104:6 /// @see src/tint/intrinsics.def:115:6
class Texture2DArray : public TypeMatcher { class Texture2DArray : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -964,7 +964,7 @@ std::string Texture2DArray::String(MatchState* state) const {
} }
/// TypeMatcher for 'type texture_3d' /// TypeMatcher for 'type texture_3d'
/// @see src/tint/intrinsics.def:105:6 /// @see src/tint/intrinsics.def:116:6
class Texture3D : public TypeMatcher { class Texture3D : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -997,7 +997,7 @@ std::string Texture3D::String(MatchState* state) const {
} }
/// TypeMatcher for 'type texture_cube' /// TypeMatcher for 'type texture_cube'
/// @see src/tint/intrinsics.def:106:6 /// @see src/tint/intrinsics.def:117:6
class TextureCube : public TypeMatcher { class TextureCube : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1030,7 +1030,7 @@ std::string TextureCube::String(MatchState* state) const {
} }
/// TypeMatcher for 'type texture_cube_array' /// TypeMatcher for 'type texture_cube_array'
/// @see src/tint/intrinsics.def:107:6 /// @see src/tint/intrinsics.def:118:6
class TextureCubeArray : public TypeMatcher { class TextureCubeArray : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1063,7 +1063,7 @@ std::string TextureCubeArray::String(MatchState* state) const {
} }
/// TypeMatcher for 'type texture_multisampled_2d' /// TypeMatcher for 'type texture_multisampled_2d'
/// @see src/tint/intrinsics.def:108:6 /// @see src/tint/intrinsics.def:119:6
class TextureMultisampled2D : public TypeMatcher { class TextureMultisampled2D : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1096,7 +1096,7 @@ std::string TextureMultisampled2D::String(MatchState* state) const {
} }
/// TypeMatcher for 'type texture_depth_2d' /// TypeMatcher for 'type texture_depth_2d'
/// @see src/tint/intrinsics.def:109:6 /// @see src/tint/intrinsics.def:120:6
class TextureDepth2D : public TypeMatcher { class TextureDepth2D : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1123,7 +1123,7 @@ std::string TextureDepth2D::String(MatchState*) const {
} }
/// TypeMatcher for 'type texture_depth_2d_array' /// TypeMatcher for 'type texture_depth_2d_array'
/// @see src/tint/intrinsics.def:110:6 /// @see src/tint/intrinsics.def:121:6
class TextureDepth2DArray : public TypeMatcher { class TextureDepth2DArray : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1150,7 +1150,7 @@ std::string TextureDepth2DArray::String(MatchState*) const {
} }
/// TypeMatcher for 'type texture_depth_cube' /// TypeMatcher for 'type texture_depth_cube'
/// @see src/tint/intrinsics.def:111:6 /// @see src/tint/intrinsics.def:122:6
class TextureDepthCube : public TypeMatcher { class TextureDepthCube : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1177,7 +1177,7 @@ std::string TextureDepthCube::String(MatchState*) const {
} }
/// TypeMatcher for 'type texture_depth_cube_array' /// TypeMatcher for 'type texture_depth_cube_array'
/// @see src/tint/intrinsics.def:112:6 /// @see src/tint/intrinsics.def:123:6
class TextureDepthCubeArray : public TypeMatcher { class TextureDepthCubeArray : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1204,7 +1204,7 @@ std::string TextureDepthCubeArray::String(MatchState*) const {
} }
/// TypeMatcher for 'type texture_depth_multisampled_2d' /// TypeMatcher for 'type texture_depth_multisampled_2d'
/// @see src/tint/intrinsics.def:113:6 /// @see src/tint/intrinsics.def:124:6
class TextureDepthMultisampled2D : public TypeMatcher { class TextureDepthMultisampled2D : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1231,7 +1231,7 @@ std::string TextureDepthMultisampled2D::String(MatchState*) const {
} }
/// TypeMatcher for 'type texture_storage_1d' /// TypeMatcher for 'type texture_storage_1d'
/// @see src/tint/intrinsics.def:114:6 /// @see src/tint/intrinsics.def:125:6
class TextureStorage1D : public TypeMatcher { class TextureStorage1D : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1270,7 +1270,7 @@ std::string TextureStorage1D::String(MatchState* state) const {
} }
/// TypeMatcher for 'type texture_storage_2d' /// TypeMatcher for 'type texture_storage_2d'
/// @see src/tint/intrinsics.def:115:6 /// @see src/tint/intrinsics.def:126:6
class TextureStorage2D : public TypeMatcher { class TextureStorage2D : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1309,7 +1309,7 @@ std::string TextureStorage2D::String(MatchState* state) const {
} }
/// TypeMatcher for 'type texture_storage_2d_array' /// TypeMatcher for 'type texture_storage_2d_array'
/// @see src/tint/intrinsics.def:116:6 /// @see src/tint/intrinsics.def:127:6
class TextureStorage2DArray : public TypeMatcher { class TextureStorage2DArray : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1348,7 +1348,7 @@ std::string TextureStorage2DArray::String(MatchState* state) const {
} }
/// TypeMatcher for 'type texture_storage_3d' /// TypeMatcher for 'type texture_storage_3d'
/// @see src/tint/intrinsics.def:117:6 /// @see src/tint/intrinsics.def:128:6
class TextureStorage3D : public TypeMatcher { class TextureStorage3D : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1387,7 +1387,7 @@ std::string TextureStorage3D::String(MatchState* state) const {
} }
/// TypeMatcher for 'type texture_external' /// TypeMatcher for 'type texture_external'
/// @see src/tint/intrinsics.def:118:6 /// @see src/tint/intrinsics.def:129:6
class TextureExternal : public TypeMatcher { class TextureExternal : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1414,7 +1414,7 @@ std::string TextureExternal::String(MatchState*) const {
} }
/// TypeMatcher for 'type __modf_result' /// TypeMatcher for 'type __modf_result'
/// @see src/tint/intrinsics.def:120:6 /// @see src/tint/intrinsics.def:131:6
class ModfResult : public TypeMatcher { class ModfResult : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1441,7 +1441,7 @@ std::string ModfResult::String(MatchState*) const {
} }
/// TypeMatcher for 'type __modf_result_vec' /// TypeMatcher for 'type __modf_result_vec'
/// @see src/tint/intrinsics.def:121:39 /// @see src/tint/intrinsics.def:132:39
class ModfResultVec : public TypeMatcher { class ModfResultVec : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1476,7 +1476,7 @@ std::string ModfResultVec::String(MatchState* state) const {
} }
/// TypeMatcher for 'type __frexp_result' /// TypeMatcher for 'type __frexp_result'
/// @see src/tint/intrinsics.def:122:6 /// @see src/tint/intrinsics.def:133:6
class FrexpResult : public TypeMatcher { class FrexpResult : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1503,7 +1503,7 @@ std::string FrexpResult::String(MatchState*) const {
} }
/// TypeMatcher for 'type __frexp_result_vec' /// TypeMatcher for 'type __frexp_result_vec'
/// @see src/tint/intrinsics.def:123:40 /// @see src/tint/intrinsics.def:134:40
class FrexpResultVec : public TypeMatcher { class FrexpResultVec : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1538,7 +1538,7 @@ std::string FrexpResultVec::String(MatchState* state) const {
} }
/// TypeMatcher for 'type __atomic_compare_exchange_result' /// TypeMatcher for 'type __atomic_compare_exchange_result'
/// @see src/tint/intrinsics.def:125:6 /// @see src/tint/intrinsics.def:136:6
class AtomicCompareExchangeResult : public TypeMatcher { class AtomicCompareExchangeResult : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules. /// Checks whether the given type matches the matcher rules.
@ -1571,7 +1571,7 @@ std::string AtomicCompareExchangeResult::String(MatchState* state) const {
} }
/// TypeMatcher for 'match abstract_or_scalar' /// TypeMatcher for 'match abstract_or_scalar'
/// @see src/tint/intrinsics.def:133:7 /// @see src/tint/intrinsics.def:144:7
class AbstractOrScalar : public TypeMatcher { class AbstractOrScalar : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -1621,7 +1621,7 @@ std::string AbstractOrScalar::String(MatchState*) const {
} }
/// TypeMatcher for 'match scalar' /// TypeMatcher for 'match scalar'
/// @see src/tint/intrinsics.def:134:7 /// @see src/tint/intrinsics.def:145:7
class Scalar : public TypeMatcher { class Scalar : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -1665,7 +1665,7 @@ std::string Scalar::String(MatchState*) const {
} }
/// TypeMatcher for 'match scalar_no_f32' /// TypeMatcher for 'match scalar_no_f32'
/// @see src/tint/intrinsics.def:135:7 /// @see src/tint/intrinsics.def:146:7
class ScalarNoF32 : public TypeMatcher { class ScalarNoF32 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -1706,7 +1706,7 @@ std::string ScalarNoF32::String(MatchState*) const {
} }
/// TypeMatcher for 'match scalar_no_f16' /// TypeMatcher for 'match scalar_no_f16'
/// @see src/tint/intrinsics.def:136:7 /// @see src/tint/intrinsics.def:147:7
class ScalarNoF16 : public TypeMatcher { class ScalarNoF16 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -1747,7 +1747,7 @@ std::string ScalarNoF16::String(MatchState*) const {
} }
/// TypeMatcher for 'match scalar_no_i32' /// TypeMatcher for 'match scalar_no_i32'
/// @see src/tint/intrinsics.def:137:7 /// @see src/tint/intrinsics.def:148:7
class ScalarNoI32 : public TypeMatcher { class ScalarNoI32 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -1788,7 +1788,7 @@ std::string ScalarNoI32::String(MatchState*) const {
} }
/// TypeMatcher for 'match scalar_no_u32' /// TypeMatcher for 'match scalar_no_u32'
/// @see src/tint/intrinsics.def:138:7 /// @see src/tint/intrinsics.def:149:7
class ScalarNoU32 : public TypeMatcher { class ScalarNoU32 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -1829,7 +1829,7 @@ std::string ScalarNoU32::String(MatchState*) const {
} }
/// TypeMatcher for 'match scalar_no_bool' /// TypeMatcher for 'match scalar_no_bool'
/// @see src/tint/intrinsics.def:139:7 /// @see src/tint/intrinsics.def:150:7
class ScalarNoBool : public TypeMatcher { class ScalarNoBool : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -1870,7 +1870,7 @@ std::string ScalarNoBool::String(MatchState*) const {
} }
/// TypeMatcher for 'match fia_fi32_f16' /// TypeMatcher for 'match fia_fi32_f16'
/// @see src/tint/intrinsics.def:140:7 /// @see src/tint/intrinsics.def:151:7
class FiaFi32F16 : public TypeMatcher { class FiaFi32F16 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -1914,7 +1914,7 @@ std::string FiaFi32F16::String(MatchState*) const {
} }
/// TypeMatcher for 'match fia_fiu32' /// TypeMatcher for 'match fia_fiu32'
/// @see src/tint/intrinsics.def:141:7 /// @see src/tint/intrinsics.def:152:7
class FiaFiu32 : public TypeMatcher { class FiaFiu32 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -1958,7 +1958,7 @@ std::string FiaFiu32::String(MatchState*) const {
} }
/// TypeMatcher for 'match fa_f32' /// TypeMatcher for 'match fa_f32'
/// @see src/tint/intrinsics.def:142:7 /// @see src/tint/intrinsics.def:153:7
class FaF32 : public TypeMatcher { class FaF32 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -1993,7 +1993,7 @@ std::string FaF32::String(MatchState*) const {
} }
/// TypeMatcher for 'match fa_f32_f16' /// TypeMatcher for 'match fa_f32_f16'
/// @see src/tint/intrinsics.def:143:7 /// @see src/tint/intrinsics.def:154:7
class FaF32F16 : public TypeMatcher { class FaF32F16 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -2031,7 +2031,7 @@ std::string FaF32F16::String(MatchState*) const {
} }
/// TypeMatcher for 'match ia_iu32' /// TypeMatcher for 'match ia_iu32'
/// @see src/tint/intrinsics.def:144:7 /// @see src/tint/intrinsics.def:155:7
class IaIu32 : public TypeMatcher { class IaIu32 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -2069,7 +2069,7 @@ std::string IaIu32::String(MatchState*) const {
} }
/// TypeMatcher for 'match fiu32_f16' /// TypeMatcher for 'match fiu32_f16'
/// @see src/tint/intrinsics.def:145:7 /// @see src/tint/intrinsics.def:156:7
class Fiu32F16 : public TypeMatcher { class Fiu32F16 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -2110,7 +2110,7 @@ std::string Fiu32F16::String(MatchState*) const {
} }
/// TypeMatcher for 'match fiu32' /// TypeMatcher for 'match fiu32'
/// @see src/tint/intrinsics.def:146:7 /// @see src/tint/intrinsics.def:157:7
class Fiu32 : public TypeMatcher { class Fiu32 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -2148,7 +2148,7 @@ std::string Fiu32::String(MatchState*) const {
} }
/// TypeMatcher for 'match fi32_f16' /// TypeMatcher for 'match fi32_f16'
/// @see src/tint/intrinsics.def:147:7 /// @see src/tint/intrinsics.def:158:7
class Fi32F16 : public TypeMatcher { class Fi32F16 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -2186,7 +2186,7 @@ std::string Fi32F16::String(MatchState*) const {
} }
/// TypeMatcher for 'match fi32' /// TypeMatcher for 'match fi32'
/// @see src/tint/intrinsics.def:148:7 /// @see src/tint/intrinsics.def:159:7
class Fi32 : public TypeMatcher { class Fi32 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -2221,7 +2221,7 @@ std::string Fi32::String(MatchState*) const {
} }
/// TypeMatcher for 'match f32_f16' /// TypeMatcher for 'match f32_f16'
/// @see src/tint/intrinsics.def:149:7 /// @see src/tint/intrinsics.def:160:7
class F32F16 : public TypeMatcher { class F32F16 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -2256,7 +2256,7 @@ std::string F32F16::String(MatchState*) const {
} }
/// TypeMatcher for 'match iu32' /// TypeMatcher for 'match iu32'
/// @see src/tint/intrinsics.def:150:7 /// @see src/tint/intrinsics.def:161:7
class Iu32 : public TypeMatcher { class Iu32 : public TypeMatcher {
public: public:
/// Checks whether the given type matches the matcher rules, and returns the /// Checks whether the given type matches the matcher rules, and returns the
@ -2291,7 +2291,7 @@ std::string Iu32::String(MatchState*) const {
} }
/// EnumMatcher for 'match f32_texel_format' /// EnumMatcher for 'match f32_texel_format'
/// @see src/tint/intrinsics.def:161:7 /// @see src/tint/intrinsics.def:172:7
class F32TexelFormat : public NumberMatcher { class F32TexelFormat : public NumberMatcher {
public: public:
/// Checks whether the given number matches the enum matcher rules. /// Checks whether the given number matches the enum matcher rules.
@ -2324,7 +2324,7 @@ std::string F32TexelFormat::String(MatchState*) const {
} }
/// EnumMatcher for 'match i32_texel_format' /// EnumMatcher for 'match i32_texel_format'
/// @see src/tint/intrinsics.def:168:7 /// @see src/tint/intrinsics.def:179:7
class I32TexelFormat : public NumberMatcher { class I32TexelFormat : public NumberMatcher {
public: public:
/// Checks whether the given number matches the enum matcher rules. /// Checks whether the given number matches the enum matcher rules.
@ -2356,7 +2356,7 @@ std::string I32TexelFormat::String(MatchState*) const {
} }
/// EnumMatcher for 'match u32_texel_format' /// EnumMatcher for 'match u32_texel_format'
/// @see src/tint/intrinsics.def:174:7 /// @see src/tint/intrinsics.def:185:7
class U32TexelFormat : public NumberMatcher { class U32TexelFormat : public NumberMatcher {
public: public:
/// Checks whether the given number matches the enum matcher rules. /// Checks whether the given number matches the enum matcher rules.
@ -2388,7 +2388,7 @@ std::string U32TexelFormat::String(MatchState*) const {
} }
/// EnumMatcher for 'match write' /// EnumMatcher for 'match write'
/// @see src/tint/intrinsics.def:181:7 /// @see src/tint/intrinsics.def:192:7
class Write : public NumberMatcher { class Write : public NumberMatcher {
public: public:
/// Checks whether the given number matches the enum matcher rules. /// Checks whether the given number matches the enum matcher rules.
@ -2414,7 +2414,7 @@ std::string Write::String(MatchState*) const {
} }
/// EnumMatcher for 'match read_write' /// EnumMatcher for 'match read_write'
/// @see src/tint/intrinsics.def:182:7 /// @see src/tint/intrinsics.def:193:7
class ReadWrite : public NumberMatcher { class ReadWrite : public NumberMatcher {
public: public:
/// Checks whether the given number matches the enum matcher rules. /// Checks whether the given number matches the enum matcher rules.
@ -2440,7 +2440,7 @@ std::string ReadWrite::String(MatchState*) const {
} }
/// EnumMatcher for 'match function_private_workgroup' /// EnumMatcher for 'match function_private_workgroup'
/// @see src/tint/intrinsics.def:184:7 /// @see src/tint/intrinsics.def:195:7
class FunctionPrivateWorkgroup : public NumberMatcher { class FunctionPrivateWorkgroup : public NumberMatcher {
public: public:
/// Checks whether the given number matches the enum matcher rules. /// Checks whether the given number matches the enum matcher rules.
@ -2470,7 +2470,7 @@ std::string FunctionPrivateWorkgroup::String(MatchState*) const {
} }
/// EnumMatcher for 'match workgroup_or_storage' /// EnumMatcher for 'match workgroup_or_storage'
/// @see src/tint/intrinsics.def:188:7 /// @see src/tint/intrinsics.def:199:7
class WorkgroupOrStorage : public NumberMatcher { class WorkgroupOrStorage : public NumberMatcher {
public: public:
/// Checks whether the given number matches the enum matcher rules. /// Checks whether the given number matches the enum matcher rules.
@ -2499,7 +2499,7 @@ std::string WorkgroupOrStorage::String(MatchState*) const {
} }
/// EnumMatcher for 'match storage' /// EnumMatcher for 'match storage'
/// @see src/tint/intrinsics.def:191:7 /// @see src/tint/intrinsics.def:202:7
class Storage : public NumberMatcher { class Storage : public NumberMatcher {
public: public:
/// Checks whether the given number matches the enum matcher rules. /// Checks whether the given number matches the enum matcher rules.

View File

@ -1708,13 +1708,13 @@ bool Validator::RequiredExtensionForBuiltinFunction(
} }
const auto extension = builtin->RequiredExtension(); const auto extension = builtin->RequiredExtension();
if (extension == ast::Extension::kNone) { if (extension == ast::Extension::kInvalid) {
return true; return true;
} }
if (!enabled_extensions.contains(extension)) { if (!enabled_extensions.contains(extension)) {
AddError("cannot call built-in function '" + std::string(builtin->str()) + AddError("cannot call built-in function '" + std::string(builtin->str()) +
"' without extension " + ast::str(extension), "' without extension " + utils::ToString(extension),
call->Declaration()->source); call->Declaration()->source);
return false; return false;
} }

View File

@ -164,9 +164,9 @@ bool Builtin::HasSideEffects() const {
ast::Extension Builtin::RequiredExtension() const { ast::Extension Builtin::RequiredExtension() const {
if (IsDP4a()) { if (IsDP4a()) {
return ast::Extension::kChromiumExperimentalDP4a; return ast::Extension::kChromiumExperimentalDp4A;
} }
return ast::Extension::kNone; return ast::Extension::kInvalid;
} }
} // namespace tint::sem } // namespace tint::sem

View File

@ -725,7 +725,7 @@ void main() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Dot4I8Packed) { TEST_F(HlslGeneratorImplTest_Builtin, Dot4I8Packed) {
Enable(ast::Extension::kChromiumExperimentalDP4a); Enable(ast::Extension::kChromiumExperimentalDp4A);
auto* val1 = Var("val1", ty.u32()); auto* val1 = Var("val1", ty.u32());
auto* val2 = Var("val2", ty.u32()); auto* val2 = Var("val2", ty.u32());
@ -751,7 +751,7 @@ void test_function() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Dot4U8Packed) { TEST_F(HlslGeneratorImplTest_Builtin, Dot4U8Packed) {
Enable(ast::Extension::kChromiumExperimentalDP4a); Enable(ast::Extension::kChromiumExperimentalDp4A);
auto* val1 = Var("val1", ty.u32()); auto* val1 = Var("val1", ty.u32());
auto* val2 = Var("val2", ty.u32()); auto* val2 = Var("val2", ty.u32());

View File

@ -380,7 +380,7 @@ void Builder::push_extension(const char* extension) {
bool Builder::GenerateExtension(ast::Extension extension) { bool Builder::GenerateExtension(ast::Extension extension) {
switch (extension) { switch (extension) {
case ast::Extension::kChromiumExperimentalDP4a: case ast::Extension::kChromiumExperimentalDp4A:
push_extension("SPV_KHR_integer_dot_product"); push_extension("SPV_KHR_integer_dot_product");
push_capability(SpvCapabilityDotProductKHR); push_capability(SpvCapabilityDotProductKHR);
push_capability(SpvCapabilityDotProductInput4x8BitPackedKHR); push_capability(SpvCapabilityDotProductInput4x8BitPackedKHR);

View File

@ -2805,7 +2805,7 @@ OpFunctionEnd
TEST_F(BuiltinBuilderTest, Call_Dot4I8Packed) { TEST_F(BuiltinBuilderTest, Call_Dot4I8Packed) {
auto* ext = auto* ext =
create<ast::Enable>(Source{Source::Range{Source::Location{10, 2}, Source::Location{10, 5}}}, create<ast::Enable>(Source{Source::Range{Source::Location{10, 2}, Source::Location{10, 5}}},
ast::Extension::kChromiumExperimentalDP4a); ast::Extension::kChromiumExperimentalDp4A);
AST().AddEnable(ext); AST().AddEnable(ext);
auto* val1 = Var("val1", ty.u32()); auto* val1 = Var("val1", ty.u32());
@ -2845,7 +2845,7 @@ OpFunctionEnd
TEST_F(BuiltinBuilderTest, Call_Dot4U8Packed) { TEST_F(BuiltinBuilderTest, Call_Dot4U8Packed) {
auto* ext = auto* ext =
create<ast::Enable>(Source{Source::Range{Source::Location{10, 2}, Source::Location{10, 5}}}, create<ast::Enable>(Source{Source::Range{Source::Location{10, 2}, Source::Location{10, 5}}},
ast::Extension::kChromiumExperimentalDP4a); ast::Extension::kChromiumExperimentalDp4A);
AST().AddEnable(ext); AST().AddEnable(ext);
auto* val1 = Var("val1", ty.u32()); auto* val1 = Var("val1", ty.u32());