MCPcopy Create free account
hub / github.com/GPUOpen-LibrariesAndSDKs/Cauldron / BenchmarkLoop

Function BenchmarkLoop

src/common/base/Benchmark.cpp:151–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151float BenchmarkLoop(const std::vector<TimeStamp> &timeStamps, Camera *pCam, std::string& outScreenShotName)
152{
153 if (bm.frame < bm.warmUpFrames) // warmup
154 {
155 bm.frame++;
156 return bm.time;
157 }
158
159 if (bm.time > bm.timeEnd) // are we done yet?
160 {
161 fclose(bm.f);
162
163 if (bm.exitWhenTimeEnds)
164 {
165 PostQuitMessage(0);
166 return bm.time;
167 }
168 }
169
170 SaveTimestamps(bm.time, timeStamps);
171
172 // animate camera
173 if (bm.m_animationFound && (pCam != NULL))
174 {
175 // if GLTF has camera with cameraID then use that camera and its animation
176 if (bm.cameraId >= 0)
177 {
178 bm.m_pGltfLoader->GetCamera(bm.cameraId, pCam);
179 }
180 else
181 {
182 // cameraID is -1, then use our sequence
183 if (bm.time >= bm.m_nextTime)
184 {
185 bm.m_nextTime = bm.m_sequence.GetNextKeyTime(bm.time);
186
187 const BenchmarkSequence::KeyFrame keyFrame = bm.m_sequence.GetNextKeyFrame(bm.time);
188
189 const bool bValidKeyframe = keyFrame.m_time >= 0;
190 if (bValidKeyframe)
191 {
192 if (keyFrame.m_camera == -1)
193 {
194 pCam->LookAt(keyFrame.m_from, keyFrame.m_to);
195 }
196 else
197 {
198 bm.m_pGltfLoader->GetCamera(keyFrame.m_camera, pCam);
199 }
200
201 const bool bShouldTakeScreenshot = !keyFrame.m_screenShotName.empty();
202 if (bShouldTakeScreenshot)
203 {
204 outScreenShotName = keyFrame.m_screenShotName;
205 }
206 }
207 }
208 }

Callers

nothing calls this directly

Calls 6

SaveTimestampsFunction · 0.85
GetCameraMethod · 0.80
GetNextKeyTimeMethod · 0.80
GetNextKeyFrameMethod · 0.80
LookAtMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected