#include <memory.h>
// INTERNAL INCLUDES
-#include <dali/public-api/actors/sampling.h>
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/common/stage.h>
-#include <dali/public-api/render-tasks/render-task.h>
#include <dali/devel-api/threading/thread-pool.h>
-#include <dali/integration-api/debug.h>
#include <dali/integration-api/core.h>
#include <dali/integration-api/gl-context-helper-abstraction.h>
-#include <dali/internal/common/owner-pointer.h>
#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/render/common/render-algorithms.h>
#include <dali/internal/render/common/render-debug.h>
#include <dali/internal/render/common/render-tracker.h>
-#include <dali/internal/render/common/render-instruction-container.h>
-#include <dali/internal/render/common/render-instruction.h>
-#include <dali/internal/render/gl-resources/context.h>
#include <dali/internal/render/queue/render-queue.h>
-#include <dali/internal/render/renderers/render-frame-buffer.h>
-#include <dali/internal/render/renderers/render-geometry.h>
-#include <dali/internal/render/renderers/render-renderer.h>
-#include <dali/internal/render/renderers/render-sampler.h>
#include <dali/internal/render/shaders/program-controller.h>
-#include <dali/internal/update/common/scene-graph-scene.h>
namespace Dali
{
depthBufferAvailable( depthBufferAvailableParam ),
stencilBufferAvailable( stencilBufferAvailableParam ),
partialUpdateAvailable( partialUpdateAvailableParam ),
- itemsCheckSum(0)
+ itemsCheckSum(0),
+ defaultSurfaceOrientation( 0 )
{
// Create thread pool with just one thread ( there may be a need to create more threads in the future ).
threadPool = std::unique_ptr<Dali::ThreadPool>( new Dali::ThreadPool() );
Context* CreateSceneContext()
{
- sceneContextContainer.push_back( new Context( glAbstraction ) );
- return sceneContextContainer[ sceneContextContainer.size() - 1 ];
+ Context* context = new Context( glAbstraction );
+ sceneContextContainer.PushBack( context );
+ return context;
}
void DestroySceneContext( Context* sceneContext )
{
- auto iter = std::find( sceneContextContainer.begin(), sceneContextContainer.end(), sceneContext );
- if( iter != sceneContextContainer.end() )
+ auto iter = std::find( sceneContextContainer.Begin(), sceneContextContainer.End(), sceneContext );
+ if( iter != sceneContextContainer.End() )
{
- sceneContextContainer.erase( iter );
+ ( *iter )->GlContextDestroyed();
+ sceneContextContainer.Erase( iter );
}
}
Context* ReplaceSceneContext( Context* oldSceneContext )
{
Context* newContext = new Context( glAbstraction );
+
+ oldSceneContext->GlContextDestroyed();
+
std::replace( sceneContextContainer.begin(), sceneContextContainer.end(), oldSceneContext, newContext );
return newContext;
}
// programs are owned by context at the moment.
Context context; ///< Holds the GL state of the share resource context
Context* currentContext; ///< Holds the GL state of the current context for rendering
- std::vector< Context* > sceneContextContainer; ///< List of owned contexts holding the GL state per scene
+ OwnerContainer< Context* > sceneContextContainer; ///< List of owned contexts holding the GL state per scene
Integration::GlAbstraction& glAbstraction; ///< GL abstraction
Integration::GlSyncAbstraction& glSyncAbstraction; ///< GL sync abstraction
Integration::GlContextHelperAbstraction& glContextHelperAbstraction; ///< GL context helper abstraction
Vector<GLuint> textureDependencyList; ///< The dependency list of binded textures
std::size_t itemsCheckSum; ///< The damaged render items checksum from previous prerender phase.
std::vector<DirtyRect> itemsDirtyRects;
+ int defaultSurfaceOrientation; ///< defaultSurfaceOrientation for the default surface we are rendering to
};
RenderManager* RenderManager::New( Integration::GlAbstraction& glAbstraction,
renderer->GlContextDestroyed();
}
- // inform scenes
- for( auto&& scene : mImpl->sceneContainer )
+ // inform context
+ for( auto&& context : mImpl->sceneContextContainer )
{
- scene->GlContextDestroyed();
+ context->GlContextDestroyed();
}
}
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
Rect<int32_t> surfaceRect = mImpl->defaultSurfaceRect;
Integration::DepthBufferAvailable depthBufferAvailable = mImpl->depthBufferAvailable;
Integration::StencilBufferAvailable stencilBufferAvailable = mImpl->stencilBufferAvailable;
+ int surfaceOrientation = mImpl->defaultSurfaceOrientation;
if ( instruction.mFrameBuffer )
{
surfaceRect = Rect<int32_t>( 0, 0, static_cast<int32_t>( scene.GetSize().width ), static_cast<int32_t>( scene.GetSize().height ) );
}
- DALI_ASSERT_DEBUG( mImpl->currentContext->IsGlContextCreated() );
+ // Make sure that GL context must be created
+ mImpl->currentContext->GlContextCreated();
// reset the program matrices for all programs once per frame
// this ensures we will set view and projection matrix once per program per camera
{
viewportRect.Set( 0, 0, instruction.mFrameBuffer->GetWidth(), instruction.mFrameBuffer->GetHeight() );
}
+ surfaceOrientation = 0;
}
else // No Offscreen frame buffer rendering
{
}
}
+ if( surfaceOrientation == 90 || surfaceOrientation == 270 )
+ {
+ int temp = viewportRect.width;
+ viewportRect.width = viewportRect.height;
+ viewportRect.height = temp;
+ }
+
bool clearFullFrameRect = true;
if( instruction.mFrameBuffer != 0 )
{
depthBufferAvailable,
stencilBufferAvailable,
mImpl->boundTextures,
- clippingRect );
+ clippingRect,
+ surfaceOrientation );
// Synchronise the FBO/Texture access when there are multiple contexts
if ( mImpl->currentContext->IsSurfacelessContextSupported() )