MCPcopy Create free account
hub / github.com/NVIDIA-RTX/RTXPT / PostRender

Method PostRender

Rtxpt/SampleCommon/CaptureScriptManager.cpp:235–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235void CaptureScriptManager::PostRender(const std::function<bool(const char*)>& dumpScreenshotCallback)
236{
237 if (m_active && !m_screenshotFileName.empty() && !(m_resetAndWarmup && m_resetAndWarmupCounter > 0) && (m_ui.RealtimeMode || m_app.AccumulationCompleted()) )
238 {
239 std::filesystem::path screenshotFile = m_screenshotFileName;
240
241 if (m_type == 1)
242 {
243 if (m_app.GetSceneTime() < m_sequenceRecordStartTime) // if not, we're still in warmup - exit
244 return;
245
246 if (m_sequenceRecordCounter == -1) // start sequence if in sequence mode
247 m_sequenceRecordCounter = m_sequenceRecordFrames;
248 assert(m_sequenceRecordCounter > 0);
249
250 std::filesystem::path justName = screenshotFile.filename().stem();
251 std::filesystem::path justExtension = screenshotFile.extension();
252 screenshotFile.remove_filename();
253 screenshotFile /= justName.string() + StringFormat("_%03d", m_sequenceRecordFrames - m_sequenceRecordCounter) + justExtension.string();
254 m_sequenceRecordCounter--;
255 }
256
257 m_captureSuccess = dumpScreenshotCallback(screenshotFile.string().c_str());
258
259 if (m_type == 0 || (m_type == 1 && m_sequenceRecordCounter == 0) || !m_captureSuccess)
260 {
261 m_active = false;
262 m_resetAndWarmupCounter = -1;
263 m_sequenceRecordCounter = -1;
264 }
265 }
266
267 if (m_exitAfterCapture && !m_active && !m_start)
268 {
269 if (m_captureSuccess)
270 {
271 donut::log::info("Capture of '%s' finished successfully. Exiting.", m_screenshotFileName.string().c_str());
272 std::exit(0);
273 }
274 else
275 {
276 donut::log::fatal("Unable capture '%s'. Exiting.", m_screenshotFileName.string().c_str());
277 std::exit(1);
278 }
279 }
280}

Callers 1

RenderMethod · 0.80

Calls 4

StringFormatFunction · 0.85
emptyMethod · 0.80
AccumulationCompletedMethod · 0.80
GetSceneTimeMethod · 0.80

Tested by

no test coverage detected