GLSL: avoid collisions on existing vars for binding 0/0.

Bug: tint:1396
Change-Id: I870c3dd7772b1fdf9bf7adfdb34798a9eb170163
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78020
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Stephen White 2022-01-24 22:51:49 +00:00 committed by Tint LUCI CQ
parent 6c0df44211
commit 2190481ad9
2 changed files with 8 additions and 1 deletions

View File

@ -137,6 +137,13 @@ struct CombineSamplers::State {
for (auto* var : ctx.src->AST().GlobalVariables()) {
if (sem.Get(var->type)->IsAnyOf<sem::Texture, sem::Sampler>()) {
ctx.Remove(ctx.src->AST().GlobalDeclarations(), var);
} else if (auto binding_point = var->BindingPoint()) {
if (binding_point.group->value == 0 &&
binding_point.binding->value == 0) {
auto* decoration =
ctx.dst->Disable(ast::DisabledValidation::kBindingPointCollision);
ctx.InsertFront(var->decorations, decoration);
}
}
}

View File

@ -633,7 +633,7 @@ fn main() -> vec4<f32> {
}
)";
auto* expect = R"(
@group(0) @binding(0) var<uniform> gcoords : vec2<f32>;
@internal(disable_validation__binding_point_collision) @group(0) @binding(0) var<uniform> gcoords : vec2<f32>;
@group(0) @binding(0) @internal(disable_validation__binding_point_collision) var tex_samp : texture_2d<f32>;