| // Copyright 2024 The Dawn & Tint Authors |
| // |
| // Redistribution and use in source and binary forms, with or without |
| // modification, are permitted provided that the following conditions are met: |
| // |
| // 1. Redistributions of source code must retain the above copyright notice, this |
| // list of conditions and the following disclaimer. |
| // |
| // 2. Redistributions in binary form must reproduce the above copyright notice, |
| // this list of conditions and the following disclaimer in the documentation |
| // and/or other materials provided with the distribution. |
| // |
| // 3. Neither the name of the copyright holder nor the names of its |
| // contributors may be used to endorse or promote products derived from |
| // this software without specific prior written permission. |
| // |
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| |
| //////////////////////////////////////////////////////////////////////////////// |
| // File generated by 'tools/src/cmd/gen' using the template: |
| // src/tint/lang/glsl/intrinsic/data.cc.tmpl |
| // |
| // To regenerate run: './tools/run gen' |
| // |
| // Do not modify this file directly |
| //////////////////////////////////////////////////////////////////////////////// |
| |
| #include <limits> |
| #include <string> |
| |
| #include "src/tint/lang/core/intrinsic/type_matchers.h" |
| #include "src/tint/lang/glsl/intrinsic/dialect.h" |
| #include "src/tint/utils/text/string_stream.h" |
| |
| namespace tint::glsl::intrinsic { |
| |
| using namespace tint::core::intrinsic; // NOLINT(build/namespaces) |
| |
| namespace { |
| |
| using ConstEvalFunctionIndex = tint::core::intrinsic::ConstEvalFunctionIndex; |
| using IntrinsicInfo = tint::core::intrinsic::IntrinsicInfo; |
| using MatcherIndicesIndex = tint::core::intrinsic::MatcherIndicesIndex; |
| using MatchState = tint::core::intrinsic::MatchState; |
| using Number = tint::core::intrinsic::Number; |
| using NumberMatcher = tint::core::intrinsic::NumberMatcher; |
| using NumberMatcherIndex = tint::core::intrinsic::NumberMatcherIndex; |
| using OverloadFlag = tint::core::intrinsic::OverloadFlag; |
| using OverloadFlags = tint::core::intrinsic::OverloadFlags; |
| using OverloadIndex = tint::core::intrinsic::OverloadIndex; |
| using OverloadInfo = tint::core::intrinsic::OverloadInfo; |
| using ParameterIndex = tint::core::intrinsic::ParameterIndex; |
| using ParameterInfo = tint::core::intrinsic::ParameterInfo; |
| using StringStream = tint::StringStream; |
| using TemplateIndex = tint::core::intrinsic::TemplateIndex; |
| using Type = tint::core::type::Type; |
| using TypeMatcher = tint::core::intrinsic::TypeMatcher; |
| using TypeMatcherIndex = tint::core::intrinsic::TypeMatcherIndex; |
| |
| template <size_t N> |
| using TemplateNumberMatcher = tint::core::intrinsic::TemplateNumberMatcher<N>; |
| |
| template <size_t N> |
| using TemplateTypeMatcher = tint::core::intrinsic::TemplateTypeMatcher<N>; |
| |
| // clang-format off |
| |
| /// TypeMatcher for 'type f16' |
| constexpr TypeMatcher kF16Matcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| if (!MatchF16(state, ty)) { |
| return nullptr; |
| } |
| return BuildF16(state, ty); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) { |
| out << style::Type("f16"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type f32' |
| constexpr TypeMatcher kF32Matcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| if (!MatchF32(state, ty)) { |
| return nullptr; |
| } |
| return BuildF32(state, ty); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) { |
| out << style::Type("f32"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type i32' |
| constexpr TypeMatcher kI32Matcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| if (!MatchI32(state, ty)) { |
| return nullptr; |
| } |
| return BuildI32(state, ty); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) { |
| out << style::Type("i32"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type u32' |
| constexpr TypeMatcher kU32Matcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| if (!MatchU32(state, ty)) { |
| return nullptr; |
| } |
| return BuildU32(state, ty); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) { |
| out << style::Type("u32"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type atomic' |
| constexpr TypeMatcher kAtomicMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| const Type* T = nullptr; |
| if (!MatchAtomic(state, ty, T)) { |
| return nullptr; |
| } |
| T = state.Type(T); |
| if (T == nullptr) { |
| return nullptr; |
| } |
| return BuildAtomic(state, ty, T); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText T; |
| state->PrintType(T); |
| out << style::Type("atomic", "<", T, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type ptr' |
| constexpr TypeMatcher kPtrMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| Number S = Number::invalid; |
| const Type* T = nullptr; |
| Number A = Number::invalid; |
| if (!MatchPtr(state, ty, S, T, A)) { |
| return nullptr; |
| } |
| S = state.Num(S); |
| if (!S.IsValid()) { |
| return nullptr; |
| } |
| T = state.Type(T); |
| if (T == nullptr) { |
| return nullptr; |
| } |
| A = state.Num(A); |
| if (!A.IsValid()) { |
| return nullptr; |
| } |
| return BuildPtr(state, ty, S, T, A); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText S; |
| state->PrintNum(S);StyledText T; |
| state->PrintType(T);StyledText A; |
| state->PrintNum(A); |
| out << style::Type("ptr", "<", S, ", ", T, ", ", A, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type vec2' |
| constexpr TypeMatcher kVec2Matcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| const Type* T = nullptr; |
| if (!MatchVec2(state, ty, T)) { |
| return nullptr; |
| } |
| T = state.Type(T); |
| if (T == nullptr) { |
| return nullptr; |
| } |
| return BuildVec2(state, ty, T); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText T; |
| state->PrintType(T); |
| out << style::Type("vec2", "<", T, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type vec3' |
| constexpr TypeMatcher kVec3Matcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| const Type* T = nullptr; |
| if (!MatchVec3(state, ty, T)) { |
| return nullptr; |
| } |
| T = state.Type(T); |
| if (T == nullptr) { |
| return nullptr; |
| } |
| return BuildVec3(state, ty, T); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText T; |
| state->PrintType(T); |
| out << style::Type("vec3", "<", T, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type vec4' |
| constexpr TypeMatcher kVec4Matcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| const Type* T = nullptr; |
| if (!MatchVec4(state, ty, T)) { |
| return nullptr; |
| } |
| T = state.Type(T); |
| if (T == nullptr) { |
| return nullptr; |
| } |
| return BuildVec4(state, ty, T); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText T; |
| state->PrintType(T); |
| out << style::Type("vec4", "<", T, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type vec' |
| constexpr TypeMatcher kVecMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| Number N = Number::invalid; |
| const Type* T = nullptr; |
| if (!MatchVec(state, ty, N, T)) { |
| return nullptr; |
| } |
| N = state.Num(N); |
| if (!N.IsValid()) { |
| return nullptr; |
| } |
| T = state.Type(T); |
| if (T == nullptr) { |
| return nullptr; |
| } |
| return BuildVec(state, ty, N, T); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText N; |
| state->PrintNum(N);StyledText T; |
| state->PrintType(T); |
| out << style::Type("vec", N, "<", T, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type texture_1d' |
| constexpr TypeMatcher kTexture1DMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| const Type* T = nullptr; |
| if (!MatchTexture1D(state, ty, T)) { |
| return nullptr; |
| } |
| T = state.Type(T); |
| if (T == nullptr) { |
| return nullptr; |
| } |
| return BuildTexture1D(state, ty, T); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText T; |
| state->PrintType(T); |
| out << style::Type("texture_1d", "<", T, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type texture_2d' |
| constexpr TypeMatcher kTexture2DMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| const Type* T = nullptr; |
| if (!MatchTexture2D(state, ty, T)) { |
| return nullptr; |
| } |
| T = state.Type(T); |
| if (T == nullptr) { |
| return nullptr; |
| } |
| return BuildTexture2D(state, ty, T); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText T; |
| state->PrintType(T); |
| out << style::Type("texture_2d", "<", T, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type texture_2d_array' |
| constexpr TypeMatcher kTexture2DArrayMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| const Type* T = nullptr; |
| if (!MatchTexture2DArray(state, ty, T)) { |
| return nullptr; |
| } |
| T = state.Type(T); |
| if (T == nullptr) { |
| return nullptr; |
| } |
| return BuildTexture2DArray(state, ty, T); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText T; |
| state->PrintType(T); |
| out << style::Type("texture_2d_array", "<", T, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type texture_3d' |
| constexpr TypeMatcher kTexture3DMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| const Type* T = nullptr; |
| if (!MatchTexture3D(state, ty, T)) { |
| return nullptr; |
| } |
| T = state.Type(T); |
| if (T == nullptr) { |
| return nullptr; |
| } |
| return BuildTexture3D(state, ty, T); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText T; |
| state->PrintType(T); |
| out << style::Type("texture_3d", "<", T, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type texture_cube' |
| constexpr TypeMatcher kTextureCubeMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| const Type* T = nullptr; |
| if (!MatchTextureCube(state, ty, T)) { |
| return nullptr; |
| } |
| T = state.Type(T); |
| if (T == nullptr) { |
| return nullptr; |
| } |
| return BuildTextureCube(state, ty, T); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText T; |
| state->PrintType(T); |
| out << style::Type("texture_cube", "<", T, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type texture_cube_array' |
| constexpr TypeMatcher kTextureCubeArrayMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| const Type* T = nullptr; |
| if (!MatchTextureCubeArray(state, ty, T)) { |
| return nullptr; |
| } |
| T = state.Type(T); |
| if (T == nullptr) { |
| return nullptr; |
| } |
| return BuildTextureCubeArray(state, ty, T); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText T; |
| state->PrintType(T); |
| out << style::Type("texture_cube_array", "<", T, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type texture_multisampled_2d' |
| constexpr TypeMatcher kTextureMultisampled2DMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| const Type* T = nullptr; |
| if (!MatchTextureMultisampled2D(state, ty, T)) { |
| return nullptr; |
| } |
| T = state.Type(T); |
| if (T == nullptr) { |
| return nullptr; |
| } |
| return BuildTextureMultisampled2D(state, ty, T); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText T; |
| state->PrintType(T); |
| out << style::Type("texture_multisampled_2d", "<", T, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type texture_depth_2d' |
| constexpr TypeMatcher kTextureDepth2DMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| if (!MatchTextureDepth2D(state, ty)) { |
| return nullptr; |
| } |
| return BuildTextureDepth2D(state, ty); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) { |
| out << style::Type("texture_depth_2d"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type texture_depth_2d_array' |
| constexpr TypeMatcher kTextureDepth2DArrayMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| if (!MatchTextureDepth2DArray(state, ty)) { |
| return nullptr; |
| } |
| return BuildTextureDepth2DArray(state, ty); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) { |
| out << style::Type("texture_depth_2d_array"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type texture_depth_cube' |
| constexpr TypeMatcher kTextureDepthCubeMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| if (!MatchTextureDepthCube(state, ty)) { |
| return nullptr; |
| } |
| return BuildTextureDepthCube(state, ty); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) { |
| out << style::Type("texture_depth_cube"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type texture_depth_cube_array' |
| constexpr TypeMatcher kTextureDepthCubeArrayMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| if (!MatchTextureDepthCubeArray(state, ty)) { |
| return nullptr; |
| } |
| return BuildTextureDepthCubeArray(state, ty); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) { |
| out << style::Type("texture_depth_cube_array"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type texture_depth_multisampled_2d' |
| constexpr TypeMatcher kTextureDepthMultisampled2DMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| if (!MatchTextureDepthMultisampled2D(state, ty)) { |
| return nullptr; |
| } |
| return BuildTextureDepthMultisampled2D(state, ty); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) { |
| out << style::Type("texture_depth_multisampled_2d"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type texture_storage_1d' |
| constexpr TypeMatcher kTextureStorage1DMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| Number F = Number::invalid; |
| Number A = Number::invalid; |
| if (!MatchTextureStorage1D(state, ty, F, A)) { |
| return nullptr; |
| } |
| F = state.Num(F); |
| if (!F.IsValid()) { |
| return nullptr; |
| } |
| A = state.Num(A); |
| if (!A.IsValid()) { |
| return nullptr; |
| } |
| return BuildTextureStorage1D(state, ty, F, A); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText F; |
| state->PrintNum(F);StyledText A; |
| state->PrintNum(A); |
| out << style::Type("texture_storage_1d", "<", F, ", ", A, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type texture_storage_2d' |
| constexpr TypeMatcher kTextureStorage2DMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| Number F = Number::invalid; |
| Number A = Number::invalid; |
| if (!MatchTextureStorage2D(state, ty, F, A)) { |
| return nullptr; |
| } |
| F = state.Num(F); |
| if (!F.IsValid()) { |
| return nullptr; |
| } |
| A = state.Num(A); |
| if (!A.IsValid()) { |
| return nullptr; |
| } |
| return BuildTextureStorage2D(state, ty, F, A); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText F; |
| state->PrintNum(F);StyledText A; |
| state->PrintNum(A); |
| out << style::Type("texture_storage_2d", "<", F, ", ", A, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type texture_storage_2d_array' |
| constexpr TypeMatcher kTextureStorage2DArrayMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| Number F = Number::invalid; |
| Number A = Number::invalid; |
| if (!MatchTextureStorage2DArray(state, ty, F, A)) { |
| return nullptr; |
| } |
| F = state.Num(F); |
| if (!F.IsValid()) { |
| return nullptr; |
| } |
| A = state.Num(A); |
| if (!A.IsValid()) { |
| return nullptr; |
| } |
| return BuildTextureStorage2DArray(state, ty, F, A); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText F; |
| state->PrintNum(F);StyledText A; |
| state->PrintNum(A); |
| out << style::Type("texture_storage_2d_array", "<", F, ", ", A, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'type texture_storage_3d' |
| constexpr TypeMatcher kTextureStorage3DMatcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| Number F = Number::invalid; |
| Number A = Number::invalid; |
| if (!MatchTextureStorage3D(state, ty, F, A)) { |
| return nullptr; |
| } |
| F = state.Num(F); |
| if (!F.IsValid()) { |
| return nullptr; |
| } |
| A = state.Num(A); |
| if (!A.IsValid()) { |
| return nullptr; |
| } |
| return BuildTextureStorage3D(state, ty, F, A); |
| }, |
| /* print */ []([[maybe_unused]] MatchState* state, StyledText& out) {StyledText F; |
| state->PrintNum(F);StyledText A; |
| state->PrintNum(A); |
| out << style::Type("texture_storage_3d", "<", F, ", ", A, ">"); |
| } |
| }; |
| |
| |
| /// TypeMatcher for 'match iu32' |
| constexpr TypeMatcher kIu32Matcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| if (MatchI32(state, ty)) { |
| return BuildI32(state, ty); |
| } |
| if (MatchU32(state, ty)) { |
| return BuildU32(state, ty); |
| } |
| return nullptr; |
| }, |
| /* print */ [](MatchState*, StyledText& out) { |
| // Note: We pass nullptr to the Matcher.print() functions, as matchers do not support |
| // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. |
| kI32Matcher.print(nullptr, out); out << style::Plain(" or "); kU32Matcher.print(nullptr, out);} |
| }; |
| |
| /// TypeMatcher for 'match fiu32' |
| constexpr TypeMatcher kFiu32Matcher { |
| /* match */ [](MatchState& state, const Type* ty) -> const Type* { |
| if (MatchF32(state, ty)) { |
| return BuildF32(state, ty); |
| } |
| if (MatchI32(state, ty)) { |
| return BuildI32(state, ty); |
| } |
| if (MatchU32(state, ty)) { |
| return BuildU32(state, ty); |
| } |
| return nullptr; |
| }, |
| /* print */ [](MatchState*, StyledText& out) { |
| // Note: We pass nullptr to the Matcher.print() functions, as matchers do not support |
| // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. |
| kF32Matcher.print(nullptr, out); out << style::Plain(", "); kI32Matcher.print(nullptr, out); out << style::Plain(" or "); kU32Matcher.print(nullptr, out);} |
| }; |
| |
| /// EnumMatcher for 'match read_write' |
| constexpr NumberMatcher kReadWriteMatcher { |
| /* match */ [](MatchState&, Number number) -> Number { |
| if (number.IsAny() || number.Value() == static_cast<uint32_t>(core::Access::kReadWrite)) { |
| return Number(static_cast<uint32_t>(core::Access::kReadWrite)); |
| } |
| return Number::invalid; |
| }, |
| /* print */ [](MatchState*, StyledText& out) { |
| out<< style::Enum("read_write"); |
| } |
| }; |
| |
| /// EnumMatcher for 'match workgroup_or_storage' |
| constexpr NumberMatcher kWorkgroupOrStorageMatcher { |
| /* match */ [](MatchState&, Number number) -> Number { |
| switch (static_cast<core::AddressSpace>(number.Value())) { |
| case core::AddressSpace::kStorage: |
| case core::AddressSpace::kWorkgroup: |
| return number; |
| default: |
| return Number::invalid; |
| } |
| }, |
| /* print */ [](MatchState*, StyledText& out) { |
| out<< style::Enum("storage")<< style::Plain(" or ") << style::Enum("workgroup"); |
| } |
| }; |
| |
| /// Type and number matchers |
| |
| /// The template types, types, and type matchers |
| constexpr TypeMatcher kTypeMatchers[] = { |
| /* [0] */ TemplateTypeMatcher<0>::matcher, |
| /* [1] */ TemplateTypeMatcher<1>::matcher, |
| /* [2] */ kF16Matcher, |
| /* [3] */ kF32Matcher, |
| /* [4] */ kI32Matcher, |
| /* [5] */ kU32Matcher, |
| /* [6] */ kAtomicMatcher, |
| /* [7] */ kPtrMatcher, |
| /* [8] */ kVec2Matcher, |
| /* [9] */ kVec3Matcher, |
| /* [10] */ kVec4Matcher, |
| /* [11] */ kVecMatcher, |
| /* [12] */ kTexture1DMatcher, |
| /* [13] */ kTexture2DMatcher, |
| /* [14] */ kTexture2DArrayMatcher, |
| /* [15] */ kTexture3DMatcher, |
| /* [16] */ kTextureCubeMatcher, |
| /* [17] */ kTextureCubeArrayMatcher, |
| /* [18] */ kTextureMultisampled2DMatcher, |
| /* [19] */ kTextureDepth2DMatcher, |
| /* [20] */ kTextureDepth2DArrayMatcher, |
| /* [21] */ kTextureDepthCubeMatcher, |
| /* [22] */ kTextureDepthCubeArrayMatcher, |
| /* [23] */ kTextureDepthMultisampled2DMatcher, |
| /* [24] */ kTextureStorage1DMatcher, |
| /* [25] */ kTextureStorage2DMatcher, |
| /* [26] */ kTextureStorage2DArrayMatcher, |
| /* [27] */ kTextureStorage3DMatcher, |
| /* [28] */ kIu32Matcher, |
| /* [29] */ kFiu32Matcher, |
| }; |
| |
| /// The template numbers, and number matchers |
| constexpr NumberMatcher kNumberMatchers[] = { |
| /* [0] */ TemplateNumberMatcher<0>::matcher, |
| /* [1] */ TemplateNumberMatcher<1>::matcher, |
| /* [2] */ kReadWriteMatcher, |
| /* [3] */ kWorkgroupOrStorageMatcher, |
| }; |
| |
| constexpr MatcherIndex kMatcherIndices[] = { |
| /* [0] */ MatcherIndex(7), |
| /* [1] */ MatcherIndex(3), |
| /* [2] */ MatcherIndex(6), |
| /* [3] */ MatcherIndex(0), |
| /* [4] */ MatcherIndex(2), |
| /* [5] */ MatcherIndex(7), |
| /* [6] */ MatcherIndex(1), |
| /* [7] */ MatcherIndex(6), |
| /* [8] */ MatcherIndex(0), |
| /* [9] */ MatcherIndex(2), |
| /* [10] */ MatcherIndex(11), |
| /* [11] */ MatcherIndex(0), |
| /* [12] */ MatcherIndex(4), |
| /* [13] */ MatcherIndex(11), |
| /* [14] */ MatcherIndex(0), |
| /* [15] */ MatcherIndex(3), |
| /* [16] */ MatcherIndex(11), |
| /* [17] */ MatcherIndex(0), |
| /* [18] */ MatcherIndex(5), |
| /* [19] */ MatcherIndex(11), |
| /* [20] */ MatcherIndex(1), |
| /* [21] */ MatcherIndex(4), |
| /* [22] */ MatcherIndex(11), |
| /* [23] */ MatcherIndex(1), |
| /* [24] */ MatcherIndex(0), |
| /* [25] */ MatcherIndex(24), |
| /* [26] */ MatcherIndex(0), |
| /* [27] */ MatcherIndex(1), |
| /* [28] */ MatcherIndex(25), |
| /* [29] */ MatcherIndex(0), |
| /* [30] */ MatcherIndex(1), |
| /* [31] */ MatcherIndex(26), |
| /* [32] */ MatcherIndex(0), |
| /* [33] */ MatcherIndex(1), |
| /* [34] */ MatcherIndex(27), |
| /* [35] */ MatcherIndex(0), |
| /* [36] */ MatcherIndex(1), |
| /* [37] */ MatcherIndex(8), |
| /* [38] */ MatcherIndex(2), |
| /* [39] */ MatcherIndex(12), |
| /* [40] */ MatcherIndex(0), |
| /* [41] */ MatcherIndex(8), |
| /* [42] */ MatcherIndex(4), |
| /* [43] */ MatcherIndex(13), |
| /* [44] */ MatcherIndex(0), |
| /* [45] */ MatcherIndex(9), |
| /* [46] */ MatcherIndex(4), |
| /* [47] */ MatcherIndex(14), |
| /* [48] */ MatcherIndex(0), |
| /* [49] */ MatcherIndex(15), |
| /* [50] */ MatcherIndex(0), |
| /* [51] */ MatcherIndex(16), |
| /* [52] */ MatcherIndex(0), |
| /* [53] */ MatcherIndex(17), |
| /* [54] */ MatcherIndex(0), |
| /* [55] */ MatcherIndex(18), |
| /* [56] */ MatcherIndex(0), |
| /* [57] */ MatcherIndex(28), |
| /* [58] */ MatcherIndex(29), |
| /* [59] */ MatcherIndex(19), |
| /* [60] */ MatcherIndex(20), |
| /* [61] */ MatcherIndex(21), |
| /* [62] */ MatcherIndex(22), |
| /* [63] */ MatcherIndex(23), |
| }; |
| |
| static_assert(MatcherIndicesIndex::CanIndex(kMatcherIndices), |
| "MatcherIndicesIndex is not large enough to index kMatcherIndices"); |
| |
| constexpr ParameterInfo kParameters[] = { |
| { |
| /* [0] */ |
| /* usage */ core::ParameterUsage::kBase, |
| /* matcher_indices */ MatcherIndicesIndex(22), |
| }, |
| { |
| /* [1] */ |
| /* usage */ core::ParameterUsage::kInsert, |
| /* matcher_indices */ MatcherIndicesIndex(22), |
| }, |
| { |
| /* [2] */ |
| /* usage */ core::ParameterUsage::kOffset, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [3] */ |
| /* usage */ core::ParameterUsage::kBits, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [4] */ |
| /* usage */ core::ParameterUsage::kBase, |
| /* matcher_indices */ MatcherIndicesIndex(3), |
| }, |
| { |
| /* [5] */ |
| /* usage */ core::ParameterUsage::kInsert, |
| /* matcher_indices */ MatcherIndicesIndex(3), |
| }, |
| { |
| /* [6] */ |
| /* usage */ core::ParameterUsage::kOffset, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [7] */ |
| /* usage */ core::ParameterUsage::kBits, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [8] */ |
| /* usage */ core::ParameterUsage::kNone, |
| /* matcher_indices */ MatcherIndicesIndex(0), |
| }, |
| { |
| /* [9] */ |
| /* usage */ core::ParameterUsage::kCompareValue, |
| /* matcher_indices */ MatcherIndicesIndex(3), |
| }, |
| { |
| /* [10] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(3), |
| }, |
| { |
| /* [11] */ |
| /* usage */ core::ParameterUsage::kOffset, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [12] */ |
| /* usage */ core::ParameterUsage::kBits, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [13] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(22), |
| }, |
| { |
| /* [14] */ |
| /* usage */ core::ParameterUsage::kOffset, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [15] */ |
| /* usage */ core::ParameterUsage::kBits, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [16] */ |
| /* usage */ core::ParameterUsage::kNone, |
| /* matcher_indices */ MatcherIndicesIndex(5), |
| }, |
| { |
| /* [17] */ |
| /* usage */ core::ParameterUsage::kNone, |
| /* matcher_indices */ MatcherIndicesIndex(3), |
| }, |
| { |
| /* [18] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(39), |
| }, |
| { |
| /* [19] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [20] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(43), |
| }, |
| { |
| /* [21] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [22] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(47), |
| }, |
| { |
| /* [23] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [24] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(49), |
| }, |
| { |
| /* [25] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [26] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(51), |
| }, |
| { |
| /* [27] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [28] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(53), |
| }, |
| { |
| /* [29] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [30] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(59), |
| }, |
| { |
| /* [31] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [32] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(60), |
| }, |
| { |
| /* [33] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [34] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(61), |
| }, |
| { |
| /* [35] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [36] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(62), |
| }, |
| { |
| /* [37] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [38] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(1), |
| }, |
| { |
| /* [39] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(13), |
| }, |
| { |
| /* [40] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [41] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(10), |
| }, |
| { |
| /* [42] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(18), |
| }, |
| { |
| /* [43] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(16), |
| }, |
| { |
| /* [44] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(37), |
| }, |
| { |
| /* [45] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(55), |
| }, |
| { |
| /* [46] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(63), |
| }, |
| { |
| /* [47] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(25), |
| }, |
| { |
| /* [48] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(28), |
| }, |
| { |
| /* [49] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(31), |
| }, |
| { |
| /* [50] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(34), |
| }, |
| }; |
| |
| static_assert(ParameterIndex::CanIndex(kParameters), |
| "ParameterIndex is not large enough to index kParameters"); |
| |
| constexpr TemplateInfo kTemplates[] = { |
| { |
| /* [0] */ |
| /* name */ "T", |
| /* matcher_indices */ MatcherIndicesIndex(57), |
| /* kind */ TemplateInfo::Kind::kType, |
| }, |
| { |
| /* [1] */ |
| /* name */ "S", |
| /* matcher_indices */ MatcherIndicesIndex(1), |
| /* kind */ TemplateInfo::Kind::kNumber, |
| }, |
| { |
| /* [2] */ |
| /* name */ "T", |
| /* matcher_indices */ MatcherIndicesIndex(57), |
| /* kind */ TemplateInfo::Kind::kType, |
| }, |
| { |
| /* [3] */ |
| /* name */ "N", |
| /* matcher_indices */ MatcherIndicesIndex(/* invalid */), |
| /* kind */ TemplateInfo::Kind::kNumber, |
| }, |
| { |
| /* [4] */ |
| /* name */ "F", |
| /* matcher_indices */ MatcherIndicesIndex(/* invalid */), |
| /* kind */ TemplateInfo::Kind::kNumber, |
| }, |
| { |
| /* [5] */ |
| /* name */ "A", |
| /* matcher_indices */ MatcherIndicesIndex(/* invalid */), |
| /* kind */ TemplateInfo::Kind::kNumber, |
| }, |
| { |
| /* [6] */ |
| /* name */ "T", |
| /* matcher_indices */ MatcherIndicesIndex(58), |
| /* kind */ TemplateInfo::Kind::kType, |
| }, |
| }; |
| |
| static_assert(TemplateIndex::CanIndex(kTemplates), |
| "TemplateIndex is not large enough to index kTemplates"); |
| |
| constexpr OverloadInfo kOverloads[] = { |
| { |
| /* [0] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse), |
| /* num_parameters */ 2, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(6), |
| /* parameters */ ParameterIndex(18), |
| /* return_matcher_indices */ MatcherIndicesIndex(12), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [1] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse), |
| /* num_parameters */ 2, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(6), |
| /* parameters */ ParameterIndex(20), |
| /* return_matcher_indices */ MatcherIndicesIndex(41), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [2] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse), |
| /* num_parameters */ 2, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(6), |
| /* parameters */ ParameterIndex(22), |
| /* return_matcher_indices */ MatcherIndicesIndex(45), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [3] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse), |
| /* num_parameters */ 2, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(6), |
| /* parameters */ ParameterIndex(24), |
| /* return_matcher_indices */ MatcherIndicesIndex(45), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [4] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse), |
| /* num_parameters */ 2, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(6), |
| /* parameters */ ParameterIndex(26), |
| /* return_matcher_indices */ MatcherIndicesIndex(41), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [5] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse), |
| /* num_parameters */ 2, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(6), |
| /* parameters */ ParameterIndex(28), |
| /* return_matcher_indices */ MatcherIndicesIndex(45), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [6] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse), |
| /* num_parameters */ 2, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 0, |
| /* templates */ TemplateIndex(/* invalid */), |
| /* parameters */ ParameterIndex(30), |
| /* return_matcher_indices */ MatcherIndicesIndex(41), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [7] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse), |
| /* num_parameters */ 2, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 0, |
| /* templates */ TemplateIndex(/* invalid */), |
| /* parameters */ ParameterIndex(32), |
| /* return_matcher_indices */ MatcherIndicesIndex(45), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [8] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse), |
| /* num_parameters */ 2, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 0, |
| /* templates */ TemplateIndex(/* invalid */), |
| /* parameters */ ParameterIndex(34), |
| /* return_matcher_indices */ MatcherIndicesIndex(41), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [9] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse), |
| /* num_parameters */ 2, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 0, |
| /* templates */ TemplateIndex(/* invalid */), |
| /* parameters */ ParameterIndex(36), |
| /* return_matcher_indices */ MatcherIndicesIndex(45), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [10] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(6), |
| /* parameters */ ParameterIndex(45), |
| /* return_matcher_indices */ MatcherIndicesIndex(41), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [11] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 0, |
| /* templates */ TemplateIndex(/* invalid */), |
| /* parameters */ ParameterIndex(46), |
| /* return_matcher_indices */ MatcherIndicesIndex(41), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [12] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 2, |
| /* templates */ TemplateIndex(4), |
| /* parameters */ ParameterIndex(47), |
| /* return_matcher_indices */ MatcherIndicesIndex(12), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [13] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 2, |
| /* templates */ TemplateIndex(4), |
| /* parameters */ ParameterIndex(48), |
| /* return_matcher_indices */ MatcherIndicesIndex(41), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [14] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 2, |
| /* templates */ TemplateIndex(4), |
| /* parameters */ ParameterIndex(49), |
| /* return_matcher_indices */ MatcherIndicesIndex(45), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [15] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 2, |
| /* templates */ TemplateIndex(4), |
| /* parameters */ ParameterIndex(50), |
| /* return_matcher_indices */ MatcherIndicesIndex(45), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [16] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 3, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(0), |
| /* parameters */ ParameterIndex(10), |
| /* return_matcher_indices */ MatcherIndicesIndex(3), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [17] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 3, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 2, |
| /* templates */ TemplateIndex(2), |
| /* parameters */ ParameterIndex(13), |
| /* return_matcher_indices */ MatcherIndicesIndex(22), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [18] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 4, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 2, |
| /* templates */ TemplateIndex(2), |
| /* parameters */ ParameterIndex(0), |
| /* return_matcher_indices */ MatcherIndicesIndex(22), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [19] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 0, |
| /* templates */ TemplateIndex(/* invalid */), |
| /* parameters */ ParameterIndex(38), |
| /* return_matcher_indices */ MatcherIndicesIndex(12), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [20] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(3), |
| /* parameters */ ParameterIndex(39), |
| /* return_matcher_indices */ MatcherIndicesIndex(10), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [21] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 0, |
| /* templates */ TemplateIndex(/* invalid */), |
| /* parameters */ ParameterIndex(38), |
| /* return_matcher_indices */ MatcherIndicesIndex(18), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [22] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(3), |
| /* parameters */ ParameterIndex(39), |
| /* return_matcher_indices */ MatcherIndicesIndex(16), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [23] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 0, |
| /* templates */ TemplateIndex(/* invalid */), |
| /* parameters */ ParameterIndex(40), |
| /* return_matcher_indices */ MatcherIndicesIndex(1), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [24] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(3), |
| /* parameters */ ParameterIndex(41), |
| /* return_matcher_indices */ MatcherIndicesIndex(13), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [25] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 0, |
| /* templates */ TemplateIndex(/* invalid */), |
| /* parameters */ ParameterIndex(42), |
| /* return_matcher_indices */ MatcherIndicesIndex(1), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [26] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(3), |
| /* parameters */ ParameterIndex(43), |
| /* return_matcher_indices */ MatcherIndicesIndex(13), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [27] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(0), |
| /* parameters */ ParameterIndex(10), |
| /* return_matcher_indices */ MatcherIndicesIndex(12), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [28] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 2, |
| /* templates */ TemplateIndex(2), |
| /* parameters */ ParameterIndex(13), |
| /* return_matcher_indices */ MatcherIndicesIndex(19), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [29] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 0, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 0, |
| /* templates */ TemplateIndex(/* invalid */), |
| /* parameters */ ParameterIndex(/* invalid */), |
| /* return_matcher_indices */ MatcherIndicesIndex(/* invalid */), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [30] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 3, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(0), |
| /* parameters */ ParameterIndex(8), |
| /* return_matcher_indices */ MatcherIndicesIndex(3), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [31] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 2, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 2, |
| /* templates */ TemplateIndex(0), |
| /* parameters */ ParameterIndex(16), |
| /* return_matcher_indices */ MatcherIndicesIndex(3), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [32] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 4, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(0), |
| /* parameters */ ParameterIndex(4), |
| /* return_matcher_indices */ MatcherIndicesIndex(3), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [33] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 0, |
| /* templates */ TemplateIndex(/* invalid */), |
| /* parameters */ ParameterIndex(44), |
| /* return_matcher_indices */ MatcherIndicesIndex(18), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [34] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 0, |
| /* templates */ TemplateIndex(/* invalid */), |
| /* parameters */ ParameterIndex(42), |
| /* return_matcher_indices */ MatcherIndicesIndex(37), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| }; |
| |
| static_assert(OverloadIndex::CanIndex(kOverloads), |
| "OverloadIndex is not large enough to index kOverloads"); |
| |
| constexpr IntrinsicInfo kBuiltins[] = { |
| { |
| /* [0] */ |
| /* fn barrier() */ |
| /* num overloads */ 1, |
| /* overloads */ OverloadIndex(29), |
| }, |
| { |
| /* [1] */ |
| /* fn memoryBarrierBuffer() */ |
| /* num overloads */ 1, |
| /* overloads */ OverloadIndex(29), |
| }, |
| { |
| /* [2] */ |
| /* fn memoryBarrierImage() */ |
| /* num overloads */ 1, |
| /* overloads */ OverloadIndex(29), |
| }, |
| { |
| /* [3] */ |
| /* fn atomicCompSwap[T : iu32](ptr<workgroup_or_storage, atomic<T>, read_write>, compare_value: T, value: T) -> T */ |
| /* num overloads */ 1, |
| /* overloads */ OverloadIndex(30), |
| }, |
| { |
| /* [4] */ |
| /* fn atomicSub[T : iu32, S : workgroup_or_storage](ptr<S, atomic<T>, read_write>, T) -> T */ |
| /* num overloads */ 1, |
| /* overloads */ OverloadIndex(31), |
| }, |
| { |
| /* [5] */ |
| /* fn floatBitsToInt(value: f32) -> i32 */ |
| /* fn floatBitsToInt[N : num](value: vec<N, f32>) -> vec<N, i32> */ |
| /* num overloads */ 2, |
| /* overloads */ OverloadIndex(19), |
| }, |
| { |
| /* [6] */ |
| /* fn floatBitsToUint(value: f32) -> u32 */ |
| /* fn floatBitsToUint[N : num](value: vec<N, f32>) -> vec<N, u32> */ |
| /* num overloads */ 2, |
| /* overloads */ OverloadIndex(21), |
| }, |
| { |
| /* [7] */ |
| /* fn intBitsToFloat(value: i32) -> f32 */ |
| /* fn intBitsToFloat[N : num](value: vec<N, i32>) -> vec<N, f32> */ |
| /* num overloads */ 2, |
| /* overloads */ OverloadIndex(23), |
| }, |
| { |
| /* [8] */ |
| /* fn uintBitsToFloat(value: u32) -> f32 */ |
| /* fn uintBitsToFloat[N : num](value: vec<N, u32>) -> vec<N, f32> */ |
| /* num overloads */ 2, |
| /* overloads */ OverloadIndex(25), |
| }, |
| { |
| /* [9] */ |
| /* fn bitCount[T : iu32](value: T) -> i32 */ |
| /* fn bitCount[T : iu32, N : num](value: vec<N, T>) -> vec<N, i32> */ |
| /* num overloads */ 2, |
| /* overloads */ OverloadIndex(27), |
| }, |
| { |
| /* [10] */ |
| /* fn bitfieldExtract[T : iu32](value: T, offset: i32, bits: i32) -> T */ |
| /* fn bitfieldExtract[T : iu32, N : num](value: vec<N, T>, offset: i32, bits: i32) -> vec<N, T> */ |
| /* fn bitfieldExtract[T : iu32, N : num](base: vec<N, T>, insert: vec<N, T>, offset: i32, bits: i32) -> vec<N, T> */ |
| /* num overloads */ 3, |
| /* overloads */ OverloadIndex(16), |
| }, |
| { |
| /* [11] */ |
| /* fn bitfieldInsert[T : iu32](base: T, insert: T, offset: i32, bits: i32) -> T */ |
| /* num overloads */ 1, |
| /* overloads */ OverloadIndex(32), |
| }, |
| { |
| /* [12] */ |
| /* fn packFloat2x16(value: vec2<f16>) -> u32 */ |
| /* num overloads */ 1, |
| /* overloads */ OverloadIndex(33), |
| }, |
| { |
| /* [13] */ |
| /* fn unpackFloat2x16(value: u32) -> vec2<f16> */ |
| /* num overloads */ 1, |
| /* overloads */ OverloadIndex(34), |
| }, |
| { |
| /* [14] */ |
| /* fn textureSize[T : fiu32](texture: texture_1d<T>, level: i32) -> i32 */ |
| /* fn textureSize[T : fiu32](texture: texture_2d<T>, level: i32) -> vec2<i32> */ |
| /* fn textureSize[T : fiu32](texture: texture_2d_array<T>, level: i32) -> vec3<i32> */ |
| /* fn textureSize[T : fiu32](texture: texture_3d<T>, level: i32) -> vec3<i32> */ |
| /* fn textureSize[T : fiu32](texture: texture_cube<T>, level: i32) -> vec2<i32> */ |
| /* fn textureSize[T : fiu32](texture: texture_cube_array<T>, level: i32) -> vec3<i32> */ |
| /* fn textureSize(texture: texture_depth_2d, level: i32) -> vec2<i32> */ |
| /* fn textureSize(texture: texture_depth_2d_array, level: i32) -> vec3<i32> */ |
| /* fn textureSize(texture: texture_depth_cube, level: i32) -> vec2<i32> */ |
| /* fn textureSize(texture: texture_depth_cube_array, level: i32) -> vec3<i32> */ |
| /* fn textureSize[T : fiu32](texture: texture_multisampled_2d<T>) -> vec2<i32> */ |
| /* fn textureSize(texture: texture_depth_multisampled_2d) -> vec2<i32> */ |
| /* num overloads */ 12, |
| /* overloads */ OverloadIndex(0), |
| }, |
| { |
| /* [15] */ |
| /* fn imageSize[F : texel_format, A : access](texture: texture_storage_1d<F, A>) -> i32 */ |
| /* fn imageSize[F : texel_format, A : access](texture: texture_storage_2d<F, A>) -> vec2<i32> */ |
| /* fn imageSize[F : texel_format, A : access](texture: texture_storage_2d_array<F, A>) -> vec3<i32> */ |
| /* fn imageSize[F : texel_format, A : access](texture: texture_storage_3d<F, A>) -> vec3<i32> */ |
| /* num overloads */ 4, |
| /* overloads */ OverloadIndex(12), |
| }, |
| }; |
| |
| // clang-format on |
| |
| } // anonymous namespace |
| |
| const core::intrinsic::TableData Dialect::kData{ |
| /* templates */ kTemplates, |
| /* type_matcher_indices */ kMatcherIndices, |
| /* type_matchers */ kTypeMatchers, |
| /* number_matchers */ kNumberMatchers, |
| /* parameters */ kParameters, |
| /* overloads */ kOverloads, |
| /* const_eval_functions */ Empty, |
| /* ctor_conv */ Empty, |
| /* builtins */ kBuiltins, |
| /* binary '+' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '-' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '*' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '/' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '%' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '^' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '&' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '|' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '&&' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '||' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '==' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '!=' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '<' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '>' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '<=' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '>=' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '<<' */ tint::core::intrinsic::kNoOverloads, |
| /* binary '>>' */ tint::core::intrinsic::kNoOverloads, |
| /* unary '!' */ tint::core::intrinsic::kNoOverloads, |
| /* unary '~' */ tint::core::intrinsic::kNoOverloads, |
| /* unary '-' */ tint::core::intrinsic::kNoOverloads, |
| /* unary '*' */ tint::core::intrinsic::kNoOverloads, |
| /* unary '&' */ tint::core::intrinsic::kNoOverloads, |
| }; |
| |
| } // namespace tint::glsl::intrinsic |