Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
    
I can't link the reference, but by my experience its as if all of them were inlined. –  akaltar Jul 17 '13 at 18:53
    
Don't you mean functions? They are inlined indeed. GLSL subroutines are a different concept. –  plasmacel Jul 17 '13 at 19:02
    
GLSL subroutines are like function pointers in C++. You can change the functionality of shaders from the host application without to recompile them. –  plasmacel Jul 17 '13 at 19:09
    
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. –  Sean Middleditch Jul 18 '13 at 1:07
    
Sorry, I indeed mixed up subroutines and functions. –  akaltar Jul 18 '13 at 9:56
add comment

1 Answer

up vote -1 down vote accepted

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

I think it will be useful for others too.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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