[Mesa-dev] [Bug 106915] [GLSL] Unused arrays declared without a size should be handled like arrays of size 1.

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Jun 27 22:54:29 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=106915

--- Comment #11 from Ian Romanick <idr at freedesktop.org> ---
(In reply to Jason Ekstrand from comment #3)
> I really hate it, but I fear they may be allowed.  From the GLSL 4.60 spec
> in the section on UBO and SSBO layouts:
> 
> > The shared qualifier overrides only the std140, std430, and packed
> > qualifiers; other qualifiers are inherited. The compiler/linker will
> > ensure that multiple programs and programmable stages containing this
> > definition will share the same memory layout for this block, as long
> > as all arrays are declared with explicit sizes and all matrices have
> > matching row_major and/or column_major qualifications (which may come
> > from a declaration outside the block definition).
> 
> I really wish I hadn't found this text and I think it's silly but there it
> is.

I think I finally understand what you were getting at here.  I noticed a note
in the revision history of ARB_shader_storage_buffer_objects that relates to
this:

    Revision 9, May 7, 2012 (pbrown)
      - Allow the use of the .length() method on unsized and implicitly sized 
        arrays.  For unsized arrays in shader storage blocks, .length() will
        be computed from the size of the associated buffer object.  For
        implicitly sized arrays, .length() will be determined at link time.

Your point, I think, was that the text you quoted would only need to
specifically mention explicitly sized arrays if implicitly sized arrays are
also possible.

I think I now also understand why all three desktop vendors implemented things
this way.  The same extension spec also says:

    (add a new paragraph to end of the section, at the bottom of p. 30) In a
    shader storage block, the last member may be declared without an explicit
    size.  In this case, the effective array size is inferred at run-time from
    the size of the data store backing the interface block.  Such unsized
    arrays may be indexed with general integer expressions, but may not be
    passed as an argument to a function or indexed with a negative constant
    expression.

I think everyone processed that first sentence as, "In a shader storage block,
ONLY the last member may be declared without an explicit size."

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180627/5a211b78/attachment.html>


More information about the mesa-dev mailing list