From c480632ed60e27a782be9077bba56d5d2f006e9c Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Wed, 19 Apr 2023 20:14:50 +0000 Subject: [PATCH] Setup ArrayLength transform for MSL benchmark Some of the benchmark shaders when run with the MSL backend are currently failing because the robustness transform is injecting the arrayLength method but there is no configuration for running the arrayLength transform. This Cl adds some default configuration to the MSL bench to make a slot available for each possible value. It just always makes them available such that all shaders work correctly. Change-Id: Ie8a15abc0b7da7d2f46be11274e66302406be019 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128060 Reviewed-by: Ben Clayton Kokoro: Kokoro Commit-Queue: Dan Sinclair --- src/tint/writer/msl/generator_bench.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/tint/writer/msl/generator_bench.cc b/src/tint/writer/msl/generator_bench.cc index 7feb1cfdb0..c58ede53e5 100644 --- a/src/tint/writer/msl/generator_bench.cc +++ b/src/tint/writer/msl/generator_bench.cc @@ -27,7 +27,26 @@ void GenerateMSL(benchmark::State& state, std::string input_name) { } auto& program = std::get(res).program; for (auto _ : state) { - auto res = Generate(&program, {}); + tint::writer::msl::Options gen_options = {}; + gen_options.array_length_from_uniform.ubo_binding = tint::writer::BindingPoint{0, 30}; + gen_options.array_length_from_uniform.bindpoint_to_size_index.emplace( + tint::writer::BindingPoint{0, 0}, 0); + gen_options.array_length_from_uniform.bindpoint_to_size_index.emplace( + tint::writer::BindingPoint{0, 1}, 1); + gen_options.array_length_from_uniform.bindpoint_to_size_index.emplace( + tint::writer::BindingPoint{0, 2}, 2); + gen_options.array_length_from_uniform.bindpoint_to_size_index.emplace( + tint::writer::BindingPoint{0, 3}, 3); + gen_options.array_length_from_uniform.bindpoint_to_size_index.emplace( + tint::writer::BindingPoint{0, 4}, 4); + gen_options.array_length_from_uniform.bindpoint_to_size_index.emplace( + tint::writer::BindingPoint{0, 5}, 5); + gen_options.array_length_from_uniform.bindpoint_to_size_index.emplace( + tint::writer::BindingPoint{0, 6}, 6); + gen_options.array_length_from_uniform.bindpoint_to_size_index.emplace( + tint::writer::BindingPoint{0, 7}, 7); + + auto res = Generate(&program, gen_options); if (!res.error.empty()) { state.SkipWithError(res.error.c_str()); }