MCPcopy Create free account
hub / github.com/MethanePowered/MethaneKit / Render

Method Render

Modules/Graphics/App/Sources/Methane/Graphics/AppBase.cpp:236–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234}
235
236bool AppBase::Render()
237{
238 META_FUNCTION_TASK();
239 if (Platform::App::IsMinimized())
240 {
241 // No need to render frames while window is minimized.
242 // Sleep thread for a while to not heat CPU by running the message loop
243 std::this_thread::sleep_for(std::chrono::milliseconds(100)); // NOSONAR - false positive
244 return false;
245 }
246
247 META_CHECK_TRUE_DESCR(m_context.IsInitialized(), "RenderContext is not initialized before rendering.");
248 if (!m_context.ReadyToRender())
249 return false;
250
251 META_LOG("\n========================= FRAME {} RENDERING =========================", m_context.GetFrameIndex());
252
253 // Wait for previous frame rendering is completed and switch to next frame
254 m_context.WaitForGpu(Rhi::IContext::WaitFor::FramePresented);
255 return true;
256}
257
258bool AppBase::SetFullScreen(bool is_full_screen)
259{

Callers

nothing calls this directly

Calls 4

IsInitializedMethod · 0.45
ReadyToRenderMethod · 0.45
GetFrameIndexMethod · 0.45
WaitForGpuMethod · 0.45

Tested by

no test coverage detected