diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-08-25 04:52:38 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-08-25 04:52:38 +0000 |
| commit | 414fa5ee38e2055b41883fc9a8ecb42ec1483f6d (patch) | |
| tree | dedddbea70658e301d06efc401eaabfc35e24920 /Graphics/GraphicsEngine | |
| parent | Added QUERY_TYPE_DURATION value and QueryDataDuration struct (diff) | |
| download | DiligentCore-414fa5ee38e2055b41883fc9a8ecb42ec1483f6d.tar.gz DiligentCore-414fa5ee38e2055b41883fc9a8ecb42ec1483f6d.zip | |
Implemented duration queries in D3D11 backend; added duration query test
Diffstat (limited to 'Graphics/GraphicsEngine')
| -rw-r--r-- | Graphics/GraphicsEngine/include/QueryBase.hpp | 15 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/interface/DeviceCaps.h | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/Graphics/GraphicsEngine/include/QueryBase.hpp b/Graphics/GraphicsEngine/include/QueryBase.hpp index 322fbf54..5b066b29 100644 --- a/Graphics/GraphicsEngine/include/QueryBase.hpp +++ b/Graphics/GraphicsEngine/include/QueryBase.hpp @@ -69,6 +69,7 @@ public: TDeviceObjectBase{pRefCounters, pDevice, Desc, bIsDeviceInternal} { const auto& deviceFeatures = pDevice->GetDeviceCaps().Features; + static_assert(QUERY_TYPE_NUM_TYPES == 6, "Not all QUERY_TYPE enum values are handled below"); switch (Desc.Type) { case QUERY_TYPE_OCCLUSION: @@ -91,6 +92,11 @@ public: LOG_ERROR_AND_THROW("Pipeline statistics queries are not supported by this device"); break; + case QUERY_TYPE_DURATION: + if (!deviceFeatures.DurationQueries) + LOG_ERROR_AND_THROW("Duration queries are not supported by this device"); + break; + default: UNEXPECTED("Unexpected device type"); } @@ -185,6 +191,7 @@ public: return false; } + static_assert(QUERY_TYPE_NUM_TYPES == 6, "Not all QUERY_TYPE enum values are handled below"); switch (this->m_Desc.Type) { case QUERY_TYPE_UNDEFINED: @@ -223,6 +230,14 @@ public: } break; + case QUERY_TYPE_DURATION: + if (DataSize != sizeof(QueryDataDuration)) + { + LOG_ERROR_MESSAGE("The size of query data (", DataSize, ") is incorrect: ", sizeof(QueryDataDuration), " (aka sizeof(QueryDataDuration)) is expected"); + return false; + } + break; + default: UNEXPECTED("Unexpected query type"); return false; diff --git a/Graphics/GraphicsEngine/interface/DeviceCaps.h b/Graphics/GraphicsEngine/interface/DeviceCaps.h index 1f0dc257..efb657df 100644 --- a/Graphics/GraphicsEngine/interface/DeviceCaps.h +++ b/Graphics/GraphicsEngine/interface/DeviceCaps.h @@ -136,6 +136,9 @@ struct DeviceFeatures /// Indicates if device supports pipeline statistics queries (see Diligent::QUERY_TYPE_PIPELINE_STATISTICS). Bool PipelineStatisticsQueries DEFAULT_INITIALIZER(False); + /// Indicates if device supports duration queries (see Diligent::QUERY_TYPE_DURATION). + Bool DurationQueries DEFAULT_INITIALIZER(False); + /// Indicates if device supports depth bias clamping Bool DepthBiasClamp DEFAULT_INITIALIZER(False); |
