glsl: fix a binding points assignment for ssbo/ubo arrays
authorAndrii Simiklit <andrii.simiklit@globallogic.com>
Tue, 5 Mar 2019 15:58:53 +0000 (17:58 +0200)
committerKristian H. Kristensen <hoegsberg@google.com>
Mon, 6 Jan 2020 21:01:19 +0000 (13:01 -0800)
commit4beb0a23088e68693e94599ef36eb41cbcd59289
tree5b7b9559e3b671fb5244d4979ca608187ba4e348
parenta3c9a2881e242b9ac588d6dcb158e805fefe352d
glsl: fix a binding points assignment for ssbo/ubo arrays

This is needed to be in agreement with spec requirements:
https://github.com/KhronosGroup/OpenGL-API/issues/46

Piers Daniell:
   "We discussed this in the OpenGL/ES working group meeting
    and agreed that eliminating unused elements from the interface
    block array is not desirable. There is no statement in the spec
    that this takes place and it would be highly implementation
    dependent if it happens. If the application has an "interface"
    in the shader they need to match up with the API it would be
    quite confusing to have the binding point get compacted.
    So the answer is no, the binding points aren't affected by
    unused elements in the interface block array."

v2: - 'original_dim_size' field moved above to keep
      the struct packed better on 64-bit
    - added a comment for 'total_num_array_elements' field
    - fixed a binding point calculations for SSBOs array of arrays
          ( Ian Romanick <ian.d.romanick@intel.com> )
    - fixed binding point calculations for non-packed SSBOs
v3:
    - rename 'total_num_array_elements' to 'aoa_size'
          ( Jason Ekstrand <jason@jlekstrand.net> )
    - rename 'boffset' to 'binding_stride'
          ( Alejandro PiƱeiro <apinheiro@igalia.com> )

Fixes: 8cf1333b "glsl: link uniform block arrays of arrays"
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109532
Reported-By: Ilia Mirkin <imirkin@alum.mit.edu>
Tested-by: Fritz Koenig <frkoenig@google.com>
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
src/compiler/glsl/link_uniform_block_active_visitor.cpp
src/compiler/glsl/link_uniform_block_active_visitor.h
src/compiler/glsl/link_uniform_blocks.cpp