MCPcopy Create free account
hub / github.com/TheRealMJP/DeferredTexturing / StartProfile

Method StartProfile

SampleFramework12/v1.00/Graphics/Profiler.cpp:74–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74uint64 Profiler::StartProfile(ID3D12GraphicsCommandList* cmdList, const char* name)
75{
76 Assert_(name != nullptr);
77 if(enableGPUProfiling == false)
78 return uint64(-1);
79
80 uint64 profileIdx = uint64(-1);
81 for(uint64 i = 0; i < numProfiles; ++i)
82 {
83 if(profiles[i].Name == name)
84 {
85 profileIdx = i;
86 break;
87 }
88 }
89
90 if(profileIdx == uint64(-1))
91 {
92 Assert_(numProfiles < MaxProfiles);
93 profileIdx = numProfiles++;
94 profiles[profileIdx].Name = name;
95 }
96
97 ProfileData& profileData = profiles[profileIdx];
98 Assert_(profileData.QueryStarted == false);
99 Assert_(profileData.QueryFinished == false);
100 profileData.CPUProfile = false;
101 profileData.Active = true;
102
103 // Insert the start timestamp
104 const uint32 startQueryIdx = uint32(profileIdx * 2);
105 cmdList->EndQuery(queryHeap, D3D12_QUERY_TYPE_TIMESTAMP, startQueryIdx);
106
107 profileData.QueryStarted = true;
108
109 return profileIdx;
110}
111
112void Profiler::EndProfile(ID3D12GraphicsCommandList* cmdList, uint64 idx)
113{

Callers 1

ProfileBlockMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected