From a8fd4dbc7958c5a9c52652a65df80e691079f1c7 Mon Sep 17 00:00:00 2001 From: Petros Bantolas Date: Mon, 16 May 2016 11:19:02 +0100 Subject: [PATCH] Adjust occlusionquery according to Vulkan spec. This moves vkCmdCopyQueryPoolResults outside of the Renderpass, as it should be according to the Vulkan spec. This understanably has looks wrong on the first frame, but by doing this you avoid having to use two renderpasses to get the occlusion result. --- occlusionquery/occlusionquery.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/occlusionquery/occlusionquery.cpp b/occlusionquery/occlusionquery.cpp index 158f259f..758c4a5c 100644 --- a/occlusionquery/occlusionquery.cpp +++ b/occlusionquery/occlusionquery.cpp @@ -261,17 +261,6 @@ public: vkCmdEndQuery(drawCmdBuffers[i], queryPool, 1); - // Query results - vkCmdCopyQueryPoolResults( - drawCmdBuffers[i], - queryPool, - 0, - 2, - queryResult.buffer, - 0, - sizeof(uint64_t), - VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT); - // Visible pass // Clear color and depth attachments VkClearAttachment clearAttachments[2] = {}; @@ -318,6 +307,17 @@ public: vkCmdEndRenderPass(drawCmdBuffers[i]); + // Query results + vkCmdCopyQueryPoolResults( + drawCmdBuffers[i], + queryPool, + 0, + 2, + queryResult.buffer, + 0, + sizeof(uint64_t), + VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT); + err = vkEndCommandBuffer(drawCmdBuffers[i]); assert(!err); } @@ -748,4 +748,4 @@ int main(const int argc, const char *argv[]) #if !defined(__ANDROID__) return 0; #endif -} \ No newline at end of file +}