X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Fcommon%2Frender-manager.cpp;h=f160f41d945372762609a21afbc6bf60b26d9708;hb=780615404d3de39db1cf4e4840ac8d76220d1366;hp=75415edb4c7294d4f6d256c8e1205f5c7727ee7f;hpb=d8f118f294e3500ef3c4786cbd74c4104e6cc606;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/render/common/render-manager.cpp b/dali/internal/render/common/render-manager.cpp old mode 100644 new mode 100755 index 75415ed..f160f41 --- a/dali/internal/render/common/render-manager.cpp +++ b/dali/internal/render/common/render-manager.cpp @@ -48,53 +48,6 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_REN } // unnamed namespace #endif -struct DirtyRect -{ - DirtyRect(Node* node, Render::Renderer* renderer, int frame, Rect& rect) - : node(node), - renderer(renderer), - frame(frame), - rect(rect), - visited(true) - { - } - - DirtyRect() - : node(nullptr), - renderer(nullptr), - frame(0), - rect(), - visited(true) - { - } - - bool operator<(const DirtyRect& rhs) const - { - if (node == rhs.node) - { - if (renderer == rhs.renderer) - { - return frame > rhs.frame; // Most recent rects come first - } - else - { - return renderer < rhs.renderer; - } - } - else - { - return node < rhs.node; - } - } - - Node* node; - Render::Renderer* renderer; - int frame; - - Rect rect; - bool visited; -}; - /** * Structure to contain internal data */ @@ -125,7 +78,7 @@ struct RenderManager::Impl depthBufferAvailable( depthBufferAvailableParam ), stencilBufferAvailable( stencilBufferAvailableParam ), partialUpdateAvailable( partialUpdateAvailableParam ), - 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( new Dali::ThreadPool() ); @@ -222,8 +175,7 @@ struct RenderManager::Impl std::unique_ptr threadPool; ///< The thread pool Vector boundTextures; ///< The textures bound for rendering Vector textureDependencyList; ///< The dependency list of binded textures - std::size_t itemsCheckSum; ///< The damaged render items checksum from previous prerender phase. - std::vector itemsDirtyRects; + int defaultSurfaceOrientation; ///< defaultSurfaceOrientation for the default surface we are rendering to }; RenderManager* RenderManager::New( Integration::GlAbstraction& glAbstraction, @@ -244,7 +196,7 @@ RenderManager* RenderManager::New( Integration::GlAbstraction& glAbstraction, } RenderManager::RenderManager() -: mImpl(NULL) +: mImpl(nullptr) { } @@ -307,6 +259,11 @@ void RenderManager::SetDefaultSurfaceRect(const Rect& rect) 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 @@ -616,6 +573,12 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector> return; } + // @TODO We need to do partial rendering rotation. + if( mImpl->defaultSurfaceOrientation != 0 ) + { + return; + } + class DamagedRectsCleaner { public: @@ -648,15 +611,19 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector> // Clean collected dirty/damaged rects on exit if 3d layer or 3d node or other conditions. DamagedRectsCleaner damagedRectCleaner(damagedRects); + + + Internal::Scene& sceneInternal = GetImplementation(scene); + SceneGraph::Scene* sceneObject = sceneInternal.GetSceneObject(); + // Mark previous dirty rects in the sorted array. The array is already sorted by node and renderer, frame number. - // so you don't need to sort: std::stable_sort(mImpl->itemsDirtyRects.begin(), mImpl->itemsDirtyRects.end()); - for (DirtyRect& dirtyRect : mImpl->itemsDirtyRects) + // so you don't need to sort: std::stable_sort(itemsDirtyRects.begin(), itemsDirtyRects.end()); + std::vector& itemsDirtyRects = sceneInternal.GetItemsDirtyRects(); + for (DirtyRect& dirtyRect : itemsDirtyRects) { dirtyRect.visited = false; } - Internal::Scene& sceneInternal = GetImplementation(scene); - SceneGraph::Scene* sceneObject = sceneInternal.GetSceneObject(); uint32_t count = sceneObject->GetRenderInstructions().Count( mImpl->renderBufferIndex ); for (uint32_t i = 0; i < count; ++i) { @@ -759,11 +726,11 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector> // 2. Mark the related dirty rects as visited so they will not be removed below. // 3. Keep only last 3 dirty rects for the same node and renderer (Tizen uses 3 back buffers, Ubuntu 1). dirtyRect.rect = rect; - auto dirtyRectPos = std::lower_bound(mImpl->itemsDirtyRects.begin(), mImpl->itemsDirtyRects.end(), dirtyRect); - dirtyRectPos = mImpl->itemsDirtyRects.insert(dirtyRectPos, dirtyRect); + auto dirtyRectPos = std::lower_bound(itemsDirtyRects.begin(), itemsDirtyRects.end(), dirtyRect); + dirtyRectPos = itemsDirtyRects.insert(dirtyRectPos, dirtyRect); int c = 1; - while (++dirtyRectPos != mImpl->itemsDirtyRects.end()) + while (++dirtyRectPos != itemsDirtyRects.end()) { if (dirtyRectPos->node != item.mNode || dirtyRectPos->renderer != item.mRenderer) { @@ -777,7 +744,7 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector> c++; if (c > 3) // no more then 3 previous rects { - mImpl->itemsDirtyRects.erase(dirtyRectPos); + itemsDirtyRects.erase(dirtyRectPos); break; } } @@ -789,8 +756,8 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector> { // 1. The item is not dirty, the node and renderer referenced by the item are still exist. // 2. Mark the related dirty rects as visited so they will not be removed below. - auto dirtyRectPos = std::lower_bound(mImpl->itemsDirtyRects.begin(), mImpl->itemsDirtyRects.end(), dirtyRect); - while (dirtyRectPos != mImpl->itemsDirtyRects.end()) + auto dirtyRectPos = std::lower_bound(itemsDirtyRects.begin(), itemsDirtyRects.end(), dirtyRect); + while (dirtyRectPos != itemsDirtyRects.end()) { if (dirtyRectPos->node != item.mNode || dirtyRectPos->renderer != item.mRenderer) { @@ -808,9 +775,9 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector> } // Check removed nodes or removed renderers dirty rects - auto i = mImpl->itemsDirtyRects.begin(); - auto j = mImpl->itemsDirtyRects.begin(); - while (i != mImpl->itemsDirtyRects.end()) + auto i = itemsDirtyRects.begin(); + auto j = itemsDirtyRects.begin(); + while (i != itemsDirtyRects.end()) { if (i->visited) { @@ -824,7 +791,7 @@ void RenderManager::PreRender( Integration::Scene& scene, std::vector> i++; } - mImpl->itemsDirtyRects.resize(j - mImpl->itemsDirtyRects.begin()); + itemsDirtyRects.resize(j - itemsDirtyRects.begin()); damagedRectCleaner.SetCleanOnReturn(false); } @@ -868,6 +835,7 @@ void RenderManager::RenderScene( Integration::RenderStatus& status, Integration: Rect surfaceRect = mImpl->defaultSurfaceRect; Integration::DepthBufferAvailable depthBufferAvailable = mImpl->depthBufferAvailable; Integration::StencilBufferAvailable stencilBufferAvailable = mImpl->stencilBufferAvailable; + int surfaceOrientation = mImpl->defaultSurfaceOrientation; if ( instruction.mFrameBuffer ) { @@ -954,7 +922,7 @@ void RenderManager::RenderScene( Integration::RenderStatus& status, Integration: clearMask |= GL_STENCIL_BUFFER_BIT; } - if( !instruction.mIgnoreRenderToFbo && ( instruction.mFrameBuffer != 0 ) ) + if( !instruction.mIgnoreRenderToFbo && ( instruction.mFrameBuffer != nullptr ) ) { // Offscreen buffer rendering if ( instruction.mIsViewportSet ) @@ -967,6 +935,7 @@ void RenderManager::RenderScene( Integration::RenderStatus& status, Integration: { viewportRect.Set( 0, 0, instruction.mFrameBuffer->GetWidth(), instruction.mFrameBuffer->GetHeight() ); } + surfaceOrientation = 0; } else // No Offscreen frame buffer rendering { @@ -983,8 +952,15 @@ void RenderManager::RenderScene( Integration::RenderStatus& status, Integration: } } + if( surfaceOrientation == 90 || surfaceOrientation == 270 ) + { + int temp = viewportRect.width; + viewportRect.width = viewportRect.height; + viewportRect.height = temp; + } + bool clearFullFrameRect = true; - if( instruction.mFrameBuffer != 0 ) + if( instruction.mFrameBuffer != nullptr ) { Viewport frameRect( 0, 0, instruction.mFrameBuffer->GetWidth(), instruction.mFrameBuffer->GetHeight() ); clearFullFrameRect = ( frameRect == viewportRect ); @@ -1046,7 +1022,8 @@ void RenderManager::RenderScene( Integration::RenderStatus& status, Integration: depthBufferAvailable, stencilBufferAvailable, mImpl->boundTextures, - clippingRect ); + clippingRect, + surfaceOrientation ); // Synchronise the FBO/Texture access when there are multiple contexts if ( mImpl->currentContext->IsSurfacelessContextSupported() )