| // Copyright 2023 The Dawn Authors |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| {% set namespace_name = Name(metadata.native_namespace) %} |
| {% set DIR = namespace_name.concatcase().upper() %} |
| #ifndef {{DIR}}_FEATURES_AUTOGEN_H_ |
| #define {{DIR}}_FEATURES_AUTOGEN_H_ |
| |
| #include "dawn/native/dawn_platform.h" |
| #include "dawn/native/DawnNative.h" |
| #include "dawn/common/ityp_array.h" |
| |
| namespace dawn::native { |
| |
| enum class Feature { |
| {% for enum in types["feature name"].values if enum.valid %} |
| {{as_cppEnum(enum.name)}}, |
| {% endfor %} |
| InvalidEnum, |
| }; |
| |
| template<> |
| struct EnumCount<Feature> { |
| {% set counter = namespace(value = 0) %} |
| {% for enum in types["feature name"].values if enum.valid -%} |
| {% set counter.value = counter.value + 1 %} |
| {% endfor %} |
| static constexpr uint32_t value = {{counter.value}}; |
| }; |
| |
| } // namespace dawn::native |
| |
| #endif // {{DIR}}_FEATURES_AUTOGEN_H_ |