On Tue, Aug 18, 2015 at 9:56 AM, Kenneth Graunke <kenn...@whitecape.org> wrote: > Hey, > > I was thinking about using an anonymous union. Specifically, something > like: > > struct shader { > ... > union { > struct geometry_shader_info gs; > struct tess_eval_shader_info tes; > ... > }; > }; > > Are those acceptable in Mesa? I don't think we've traditionally used > them, but I'm not sure why. Apparently they're part of C11, though not > part of C99. However, GCC allows them, presumably Clang, and it looks > like MSVC 2005 supports them in C: > > https://msdn.microsoft.com/en-us/library/y9zewe0d%28v=vs.80%29.aspx > > We might be able to use these to avoid some of our fun > thing->base.Base.base.program.Base.base shenanigans... > > --Ken > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev >
Well, we already use anonymous unions in various places in NIR (for example, the definition of nir_dest and nir_src), so they should be ok for core Mesa. IIRC there was a problem with combining anonymous unions and C99-style initializers, but it doesn't sound like you'll be too worried about that. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev