GLSL: don't emit "set=<group>" layout qualifier.

Only Vulkan-flavoured GLSL has these. Dawn will have to pack
everything into the binding= decoration for OpenGL.

Bug: 1223
Change-Id: I7ffdbc1b2f37e176411c41e4ff65b93b8f0f5ec6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67640
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Stephen White 2021-10-28 11:49:28 +00:00 committed by Tint LUCI CQ
parent 97c692d337
commit c6ce5785d0
4 changed files with 25 additions and 27 deletions

View File

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

View File

@ -434,7 +434,7 @@ TEST_F(GlslGeneratorImplTest_Function,
precision mediump float;
layout (set = 1, binding = 0) uniform UBO_1 {
layout (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_1 {
layout (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_1 {
layout (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_1 {
layout (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_1 {
layout (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_1 {
layout (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_1 {
layout (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_1 {
layout (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_1 {
layout (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_1 {
layout (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_1 {
layout (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_1 {
layout (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_1 {
layout (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_1 {
layout (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_1 {
layout (binding = 0) buffer Data_1 {
Inner c[4];
} data;
@ -590,7 +590,7 @@ struct Inner {
vec3 b;
};
layout (set = 1, binding = 0) buffer Data_1 {
layout (binding = 0) buffer Data_1 {
Inner c[4];
} data;
@ -649,7 +649,7 @@ struct Inner {
vec3 b;
};
layout (set = 1, binding = 0) buffer Data_1 {
layout (binding = 0) buffer Data_1 {
Inner c[4];
} data;
@ -708,7 +708,7 @@ struct Inner {
vec3 b;
};
layout (set = 1, binding = 0) buffer Data_1 {
layout (binding = 0) buffer Data_1 {
Inner c[4];
} data;
@ -763,7 +763,7 @@ struct Inner {
vec3 b;
};
layout (set = 1, binding = 0) buffer Data_1 {
layout (binding = 0) buffer Data_1 {
Inner c[4];
} data;
@ -822,7 +822,7 @@ struct Inner {
vec3 b;
};
layout (set = 1, binding = 0) buffer Data_1 {
layout (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_1 {
layout (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_1 {
layout (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_1 {
layout (binding = 1) buffer my_struct_1 {
float a[0];
} b;