47 uint32_t aWidth, uint32_t aHeight,
float aDpiScale )
49 auto now = RHI_PHASE_STALL_TRACKER::CLOCK::now();
53 wxLogTrace(
traceRhi, wxS(
"SwapchainCtrl: OnPaint first call windowId=%u %ux%u "
54 "dpi=%.1f native=%p" ),
60 create.
width = aWidth;
67 wxLogTrace(
traceRhi, wxS(
"SwapchainCtrl: SubmitControl(CREATE) FAILED" ) );
86 wxLogTrace(
traceRhi, wxS(
"SwapchainCtrl: SubmitControl(FRAME_REQUEST) FAILED "
87 "windowId=%u gen=%llu" ),
92 wxLogTrace(
traceRhi, wxS(
"SwapchainCtrl: OnPaint windowId=%u gen=%llu" ),
100 if( stall.shouldLog )
102 wxLogTrace(
traceRhi, wxS(
"SwapchainCtrl: suspected render-thread stall "
103 "windowId=%u phase=%d gen=%llu queued=%llu age=%lldms" ),
106 static_cast<unsigned long long>( stall.stalledGenerations ),
107 static_cast<long long>( stall.stallAge.count() ) );
118 wxLogTrace(
traceRhi, wxS(
"SwapchainCtrl: OnResize SKIPPED (not created) "
119 "windowId=%u %ux%u" ),
127 wxLogTrace(
traceRhi, wxS(
"SwapchainCtrl: OnResize windowId=%u %ux%u -> %ux%u "
137 resize.
width = aWidth;
147 wxLogTrace(
traceRhi, wxS(
"SwapchainCtrl: OnClose windowId=%u (created=%s)" ),
159 wxLogTrace(
traceRhi, wxS(
"SwapchainCtrl: OnClose submit=%s" ), ok ?
"OK" :
"FAILED" );
167 wxLogTrace(
traceRhi, wxS(
"SwapchainCtrl: OnCloseSync windowId=%u timeout=%lldms" ),
168 m_windowId,
static_cast<long long>( aTimeout.count() ) );
175 wxLogTrace(
traceRhi, wxS(
"SwapchainCtrl: OnCloseSync fence=%s" ),
176 ok ?
"signaled" :
"TIMEOUT" );
Thread that owns the RHI device.
SWAPCHAIN_CONTROLLER(RENDER_THREAD &aRenderThread, RHI_WINDOW_ID aWindowId)
uint64_t m_lastLoggedGeneration
RHI_PHASE_STALL_TRACKER m_phaseStallTracker
RENDER_THREAD & m_renderThread
FRAME_MAILBOX * m_frameMailbox
bool OnResize(uint32_t aWidth, uint32_t aHeight, float aDpiScale=1.0f)
bool OnCloseSync(std::chrono::milliseconds aTimeout=std::chrono::milliseconds(2000))
Close and wait for the render thread to release the window's GPU resources, so the native window can ...
bool OnPaint(const RHI_NATIVE_WINDOW_HANDLE &aHandle, uint32_t aWidth, uint32_t aHeight, float aDpiScale=1.0f)
The first call creates the swapchain.
const wxChar *const traceRhi
Flag to enable debug output of the RHI rendering backend.
The Cairo implementation of the graphics abstraction layer.
RHI_PHASE_STALL_RESULT EvaluateRenderThreadPhaseStall(RHI_PHASE_STALL_TRACKER &aTracker, int aPhase, uint64_t aGeneration, RHI_PHASE_STALL_TRACKER::CLOCK::time_point aNow, std::chrono::milliseconds aStallThreshold=std::chrono::milliseconds(1000), uint64_t aGenerationThreshold=60, std::chrono::milliseconds aRepeatThreshold=std::chrono::milliseconds(1000))
uint32_t RHI_WINDOW_ID
Routes control commands to a swapchain.
float refreshHz
display refresh rate, 0 when unknown
KIGFX::FRAME_MAILBOX * frame2DMailbox
Owned by the panel.
RHI_NATIVE_WINDOW_HANDLE nativeHandle
Platform-agnostic wrapper for a native window handle.
wxLogTrace helper definitions.