[Mesa-dev] Seeking information about commit 586b4b50 (glsl: Also update implicit sizes of varyings at link time)

Fabian Bieler fabianbieler at fastmail.fm
Mon Jun 10 16:25:03 PDT 2013


Hello!

I'm obviously no expert for this code but as far as I understand it this was supposed to resize the zero length built-in arrays when they are not redeclared by the user (and only indexed with constant expressions).

However, the later commit
6f53921 linker: Ensure that unsized arrays have a size after linking
also fixes this issue during intra-stage linking.

On the other hand update_array_sizes additionally ensures that built-in varying arrays have the same size across stages.
(from the GLSL 1.1 spec page 99 (page 105 of the PDF):
    "Multiple modules can declare it [gl_TexCoord] with different sizes, the
    maximum will be used at link time.")
Without the patch, corresponding shader outputs and inputs don't necessarily have the same size (I have no idea if a driver might take offense to that, though).

Fabian

On 2013-06-10 23:55, Paul Berry wrote:
> The full commit message is this:
> 
> commit 586b4b500fed64fb724beb3753bc190cd1c676e0
> Author: Eric Anholt <eric at anholt.net <mailto:eric at anholt.net>>
> Date:   Tue Sep 28 14:32:16 2010 -0700
> 
>     glsl: Also update implicit sizes of varyings at link time.
>    
>     Otherwise, we'll often end up with gl_TexCoord being 0 length, for
>     example.  With ir_to_mesa, things ended up working out anyway, as long
>     as multiple implicitly-sized arrays weren't involved.
> 
> Unfortunately, this commit assumes that vertex shader outputs and fragment shader inputs can be matched up by simply searching for variables with common names in all shaders.  That's not going to be safe in the presence of geometry shaders or interface blocks.
> 
> I tried reverting* the commit and didn't get any piglit failures.  Is it still needed?  I'm having trouble understanding the problem it's trying to solve (in what circumstances would we have ended up with gl_TexCoord being 0 length?)
> 
> *Note: because of merge conflicts I couldn't revert the patch directly, but I did the moral equivalent by restoring the if test in update_array_sizes() to its initial form.  My experiment can be found in branch "revert-update-array-sizes" of git://github.com/stereotype441/mesa.git <http://github.com/stereotype441/mesa.git>
> 
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 



More information about the mesa-dev mailing list