From cb837597c352273e506c816a340dc54520be45f9 Mon Sep 17 00:00:00 2001 From: assiduous Date: Sun, 5 Jan 2020 20:32:20 -0800 Subject: Implemented queries in Vulkan (closed https://github.com/DiligentGraphics/DiligentCore/issues/25) --- Graphics/GraphicsEngine/include/DeviceContextBase.h | 6 ++++++ Graphics/GraphicsEngine/interface/DeviceContext.h | 2 +- Graphics/GraphicsEngine/interface/GraphicsTypes.h | 12 +++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/include/DeviceContextBase.h b/Graphics/GraphicsEngine/include/DeviceContextBase.h index f7b94118..02e564af 100644 --- a/Graphics/GraphicsEngine/include/DeviceContextBase.h +++ b/Graphics/GraphicsEngine/include/DeviceContextBase.h @@ -910,6 +910,12 @@ inline bool DeviceContextBase::BeginQuery(I return false; } + if (pQuery->GetDesc().Type == QUERY_TYPE_TIMESTAMP) + { + LOG_ERROR_MESSAGE("BeginQuery() is disabled for timestamp queries. Call EndQuery() to set the timestamp."); + return false; + } + if (!ValidatedCast(pQuery)->OnBeginQuery(this)) return false; diff --git a/Graphics/GraphicsEngine/interface/DeviceContext.h b/Graphics/GraphicsEngine/interface/DeviceContext.h index 628f88ea..f08e2128 100644 --- a/Graphics/GraphicsEngine/interface/DeviceContext.h +++ b/Graphics/GraphicsEngine/interface/DeviceContext.h @@ -1014,7 +1014,7 @@ public: /// /// \remarks Only immediate context can begin a query. /// - /// \warning OpenGL does not support nested queries of the same type. + /// \warning OpenGL and Vulkan do not support nested queries of the same type. virtual void BeginQuery(IQuery* pQuery) = 0; diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h index b5ce083c..561b8fd8 100644 --- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h +++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h @@ -1462,7 +1462,7 @@ namespace Diligent /// global dynamic heap manager to avoid page creation at run time. Uint32 NumDynamicHeapPagesToReserve = 1; - /// The size of query pool for each query type. + /// Query pool size for each query type. Uint32 QueryPoolSizes[5] = { 0, // Ignored @@ -1594,6 +1594,16 @@ namespace Diligent /// Size of the memory chunk suballocated by immediate/deferred context from /// the global dynamic heap to perform lock-free dynamic suballocations Uint32 DynamicHeapPageSize = 256 << 10; + + /// Query pool size for each query type. + Uint32 QueryPoolSizes[5] = + { + 0, // Ignored + 128, // QUERY_TYPE_OCCLUSION + 128, // QUERY_TYPE_BINARY_OCCLUSION + 512, // QUERY_TYPE_TIMESTAMP + 128 // QUERY_TYPE_PIPELINE_STATISTICS + }; }; -- cgit v1.2.3