[Mesa-dev] The ARB_shader_subroutine extension

Ian Romanick idr at freedesktop.org
Tue Nov 18 10:51:21 PST 2014


On 11/16/2014 08:31 AM, Gustaw Smolarczyk wrote:
> Hello once again,
> 
> This time, I would like to ask about the shader subroutine extension.
> I believe this extension is not very popular, but is still needed for
> GL4 compliance.
> 
> What is the reason for its unpopularity?
> Is it because one needs to reset subroutine uniform values after any glUse*?
> Or it just didn't provide enough value?
> Wouldn't it be good to implement uber-shaders (especially using
> subroutine uniform array)?

It has a very strong negative affect on register allocation.  Basically,
the compiler has to, at the very least, allocate registers for the
"worst" subroutine.  This means that subroutines that use fewer
registers will often perform worse (on some GPUs much, much worse) than
they should.  On Intel GPUs this means that you might just get SIMD8 for
a shader that could have had SIMD16.  I've been told that on AMD GPUs it
means you have much fewer vertices or pixels executing in parallel
leading to dramatic performance hits.

> Is anybody actively working on it? I guess, there are changes needed
> in the GLSL compiler. It could be easily lowered to a
> switch-on-uniform-int thing, or something like that, if only
> compliance to the GL4 matters and not the performance.
> 
> Regards,
> Gustaw
> _______________________________________________
> 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