X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Fcommon%2Frender-manager.cpp;h=91cb4c51679716f502c99371625f4d6ac759d519;hb=refs%2Fchanges%2F13%2F263213%2F14;hp=56495cc4693a4c4ecac8327f27467ea1c8595fae;hpb=c730e6ed274d11a6ae8196d4d2812fc05c64bc23;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 index 56495cc..91cb4c5 100644 --- a/dali/internal/render/common/render-manager.cpp +++ b/dali/internal/render/common/render-manager.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -42,7 +43,7 @@ #include #include -#include +#include namespace Dali { @@ -57,6 +58,43 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_REN } // unnamed namespace #endif +namespace +{ +inline Graphics::Rect2D RecalculateScissorArea(Graphics::Rect2D scissorArea, int orientation, Rect viewportRect) +{ + Graphics::Rect2D newScissorArea; + + if(orientation == 90) + { + newScissorArea.x = viewportRect.height - (scissorArea.y + scissorArea.height); + newScissorArea.y = scissorArea.x; + newScissorArea.width = scissorArea.height; + newScissorArea.height = scissorArea.width; + } + else if(orientation == 180) + { + newScissorArea.x = viewportRect.width - (scissorArea.x + scissorArea.width); + newScissorArea.y = viewportRect.height - (scissorArea.y + scissorArea.height); + newScissorArea.width = scissorArea.width; + newScissorArea.height = scissorArea.height; + } + else if(orientation == 270) + { + newScissorArea.x = scissorArea.y; + newScissorArea.y = viewportRect.width - (scissorArea.x + scissorArea.width); + newScissorArea.width = scissorArea.height; + newScissorArea.height = scissorArea.width; + } + else + { + newScissorArea.x = scissorArea.x; + newScissorArea.y = scissorArea.y; + newScissorArea.width = scissorArea.width; + newScissorArea.height = scissorArea.height; + } + return newScissorArea; +} +} // namespace /** * Structure to contain internal data */ @@ -83,10 +121,11 @@ struct RenderManager::Impl partialUpdateAvailable(partialUpdateAvailableParam) { // 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()); + threadPool = std::make_unique(); threadPool->Initialize(1u); - uniformBufferManager.reset(new Render::UniformBufferManager(&graphicsController)); + uniformBufferManager = std::make_unique(&graphicsController); + pipelineCache = std::make_unique(graphicsController); } ~Impl() @@ -139,6 +178,7 @@ struct RenderManager::Impl Render::ShaderCache shaderCache; ///< The cache for the graphics shaders std::unique_ptr uniformBufferManager; ///< The uniform buffer manager + std::unique_ptr pipelineCache; Integration::DepthBufferAvailable depthBufferAvailable; ///< Whether the depth buffer is available Integration::StencilBufferAvailable stencilBufferAvailable; ///< Whether the stencil buffer is available @@ -184,7 +224,7 @@ void RenderManager::SetShaderSaver(ShaderSaver& upstream) void RenderManager::AddRenderer(OwnerPointer& renderer) { // Initialize the renderer as we are now in render thread - renderer->Initialize(mImpl->graphicsController, mImpl->programController, mImpl->shaderCache, *(mImpl->uniformBufferManager.get())); + renderer->Initialize(mImpl->graphicsController, mImpl->programController, mImpl->shaderCache, *(mImpl->uniformBufferManager.get()), *(mImpl->pipelineCache.get())); mImpl->rendererContainer.PushBack(renderer.Release()); } @@ -341,7 +381,14 @@ void RenderManager::AddGeometry(OwnerPointer& geometry) void RenderManager::RemoveGeometry(Render::Geometry* geometry) { - mImpl->geometryContainer.EraseObject(geometry); + auto it = std::find_if(mImpl->geometryContainer.begin(), mImpl->geometryContainer.end(), [geometry](auto& item) { + return geometry == item; + }); + + if(it != mImpl->geometryContainer.end()) + { + mImpl->geometryContainer.Erase(it); + } } void RenderManager::AttachVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer) @@ -418,43 +465,9 @@ void RenderManager::PreRender(Integration::RenderStatus& status, bool forceClear DALI_LOG_INFO(gLogFilter, Debug::General, "Render: Processing\n"); // Upload the geometries - for(auto& i : mImpl->sceneContainer) + for(auto&& geom : mImpl->geometryContainer) { - RenderInstructionContainer& instructions = i->GetRenderInstructions(); - for(uint32_t j = 0; j < instructions.Count(mImpl->renderBufferIndex); ++j) - { - RenderInstruction& instruction = instructions.At(mImpl->renderBufferIndex, j); - - const Matrix* viewMatrix = instruction.GetViewMatrix(mImpl->renderBufferIndex); - const Matrix* projectionMatrix = instruction.GetProjectionMatrix(mImpl->renderBufferIndex); - - DALI_ASSERT_DEBUG(viewMatrix); - DALI_ASSERT_DEBUG(projectionMatrix); - - if(viewMatrix && projectionMatrix) - { - const RenderListContainer::SizeType renderListCount = instruction.RenderListCount(); - - // Iterate through each render list. - for(RenderListContainer::SizeType index = 0; index < renderListCount; ++index) - { - const RenderList* renderList = instruction.GetRenderList(index); - - if(renderList && !renderList->IsEmpty()) - { - const std::size_t itemCount = renderList->Count(); - for(uint32_t itemIndex = 0u; itemIndex < itemCount; ++itemIndex) - { - const RenderItem& item = renderList->GetItem(itemIndex); - if(DALI_LIKELY(item.mRenderer)) - { - item.mRenderer->Upload(); - } - } - } - } - } - } + geom->Upload(mImpl->graphicsController); } } } @@ -598,9 +611,9 @@ void RenderManager::PreRender(Integration::Scene& scene, std::vector>& (item.mNode->Updated() || (item.mRenderer && item.mRenderer->Updated(mImpl->renderBufferIndex, item.mNode))))) { item.mIsUpdated = false; - item.mNode->SetUpdated(false); + item.mNode->SetUpdatedTree(false); - rect = item.CalculateViewportSpaceAABB(item.mUpdateSize, viewportRect.width, viewportRect.height); + rect = RenderItem::CalculateViewportSpaceAABB(item.mModelViewMatrix, item.mUpdateSize, viewportRect.width, viewportRect.height); if(rect.IsValid() && rect.Intersect(viewportRect) && !rect.IsEmpty()) { const int left = rect.x; @@ -877,6 +890,11 @@ void RenderManager::RenderScene(Integration::RenderStatus& status, Integration:: } } + // Scissor's value should be set based on the default system coordinates. + // When the surface is rotated, the input values already were set with the rotated angle. + // So, re-calculation is needed. + scissorArea = RecalculateScissorArea(scissorArea, surfaceOrientation, viewportRect); + // Begin render pass mainCommandBuffer->BeginRenderPass( currentRenderPass,