BindingRemapper: Allow for binding point collisions

Add a new parameter to BindingRemapper::Remappings that allows resulting binding points to collide.

When enabled, the output of the transform contains two or more module-scoped variables with the same binding point, used by the same entry point, then these variables will be decorated with an internal decoration to disable validation for the collision.

This is to work around collisions generated for the HLSL backend where the variables actually exist in different register classes, which is permitted by D3D12.

The transform will only generate these decorations if it needs to.

Fixed: tint:797
Change-Id: Id8a87523801bd0cd0dd54227ebabd4299bc20c27
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50742
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton
2021-05-12 13:30:51 +00:00
committed by Commit Bot service account
parent 451f2cc68a
commit 3103a1f666
6 changed files with 200 additions and 5 deletions

View File

@@ -32,6 +32,8 @@ std::string DisableValidationDecoration::Name() const {
switch (validation_) {
case DisabledValidation::kFunctionHasNoBody:
return "disable_validation__function_has_no_body";
case DisabledValidation::kBindingPointCollision:
return "disable_validation__binding_point_collision";
}
return "<invalid>";
}

View File

@@ -28,6 +28,9 @@ enum class DisabledValidation {
/// When applied to a function, the validator will not complain there is no
/// body to a function.
kFunctionHasNoBody,
/// When applied to a module-scoped variable, the validator will not complain
/// if two resource variables have the same binding points.
kBindingPointCollision,
};
/// An internal decoration used to tell the validator to ignore specific