forked from GPUOpen-Tools/gpu_performance_api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGPACounterGeneratorDX11Base.cpp
426 lines (349 loc) · 21.8 KB
/
GPACounterGeneratorDX11Base.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
//==============================================================================
// Copyright (c) 2016-2018 Advanced Micro Devices, Inc. All rights reserved.
/// \author AMD Developer Tools Team
/// \file
/// \brief Base class for DX11 counter generation -- add D3D11 Query counters which are supported on all hardware
//==============================================================================
#include <d3d11.h>
#ifdef EXTRA_COUNTER_INFO
#include <sstream>
#endif
#include "GPACounterGeneratorDX11Base.h"
#include "Logging.h"
#include "GPASoftwareCounters.h"
#include "GPACounterGeneratorSchedulerManager.h"
#include "GPACommonDefs.h"
GPA_CounterGeneratorDX11Base::GPA_CounterGeneratorDX11Base()
{
GPA_CounterGeneratorBase::SetAllowedCounters(false, false, true); //enable sw counters
}
GPA_Status GPA_CounterGeneratorDX11Base::GeneratePublicCounters(
GDT_HW_GENERATION desiredGeneration,
GDT_HW_ASIC_TYPE asicType,
gpa_uint8 generateAsicSpecificCounters,
GPA_PublicCounters* pPublicCounters)
{
// do nothing in base class
UNREFERENCED_PARAMETER(desiredGeneration);
UNREFERENCED_PARAMETER(asicType);
UNREFERENCED_PARAMETER(generateAsicSpecificCounters);
UNREFERENCED_PARAMETER(pPublicCounters);
return GPA_STATUS_OK;
}
GPA_Status GPA_CounterGeneratorDX11Base::GenerateHardwareCounters(
GDT_HW_GENERATION desiredGeneration,
GDT_HW_ASIC_TYPE asicType,
gpa_uint8 generateAsicSpecificCounters,
GPA_HardwareCounters* pHardwareCounters)
{
// do nothing in base class
UNREFERENCED_PARAMETER(desiredGeneration);
UNREFERENCED_PARAMETER(asicType);
UNREFERENCED_PARAMETER(generateAsicSpecificCounters);
UNREFERENCED_PARAMETER(pHardwareCounters);
return GPA_STATUS_OK;
}
GPA_Status GPA_CounterGeneratorDX11Base::GenerateSoftwareCounters(
GDT_HW_GENERATION desiredGeneration,
GDT_HW_ASIC_TYPE asicType,
gpa_uint8 generateAsicSpecificCounters,
GPA_SoftwareCounters* pSoftwareCounters)
{
UNREFERENCED_PARAMETER(asicType);
UNREFERENCED_PARAMETER(generateAsicSpecificCounters);
if (pSoftwareCounters->m_countersGenerated)
{
return GPA_STATUS_OK;
}
pSoftwareCounters->Clear();
GenerateD3DSoftwareCounters(desiredGeneration);
pSoftwareCounters->m_groupCount = 1;
m_d3dCounterGroup.m_numCounters = SwCounterManager::Instance()->GetNumSwCounters();
m_d3dCounterGroup.m_maxActiveCounters = SwCounterManager::Instance()->GetNumSwCounters();
pSoftwareCounters->m_pGroups = &m_d3dCounterGroup;
GPA_SoftwareCounterDescExt counter;
const SwCounterDescVec* pSwCounters = SwCounterManager::Instance()->GetSwCounters();
for (gpa_uint32 c = 0; c < SwCounterManager::Instance()->GetNumSwCounters(); c++)
{
counter.m_groupIndex = 0;
counter.m_groupIdDriver = GetD3D11Enum(c);
// A D3D11_QUERY can return several values, we need to know the index into these values that the counter belongs to.
// Re-purpose as the local index. This converts our counter index into a local index (if the counter happens to lie within an enum that has several values)
counter.m_counterIdDriver = GetD3D11Enum(c);
// assign the actual counter
counter.m_pSoftwareCounter = const_cast<GPA_SoftwareCounterDesc*>(&((*pSwCounters)[c]));
// add counter to the list
pSoftwareCounters->m_counters.push_back(counter);
}
pSoftwareCounters->m_countersGenerated = true;
return GPA_STATUS_OK;
}
void GPA_CounterGeneratorDX11Base::ComputeSWCounterValue(gpa_uint32 softwareCounterIndex,
gpa_uint64 value,
void* pResult,
const GPA_HWInfo* pHwInfo) const
{
gpa_uint32 numAMDCounters = GetNumAMDCounters();
if (softwareCounterIndex >= numAMDCounters)
{
softwareCounterIndex -= numAMDCounters; //adjust index for AMD counters
}
const SwCounterDescVec* pSwCounters = SwCounterManager::Instance()->GetSwCounters();
if (softwareCounterIndex < static_cast<gpa_uint32>(pSwCounters->size()))
{
const std::string nvGPUTime = "GPUTime";
const std::string d3dGPUTime = "D3DGPUTime";
const std::string counterName = pSwCounters->at(softwareCounterIndex).m_name;
if (counterName == d3dGPUTime || counterName == nvGPUTime)
{
gpa_uint64 freq = 1u;
GPA_ASSERT(pHwInfo->GetTimeStampFrequency(freq));
gpa_float64* pBuf = static_cast<gpa_float64*>(pResult);
*pBuf = static_cast<gpa_float64>(value) / static_cast<gpa_float64>(freq) * 1000.0;
}
else // other SW DX counters
{
GPA_Data_Type type = (*pSwCounters)[softwareCounterIndex].m_type;
if (GPA_DATA_TYPE_UINT64 == type)
{
gpa_uint64* pBuf = static_cast<gpa_uint64*>(pResult);
*pBuf = static_cast<gpa_uint64>(value);
}
else if (GPA_DATA_TYPE_FLOAT64 == type)
{
memcpy(pResult, &value, sizeof(gpa_float64));
}
else
{
GPA_LogError("Unexpected software counter type.");
}
}
}
}
void GPA_CounterGeneratorDX11Base::GenerateD3DSoftwareCounters(GDT_HW_GENERATION desiredGeneration)
{
GPA_SoftwareCounterDesc tempCounter;
gpa_uint64 counterIndexInGroup = 0;
tempCounter.m_counterIndexInGroup = 0;
SwCounterManager::Instance()->SetNumAmdCounters(GetNumAMDCounters());
if (SwCounterManager::Instance()->SwCountersGenerated())
{
return;
}
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Time spent in GPU");
tempCounter.m_type = GPA_DATA_TYPE_FLOAT64;
if (IsAMDGPU(desiredGeneration)) // AMD card
{
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "D3DGPUTime");
}
else // non-AMD card
{
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "GPUTime");
}
SwCounterManager::Instance()->AddSwCounter(tempCounter); //GPUTime || D3DGPUTime
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Get the number of samples that passed the depth and stencil tests.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "Occlusion");
tempCounter.m_type = GPA_DATA_TYPE_UINT64;
SwCounterManager::Instance()->AddSwCounter(tempCounter); //Occlusion
//D3D11_QUERY_DATA_PIPELINE_STATISTICS description from http://msdn.microsoft.com/en-us/library/windows/desktop/ff476192%28v=vs.85%29.aspx
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Number of vertices read by input assembler.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "IAVertices");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //IAVertices
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Number of primitives read by the input assembler.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "IAPrimitives");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //IAPrimitives
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Number of times a vertex shader was invoked.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "VSInvocations");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //VSInvocations
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Number of times a geometry shader was invoked.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "GSInvocations");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //GSInvocations
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Number of primitives output by a geometry shader.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "GSPrimitives");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //GSPrimitives
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Number of primitives that were sent to the rasterizer.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "CInvocations");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //CInvocations
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Number of primitives that were rendered.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "CPrimitives");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //CPrimitives
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Number of times a pixel shader was invoked.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "PSInvocations");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //PSInvocations
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Number of times a hull shader was invoked.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "HSInvocations");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //HSInvocations
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Number of times a domain shader was invoked.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "DSInvocations");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //DSInvocations
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Number of times a compute shader was invoked.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "CSInvocations");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //CSInvocations
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Did any samples pass the depth and stencil tests?");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "OcclusionPredicate");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //OcclusionPredicate
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Number of primitives written to the stream-output buffers.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "PrimsWritten");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //PrimsWritten
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Primitives not written to the SO buffers due to limited space.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "PrimsStorageNeed");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //PrimsStorageNeed
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Determines if any of the streaming output buffers overflowed.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "OverflowPred");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //OverflowPred
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Number of primitives written to the stream 0 buffer.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "PrimsWritten_S0");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //PrimsWritten_S0
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Primitives not written to stream 0 due to limited space.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "PrimsStorageNeed_S0");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //PrimsStorageNeed_S0
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Determines if the stream 0 buffer overflowed.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "OverflowPred_S0");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //OverflowPred_S0
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Number of primitives written to the stream 1 buffer.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "PrimsWritten_S1");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //PrimsWritten_S1
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Primitives not written to stream 1 due to limited space.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "PrimsStorageNeed_S1");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //PrimsStorageNeed_S1
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Determines if the stream 1 buffer overflowed.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "OverflowPred_S1");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //OverflowPred_S1
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Number of primitives written to the stream 2 buffer.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "PrimsWritten_S2");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //PrimsWritten_S2
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Primitives not written to stream 2 due to limited space.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "PrimsStorageNeed_S2");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //PrimsStorageNeed_S2
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Determines if the stream 2 buffer overflowed.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "OverflowPred_S2");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //OverflowPred_S2
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Number of primitives written to the stream 3 buffer.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "PrimsWritten_S3");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //PrimsWritten_S3
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Primitives not written to stream 3 due to limited space.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "PrimsStorageNeed_S3");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //PrimsStorageNeed_S3
tempCounter.m_counterIndexInGroup = counterIndexInGroup++;
sprintf_s(tempCounter.m_group, maxSoftwareCounterGroupLength, "%s", "D3D11");
sprintf_s(tempCounter.m_description, maxSoftwareCounterDescriptionLength, "%s", "Determines if the stream 3 buffer overflowed.");
sprintf_s(tempCounter.m_name, maxSoftwareCounterNameLength, "%s", "OverflowPred_S3");
SwCounterManager::Instance()->AddSwCounter(tempCounter); //OverflowPred_S3
SwCounterManager::Instance()->SetSwCountersGenerated(true);
}
gpa_uint32 GPA_CounterGeneratorDX11Base::GetD3D11Enum(gpa_uint32 index) const
{
D3DCOUNTERS counterIndex = static_cast<D3DCOUNTERS>(index);
switch (counterIndex)
{
case D3DCOUNTERS::GPUTIME:
return static_cast<gpa_uint32>(D3D11_QUERY_TIMESTAMP);
case D3DCOUNTERS::OCCLUSION:
return static_cast<gpa_uint32>(D3D11_QUERY_OCCLUSION);
case D3DCOUNTERS::IAVERTICES:
case D3DCOUNTERS::IAPRIMITIVES:
case D3DCOUNTERS::VSINVOCATIONS:
case D3DCOUNTERS::GSINVOCATIONS:
case D3DCOUNTERS::GSPRIMITIVES:
case D3DCOUNTERS::CINVOCATIONS:
case D3DCOUNTERS::CPRIMITIVES:
case D3DCOUNTERS::PSINVOCATIONS:
case D3DCOUNTERS::HSINVOCATIONS:
case D3DCOUNTERS::DSINVOCATIONS:
case D3DCOUNTERS::CSINVOCATIONS:
return static_cast<gpa_uint32>(D3D11_QUERY_PIPELINE_STATISTICS);
case D3DCOUNTERS::OCCLUSIONPREDICATE:
return static_cast<gpa_uint32>(D3D11_QUERY_OCCLUSION_PREDICATE);
/// D3D11_QUERY_SO_STATISTICS
case D3DCOUNTERS::SOPRIMSWRITTEN:
case D3DCOUNTERS::SOPRIMSSTORAGENEED:
return static_cast<gpa_uint32>(D3D11_QUERY_SO_STATISTICS);
case D3DCOUNTERS::SOOVERFLOWPRED:
return static_cast<gpa_uint32>(D3D11_QUERY_SO_OVERFLOW_PREDICATE);
/// D3D11_QUERY_SO_STATISTICS_STREAM0
case D3DCOUNTERS::PRIMSWRITTEN_S0:
case D3DCOUNTERS::PRIMSSTORAGENEED_S0:
return static_cast<gpa_uint32>(D3D11_QUERY_SO_STATISTICS_STREAM0);
case D3DCOUNTERS::OVERFLOWPRED_S0:
return static_cast<gpa_uint32>(D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0);
/// D3D11_QUERY_SO_STATISTICS_STREAM1
case D3DCOUNTERS::PRIMSWRITTEN_S1:
case D3DCOUNTERS::PRIMSSTORAGENEED_S1:
return static_cast<gpa_uint32>(D3D11_QUERY_SO_STATISTICS_STREAM1);
case D3DCOUNTERS::OVERFLOWPRED_S1:
return static_cast<gpa_uint32>(D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1);
/// D3D11_QUERY_SO_STATISTICS_STREAM2
case D3DCOUNTERS::PRIMSWRITTEN_S2:
case D3DCOUNTERS::PRIMSSTORAGENEED_S2:
return static_cast<gpa_uint32>(D3D11_QUERY_SO_STATISTICS_STREAM2);
case D3DCOUNTERS::OVERFLOWPRED_S2:
return static_cast<gpa_uint32>(D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2);
/// D3D11_QUERY_SO_STATISTICS_STREAM3
case D3DCOUNTERS::PRIMSWRITTEN_S3:
case D3DCOUNTERS::PRIMSSTORAGENEED_S3:
return static_cast<gpa_uint32>(D3D11_QUERY_SO_STATISTICS_STREAM3);
case D3DCOUNTERS::OVERFLOWPRED_S3:
return static_cast<gpa_uint32>(D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3);
default:
return static_cast<gpa_uint32>(0);
}
}
bool GPA_CounterGeneratorDX11Base::IsAMDGPU(GDT_HW_GENERATION generation)
{
return generation >= GDT_HW_GENERATION_FIRST_AMD && generation < GDT_HW_GENERATION_LAST;
}