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
*/
lastFrameWasRendered( false ),
programController( glAbstraction ),
depthBufferAvailable( depthBufferAvailableParam ),
- stencilBufferAvailable( stencilBufferAvailableParam )
+ stencilBufferAvailable( stencilBufferAvailableParam ),
+ defaultSurfaceOrientation( 0 )
{
}
Integration::DepthBufferAvailable depthBufferAvailable; ///< Whether the depth buffer is available
Integration::StencilBufferAvailable stencilBufferAvailable; ///< Whether the stencil buffer is available
+ int defaultSurfaceOrientation; ///< defaultSurfaceOrientation for the default surface we are rendering to
+
};
RenderManager* RenderManager::New( Integration::GlAbstraction& glAbstraction,
mImpl->defaultSurfaceRect = rect;
}
+void RenderManager::SetDefaultSurfaceOrientation( int orientation )
+{
+ mImpl->defaultSurfaceOrientation = orientation;
+}
+
void RenderManager::AddRenderer( OwnerPointer< Render::Renderer >& renderer )
{
// Initialize the renderer as we are now in render thread
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 );
iter->OnRenderFinished();
}
}
+ else
+ {
+ DALI_LOG_RELEASE_INFO( "RenderManager::Render: Skip rendering [%d, %d, %d]\n", haveInstructions, mImpl->lastFrameWasRendered, forceClear );
+ }
mImpl->UpdateTrackers();
}
Rect<int32_t> surfaceRect = mImpl->defaultSurfaceRect;
+ int surfaceOrientation = mImpl->defaultSurfaceOrientation;
Vector4 backgroundColor = mImpl->backgroundColor;
Integration::DepthBufferAvailable depthBufferAvailable = mImpl->depthBufferAvailable;
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() );
// For glViewport the lower-left corner is (0,0)
// For glViewport the lower-left corner is (0,0)
const int32_t y = ( surfaceRect.height - instruction.mViewport.height ) - instruction.mViewport.y;
- viewportRect.Set( instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height );
+ viewportRect.Set( instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height );
}
else
{
{
viewportRect.Set( 0, 0, instruction.mFrameBuffer->GetWidth(), instruction.mFrameBuffer->GetHeight() );
}
+ surfaceOrientation = 0;
}
}
else // No Offscreen frame buffer rendering
{
// For glViewport the lower-left corner is (0,0)
const int32_t y = ( instruction.mFrameBuffer->GetHeight() - instruction.mViewport.height ) - instruction.mViewport.y;
- viewportRect.Set( instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height );
+ viewportRect.Set( instruction.mViewport.x, y, instruction.mViewport.width, instruction.mViewport.height );
}
else
{
}
}
+ if ( surfaceOrientation == 90 || surfaceOrientation == 270 )
+ {
+ int temp = viewportRect.width;
+ viewportRect.width = viewportRect.height;
+ viewportRect.height = temp;
+ }
+
mImpl->currentContext->Viewport(viewportRect.x, viewportRect.y, viewportRect.width, viewportRect.height);
if ( instruction.mIsClearColorSet )
*mImpl->currentContext,
mImpl->renderBufferIndex,
depthBufferAvailable,
- stencilBufferAvailable );
+ stencilBufferAvailable,
+ surfaceOrientation );
if( instruction.mRenderTracker && ( instruction.mFrameBuffer != 0 ) )
{