[Mesa-dev] Anonymous structure in uniform question

Grigori Goronzy greg at chown.ath.cx
Sun Nov 24 11:43:27 PST 2013


On 21.11.2013 21:50, f.josef at email.cz wrote:
> The problem is, that each anonymous structure gets its own unique type,
> without checking if such type already exists. It seems to me, that such
> code is somewhat in the gray area - the rest of OpenGL implementations
> doesn't seem to have a problem with this code (Intel on Win, OSX, Nvidia
> and AMD drivers in Win, OSX and Linux), which of course doesn't mean
> such a behavior is correct.
>

This should be allowed, according to GLSL (3.3) spec and grammar. It's 
just a bug/oversight in the linker, I guess. The GLSL linker already 
includes some special handling to match array types between stages. I 
added something similar for structs, see the attached patch. It's 
probably not the nicest approach (it duplicates some code from 
glsl_types.cpp), but seems to work fine. I don't really know the GLSL 
compiler/linker code, so YMMV. :)

Best regards
Grigori

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-WIP-fix-unnamed-struct-type-conflicts.patch
Type: text/x-patch
Size: 2336 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131124/31cf6e25/attachment-0001.bin>


More information about the mesa-dev mailing list