From afc1663f85bcd686b1f102892e630dc21542b1fd Mon Sep 17 00:00:00 2001 From: Ricardo Garcia Date: Wed, 20 Mar 2019 14:15:44 +0100 Subject: [PATCH] Fix occlusion query example visual glitch In the occlusion query example, uniform buffers containing visibility flags are only updated when the view changes, and visibility information is calculated from occlusion queries coming from the previous frame. This means a quick mouse movement can produce a visual glitch by which the number of visible fragments becomes zero (and this is correctly reflected in the UI overlay) but the color of the model remains unchanged, or vice versa, until the view is changed again with the mouse. To fix this, update uniform buffers before preparing every frame as part of the draw() method. --- examples/occlusionquery/occlusionquery.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/occlusionquery/occlusionquery.cpp b/examples/occlusionquery/occlusionquery.cpp index f4305702..4a31a622 100644 --- a/examples/occlusionquery/occlusionquery.cpp +++ b/examples/occlusionquery/occlusionquery.cpp @@ -273,6 +273,7 @@ public: void draw() { + updateUniformBuffers(); VulkanExampleBase::prepareFrame(); submitInfo.commandBufferCount = 1; @@ -594,11 +595,6 @@ public: draw(); } - virtual void viewChanged() - { - updateUniformBuffers(); - } - virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay) { if (overlay->header("Occlusion query results")) { @@ -609,4 +605,4 @@ public: }; -VULKAN_EXAMPLE_MAIN() \ No newline at end of file +VULKAN_EXAMPLE_MAIN()