My advice is: The shader being compiled should be analyzed before compilation and an array of bool flags (or one uint16_t for all flags) should be produced saying which sampler units use TG4. Then, you only need to set the swizzle in the key for the i-th sampler if the i-th sampler is really used by TG4.
The shader analysis can be done in tgsi_scan_shader, which should be pretty trivial. However, this won't work with GL4 sampler arrays and indirect addressing of those arrays, so.... well, if I were you, I would probably ignore the ZERO and ONE swizzle cases and just put up with the fact some piglit tests will always fail. That's the only use of the tg4_swizzle array as far as I can see, so it can be removed. Marek On Mon, Jul 14, 2014 at 11:27 PM, Dave Airlie <airl...@gmail.com> wrote: >>> Also, have you looked at Dave Airlie's impl? Not sure what's been >>> going on there... >>> http://cgit.freedesktop.org/~airlied/mesa/log/?h=r600g-texture-gather >>> . He seemed to enable 4 components for >= CEDAR. >>> >> >> No, didn't pop up when i searched the archives for any prior work on this. >> Interesting! It looks like the GL_ARB_texture_gather portion in that branch >> is almost exactly equivalent to my patch. >> >> It also has some of the additional parts needed for GL_ARB_gpu_shader5 such >> as non-constant offsets, but i don't see where it would trigger shader >> recompiles if texture sampler swizzle changes? Does it pass piglit? >> >> >> David, any opinions on how to move forward with this feature? > > I didn't like my implementation sufficiently to push it forward, but I > think the main thing > was the extra key changes, I meant to get Marek's input on that code, > but then it fell > off my radar. So get input from Marek, repost and merge :) > > Dave. > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev