From aae8c180cbbf91ba12f53c37e81a97d4b3cc4ccd Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Tue, 26 Nov 2019 18:52:15 -0300 Subject: gl_query_cache: Implement host queries using a deferred cache Instead of waiting immediately for executed commands, defer the query until the guest CPU reads it. This way we get closer to what the guest program is doing. To archive this we have to build a dependency queue, because host APIs (like OpenGL and Vulkan) use ranged queries instead of counters like NVN. Waiting for queries implicitly uses fences and this requires a command being queued, otherwise the driver will lock waiting until a timeout. To fix this when there are no commands queued, we explicitly call glFlush. --- src/video_core/rasterizer_interface.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/video_core/rasterizer_interface.h') diff --git a/src/video_core/rasterizer_interface.h b/src/video_core/rasterizer_interface.h index 2fc627539..a394f2d3e 100644 --- a/src/video_core/rasterizer_interface.h +++ b/src/video_core/rasterizer_interface.h @@ -20,6 +20,7 @@ namespace VideoCore { enum class QueryType { SamplesPassed, }; +constexpr std::size_t NumQueryTypes = 1; enum class LoadCallbackStage { Prepare, @@ -48,8 +49,8 @@ public: /// Resets the counter of a query virtual void ResetCounter(QueryType type) = 0; - /// Returns the value of a GPU query - virtual u64 Query(QueryType type) = 0; + /// Records a GPU query and caches it + virtual void Query(GPUVAddr gpu_addr, QueryType type) = 0; /// Notify rasterizer that all caches should be flushed to Switch memory virtual void FlushAll() = 0; -- cgit v1.2.3