Diligent Engine  v.2.4.g
Query.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2021 Diligent Graphics LLC
3  * Copyright 2015-2019 Egor Yusov
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * In no event and under no legal theory, whether in tort (including negligence),
18  * contract, or otherwise, unless required by applicable law (such as deliberate
19  * and grossly negligent acts) or agreed to in writing, shall any Contributor be
20  * liable for any damages, including any direct, indirect, special, incidental,
21  * or consequential damages of any character arising as a result of this License or
22  * out of the use or inability to use the software (including but not limited to damages
23  * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
24  * all other commercial damages or losses), even if such Contributor has been advised
25  * of the possibility of such damages.
26  */
27 
28 #pragma once
29 
32 
33 #include "DeviceObject.h"
34 #include "GraphicsTypes.h"
35 
37 
38 // {70F2A88A-F8BE-4901-8F05-2F72FA695BA0}
39 static const INTERFACE_ID IID_Query =
40  {0x70f2a88a, 0xf8be, 0x4901, {0x8f, 0x5, 0x2f, 0x72, 0xfa, 0x69, 0x5b, 0xa0}};
41 
45 {
48 
52 };
54 
58 {
61 
64  bool AnySamplePassed DEFAULT_INITIALIZER(0);
65 };
67 
71 {
74 
77 
81 };
83 
89 {
92 
94  Uint64 InputVertices DEFAULT_INITIALIZER(0);
95 
97  Uint64 InputPrimitives DEFAULT_INITIALIZER(0);
98 
100  Uint64 GSPrimitives DEFAULT_INITIALIZER(0);
101 
103  Uint64 ClippingInvocations DEFAULT_INITIALIZER(0);
104 
108  Uint64 ClippingPrimitives DEFAULT_INITIALIZER(0);
109 
111  Uint64 VSInvocations DEFAULT_INITIALIZER(0);
112 
114  Uint64 GSInvocations DEFAULT_INITIALIZER(0);
115 
117  Uint64 PSInvocations DEFAULT_INITIALIZER(0);
118 
120  Uint64 HSInvocations DEFAULT_INITIALIZER(0);
121 
123  Uint64 DSInvocations DEFAULT_INITIALIZER(0);
124 
126  Uint64 CSInvocations DEFAULT_INITIALIZER(0);
127 };
129 
133 {
136 
140 
144 };
146 
147 // clang-format off
148 
151 
154 
155 #if DILIGENT_CPP_INTERFACE
156  QueryDesc() noexcept {};
157 
158  explicit QueryDesc(QUERY_TYPE _Type) noexcept :
159  Type(_Type)
160  {}
161 #endif
162 };
163 typedef struct QueryDesc QueryDesc;
164 
165 #define DILIGENT_INTERFACE_NAME IQuery
166 #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
167 
168 #define IQueryInclusiveMethods \
169  IDeviceObjectInclusiveMethods; \
170  IQueryMethods Query
171 
172 // clang-format off
173 
175 
178 {
179 #if DILIGENT_CPP_INTERFACE
180  virtual const QueryDesc& METHOD(GetDesc)() const override = 0;
182 #endif
183 
185 
204  VIRTUAL bool METHOD(GetData)(THIS_
205  void* pData,
206  Uint32 DataSize,
207  bool AutoInvalidate DEFAULT_VALUE(true)) PURE;
208 
210  VIRTUAL void METHOD(Invalidate)(THIS) PURE;
211 };
213 
214 #include "../../../Primitives/interface/UndefInterfaceHelperMacros.h"
215 
216 #if DILIGENT_C_INTERFACE
217 
218 // clang-format off
219 
220 # define IQuery_GetDesc(This) (const struct QueryDesc*)IDeviceObject_GetDesc(This)
221 
222 # define IQuery_GetData(This, ...) CALL_IFACE_METHOD(Query, GetData, This, __VA_ARGS__)
223 # define IQuery_Invalidate(This) CALL_IFACE_METHOD(Query, Invalidate, This)
224 
225 // clang-format on
226 
227 #endif
228 
229 DILIGENT_END_NAMESPACE // namespace Diligent
DILIGENT_END_INTERFACE
#define DILIGENT_END_INTERFACE
Definition: DefineInterfaceHelperMacros.h:88
Diligent::INTERFACE_ID
struct INTERFACE_ID INTERFACE_ID
Definition: InterfaceID.h:54
VIRTUAL
#define VIRTUAL
Definition: DefineInterfaceHelperMacros.h:83
Diligent::QueryDataBinaryOcclusion
Binary occlusion query data. This structure is filled by IQuery::GetData() for Diligent::QUERY_TYPE_B...
Definition: Query.h:57
DILIGENT_BEGIN_INTERFACE
#define DILIGENT_BEGIN_INTERFACE(Name, Base)
Definition: CommonDefinitions.h:97
Diligent::QueryDesc
Query description.
Definition: Query.h:150
Diligent::Uint64
uint64_t Uint64
64-bit unsigned integer
Definition: BasicTypes.h:50
Diligent::QueryDataTimestamp
Timestamp query data. This structure is filled by IQuery::GetData() for Diligent::QUERY_TYPE_TIMESTAM...
Definition: Query.h:70
Diligent::QueryDesc::QueryDesc
QueryDesc(QUERY_TYPE _Type) noexcept
Definition: Query.h:158
Diligent::IDeviceObject
Base interface for all objects created by the render device Diligent::IRenderDevice.
Definition: DeviceObject.h:52
THIS
#define THIS
Definition: DefineInterfaceHelperMacros.h:81
Diligent::QueryDataOcclusion
Occlusion query data. This structure is filled by IQuery::GetData() for Diligent::QUERY_TYPE_OCCLUSIO...
Definition: Query.h:44
PURE
#define PURE
Definition: DefineInterfaceHelperMacros.h:85
Diligent::QUERY_TYPE_BINARY_OCCLUSION
@ 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
Diligent::DeviceObjectAttribs
Describes common device object attributes.
Definition: GraphicsTypes.h:1196
DILIGENT_END_NAMESPACE
#define DILIGENT_END_NAMESPACE
Definition: CommonDefinitions.h:86
DILIGENT_DERIVE
#define DILIGENT_DERIVE(TypeName)
Definition: CommonDefinitions.h:90
Diligent::QueryDesc::QueryDesc
QueryDesc() noexcept
Definition: Query.h:156
Type
const D3D12_PIPELINE_STATE_SUBOBJECT_TYPE Type
Definition: PipelineStateD3D12Impl.cpp:69
Diligent::Uint32
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
DEFAULT_INITIALIZER
#define DEFAULT_INITIALIZER(x)
Definition: CommonDefinitions.h:93
Diligent::QUERY_TYPE_DURATION
@ QUERY_TYPE_DURATION
Gets the number of high-frequency counter ticks between IDeviceContext::BeginQuery and IDeviceContext...
Definition: GraphicsTypes.h:1470
Diligent::QueryDataDuration
Duration query data. This structure is filled by IQuery::GetData() for Diligent::QUERY_TYPE_DURATION ...
Definition: Query.h:132
Diligent::QUERY_TYPE_UNDEFINED
@ QUERY_TYPE_UNDEFINED
Query type is undefined.
Definition: GraphicsTypes.h:1449
DeviceObject.h
Diligent::QUERY_TYPE_OCCLUSION
@ QUERY_TYPE_OCCLUSION
Gets the number of samples that passed the depth and stencil tests in between IDeviceContext::BeginQu...
Definition: GraphicsTypes.h:1453
Diligent::QueryDataPipelineStatistics
Pipeline statistics query data. This structure is filled by IQuery::GetData() for Diligent::QUERY_TYP...
Definition: Query.h:88
METHOD
#define METHOD(Name)
Definition: DefineInterfaceHelperMacros.h:87
DEFAULT_VALUE
#define DEFAULT_VALUE(x)
Definition: CommonDefinitions.h:99
Diligent::QUERY_TYPE
QUERY_TYPE
Query type.
Definition: GraphicsTypes.h:1446
Diligent::IQuery
Query interface.
Definition: Query.h:177
DILIGENT_BEGIN_NAMESPACE
#define DILIGENT_BEGIN_NAMESPACE(Name)
Definition: CommonDefinitions.h:82
GraphicsTypes.h
NumSamples
Uint32 NumSamples
Definition: DXBCUtils.cpp:82
Diligent::QUERY_TYPE_TIMESTAMP
@ QUERY_TYPE_TIMESTAMP
Gets the GPU timestamp corresponding to IDeviceContext::EndQuery call. Fot this query type IDeviceCon...
Definition: GraphicsTypes.h:1462
Diligent::QUERY_TYPE_PIPELINE_STATISTICS
@ QUERY_TYPE_PIPELINE_STATISTICS
Gets pipeline statistics, such as the number of pixel shader invocations in between IDeviceContext::B...
Definition: GraphicsTypes.h:1466
Diligent
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
THIS_
#define THIS_
Definition: DefineInterfaceHelperMacros.h:82