Skip to content

anv: Properly fetch the results of unavailable occlusion queries

Brian Ho requested to merge brkho/mesa:anv-fix into master

This patch series fixes fetching occlusion query results via vkCmdCopyQueryPoolResults and vkGetQueryPoolResults when the query is not yet available.

  • For vkGetQueryPoolResults, the Vulkan spec states that the return value for an unavailable query with the PARTIAL_BIT flag set should be an "intermediate result value between zero and the final result value". Currently, anv returns slot.end - slot.begin, but in the case of unavailable queries, slot.end is still at the initial value of 0. If slot.begin is non-zero, the occlusion count underflows to a value that is likely outside the acceptable range of the partial result.
  • For vkCmdCopyQueryPoolResults, there is no special handling of unavailable queries at all, so anv always writes slot.end - slot.begin into the output buffer. According to the Vulkan spec, we should return an intermediate value if the PARTIAL_BIT flag is set and if not, skip writing into the buffer altogether.

In this fix, I use MI_PREDIACTE with MI_STORE_REGISTER_MEM to store the results of a query predicated by its availability status. I'm not too familiar with Intel, but is there a cleaner way of conditionally executing a store that doesn't require Haswell+?

Merge request reports