Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 1 | // Copyright 2022 The Dawn & Tint Authors |
Ben Clayton | 7f2b8cd | 2022-05-18 22:41:48 +0000 | [diff] [blame] | 2 | // |
Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 3 | // Redistribution and use in source and binary forms, with or without |
| 4 | // modification, are permitted provided that the following conditions are met: |
Ben Clayton | 7f2b8cd | 2022-05-18 22:41:48 +0000 | [diff] [blame] | 5 | // |
Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 6 | // 1. Redistributions of source code must retain the above copyright notice, this |
| 7 | // list of conditions and the following disclaimer. |
Ben Clayton | 7f2b8cd | 2022-05-18 22:41:48 +0000 | [diff] [blame] | 8 | // |
Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 9 | // 2. Redistributions in binary form must reproduce the above copyright notice, |
| 10 | // this list of conditions and the following disclaimer in the documentation |
| 11 | // and/or other materials provided with the distribution. |
| 12 | // |
| 13 | // 3. Neither the name of the copyright holder nor the names of its |
| 14 | // contributors may be used to endorse or promote products derived from |
| 15 | // this software without specific prior written permission. |
| 16 | // |
| 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 20 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 21 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 22 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 23 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 24 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 25 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Ben Clayton | 7f2b8cd | 2022-05-18 22:41:48 +0000 | [diff] [blame] | 27 | |
Ben Clayton | f50d56a | 2022-07-27 18:32:19 +0000 | [diff] [blame] | 28 | //////////////////////////////////////////////////////////////////////////////// |
Ben Clayton | 57ded6a | 2023-08-22 13:22:22 +0000 | [diff] [blame] | 29 | // File generated by 'tools/src/cmd/gen' using the template: |
Ben Clayton | 1165389 | 2023-09-19 19:15:59 +0000 | [diff] [blame] | 30 | // src/tint/lang/wgsl/extension.h.tmpl |
Ben Clayton | f50d56a | 2022-07-27 18:32:19 +0000 | [diff] [blame] | 31 | // |
Ben Clayton | 57ded6a | 2023-08-22 13:22:22 +0000 | [diff] [blame] | 32 | // To regenerate run: './tools/run gen' |
| 33 | // |
| 34 | // Do not modify this file directly |
Ben Clayton | f50d56a | 2022-07-27 18:32:19 +0000 | [diff] [blame] | 35 | //////////////////////////////////////////////////////////////////////////////// |
| 36 | |
Ben Clayton | 1165389 | 2023-09-19 19:15:59 +0000 | [diff] [blame] | 37 | #ifndef SRC_TINT_LANG_WGSL_EXTENSION_H_ |
| 38 | #define SRC_TINT_LANG_WGSL_EXTENSION_H_ |
Ben Clayton | 7f2b8cd | 2022-05-18 22:41:48 +0000 | [diff] [blame] | 39 | |
dan sinclair | 22b4dd2 | 2023-07-21 00:40:07 +0000 | [diff] [blame] | 40 | #include "src/tint/utils/containers/unique_vector.h" |
Ben Clayton | 6891960 | 2023-07-28 22:51:18 +0000 | [diff] [blame] | 41 | #include "src/tint/utils/traits/traits.h" |
Ben Clayton | 7f2b8cd | 2022-05-18 22:41:48 +0000 | [diff] [blame] | 42 | |
Ben Clayton | 1165389 | 2023-09-19 19:15:59 +0000 | [diff] [blame] | 43 | namespace tint::wgsl { |
Ben Clayton | 7f2b8cd | 2022-05-18 22:41:48 +0000 | [diff] [blame] | 44 | |
| 45 | /// An enumerator of WGSL extensions |
Ben Clayton | 2dffb3c | 2023-08-07 12:35:33 +0000 | [diff] [blame] | 46 | /// @see src/tint/lang/wgsl/intrinsics.def for extension descriptions |
Ben Clayton | 0f8b6ef | 2023-08-10 14:12:42 +0000 | [diff] [blame] | 47 | enum class Extension : uint8_t { |
Ben Clayton | d2e0db3 | 2022-10-12 18:49:15 +0000 | [diff] [blame] | 48 | kUndefined, |
Ben Clayton | 7f2b8cd | 2022-05-18 22:41:48 +0000 | [diff] [blame] | 49 | kChromiumDisableUniformityAnalysis, |
Ben Clayton | 3e56a38 | 2023-11-09 16:22:33 +0000 | [diff] [blame] | 50 | kChromiumExperimentalFramebufferFetch, |
Ben Clayton | 74688c9 | 2023-09-05 13:35:35 +0000 | [diff] [blame] | 51 | kChromiumExperimentalPixelLocal, |
dan sinclair | 4abf28e | 2022-08-02 15:55:35 +0000 | [diff] [blame] | 52 | kChromiumExperimentalPushConstant, |
dan sinclair | 5e6e609 | 2024-08-19 20:00:01 +0000 | [diff] [blame] | 53 | kChromiumExperimentalSubgroupMatrix, |
James Price | 3b97fc4 | 2023-08-01 08:08:34 +0000 | [diff] [blame] | 54 | kChromiumExperimentalSubgroups, |
Ben Clayton | e4d210d | 2024-02-26 17:08:02 +0000 | [diff] [blame] | 55 | kChromiumInternalGraphite, |
Le Hoang Quyen | f9a9918 | 2024-05-22 21:02:35 +0000 | [diff] [blame] | 56 | kChromiumInternalInputAttachments, |
James Price | 0b3400c | 2023-02-27 18:39:20 +0000 | [diff] [blame] | 57 | kChromiumInternalRelaxedUniformLayout, |
Jiawei Shao | 2918c42 | 2024-08-15 00:55:19 +0000 | [diff] [blame] | 58 | kClipDistances, |
Jiawei Shao | cc43f15 | 2024-05-29 00:44:43 +0000 | [diff] [blame] | 59 | kDualSourceBlending, |
Ben Clayton | db368f1 | 2022-10-11 18:26:18 +0000 | [diff] [blame] | 60 | kF16, |
James Price | 32950eb | 2024-06-26 11:25:37 +0000 | [diff] [blame] | 61 | kSubgroups, |
| 62 | kSubgroupsF16, |
Ben Clayton | 7f2b8cd | 2022-05-18 22:41:48 +0000 | [diff] [blame] | 63 | }; |
| 64 | |
Ben Clayton | 6891960 | 2023-07-28 22:51:18 +0000 | [diff] [blame] | 65 | /// @param value the enum value |
| 66 | /// @returns the string for the given enum value |
| 67 | std::string_view ToString(Extension value); |
| 68 | |
dan sinclair | 6cc183c | 2023-03-02 21:28:45 +0000 | [diff] [blame] | 69 | /// @param out the stream to write to |
Ben Clayton | f50d56a | 2022-07-27 18:32:19 +0000 | [diff] [blame] | 70 | /// @param value the Extension |
Ben Clayton | 6891960 | 2023-07-28 22:51:18 +0000 | [diff] [blame] | 71 | /// @returns @p out so calls can be chained |
| 72 | template <typename STREAM, typename = traits::EnableIfIsOStream<STREAM>> |
| 73 | auto& operator<<(STREAM& out, Extension value) { |
| 74 | return out << ToString(value); |
| 75 | } |
Ben Clayton | 7f2b8cd | 2022-05-18 22:41:48 +0000 | [diff] [blame] | 76 | |
Ben Clayton | f50d56a | 2022-07-27 18:32:19 +0000 | [diff] [blame] | 77 | /// ParseExtension parses a Extension from a string. |
| 78 | /// @param str the string to parse |
Ben Clayton | d2e0db3 | 2022-10-12 18:49:15 +0000 | [diff] [blame] | 79 | /// @returns the parsed enum, or Extension::kUndefined if the string could not be parsed. |
Ben Clayton | f50d56a | 2022-07-27 18:32:19 +0000 | [diff] [blame] | 80 | Extension ParseExtension(std::string_view str); |
Ben Clayton | 7f2b8cd | 2022-05-18 22:41:48 +0000 | [diff] [blame] | 81 | |
Ben Clayton | 0b255d2 | 2023-11-08 18:34:09 +0000 | [diff] [blame] | 82 | constexpr std::string_view kExtensionStrings[] = { |
Ben Clayton | e4d210d | 2024-02-26 17:08:02 +0000 | [diff] [blame] | 83 | "chromium_disable_uniformity_analysis", |
| 84 | "chromium_experimental_framebuffer_fetch", |
| 85 | "chromium_experimental_pixel_local", |
| 86 | "chromium_experimental_push_constant", |
dan sinclair | 5e6e609 | 2024-08-19 20:00:01 +0000 | [diff] [blame] | 87 | "chromium_experimental_subgroup_matrix", |
Ben Clayton | e4d210d | 2024-02-26 17:08:02 +0000 | [diff] [blame] | 88 | "chromium_experimental_subgroups", |
Ben Clayton | e4d210d | 2024-02-26 17:08:02 +0000 | [diff] [blame] | 89 | "chromium_internal_graphite", |
Le Hoang Quyen | f9a9918 | 2024-05-22 21:02:35 +0000 | [diff] [blame] | 90 | "chromium_internal_input_attachments", |
Ben Clayton | e4d210d | 2024-02-26 17:08:02 +0000 | [diff] [blame] | 91 | "chromium_internal_relaxed_uniform_layout", |
Jiawei Shao | 2918c42 | 2024-08-15 00:55:19 +0000 | [diff] [blame] | 92 | "clip_distances", |
Jiawei Shao | cc43f15 | 2024-05-29 00:44:43 +0000 | [diff] [blame] | 93 | "dual_source_blending", |
Ben Clayton | e4d210d | 2024-02-26 17:08:02 +0000 | [diff] [blame] | 94 | "f16", |
James Price | 32950eb | 2024-06-26 11:25:37 +0000 | [diff] [blame] | 95 | "subgroups", |
| 96 | "subgroups_f16", |
Ben Clayton | b7aef03 | 2022-10-11 19:29:11 +0000 | [diff] [blame] | 97 | }; |
| 98 | |
Ben Clayton | 1d6f354 | 2023-11-07 20:33:31 +0000 | [diff] [blame] | 99 | /// All extensions |
| 100 | static constexpr Extension kAllExtensions[] = { |
| 101 | Extension::kChromiumDisableUniformityAnalysis, |
Ben Clayton | 3e56a38 | 2023-11-09 16:22:33 +0000 | [diff] [blame] | 102 | Extension::kChromiumExperimentalFramebufferFetch, |
Ben Clayton | 1d6f354 | 2023-11-07 20:33:31 +0000 | [diff] [blame] | 103 | Extension::kChromiumExperimentalPixelLocal, |
| 104 | Extension::kChromiumExperimentalPushConstant, |
dan sinclair | 5e6e609 | 2024-08-19 20:00:01 +0000 | [diff] [blame] | 105 | Extension::kChromiumExperimentalSubgroupMatrix, |
Ben Clayton | 1d6f354 | 2023-11-07 20:33:31 +0000 | [diff] [blame] | 106 | Extension::kChromiumExperimentalSubgroups, |
Ben Clayton | e4d210d | 2024-02-26 17:08:02 +0000 | [diff] [blame] | 107 | Extension::kChromiumInternalGraphite, |
Le Hoang Quyen | f9a9918 | 2024-05-22 21:02:35 +0000 | [diff] [blame] | 108 | Extension::kChromiumInternalInputAttachments, |
Ben Clayton | 1d6f354 | 2023-11-07 20:33:31 +0000 | [diff] [blame] | 109 | Extension::kChromiumInternalRelaxedUniformLayout, |
Jiawei Shao | 2918c42 | 2024-08-15 00:55:19 +0000 | [diff] [blame] | 110 | Extension::kClipDistances, |
Jiawei Shao | cc43f15 | 2024-05-29 00:44:43 +0000 | [diff] [blame] | 111 | Extension::kDualSourceBlending, |
Ben Clayton | 1d6f354 | 2023-11-07 20:33:31 +0000 | [diff] [blame] | 112 | Extension::kF16, |
James Price | 32950eb | 2024-06-26 11:25:37 +0000 | [diff] [blame] | 113 | Extension::kSubgroups, |
| 114 | Extension::kSubgroupsF16, |
Ben Clayton | 1d6f354 | 2023-11-07 20:33:31 +0000 | [diff] [blame] | 115 | }; |
| 116 | |
| 117 | /// A unique vector of extensions |
dan sinclair | bae54e7 | 2023-07-28 15:01:54 +0000 | [diff] [blame] | 118 | using Extensions = UniqueVector<Extension, 4>; |
Ben Clayton | 7f2b8cd | 2022-05-18 22:41:48 +0000 | [diff] [blame] | 119 | |
Ben Clayton | 1165389 | 2023-09-19 19:15:59 +0000 | [diff] [blame] | 120 | } // namespace tint::wgsl |
Ben Clayton | 7f2b8cd | 2022-05-18 22:41:48 +0000 | [diff] [blame] | 121 | |
Ben Clayton | 1165389 | 2023-09-19 19:15:59 +0000 | [diff] [blame] | 122 | #endif // SRC_TINT_LANG_WGSL_EXTENSION_H_ |