forked from GPUOpen-Tools/gpu_performance_api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGPACounterSchedulerDX11.cpp
91 lines (73 loc) · 2.81 KB
/
GPACounterSchedulerDX11.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
//==============================================================================
// Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved.
/// \author AMD Developer Tools Team
/// \file
/// \brief Base class to handle the scheduling of the D3D Query counters
//==============================================================================
#include "GPASwCounterManager.h"
#include "GPACounterSchedulerDX11.h"
#include "GPACounterGeneratorSchedulerManager.h"
GPA_CounterSchedulerDX11::GPA_CounterSchedulerDX11()
{
CounterGeneratorSchedulerManager::Instance()->RegisterCounterScheduler(GPA_API_DIRECTX_11, GDT_HW_GENERATION_NVIDIA, this, false);
for (int gen = GDT_HW_GENERATION_INTEL; gen < GDT_HW_GENERATION_LAST; gen++)
{
CounterGeneratorSchedulerManager::Instance()->RegisterCounterScheduler(GPA_API_DIRECTX_11, static_cast<GDT_HW_GENERATION>(gen), this);
}
}
GPA_Status GPA_CounterSchedulerDX11::EnableCounter(gpa_uint32 index)
{
GPA_Status status = GPA_CounterSchedulerBase::EnableCounter(index);
#if defined(WIN32)
gpa_uint32 totalCounters = m_pCounterAccessor->GetNumCounters();
if (NVIDIA_VENDOR_ID == m_vendorId)
{
if (index < SwCounterManager::Instance()->GetNumSwCounters()) //SW counter
{
SwCounterManager::Instance()->EnableSwCounter(index);
}
}
else //for AMD SW D3D counters are added at the end
{
if ((index >= totalCounters - SwCounterManager::Instance()->GetNumSwCounters()) && index < totalCounters)
{
SwCounterManager::Instance()->EnableSwCounter(index);
}
}
#endif // WIN32
return status;
}
GPA_Status GPA_CounterSchedulerDX11::DoDisableCounter(gpa_uint32 index)
{
GPA_Status status = GPA_CounterSchedulerBase::DoDisableCounter(index);
if (GPA_STATUS_OK == status)
{
#if defined(WIN32)
if (NVIDIA_VENDOR_ID == m_vendorId)
{
if (index < SwCounterManager::Instance()->GetNumSwCounters()) //SW counter
{
SwCounterManager::Instance()->DisableSwCounter(index);
}
}
else //for AMD SW D3D counters are added at the end (for Intel, they are first and last)
{
gpa_uint32 totalCounters = m_pCounterAccessor->GetNumCounters();
if ((index >= totalCounters - SwCounterManager::Instance()->GetNumSwCounters()) && index < totalCounters)
{
SwCounterManager::Instance()->DisableSwCounter(index);
}
}
#endif // WIN32
}
return status;
}
void GPA_CounterSchedulerDX11::DisableAllCounters()
{
GPA_CounterSchedulerBase::DisableAllCounters();
SwCounterManager::Instance()->ClearEnabledSwCounters();
}
GPACounterSplitterAlgorithm GPA_CounterSchedulerDX11::GetPreferredSplittingAlgorithm() const
{
return CONSOLIDATED;
}