Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


#ActualHodgman

Posted 26 October 2013 - 09:39 PM

Using GL_ANY_SAMPLES_PASSED may allow your driver to perform the more efficient test you're looking for

This isn't a solution for what I'm requesting. This will simply draw or not draw the entire thing based on a *previous* draw result. I need to not draw specific fragments based on a single fragment passing in *the same* draw call.
The only difference between samples-passed and any-samples-passed is that the first returns an integer counter of how many pixels passed the depth test, while the latter returns a Boolean indicating whether any pixels passed the depth test (basically, returning 'counter>0').

If the GPU is capable of short-circuiting a draw call as you're requesting, then using this 'any' version query is a hint to the driver that it should go ahead and perform this short-circuit optimization.

The any-conservative query is the same, but tells the driver that it's allowed to perform the test against the Hi-Z buffer instead of the Z buffer, which will be quicker but less accurate (may return true when the ground-truth answer is false).

So, mhagain has answered the original question perfectly ;-D

The other solutions of implementing an atomic test in the fragment shader will always be slower, because in a typical occlusion querying situation the fragment shader does absolutuely zero work anyway.

FWIW though, in my experience, GPU occlusion queries are a terrible solution for occlusion culling if you're after performance. I'd personally still recommend CPU based solutions...

#2Hodgman

Posted 26 October 2013 - 09:32 PM

Using GL_ANY_SAMPLES_PASSED may allow your driver to perform the more efficient test you're looking for

This isn't a solution for what I'm requesting. This will simply draw or not draw the entire thing based on a *previous* draw result. I need to not draw specific fragments based on a single fragment passing in *the same* draw call.
The only difference between samples-passed and any-samples-passed is that the first returns an integer counter of how many pixels passed the depth test, while the latter returns a Boolean indicating whether any pixels passed the depth test (basically, returning 'counter>0').

If the GPU is capable of short-circuiting a draw call as you're requesting, then using this 'any' version query is a hint to the driver that it should go ahead and perform this short-circuit optimization.

The any-conservative query is the same, but tells the driver that it's allowed to perform the test against the Hi-Z buffer instead of the Z buffer, which will be quicker but less accurate (may return true when the ground-truth answer is false).

#1Hodgman

Posted 26 October 2013 - 09:30 PM

Using GL_ANY_SAMPLES_PASSED may allow your driver to perform the more efficient test you're looking for

 This isn't a solution for what I'm requesting. This will simply draw or not draw the entire thing based on a *previous* draw result. I need to not draw specific fragments based on a single fragment passing in *the same* draw call.
The only difference between samples-passed and any-samples-passed is that the first returns an integer counter of how many pixels passed the depth test, while the latter returns a Boolean indicating whether any pixels passed the depth test.
If the GPU is calls of short-circuiting a draw call as you're requesting, then using this 'any' query is a hint to the driver that it should go ahead and perform this short-circuit optimization.

The any-conservative query is the same, but tells the driver that it's allowed to perform the test against the Hi-Z buffer instead of the Z buffer, which will be quicker but less accurate (may return true when the ground-truth answer is false).

PARTNERS