{
LOG_UPDATE_RENDER_TRACE;
+ // For thread safe
+ bool uploadOnly = mUploadWithoutRendering;
+
// Performance statistics are logged upon a VSYNC tick so use this point for a VSync marker
AddPerformanceMarker(PerformanceInterface::VSYNC);
nextFrameTime,
updateStatus,
renderToFboEnabled,
- isRenderingToFbo);
+ isRenderingToFbo,
+ uploadOnly);
AddPerformanceMarker(PerformanceInterface::UPDATE_END);
unsigned int keepUpdatingStatus = updateStatus.KeepUpdating();
AddPerformanceMarker(PerformanceInterface::RENDER_START);
// Upload shared resources
- mCore.PreRender(renderStatus, mForceClear, mUploadWithoutRendering);
+ mCore.PreRender(renderStatus, mForceClear);
- if(!mUploadWithoutRendering)
+ if(!uploadOnly)
{
// Go through each window
WindowContainer windows;
mDamagedRects.clear();
// Collect damage rects
- mCore.PreRender(scene, mDamagedRects);
-
- graphics.ActivateSurfaceContext(windowSurface);
+ mCore.PreRender(windowRenderStatus, scene, mDamagedRects);
// Render off-screen frame buffers first if any
mCore.RenderScene(windowRenderStatus, scene, true);
Rect<int> clippingRect; // Empty for fbo rendering
// Switch to the context of the surface, merge damaged areas for previous frames
- windowSurface->PreRender(sceneSurfaceResized, mDamagedRects, clippingRect); // Switch GL context
+ if(windowRenderStatus.NeedsUpdate())
+ {
+ windowSurface->PreRender(sceneSurfaceResized, mDamagedRects, clippingRect); // Switch GL context
+ }
// Render the surface
mCore.RenderScene(windowRenderStatus, scene, false, clippingRect);
}
}
- if(!mUploadWithoutRendering)
+ if(!uploadOnly)
{
- graphics.ActivateResourceContext();
+ graphics.PostRender();
}
- mCore.PostRender(mUploadWithoutRendering);
+ mCore.PostRender();
//////////////////////////////
// DELETE SURFACE