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

View File

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

View File

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

View File

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