GLSL: emit [] for runtime-sized arrays, not [0].

Bug: tint:1262
Change-Id: Ic58729f075353f957c5d974c742b531e1e2cf518
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67940
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-11-01 19:23:46 +00:00 committed by Tint LUCI CQ
parent d148be4f00
commit e9216ce595
2 changed files with 8 additions and 4 deletions

View File

@ -2310,7 +2310,11 @@ bool GeneratorImpl::EmitType(std::ostream& out,
} }
} }
for (uint32_t size : sizes) { for (uint32_t size : sizes) {
out << "[" << size << "]"; if (size > 0) {
out << "[" << size << "]";
} else {
out << "[]";
}
} }
} else if (type->Is<sem::Bool>()) { } else if (type->Is<sem::Bool>()) {
out << "bool"; out << "bool";

View File

@ -53,7 +53,7 @@ precision mediump float;
layout (binding = 1) buffer my_struct_1 { layout (binding = 1) buffer my_struct_1 {
float a[0]; float a[];
} b; } b;
void a_func() { void a_func() {
@ -105,7 +105,7 @@ precision mediump float;
layout (binding = 1) buffer my_struct_1 { layout (binding = 1) buffer my_struct_1 {
float z; float z;
float a[0]; float a[];
} b; } b;
void a_func() { void a_func() {
@ -158,7 +158,7 @@ precision mediump float;
layout (binding = 1) buffer my_struct_1 { layout (binding = 1) buffer my_struct_1 {
float a[0]; float a[];
} b; } b;
void a_func() { void a_func() {