glsl: fix GL_BUFFER_DATA_SIZE value for shader storage blocks with unsize arrays
authorSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Thu, 22 Oct 2015 08:07:54 +0000 (10:07 +0200)
committerSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Thu, 29 Oct 2015 07:29:06 +0000 (08:29 +0100)
commit85f1f0441326ef3f49a4edeac474599db471ef7f
tree522c7520471e0992fa4c372f7f4c8d0c24ee5e72
parentcf93251bedc831dc252afaec82d654de3cbd9a48
glsl: fix GL_BUFFER_DATA_SIZE value for shader storage blocks with unsize arrays

From ARB_program_interface_query:

"For the property of BUFFER_DATA_SIZE, then the implementation-dependent
 minimum total buffer object size, in basic machine units, required to hold
 all active variables associated with an active uniform block, shader
 storage block, or atomic counter buffer is written to <params>.  If the
 final member of an active shader storage block is array with no declared
 size, the minimum buffer size is computed assuming the array was declared
 as an array with one element."

Fixes the following dEQP-GLES31 tests:

dEQP-GLES31.functional.program_interface_query.shader_storage_block.buffer_data_size.named_block
dEQP-GLES31.functional.program_interface_query.shader_storage_block.buffer_data_size.unnamed_block
dEQP-GLES31.functional.program_interface_query.shader_storage_block.buffer_data_size.block_array

v2:
- Fix comment's indentation and explain that the parser already
  checked that unsized array is in last element of a shader
  storage block (Iago).
- Add assert (Iago).

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/glsl/link_uniform_blocks.cpp