Occlusion queries track the number of samples that pass the per-fragment
tests for a set of drawing commands. As such, occlusion queries are only
available on queue families supporting graphics operations. The application
can then use these results to inform future rendering decisions. An
occlusion query is begun and ended by calling vkCmdBeginQuery
and
vkCmdEndQuery
, respectively. When an occlusion query begins, the count
of passing samples always starts at zero. For each drawing command, the
count is incremented as described in Sample Counting. If flags
does not contain
VK_QUERY_CONTROL_PRECISE_BIT
an implementation may generate any
non-zero result value for the query if the count of passing samples is
non-zero.
![]() | Note |
---|---|
Not setting |
When an occlusion query finishes, the result for that query is marked
as available. The application can then either copy the result to a buffer
(via vkCmdCopyQueryPoolResults
) or request it be put into host memory
(via vkGetQueryPoolResults
).
![]() | Note |
---|---|
If occluding geometry is not drawn first, samples can pass the depth test, but still not be visible in a final image. |