I have a situation where a number of values are guaranteed to be the same across all items in work group. In addition, theses values come from memory loads. What I would like is a decorator on a variable that tells the shader compiler implementation that it can assume a value is the same across an entire work group. The gain I hope to achieve is that then less registers are used and most importantly, memory reads are not duplicated across all SIMD lanes.
There is a way to emulate this by use/abuse of
GL_ARB_shader_ballot; however it is still quite awkward and because the value of
gl_SubGroupSizeARB is not known until after the shader shader compiles it introduces a great deal of awkwardness.
One way to think of this is that quite often in vertex/fragment shader pair, a vertex shader would do some memory loads and push those values down to the fragment shader via a varying. This would make it avoid the memory load across a primitive. I have a number of examples where this made a significant difference in performance. This is the motivation for the request: to avoid repeating the same memory load operation within a work group.