Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do functions have a performance penalty in GLSL?

Do functions have a performance penalty in GLSL (especially on iOS and Android implementations)?

Under performance penalty I imply additional time necessary for function invocation.

like image 379
givi Avatar asked Sep 14 '25 03:09

givi


1 Answers

This depends on how the function is used. If it's written in a way that it can be inlined by the compiler, then there's no penality. If however the function can not be inlined, then of course there's a bit of overhead. However a simple texture access is already more expensive than a function call, so I wouldn't bother about it. GLSL compilers, fortunately, have become quite capable.

like image 119
datenwolf Avatar answered Sep 16 '25 17:09

datenwolf