Add option to auto generate bindings for external textures

With this change, the backend sanitizers always run the
MultiplanarExternalTexture transform. If the new option is enabled, it
auto-generates bindings for this transform.

This change also enables this auto-generation for the Tint commandline
application, as well as for the fuzzers.

Bug: chromium:1310623
Change-Id: I3c661c4753dc67c0212051d09024cbeda3939f8c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85542
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Antonio Maiorano
2022-04-06 13:57:54 +00:00
committed by Tint LUCI CQ
parent 12f2f9b1bc
commit a730eb738e
44 changed files with 2006 additions and 113 deletions

View File

@@ -569,6 +569,7 @@ bool GenerateSpirv(const tint::Program* program, const Options& options) {
// TODO(jrprice): Provide a way for the user to set non-default options.
tint::writer::spirv::Options gen_options;
gen_options.disable_workgroup_init = options.disable_workgroup_init;
gen_options.generate_external_texture_bindings = true;
auto result = tint::writer::spirv::Generate(program, gen_options);
if (!result.success) {
PrintWGSL(std::cerr, *program);
@@ -717,6 +718,7 @@ bool GenerateMsl(const tint::Program* program, const Options& options) {
// TODO(jrprice): Provide a way for the user to set non-default options.
tint::writer::msl::Options gen_options;
gen_options.disable_workgroup_init = options.disable_workgroup_init;
gen_options.generate_external_texture_bindings = true;
auto result = tint::writer::msl::Generate(input_program, gen_options);
if (!result.success) {
PrintWGSL(std::cerr, *program);
@@ -771,6 +773,7 @@ bool GenerateHlsl(const tint::Program* program, const Options& options) {
// TODO(jrprice): Provide a way for the user to set non-default options.
tint::writer::hlsl::Options gen_options;
gen_options.disable_workgroup_init = options.disable_workgroup_init;
gen_options.generate_external_texture_bindings = true;
auto result = tint::writer::hlsl::Generate(program, gen_options);
if (!result.success) {
PrintWGSL(std::cerr, *program);
@@ -846,6 +849,7 @@ bool GenerateGlsl(const tint::Program* program, const Options& options) {
auto generate = [&](const tint::Program* prg,
const std::string entry_point_name) -> bool {
tint::writer::glsl::Options gen_options;
gen_options.generate_external_texture_bindings = true;
auto result =
tint::writer::glsl::Generate(prg, gen_options, entry_point_name);
if (!result.success) {