GLSL: ensure interface blocks have unique names.

Bug: tint:1260
Change-Id: I59aeb7272462c80bfb739c6f4759327d12145ac8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67440
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 2021-10-25 19:53:01 +00:00 committed by Tint LUCI CQ
parent 91689fb6f0
commit 0436d045ab
4 changed files with 25 additions and 25 deletions

View File

@ -1555,7 +1555,7 @@ bool GeneratorImpl::EmitUniformVariable(const sem::Variable* var) {
ast::VariableBindingPoint bp = decl->BindingPoint();
line() << "layout (set = " << bp.group->value
<< ", binding = " << bp.binding->value << ") uniform "
<< StructName(str) << " {";
<< UniqueIdentifier(StructName(str)) << " {";
EmitStructMembers(current_buffer_, str);
auto name = builder_.Symbols().NameFor(decl->symbol);
line() << "} " << name << ";";
@ -1575,7 +1575,7 @@ bool GeneratorImpl::EmitStorageVariable(const sem::Variable* var) {
ast::VariableBindingPoint bp = decl->BindingPoint();
line() << "layout (set = " << bp.group->value
<< ", binding = " << bp.binding->value << ") buffer "
<< StructName(str) << " {";
<< UniqueIdentifier(StructName(str)) << " {";
EmitStructMembers(current_buffer_, str);
auto name = builder_.Symbols().NameFor(decl->symbol);
line() << "} " << name << ";";

View File

@ -434,7 +434,7 @@ TEST_F(GlslGeneratorImplTest_Function,
precision mediump float;
layout (set = 1, binding = 0) uniform UBO {
layout (set = 1, binding = 0) uniform UBO_1 {
vec4 coord;
} ubo;
@ -484,7 +484,7 @@ TEST_F(GlslGeneratorImplTest_Function,
precision mediump float;
layout (set = 1, binding = 0) uniform Uniforms {
layout (set = 1, binding = 0) uniform Uniforms_1 {
vec4 coord;
} uniforms;
@ -535,7 +535,7 @@ TEST_F(GlslGeneratorImplTest_Function,
precision mediump float;
layout (set = 1, binding = 0) buffer Data {
layout (set = 1, binding = 0) buffer Data_1 {
int a;
float b;
} coord;
@ -587,7 +587,7 @@ TEST_F(GlslGeneratorImplTest_Function,
precision mediump float;
layout (set = 1, binding = 0) buffer Data {
layout (set = 1, binding = 0) buffer Data_1 {
int a;
float b;
} coord;
@ -635,7 +635,7 @@ TEST_F(GlslGeneratorImplTest_Function,
precision mediump float;
layout (set = 1, binding = 0) buffer Data {
layout (set = 1, binding = 0) buffer Data_1 {
int a;
float b;
} coord;
@ -684,7 +684,7 @@ TEST_F(GlslGeneratorImplTest_Function,
precision mediump float;
layout (set = 1, binding = 0) buffer Data {
layout (set = 1, binding = 0) buffer Data_1 {
int a;
float b;
} coord;
@ -735,7 +735,7 @@ TEST_F(GlslGeneratorImplTest_Function,
precision mediump float;
layout (set = 1, binding = 0) uniform S {
layout (set = 1, binding = 0) uniform S_1 {
float x;
} coord;
@ -791,7 +791,7 @@ TEST_F(GlslGeneratorImplTest_Function,
precision mediump float;
layout (set = 1, binding = 0) buffer S {
layout (set = 1, binding = 0) buffer S_1 {
float x;
} coord;
@ -1057,7 +1057,7 @@ TEST_F(GlslGeneratorImplTest_Function,
precision mediump float;
layout (set = 0, binding = 0) buffer Data {
layout (set = 0, binding = 0) buffer Data_1 {
float d;
} data;

View File

@ -297,7 +297,7 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_Matrix_Empty) {
precision mediump float;
layout (set = 1, binding = 0) buffer Data {
layout (set = 1, binding = 0) buffer Data_1 {
int a;
mat2x3 b;
} data;
@ -343,7 +343,7 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor,
precision mediump float;
layout (set = 1, binding = 0) buffer Data {
layout (set = 1, binding = 0) buffer Data_1 {
float z;
mat4x3 a;
} data;
@ -387,7 +387,7 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor,
precision mediump float;
layout (set = 1, binding = 0) buffer Data {
layout (set = 1, binding = 0) buffer Data_1 {
float z;
int a[5];
} data;
@ -432,7 +432,7 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor,
precision mediump float;
layout (set = 1, binding = 0) buffer Data {
layout (set = 1, binding = 0) buffer Data_1 {
float z;
int a[5];
} data;
@ -474,7 +474,7 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_ToArray) {
precision mediump float;
layout (set = 1, binding = 0) buffer Data {
layout (set = 1, binding = 0) buffer Data_1 {
float z;
int a[5];
} data;
@ -531,7 +531,7 @@ struct Inner {
vec3 b;
};
layout (set = 1, binding = 0) buffer Data {
layout (set = 1, binding = 0) buffer Data_1 {
Inner c[4];
} data;
@ -590,7 +590,7 @@ struct Inner {
vec3 b;
};
layout (set = 1, binding = 0) buffer Data {
layout (set = 1, binding = 0) buffer Data_1 {
Inner c[4];
} data;
@ -649,7 +649,7 @@ struct Inner {
vec3 b;
};
layout (set = 1, binding = 0) buffer Data {
layout (set = 1, binding = 0) buffer Data_1 {
Inner c[4];
} data;
@ -708,7 +708,7 @@ struct Inner {
vec3 b;
};
layout (set = 1, binding = 0) buffer Data {
layout (set = 1, binding = 0) buffer Data_1 {
Inner c[4];
} data;
@ -763,7 +763,7 @@ struct Inner {
vec3 b;
};
layout (set = 1, binding = 0) buffer Data {
layout (set = 1, binding = 0) buffer Data_1 {
Inner c[4];
} data;
@ -822,7 +822,7 @@ struct Inner {
vec3 b;
};
layout (set = 1, binding = 0) buffer Data {
layout (set = 1, binding = 0) buffer Data_1 {
Inner c[4];
} data;

View File

@ -52,7 +52,7 @@ TEST_F(GlslSanitizerTest, Call_ArrayLength) {
precision mediump float;
layout (set = 2, binding = 1) buffer my_struct {
layout (set = 2, binding = 1) buffer my_struct_1 {
float a[0];
} b;
@ -103,7 +103,7 @@ TEST_F(GlslSanitizerTest, Call_ArrayLength_OtherMembersInStruct) {
precision mediump float;
layout (set = 2, binding = 1) buffer my_struct {
layout (set = 2, binding = 1) buffer my_struct_1 {
float z;
float a[0];
} b;
@ -157,7 +157,7 @@ TEST_F(GlslSanitizerTest, Call_ArrayLength_ViaLets) {
precision mediump float;
layout (set = 2, binding = 1) buffer my_struct {
layout (set = 2, binding = 1) buffer my_struct_1 {
float a[0];
} b;