| // 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(24), |
| /* [20] */ MatcherIndex(0), |
| /* [21] */ MatcherIndex(1), |
| /* [22] */ MatcherIndex(25), |
| /* [23] */ MatcherIndex(0), |
| /* [24] */ MatcherIndex(1), |
| /* [25] */ MatcherIndex(26), |
| /* [26] */ MatcherIndex(0), |
| /* [27] */ MatcherIndex(1), |
| /* [28] */ MatcherIndex(27), |
| /* [29] */ MatcherIndex(0), |
| /* [30] */ MatcherIndex(1), |
| /* [31] */ MatcherIndex(8), |
| /* [32] */ MatcherIndex(2), |
| /* [33] */ MatcherIndex(12), |
| /* [34] */ MatcherIndex(0), |
| /* [35] */ MatcherIndex(8), |
| /* [36] */ MatcherIndex(4), |
| /* [37] */ MatcherIndex(13), |
| /* [38] */ MatcherIndex(0), |
| /* [39] */ MatcherIndex(9), |
| /* [40] */ MatcherIndex(4), |
| /* [41] */ MatcherIndex(14), |
| /* [42] */ MatcherIndex(0), |
| /* [43] */ MatcherIndex(15), |
| /* [44] */ MatcherIndex(0), |
| /* [45] */ MatcherIndex(16), |
| /* [46] */ MatcherIndex(0), |
| /* [47] */ MatcherIndex(17), |
| /* [48] */ MatcherIndex(0), |
| /* [49] */ MatcherIndex(18), |
| /* [50] */ MatcherIndex(0), |
| /* [51] */ MatcherIndex(28), |
| /* [52] */ MatcherIndex(29), |
| /* [53] */ MatcherIndex(19), |
| /* [54] */ MatcherIndex(20), |
| /* [55] */ MatcherIndex(21), |
| /* [56] */ MatcherIndex(22), |
| /* [57] */ MatcherIndex(23), |
| }; |
| |
| static_assert(MatcherIndicesIndex::CanIndex(kMatcherIndices), |
| "MatcherIndicesIndex is not large enough to index kMatcherIndices"); |
| |
| constexpr ParameterInfo kParameters[] = { |
| { |
| /* [0] */ |
| /* usage */ core::ParameterUsage::kNone, |
| /* matcher_indices */ MatcherIndicesIndex(0), |
| }, |
| { |
| /* [1] */ |
| /* usage */ core::ParameterUsage::kCompareValue, |
| /* matcher_indices */ MatcherIndicesIndex(3), |
| }, |
| { |
| /* [2] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(3), |
| }, |
| { |
| /* [3] */ |
| /* usage */ core::ParameterUsage::kNone, |
| /* matcher_indices */ MatcherIndicesIndex(5), |
| }, |
| { |
| /* [4] */ |
| /* usage */ core::ParameterUsage::kNone, |
| /* matcher_indices */ MatcherIndicesIndex(3), |
| }, |
| { |
| /* [5] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(33), |
| }, |
| { |
| /* [6] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [7] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(37), |
| }, |
| { |
| /* [8] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [9] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(41), |
| }, |
| { |
| /* [10] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [11] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(43), |
| }, |
| { |
| /* [12] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [13] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(45), |
| }, |
| { |
| /* [14] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [15] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(47), |
| }, |
| { |
| /* [16] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [17] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(53), |
| }, |
| { |
| /* [18] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [19] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(54), |
| }, |
| { |
| /* [20] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [21] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(55), |
| }, |
| { |
| /* [22] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [23] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(56), |
| }, |
| { |
| /* [24] */ |
| /* usage */ core::ParameterUsage::kLevel, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [25] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(1), |
| }, |
| { |
| /* [26] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(13), |
| }, |
| { |
| /* [27] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(12), |
| }, |
| { |
| /* [28] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(10), |
| }, |
| { |
| /* [29] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(18), |
| }, |
| { |
| /* [30] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(16), |
| }, |
| { |
| /* [31] */ |
| /* usage */ core::ParameterUsage::kValue, |
| /* matcher_indices */ MatcherIndicesIndex(31), |
| }, |
| { |
| /* [32] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(49), |
| }, |
| { |
| /* [33] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(57), |
| }, |
| { |
| /* [34] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(19), |
| }, |
| { |
| /* [35] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(22), |
| }, |
| { |
| /* [36] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(25), |
| }, |
| { |
| /* [37] */ |
| /* usage */ core::ParameterUsage::kTexture, |
| /* matcher_indices */ MatcherIndicesIndex(28), |
| }, |
| }; |
| |
| static_assert(ParameterIndex::CanIndex(kParameters), |
| "ParameterIndex is not large enough to index kParameters"); |
| |
| constexpr TemplateInfo kTemplates[] = { |
| { |
| /* [0] */ |
| /* name */ "T", |
| /* matcher_indices */ MatcherIndicesIndex(51), |
| /* kind */ TemplateInfo::Kind::kType, |
| }, |
| { |
| /* [1] */ |
| /* name */ "S", |
| /* matcher_indices */ MatcherIndicesIndex(1), |
| /* kind */ TemplateInfo::Kind::kNumber, |
| }, |
| { |
| /* [2] */ |
| /* name */ "F", |
| /* matcher_indices */ MatcherIndicesIndex(/* invalid */), |
| /* kind */ TemplateInfo::Kind::kNumber, |
| }, |
| { |
| /* [3] */ |
| /* name */ "A", |
| /* matcher_indices */ MatcherIndicesIndex(/* invalid */), |
| /* kind */ TemplateInfo::Kind::kNumber, |
| }, |
| { |
| /* [4] */ |
| /* name */ "N", |
| /* matcher_indices */ MatcherIndicesIndex(/* invalid */), |
| /* kind */ TemplateInfo::Kind::kNumber, |
| }, |
| { |
| /* [5] */ |
| /* name */ "T", |
| /* matcher_indices */ MatcherIndicesIndex(52), |
| /* 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(5), |
| /* parameters */ ParameterIndex(5), |
| /* 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(5), |
| /* parameters */ ParameterIndex(7), |
| /* return_matcher_indices */ MatcherIndicesIndex(35), |
| /* 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(5), |
| /* parameters */ ParameterIndex(9), |
| /* return_matcher_indices */ MatcherIndicesIndex(39), |
| /* 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(5), |
| /* parameters */ ParameterIndex(11), |
| /* return_matcher_indices */ MatcherIndicesIndex(39), |
| /* 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(5), |
| /* parameters */ ParameterIndex(13), |
| /* return_matcher_indices */ MatcherIndicesIndex(35), |
| /* 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(5), |
| /* parameters */ ParameterIndex(15), |
| /* return_matcher_indices */ MatcherIndicesIndex(39), |
| /* 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(17), |
| /* return_matcher_indices */ MatcherIndicesIndex(35), |
| /* 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(19), |
| /* return_matcher_indices */ MatcherIndicesIndex(39), |
| /* 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(21), |
| /* return_matcher_indices */ MatcherIndicesIndex(35), |
| /* 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(23), |
| /* return_matcher_indices */ MatcherIndicesIndex(39), |
| /* 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(5), |
| /* parameters */ ParameterIndex(32), |
| /* return_matcher_indices */ MatcherIndicesIndex(35), |
| /* 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(33), |
| /* return_matcher_indices */ MatcherIndicesIndex(35), |
| /* 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(2), |
| /* parameters */ ParameterIndex(34), |
| /* 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(2), |
| /* parameters */ ParameterIndex(35), |
| /* return_matcher_indices */ MatcherIndicesIndex(35), |
| /* 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(2), |
| /* parameters */ ParameterIndex(36), |
| /* return_matcher_indices */ MatcherIndicesIndex(39), |
| /* 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(2), |
| /* parameters */ ParameterIndex(37), |
| /* return_matcher_indices */ MatcherIndicesIndex(39), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [16] */ |
| /* 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(25), |
| /* return_matcher_indices */ MatcherIndicesIndex(12), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [17] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 1, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(4), |
| /* parameters */ ParameterIndex(26), |
| /* return_matcher_indices */ MatcherIndicesIndex(10), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [18] */ |
| /* 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(25), |
| /* return_matcher_indices */ MatcherIndicesIndex(18), |
| /* 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 */ 1, |
| /* templates */ TemplateIndex(4), |
| /* parameters */ ParameterIndex(26), |
| /* return_matcher_indices */ MatcherIndicesIndex(16), |
| /* 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 */ 0, |
| /* templates */ TemplateIndex(/* invalid */), |
| /* parameters */ ParameterIndex(27), |
| /* return_matcher_indices */ MatcherIndicesIndex(1), |
| /* 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 */ 1, |
| /* templates */ TemplateIndex(4), |
| /* parameters */ ParameterIndex(28), |
| /* return_matcher_indices */ MatcherIndicesIndex(13), |
| /* 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 */ 0, |
| /* templates */ TemplateIndex(/* invalid */), |
| /* parameters */ ParameterIndex(29), |
| /* return_matcher_indices */ MatcherIndicesIndex(1), |
| /* 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 */ 1, |
| /* templates */ TemplateIndex(4), |
| /* parameters */ ParameterIndex(30), |
| /* return_matcher_indices */ MatcherIndicesIndex(13), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [24] */ |
| /* 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 */), |
| }, |
| { |
| /* [25] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 3, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 1, |
| /* templates */ TemplateIndex(0), |
| /* parameters */ ParameterIndex(0), |
| /* return_matcher_indices */ MatcherIndicesIndex(3), |
| /* const_eval_fn */ ConstEvalFunctionIndex(/* invalid */), |
| }, |
| { |
| /* [26] */ |
| /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), |
| /* num_parameters */ 2, |
| /* num_explicit_templates */ 0, |
| /* num_templates */ 2, |
| /* templates */ TemplateIndex(0), |
| /* parameters */ ParameterIndex(3), |
| /* return_matcher_indices */ MatcherIndicesIndex(3), |
| /* 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 */ 0, |
| /* templates */ TemplateIndex(/* invalid */), |
| /* parameters */ ParameterIndex(31), |
| /* return_matcher_indices */ MatcherIndicesIndex(18), |
| /* 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 */ 0, |
| /* templates */ TemplateIndex(/* invalid */), |
| /* parameters */ ParameterIndex(29), |
| /* return_matcher_indices */ MatcherIndicesIndex(31), |
| /* 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(24), |
| }, |
| { |
| /* [1] */ |
| /* fn memoryBarrierBuffer() */ |
| /* num overloads */ 1, |
| /* overloads */ OverloadIndex(24), |
| }, |
| { |
| /* [2] */ |
| /* fn memoryBarrierImage() */ |
| /* num overloads */ 1, |
| /* overloads */ OverloadIndex(24), |
| }, |
| { |
| /* [3] */ |
| /* fn atomicCompSwap[T : iu32](ptr<workgroup_or_storage, atomic<T>, read_write>, compare_value: T, value: T) -> T */ |
| /* num overloads */ 1, |
| /* overloads */ OverloadIndex(25), |
| }, |
| { |
| /* [4] */ |
| /* fn atomicSub[T : iu32, S : workgroup_or_storage](ptr<S, atomic<T>, read_write>, T) -> T */ |
| /* num overloads */ 1, |
| /* overloads */ OverloadIndex(26), |
| }, |
| { |
| /* [5] */ |
| /* fn floatBitsToInt(value: f32) -> i32 */ |
| /* fn floatBitsToInt[N : num](value: vec<N, f32>) -> vec<N, i32> */ |
| /* num overloads */ 2, |
| /* overloads */ OverloadIndex(16), |
| }, |
| { |
| /* [6] */ |
| /* fn floatBitsToUint(value: f32) -> u32 */ |
| /* fn floatBitsToUint[N : num](value: vec<N, f32>) -> vec<N, u32> */ |
| /* num overloads */ 2, |
| /* overloads */ OverloadIndex(18), |
| }, |
| { |
| /* [7] */ |
| /* fn intBitsToFloat(value: i32) -> f32 */ |
| /* fn intBitsToFloat[N : num](value: vec<N, i32>) -> vec<N, f32> */ |
| /* num overloads */ 2, |
| /* overloads */ OverloadIndex(20), |
| }, |
| { |
| /* [8] */ |
| /* fn uintBitsToFloat(value: u32) -> f32 */ |
| /* fn uintBitsToFloat[N : num](value: vec<N, u32>) -> vec<N, f32> */ |
| /* num overloads */ 2, |
| /* overloads */ OverloadIndex(22), |
| }, |
| { |
| /* [9] */ |
| /* fn packFloat2x16(value: vec2<f16>) -> u32 */ |
| /* num overloads */ 1, |
| /* overloads */ OverloadIndex(27), |
| }, |
| { |
| /* [10] */ |
| /* fn unpackFloat2x16(value: u32) -> vec2<f16> */ |
| /* num overloads */ 1, |
| /* overloads */ OverloadIndex(28), |
| }, |
| { |
| /* [11] */ |
| /* 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), |
| }, |
| { |
| /* [12] */ |
| /* 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 |