Vulkan: fix glGetQueryObject not flushing
glGetQueryObject* requires forward progress in the queue regardless of
whether we are waiting on the result or busy-looping over whether the
results are available. This commit calls flush() if the query has
pending work.
Additionally, this fixes a race condition where glGetQueryObject* may be
accessing a query whose corresponding batch has been submitted but not
yet executed. In such a case, the GPU may not have already reset the
query, so we have to wait on the fence of that batch to make sure the
query results are reliably available.
Bug: angleproject:2855
Change-Id: I977909c6526c0778a13722a8b8b73e54ad0202f6
Reviewed-on: https://chromium-review.googlesource.com/c/1279125
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/CommandGraph.h b/src/libANGLE/renderer/vulkan/CommandGraph.h
index 49769f6..f598fde 100644
--- a/src/libANGLE/renderer/vulkan/CommandGraph.h
+++ b/src/libANGLE/renderer/vulkan/CommandGraph.h
@@ -193,12 +193,13 @@
// Called when 'this' object changes, but we'd like to start a new command buffer later.
void finishCurrentCommands(RendererVk *renderer);
+ // Get the current queue serial for this resource. Used to release resources, and for
+ // queries, to know if the queue they are submitted on has finished execution.
+ Serial getStoredQueueSerial() const;
+
protected:
explicit CommandGraphResource(CommandGraphResourceType resourceType);
- // Get the current queue serial for this resource. Only used to release resources.
- Serial getStoredQueueSerial() const;
-
private:
void startNewCommands(RendererVk *renderer, CommandGraphNodeFunction function);