Go to the documentation of this file.
44 template <
typename EngineImplTraits>
45 class QueryBase :
public DeviceObjectBase<typename EngineImplTraits::QueryInterface, typename EngineImplTraits::RenderDeviceImplType, QueryDesc>
71 bool bIsDeviceInternal =
false) :
74 const auto& deviceFeatures = pDevice->GetDeviceCaps().Features;
79 if (!deviceFeatures.OcclusionQueries)
84 if (!deviceFeatures.BinaryOcclusionQueries)
89 if (!deviceFeatures.TimestampQueries)
94 if (!deviceFeatures.PipelineStatisticsQueries)
99 if (!deviceFeatures.DurationQueries)
113 "' that is in querying state. End the query before releasing it.");
127 "BeginQuery cannot be called on timestamp query '", this->m_Desc.Name,
128 "'. Call EndQuery to set the timestamp.");
131 "Attempting to begin query '", this->
m_Desc.
Name,
132 "' twice. A query must be ended before it can be begun again.");
143 "Attempting to end query '", this->
m_Desc.
Name,
"' that has not been begun.");
149 "Ending query '", this->m_Desc.Name,
"' that has not been begun.");
168 "Attempting to get data of query '", this->
m_Desc.
Name,
"' that has not been ended.");
170 if (pData !=
nullptr)
178 UNEXPECTED(
"Undefined query type is unexpected.");
183 "The size of query data (", DataSize,
") is incorrect: ",
sizeof(
QueryDataOcclusion),
" (aka sizeof(QueryDataOcclusion)) is expected.");
188 "The size of query data (", DataSize,
") is incorrect: ",
sizeof(
QueryDataBinaryOcclusion),
" (aka sizeof(QueryDataBinaryOcclusion)) is expected.");
193 "The size of query data (", DataSize,
") is incorrect: ",
sizeof(
QueryDataTimestamp),
" (aka sizeof(QueryDataTimestamp)) is expected.");
198 "The size of query data (", DataSize,
") is incorrect: ",
sizeof(
QueryDataPipelineStatistics),
" (aka sizeof(QueryDataPipelineStatistics)) is expected.");
203 "The size of query data (", DataSize,
") is incorrect: ",
sizeof(
QueryDataDuration),
" (aka sizeof(QueryDataDuration)) is expected.");
Base interface for a reference counter object that stores the number of strong and weak references an...
Definition: ReferenceCounters.h:44
#define LOG_ERROR_MESSAGE(...)
Definition: Errors.hpp:122
Binary occlusion query data. This structure is filled by IQuery::GetData() for Diligent::QUERY_TYPE_B...
Definition: Query.h:57
#define LOG_ERROR_AND_THROW(...)
Definition: Errors.hpp:101
Query description.
Definition: Query.h:150
Timestamp query data. This structure is filled by IQuery::GetData() for Diligent::QUERY_TYPE_TIMESTAM...
Definition: Query.h:70
#define UNEXPECTED(...)
Definition: DebugUtilities.hpp:77
void OnBeginQuery(struct IDeviceContext *pContext)
Definition: QueryBase.hpp:124
QueryDesc m_Desc
Object description.
Definition: DeviceObjectBase.hpp:182
QueryState
Definition: QueryBase.hpp:54
QueryState GetState() const
Definition: QueryBase.hpp:160
typename EngineGLImplTraits ::RenderDeviceImplType RenderDeviceImplType
Definition: QueryBase.hpp:52
#define DEV_CHECK_ERR(...)
Definition: DebugUtilities.hpp:90
Occlusion query data. This structure is filled by IQuery::GetData() for Diligent::QUERY_TYPE_OCCLUSIO...
Definition: Query.h:44
@ QUERY_TYPE_BINARY_OCCLUSION
Acts like QUERY_TYPE_OCCLUSION except that it returns simply a binary true/false result: false indica...
Definition: GraphicsTypes.h:1458
~QueryBase()
Definition: QueryBase.hpp:108
enum QUERY_TYPE Type
Query type, see Diligent::QUERY_TYPE.
Definition: Query.h:153
#define IMPLEMENT_QUERY_INTERFACE_IN_PLACE(InterfaceID, ParentClassName)
Definition: ObjectBase.hpp:59
Template class that implements reference counting.
Definition: RefCntAutoPtr.hpp:73
#define DILIGENT_CALL_TYPE
Definition: CommonDefinitions.h:45
QueryBase(IReferenceCounters *pRefCounters, RenderDeviceImplType *pDevice, const QueryDesc &Desc, bool bIsDeviceInternal=false)
Definition: QueryBase.hpp:68
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
@ QUERY_TYPE_DURATION
Gets the number of high-frequency counter ticks between IDeviceContext::BeginQuery and IDeviceContext...
Definition: GraphicsTypes.h:1470
QueryState m_State
Definition: QueryBase.hpp:215
Duration query data. This structure is filled by IQuery::GetData() for Diligent::QUERY_TYPE_DURATION ...
Definition: Query.h:132
@ QUERY_TYPE_UNDEFINED
Query type is undefined.
Definition: GraphicsTypes.h:1449
@ QUERY_TYPE_NUM_TYPES
The number of query types in the enum.
Definition: GraphicsTypes.h:1473
@ QUERY_TYPE_OCCLUSION
Gets the number of samples that passed the depth and stencil tests in between IDeviceContext::BeginQu...
Definition: GraphicsTypes.h:1453
Pipeline statistics query data. This structure is filled by IQuery::GetData() for Diligent::QUERY_TYP...
Definition: Query.h:88
void CheckQueryDataPtr(void *pData, Uint32 DataSize)
Definition: QueryBase.hpp:165
Device context interface.
Definition: DeviceContext.h:1460
typename EngineGLImplTraits ::QueryInterface BaseInterface
Definition: QueryBase.hpp:49
QUERY_TYPE
Query type.
Definition: GraphicsTypes.h:1446
virtual void Invalidate() override
Definition: QueryBase.hpp:119
@ QUERY_TYPE_TIMESTAMP
Gets the GPU timestamp corresponding to IDeviceContext::EndQuery call. Fot this query type IDeviceCon...
Definition: GraphicsTypes.h:1462
RefCntAutoPtr< IDeviceContext > m_pContext
Definition: QueryBase.hpp:213
@ QUERY_TYPE_PIPELINE_STATISTICS
Gets pipeline statistics, such as the number of pixel shader invocations in between IDeviceContext::B...
Definition: GraphicsTypes.h:1466
const Char * Name
Object name.
Definition: GraphicsTypes.h:1199
Template class implementing base functionality of the device object.
Definition: DeviceObjectBase.hpp:45
void OnEndQuery(IDeviceContext *pContext)
Definition: QueryBase.hpp:138
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
DeviceObjectBase< BaseInterface, RenderDeviceImplType, QueryDesc > TDeviceObjectBase
Definition: QueryBase.hpp:61
Template class implementing base functionality of the query object.
Definition: QueryBase.hpp:45