} // unnamed namespace
#endif
-struct DirtyRect
-{
- DirtyRect(Node* node, Render::Renderer* renderer, int frame, Rect<int>& 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<int> rect;
- bool visited;
-};
-
/**
* Structure to contain internal data
*/
programController( glAbstraction ),
depthBufferAvailable( depthBufferAvailableParam ),
stencilBufferAvailable( stencilBufferAvailableParam ),
- partialUpdateAvailable( partialUpdateAvailableParam ),
- itemsCheckSum(0),
- defaultSurfaceOrientation( 0 )
+ 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() );
std::unique_ptr<Dali::ThreadPool> threadPool; ///< The thread pool
Vector<GLuint> boundTextures; ///< The textures bound for rendering
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,
}
RenderManager::RenderManager()
-: mImpl(NULL)
+: mImpl(nullptr)
{
}
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
frameBuffer->AttachDepthStencilTexture( mImpl->context, texture, mipmapLevel );
}
+void RenderManager::CaptureRenderingResult(Render::FrameBuffer* frameBuffer)
+{
+ frameBuffer->CaptureRenderingResult();
+}
+
void RenderManager::AddVertexBuffer( OwnerPointer< Render::VertexBuffer >& vertexBuffer )
{
mImpl->vertexBufferContainer.PushBack( vertexBuffer.Release() );
return;
}
+ Internal::Scene& sceneInternal = GetImplementation(scene);
+ SceneGraph::Scene* sceneObject = sceneInternal.GetSceneObject();
+
+ // @TODO We need to do partial rendering rotation.
+ if( sceneObject && sceneObject->GetSurfaceOrientation() != 0 )
+ {
+ return;
+ }
+
class DamagedRectsCleaner
{
public:
DamagedRectsCleaner damagedRectCleaner(damagedRects);
// 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<DirtyRect>& 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)
{
// 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)
{
c++;
if (c > 3) // no more then 3 previous rects
{
- mImpl->itemsDirtyRects.erase(dirtyRectPos);
+ itemsDirtyRects.erase(dirtyRectPos);
break;
}
}
{
// 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)
{
}
// 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)
{
i++;
}
- mImpl->itemsDirtyRects.resize(j - mImpl->itemsDirtyRects.begin());
+ itemsDirtyRects.resize(j - itemsDirtyRects.begin());
damagedRectCleaner.SetCleanOnReturn(false);
}
Rect<int32_t> surfaceRect = mImpl->defaultSurfaceRect;
Integration::DepthBufferAvailable depthBufferAvailable = mImpl->depthBufferAvailable;
Integration::StencilBufferAvailable stencilBufferAvailable = mImpl->stencilBufferAvailable;
- int surfaceOrientation = mImpl->defaultSurfaceOrientation;
+ int surfaceOrientation = sceneObject->GetSurfaceOrientation();
if ( instruction.mFrameBuffer )
{
clearMask |= GL_STENCIL_BUFFER_BIT;
}
- if( !instruction.mIgnoreRenderToFbo && ( instruction.mFrameBuffer != 0 ) )
+ if( !instruction.mIgnoreRenderToFbo && ( instruction.mFrameBuffer != nullptr ) )
{
// Offscreen buffer rendering
if ( instruction.mIsViewportSet )
}
bool clearFullFrameRect = true;
- if( instruction.mFrameBuffer != 0 )
+ if( instruction.mFrameBuffer != nullptr )
{
Viewport frameRect( 0, 0, instruction.mFrameBuffer->GetWidth(), instruction.mFrameBuffer->GetHeight() );
clearFullFrameRect = ( frameRect == viewportRect );
if ( renderToFbo )
{
mImpl->currentContext->Flush();
+ instruction.mFrameBuffer->DrawRenderedBuffer(*mImpl->currentContext);
}
}