mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-19 09:55:26 +00:00
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:
committed by
Tint LUCI CQ
parent
12f2f9b1bc
commit
a730eb738e
@@ -37,6 +37,7 @@
|
||||
#include "src/tint/transform/unshadow.h"
|
||||
#include "src/tint/transform/unwind_discard_functions.h"
|
||||
#include "src/tint/transform/zero_init_workgroup_memory.h"
|
||||
#include "src/tint/writer/generate_external_texture_bindings.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::Glsl);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::Glsl::Config);
|
||||
@@ -91,6 +92,13 @@ Output Glsl::Run(const Program* in, const DataMap& inputs) const {
|
||||
manager.Add<SimplifyPointers>();
|
||||
|
||||
manager.Add<RemovePhonies>();
|
||||
|
||||
if (cfg && cfg->generate_external_texture_bindings) {
|
||||
auto new_bindings_map = writer::GenerateExternalTextureBindings(in);
|
||||
data.Add<MultiplanarExternalTexture::NewBindingPoints>(new_bindings_map);
|
||||
}
|
||||
manager.Add<MultiplanarExternalTexture>();
|
||||
|
||||
manager.Add<CombineSamplers>();
|
||||
if (auto* binding_info = inputs.Get<CombineSamplers::BindingInfo>()) {
|
||||
data.Add<CombineSamplers::BindingInfo>(*binding_info);
|
||||
@@ -106,6 +114,7 @@ Output Glsl::Run(const Program* in, const DataMap& inputs) const {
|
||||
BindingRemapper::AccessControls ac;
|
||||
data.Add<BindingRemapper::Remappings>(bp, ac, /* mayCollide */ true);
|
||||
}
|
||||
|
||||
manager.Add<PromoteInitializersToConstVar>();
|
||||
|
||||
manager.Add<AddEmptyEntryPoint>();
|
||||
@@ -124,8 +133,13 @@ Output Glsl::Run(const Program* in, const DataMap& inputs) const {
|
||||
return Output{Program(std::move(builder))};
|
||||
}
|
||||
|
||||
Glsl::Config::Config(const std::string& ep, bool disable_wi)
|
||||
: entry_point(ep), disable_workgroup_init(disable_wi) {}
|
||||
Glsl::Config::Config(const std::string& entry_point_in,
|
||||
bool disable_workgroup_init_in,
|
||||
bool generate_external_texture_bindings_in)
|
||||
: entry_point(entry_point_in),
|
||||
disable_workgroup_init(disable_workgroup_init_in),
|
||||
generate_external_texture_bindings(
|
||||
generate_external_texture_bindings_in) {}
|
||||
Glsl::Config::Config(const Config&) = default;
|
||||
Glsl::Config::~Config() = default;
|
||||
|
||||
|
||||
@@ -37,8 +37,11 @@ class Glsl final : public Castable<Glsl, Transform> {
|
||||
/// @param entry_point the root entry point function to generate
|
||||
/// @param disable_workgroup_init `true` to disable workgroup memory zero
|
||||
/// initialization
|
||||
/// @param generate_external_texture_bindings 'true' to generates binding
|
||||
/// mappings for external textures
|
||||
explicit Config(const std::string& entry_point,
|
||||
bool disable_workgroup_init = false);
|
||||
bool disable_workgroup_init,
|
||||
bool generate_external_texture_bindings);
|
||||
|
||||
/// Copy constructor
|
||||
Config(const Config&);
|
||||
@@ -51,6 +54,9 @@ class Glsl final : public Castable<Glsl, Transform> {
|
||||
|
||||
/// Set to `true` to disable workgroup memory zero initialization
|
||||
bool disable_workgroup_init = false;
|
||||
|
||||
/// Set to 'true' to generates binding mappings for external textures
|
||||
bool generate_external_texture_bindings = false;
|
||||
};
|
||||
|
||||
/// Constructor
|
||||
|
||||
Reference in New Issue
Block a user