| // Copyright 2022 The Tint Authors. |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| //////////////////////////////////////////////////////////////////////////////// |
| // File generated by tools/src/cmd/gen |
| // using the template: |
| // src/tint/ast/texel_format_bench.cc.tmpl |
| // |
| // Do not modify this file directly |
| //////////////////////////////////////////////////////////////////////////////// |
| |
| #include "src/tint/ast/texel_format.h" |
| |
| #include <array> |
| |
| #include "benchmark/benchmark.h" |
| |
| namespace tint::ast { |
| namespace { |
| |
| void TexelFormatParser(::benchmark::State& state) { |
| std::array kStrings{ |
| "rcc2flot", "3flo3", "r32flVat", "r32float", "132float", |
| "32Jlqqat", "ll3277loat", "ppqq2snHH", "r3cv", "b2siGt", |
| "r32sint", "r32siivt", "8WW2sint", "rxxsint", "rXuingg", |
| "3uiXt", "r32u3nt", "r32uint", "E32uint", "rPTTuint", |
| "r32uidxx", "44g32float", "VVg32SSloat", "r32flo2Rt", "rg32float", |
| "r93Float", "rg32foat", "rgVROOlHat", "rg3ysin", "77grr2sllnnt", |
| "04g32sint", "rg32sint", "g3oont", "rg32zzt", "rgiipps1n", |
| "XXg32uint", "rII39955nnnt", "aagHH2uinYSS", "rg32uint", "rkk3it", |
| "gj3uRRn", "r3bunt", "rgba16fljat", "rgba6float", "rbq6float", |
| "rgba16float", "rgba1NNloat", "rgbvv6flot", "rgbaQQ6foat", "rgb6srnff", |
| "rgba16sijt", "NNgba16ww2t", "rgba16sint", "rgba16snt", "rgba16rrint", |
| "rgba1Gsint", "rgba16uFFnt", "g16uEnt", "rgb16rrint", "rgba16uint", |
| "gba16uit", "rXa1DuiJJt", "rgauint", "rga32klot", "rgb32float", |
| "rgJa32flot", "rgba32float", "rgba32fcoat", "rgba32floOt", "__gttavv2fKKoat", |
| "rg5a32xxnt", "__ba3sqqFt", "rgbqq2sint", "rgba32sint", "33ba32s66nt", |
| "rtt6a3QQooint", "r66ba3sint", "xba32zzinO6", "ryyba32uint", "rbZ32HinZ", |
| "rgba32uint", "rgba3u4WWnq", "rgba32uOOt", "oogba2Yin", "gba8si", |
| "rgba8inF", "rgba8wnt", "rgba8sint", "Gb8Kinff", "KKgqa8sint", |
| "rgbammsi3t", "rgba8snom", "rqba8norm", "rgbabbsnor", "rgba8snorm", |
| "rba8siorm", "qgba8snoOm", "rgba8snoTTvv", "rgbaFFuint", "rgQa00uiP", |
| "rgPa8uint", "rgba8uint", "rgssa77unt", "Cgbbb8uiRRt", "rgba8uinXX", |
| "CqgbaOOunorm", "rgbu8usrL", "rgba8Xnorm", "rgba8unorm", "rgba8unrm", |
| "ba8uqqor", "rgba8unor22", |
| }; |
| for (auto _ : state) { |
| for (auto& str : kStrings) { |
| auto result = ParseTexelFormat(str); |
| benchmark::DoNotOptimize(result); |
| } |
| } |
| } |
| |
| BENCHMARK(TexelFormatParser); |
| |
| } // namespace |
| } // namespace tint::ast |