namespace SceneGraph
{
+#if defined(DEBUG_ENABLED)
+namespace
+{
+Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_RENDER_MANAGER" );
+} // unnamed namespace
+#endif
+
/**
* Structure to contain internal data
*/
sampler->mTWrapMode = static_cast<Dali::WrapMode::Type>(tWrapMode);
}
-void RenderManager::AddFrameBuffer( Render::FrameBuffer* frameBuffer )
+void RenderManager::AddFrameBuffer( OwnerPointer< Render::FrameBuffer >& frameBuffer )
{
- mImpl->frameBufferContainer.PushBack( frameBuffer );
- if ( frameBuffer->IsSurfaceBacked() )
+ Render::FrameBuffer* frameBufferPtr = frameBuffer.Release();
+ mImpl->frameBufferContainer.PushBack( frameBufferPtr );
+ if ( frameBufferPtr->IsSurfaceBacked() )
{
- frameBuffer->Initialize( *mImpl->CreateSurfaceContext() );
+ frameBufferPtr->Initialize( *mImpl->CreateSurfaceContext() );
}
else
{
- frameBuffer->Initialize( mImpl->context );
+ frameBufferPtr->Initialize( mImpl->context );
}
}
const uint32_t count = mImpl->instructions.Count( mImpl->renderBufferIndex );
const bool haveInstructions = count > 0u;
+ DALI_LOG_INFO( gLogFilter, Debug::General,
+ "Render: haveInstructions(%s) || mImpl->lastFrameWasRendered(%s) || forceClear(%s)\n",
+ haveInstructions ? "true" : "false",
+ mImpl->lastFrameWasRendered ? "true" : "false",
+ forceClear ? "true" : "false" );
+
// Only render if we have instructions to render, or the last frame was rendered (and therefore a clear is required).
if( haveInstructions || mImpl->lastFrameWasRendered || forceClear )
{
+ DALI_LOG_INFO( gLogFilter, Debug::General, "Render: Processing\n" );
+
// Mark that we will require a post-render step to be performed (includes swap-buffers).
status.SetNeedsPostRender( true );
Integration::StencilBufferAvailable stencilBufferAvailable = mImpl->stencilBufferAvailable;
Render::SurfaceFrameBuffer* surfaceFrameBuffer = nullptr;
- if ( ( instruction.mFrameBuffer != 0 ) && instruction.mFrameBuffer->IsSurfaceBacked() )
+ if ( instruction.mFrameBuffer != 0 )
{
- surfaceFrameBuffer = static_cast<Render::SurfaceFrameBuffer*>( instruction.mFrameBuffer );
-
- if ( mImpl->currentContext->IsSurfacelessContextSupported() )
+ if ( instruction.mFrameBuffer->IsSurfaceBacked() )
{
- Context* surfaceContext = surfaceFrameBuffer->GetContext();
- if ( mImpl->currentContext != surfaceContext )
+ surfaceFrameBuffer = static_cast<Render::SurfaceFrameBuffer*>( instruction.mFrameBuffer );
+
+ if ( mImpl->currentContext->IsSurfacelessContextSupported() )
{
- // Switch the correct context if rendering to a surface
- mImpl->currentContext = surfaceContext;
- // Clear the current cached program when the context is switched
- mImpl->programController.ClearCurrentProgram();
+ Context* surfaceContext = surfaceFrameBuffer->GetContext();
+ if ( mImpl->currentContext != surfaceContext )
+ {
+ // Switch the correct context if rendering to a surface
+ mImpl->currentContext = surfaceContext;
+ // Clear the current cached program when the context is switched
+ mImpl->programController.ClearCurrentProgram();
+ }
}
- }
- surfaceRect = Rect<int32_t>( 0, 0, static_cast<int32_t>( surfaceFrameBuffer->GetWidth() ), static_cast<int32_t>( surfaceFrameBuffer->GetHeight() ) );
- backgroundColor = surfaceFrameBuffer->GetBackgroundColor();
+ surfaceRect = Rect<int32_t>( 0, 0, static_cast<int32_t>( surfaceFrameBuffer->GetWidth() ), static_cast<int32_t>( surfaceFrameBuffer->GetHeight() ) );
+ backgroundColor = surfaceFrameBuffer->GetBackgroundColor();
+ }
+ else
+ {
+ // Switch to shared context for off-screen buffer
+ mImpl->currentContext = &mImpl->context;
+ }
}
DALI_ASSERT_DEBUG( mImpl->currentContext->IsGlContextCreated() );