#include <dali/internal/render/common/render-instruction.h>
#include <dali/internal/render/common/render-tracker.h>
#include <dali/internal/render/queue/render-queue.h>
+#include <dali/internal/render/renderers/pipeline-cache.h>
#include <dali/internal/render/renderers/render-frame-buffer.h>
#include <dali/internal/render/renderers/render-texture.h>
#include <dali/internal/render/renderers/shader-cache.h>
#include <dali/internal/render/renderers/uniform-buffer-view-pool.h>
#include <dali/internal/render/shaders/program-controller.h>
-#include <dali/internal/render/renderers/uniform-buffer-manager.h>
+#include <memory>
namespace Dali
{
} // unnamed namespace
#endif
+namespace
+{
+inline Graphics::Rect2D RecalculateScissorArea(Graphics::Rect2D scissorArea, int orientation, Rect<int32_t> 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
*/
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<Dali::ThreadPool>(new Dali::ThreadPool());
+ threadPool = std::make_unique<Dali::ThreadPool>();
threadPool->Initialize(1u);
- uniformBufferManager.reset(new Render::UniformBufferManager(&graphicsController));
+ uniformBufferManager = std::make_unique<Render::UniformBufferManager>(&graphicsController);
+ pipelineCache = std::make_unique<Render::PipelineCache>(graphicsController);
}
~Impl()
Render::ShaderCache shaderCache; ///< The cache for the graphics shaders
std::unique_ptr<Render::UniformBufferManager> uniformBufferManager; ///< The uniform buffer manager
+ std::unique_ptr<Render::PipelineCache> pipelineCache;
Integration::DepthBufferAvailable depthBufferAvailable; ///< Whether the depth buffer is available
Integration::StencilBufferAvailable stencilBufferAvailable; ///< Whether the stencil buffer is available
void RenderManager::AddRenderer(OwnerPointer<Render::Renderer>& 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());
}
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)
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);
}
}
}
(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;
}
}
+ // 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,