OSDN Git Service

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)
committerDylan Baker <dylan@pnwbakers.com>
Tue, 7 Jan 2020 17:20:50 +0000 (09:20 -0800)
commite87b10088022e525f4209ef3be12b9dcb2c197ef
treefe2562201f59b6e0b9f17affa3e7b59af3f416a6
parent9f1782854e0e25e50379903ae0c363be369133cc
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>
(cherry picked from commit 4beb0a23088e68693e94599ef36eb41cbcd59289)
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