vkGetQueryPoolResults returns incorrect values when VK_QUERY_RESULT_PARTIAL_BIT is set

This function does not work as expected when the following conditions are met:

  1. The query has been used before and a non-zero result was ‘stored’ in it.
  2. The query was reset later using vkCmdResetQueryPool.
  3. A new occlusion query was made and the final result shall be fully occluded (0).
  4. While the query is not yet ready, vkGetQueryPoolResults is called with VK_QUERY_RESULT_PARTIAL_BIT.

In this case, step 4 seemingly writes the result from step 1 into result. While in this case the query is yet to be processed, it has been reset. The vulkan spec says anything written into the result would be between 0 and the final result but the result is fully occluded, hence any partials should have been 0. This is very easy to work around with the RESULT_WAIT flag but I thought it would be good to report anyway.