mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 17:48:10 +02:00
glsl: non-last member unsized array on SSBO must fail compilation on GLSL ES 3.1
From GLSL ES 3.10 spec, section 4.1.9 "Arrays":
"If an array is declared as the last member of a shader storage block
and the size is not specified at compile-time, it is sized at run-time.
In all other cases, arrays are sized only at compile-time."
In desktop GLSL it is allowed to have unsized-arrays that are
not last, as long as we can determine that they are implicitly
sized, which is detected at link-time.
With this patch Mesa reports a compilation error as glslang does with
the following shader:
buffer SSBO { vec4 data[]; vec4 moreData;};
void main (void)
{
}
Fixes:
dEQP-GLES31.functional.debug.negative_coverage.log.shader.compile_compute_shader
dEQP-GLES31.functional.debug.negative_coverage.callbacks.shader.compile_compute_shader
dEQP-GLES31.functional.debug.negative_coverage.get_error.shader.compile_compute_shader
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 5bc222ebaf)
This commit is contained in:
parent
ce0eebc935
commit
1f76523596
1 changed files with 7 additions and 4 deletions
|
|
@ -7861,10 +7861,9 @@ ast_interface_block::hir(exec_list *instructions,
|
|||
}
|
||||
|
||||
if (var->type->is_unsized_array()) {
|
||||
if (var->is_in_shader_storage_block()) {
|
||||
if (is_unsized_array_last_element(var)) {
|
||||
var->data.from_ssbo_unsized_array = true;
|
||||
}
|
||||
if (var->is_in_shader_storage_block() &&
|
||||
is_unsized_array_last_element(var)) {
|
||||
var->data.from_ssbo_unsized_array = true;
|
||||
} else {
|
||||
/* From GLSL ES 3.10 spec, section 4.1.9 "Arrays":
|
||||
*
|
||||
|
|
@ -7872,6 +7871,10 @@ ast_interface_block::hir(exec_list *instructions,
|
|||
* block and the size is not specified at compile-time, it is
|
||||
* sized at run-time. In all other cases, arrays are sized only
|
||||
* at compile-time."
|
||||
*
|
||||
* In desktop GLSL it is allowed to have unsized-arrays that are
|
||||
* not last, as long as we can determine that they are implicitly
|
||||
* sized.
|
||||
*/
|
||||
if (state->es_shader) {
|
||||
_mesa_glsl_error(&loc, state, "unsized array `%s' "
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue