| // 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{ | |
| "rgbaunccrm", "rlbanr3", "rVba8unorm", "rgba8unorm", "rgba1unorm", | |
| "rgbJqqnorm", "rgb7ll8unorm", "rgqqappnoHHm", "rv8scor", "rgbbGsnrm", | |
| "rgba8snorm", "rgba8vniirm", "rg8a8snoWWm", "Mgbaxxnorm", "rXa8uggnt", | |
| "rgbXVut", "3gba8uint", "rgba8uint", "rgba8uiEt", "rgTTPauint", | |
| "ddgbauixxt", "44gba8sint", "VVgbaSSsint", "rba8si2Rt", "rgba8sint", | |
| "r9bFsint", "rgba8int", "rgVROOsHnt", "ryba1uint", "r77ba1nnullrrt", | |
| "rgb4006uint", "rgba16uint", "rb1uioot", "rga1uzznt", "r11b1uppiit", | |
| "XXgba16sint", "IIgb9916nni55t", "rYbaSSrrsiHHat", "rgba16sint", "rbkk6Hit", | |
| "jgba1sgRR", "rgbab6si", "rgba16fljat", "rgba6float", "rbq6float", | |
| "rgba16float", "rgba1NNloat", "rgbvv6flot", "rgbaQQ6foat", "r3ffir", | |
| "r32uijt", "rNNwuin8", "r32uint", "r32int", "rrr2uint", | |
| "G32uint", "r32sinFF", "32st", "r3rrint", "r32sint", | |
| "2sint", "D3siJJt", "r38n", "r211lk", "r32floa", | |
| "r3flJat", "r32float", "r32fcoat", "r32floOt", "r32floKK_vtt", | |
| "rxx32ui8", "Fg3qq__n", "rg32iqqt", "rg32uint", "rg333uin6", | |
| "rtto62u9QQt", "rg366uin", "rOx2si6zz", "rg3yysint", "rHHsint", | |
| "rg32sint", "qWW432snt", "rg3OOsnt", "g32siYt", "g32flo", | |
| "rg32foaF", "rg32fwat", "rg32float", "G3fKoaff", "KKgq2float", | |
| "rg32mmlo3t", "rgba32uit", "rqba3uint", "rgbabb2uin", "rgba32uint", | |
| "rba32iint", "qgba32uiOt", "rgba32uiTTvv", "rgFFa32sint", "rg00Q2sPnt", | |
| "rgbaP2sint", "rgba32sint", "rgb77s2sint", "rgba32sbbRRC", "rgbXX32sint", | |
| "rOOOba3CCqoat", "rgbu32fsLt", "rgba3Xfloat", "rgba32float", "rba32float", | |
| "qqb3float", "rgba32fl22at", | |
| }; | |
| for (auto _ : state) { | |
| for (auto& str : kStrings) { | |
| auto result = ParseTexelFormat(str); | |
| benchmark::DoNotOptimize(result); | |
| } | |
| } | |
| } | |
| BENCHMARK(TexelFormatParser); | |
| } // namespace | |
| } // namespace tint::ast |