diff --git a/src/writer/glsl/generator_impl.cc b/src/writer/glsl/generator_impl.cc index 0909adc12a..e16b3d769d 100644 --- a/src/writer/glsl/generator_impl.cc +++ b/src/writer/glsl/generator_impl.cc @@ -2310,7 +2310,11 @@ bool GeneratorImpl::EmitType(std::ostream& out, } } for (uint32_t size : sizes) { - out << "[" << size << "]"; + if (size > 0) { + out << "[" << size << "]"; + } else { + out << "[]"; + } } } else if (type->Is()) { out << "bool"; diff --git a/src/writer/glsl/generator_impl_sanitizer_test.cc b/src/writer/glsl/generator_impl_sanitizer_test.cc index b85bde6f2e..23247936f6 100644 --- a/src/writer/glsl/generator_impl_sanitizer_test.cc +++ b/src/writer/glsl/generator_impl_sanitizer_test.cc @@ -53,7 +53,7 @@ precision mediump float; layout (binding = 1) buffer my_struct_1 { - float a[0]; + float a[]; } b; void a_func() { @@ -105,7 +105,7 @@ precision mediump float; layout (binding = 1) buffer my_struct_1 { float z; - float a[0]; + float a[]; } b; void a_func() { @@ -158,7 +158,7 @@ precision mediump float; layout (binding = 1) buffer my_struct_1 { - float a[0]; + float a[]; } b; void a_func() {