Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Adept I

GLSL hardware PCF code generation issue

I'm experiencing a performance concern when implementing shadow PCF in GLSL - it seems that for every call to texture(), the compiler emits a branch between IMAGE_SAMPLE and IMAGE_SAMPLE_C, presumably depending on the sampler params.

This would be fair enough if there was only 1 call to texture(), but I'm implementing a 4x4 box filter (excluding the hardware 2x2), so this results in 32 branches(!)

You can see what I mean below, this pattern of 2 branches and the various boilerplate to query the sampler state repeats 16 times. Definitely not good for performance.


For GLSL to reproduce the issue, see this example:

So my question is: is there any hint I can give the compiler that the shadow map sampler will always be compatible with IMAGE_SAMPLE_C?

0 Replies