Home

Search IconIcon to open search

GLSL compilation

The compiler usually tries to unroll loops for performance gain, but if there are too many cycles, the code can get too long and overwhelm the GPU. Or sometimes slow down the compilation. You can prevent this by tricking the compiler and throwing non-constants to the loop conditions. Example:

1
2
3
4
5
#define ZERO (min(iFrame,0))
for( int i=ZERO; i<24; i++ )
{
	...
}

# Useful