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 <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2023-04-19 20:14:50 +00:00 committed by Dawn LUCI CQ
parent e16ed7ccc2
commit c480632ed6
1 changed files with 20 additions and 1 deletions
src/tint/writer/msl

View File

@ -27,7 +27,26 @@ void GenerateMSL(benchmark::State& state, std::string input_name) {
}
auto& program = std::get<bench::ProgramAndFile>(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());
}