Move `clamp_frag_depth` transformer to backend.

This CL moves the `clamp_frag_depth` transform to be controlled by the
SPIR-V backend.

Bug: tint:1855 chromium:1421379
Change-Id: Ia439d812d4baf35d4d4955595938a2bd5e647167
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/123560
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2023-03-14 16:33:55 +00:00 committed by Dawn LUCI CQ
parent 6521a357f5
commit 1f6ce67ed2
4 changed files with 9 additions and 5 deletions

View File

@ -27,7 +27,6 @@
#include "src/tint/reader/reader.h"
#include "src/tint/text/unicode.h"
#include "src/tint/transform/binding_remapper.h"
#include "src/tint/transform/clamp_frag_depth.h"
#include "src/tint/transform/first_index_offset.h"
#include "src/tint/transform/manager.h"
#include "src/tint/transform/multiplanar_external_texture.h"

View File

@ -305,10 +305,6 @@ ResultOrError<ShaderModule::ModuleAndSpirv> ShaderModule::GetHandleAndSpirv(
r.newBindingsMap);
}
if (r.clampFragDepth) {
transformManager.Add<tint::transform::ClampFragDepth>();
}
tint::Program program;
tint::transform::DataMap transformOutputs;
{
@ -340,6 +336,7 @@ ResultOrError<ShaderModule::ModuleAndSpirv> ShaderModule::GetHandleAndSpirv(
}
tint::writer::spirv::Options options;
options.clamp_frag_depth = r.clampFragDepth;
options.disable_robustness = !r.isRobustnessEnabled;
options.emit_vertex_point_size = true;
options.disable_workgroup_init = r.disableWorkgroupInit;

View File

@ -46,6 +46,9 @@ struct Options {
/// Set to `true` to disable workgroup memory zero initialization
bool disable_workgroup_init = false;
/// Set to `true` to clamp frag depth
bool clamp_frag_depth = false;
/// Options used in the binding mappings for external textures
ExternalTextureOptions external_texture_options = {};

View File

@ -21,6 +21,7 @@
#include "src/tint/transform/add_empty_entry_point.h"
#include "src/tint/transform/builtin_polyfill.h"
#include "src/tint/transform/canonicalize_entry_point_io.h"
#include "src/tint/transform/clamp_frag_depth.h"
#include "src/tint/transform/demote_to_helper.h"
#include "src/tint/transform/direct_variable_access.h"
#include "src/tint/transform/disable_uniformity_analysis.h"
@ -49,6 +50,10 @@ SanitizedResult Sanitize(const Program* in, const Options& options) {
transform::Manager manager;
transform::DataMap data;
if (options.clamp_frag_depth) {
manager.Add<tint::transform::ClampFragDepth>();
}
manager.Add<transform::DisableUniformityAnalysis>();
// ExpandCompoundAssignment must come before BuiltinPolyfill