anv: Properly fetch the results of unavailable occlusion queries
This patch series fixes fetching occlusion query results via
vkGetQueryPoolResults when the query is not yet available.
vkGetQueryPoolResults, the Vulkan spec states that the return value for an unavailable query with the
PARTIAL_BITflag 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.endis still at the initial value of 0. If
slot.beginis non-zero, the occlusion count underflows to a value that is likely outside the acceptable range of the partial result.
vkCmdCopyQueryPoolResults, there is no special handling of unavailable queries at all, so anv always writes
slot.end - slot.begininto the output buffer. According to the Vulkan spec, we should return an intermediate value if the
PARTIAL_BITflag is set and if not, skip writing into the buffer altogether.
In this fix, I use
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+?