3
\$\begingroup\$

There's not too much deep information about them on the web.

How are they implemented and how they work under the hood? I'd like to know that they cause any performance overhead or not, especially in the case of multiple subroutines to decide what's the best practice to create different versions of shaders: subroutines or separate shaders.

Any info or advice?

\$\endgroup\$
  • \$\begingroup\$ I can't link the reference, but by my experience its as if all of them were inlined. \$\endgroup\$ – akaltar Jul 17 '13 at 18:53
  • \$\begingroup\$ Don't you mean functions? They are inlined indeed. GLSL subroutines are a different concept. \$\endgroup\$ – plasmacel Jul 17 '13 at 19:02
  • \$\begingroup\$ GLSL subroutines are like function pointers in C++. You can change the functionality of shaders from the host application without to recompile them. \$\endgroup\$ – plasmacel Jul 17 '13 at 19:09
  • \$\begingroup\$ They're equivalent functionality to HLSL Shader Model 5.0 Interfaces, for which there is slightly more information available. Might help you find what you're looking for. In general, though, just profile and find out; whether they're super slow might depend on your target driver, hardware, etc. \$\endgroup\$ – Sean Middleditch Jul 18 '13 at 1:07
  • \$\begingroup\$ Sorry, I indeed mixed up subroutines and functions. \$\endgroup\$ – akaltar Jul 18 '13 at 9:56
-1
\$\begingroup\$

Meanwhile I get a nice detailed answer from the OpenGL Forum here.

I think it will be useful for others too.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.