- its not possible to have a renderer without scene graph geometry and shader
- renderers are now ready and complete as soon as they are ready, i.e. have valid geometry and shader
Change-Id: I197c7af70a4c204260558a57b54bd69a2830f410
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* Rebuild the Layer::colorRenderables and overlayRenderables members,
* including only renderers which are included in the current render-task.
/**
* Rebuild the Layer::colorRenderables and overlayRenderables members,
* including only renderers which are included in the current render-task.
- * Returns true if all renderers have finished acquiring resources.
*
* @param[in] updateBufferIndex The current update buffer index.
* @param[in] node The current node of the scene-graph.
*
* @param[in] updateBufferIndex The current update buffer index.
* @param[in] node The current node of the scene-graph.
* Note: ClippingId is passed by reference, so it is permanently modified when traversing back up the tree for uniqueness.
* @param[in] clippingDepth The current clipping depth
*/
* Note: ClippingId is passed by reference, so it is permanently modified when traversing back up the tree for uniqueness.
* @param[in] clippingDepth The current clipping depth
*/
-bool AddRenderablesForTask( BufferIndex updateBufferIndex,
+void AddRenderablesForTask( BufferIndex updateBufferIndex,
Node& node,
Layer& currentLayer,
RenderTask& renderTask,
Node& node,
Layer& currentLayer,
RenderTask& renderTask,
uint32_t& currentClippingId,
uint32_t clippingDepth )
{
uint32_t& currentClippingId,
uint32_t clippingDepth )
{
- bool resourcesFinished = true;
-
// Short-circuit for invisible nodes
if( !node.IsVisible( updateBufferIndex ) )
{
// Short-circuit for invisible nodes
if( !node.IsVisible( updateBufferIndex ) )
{
- return resourcesFinished;
}
// Check whether node is exclusive to a different render-task
const RenderTask* exclusiveTo = node.GetExclusiveRenderTask();
if( exclusiveTo && ( exclusiveTo != &renderTask ) )
{
}
// Check whether node is exclusive to a different render-task
const RenderTask* exclusiveTo = node.GetExclusiveRenderTask();
if( exclusiveTo && ( exclusiveTo != &renderTask ) )
{
- return resourcesFinished;
}
// Assume all children go to this layer (if this node is a layer).
}
// Assume all children go to this layer (if this node is a layer).
for( unsigned int i = 0; i < count; ++i )
{
SceneGraph::Renderer* renderer = node.GetRendererAt( i );
for( unsigned int i = 0; i < count; ++i )
{
SceneGraph::Renderer* renderer = node.GetRendererAt( i );
- bool ready = false;
- bool complete = false;
- renderer->GetReadyAndComplete( ready, complete );
-
- DALI_LOG_INFO( gRenderTaskLogFilter, Debug::General, "Testing renderable:%p ready:%s complete:%s\n", renderer, ready ? "T" : "F", complete ? "T" : "F" );
-
- resourcesFinished &= complete;
- if( ready ) // IE. should be rendered (all resources are available)
+ // Normal is the more-likely draw mode to occur.
+ if( DALI_LIKELY( inheritedDrawMode == DrawMode::NORMAL ) )
- // Normal is the more-likely draw mode to occur.
- if( DALI_LIKELY( inheritedDrawMode == DrawMode::NORMAL ) )
- {
- layer->colorRenderables.PushBack( Renderable( &node, renderer ) );
- }
- else
- {
- layer->overlayRenderables.PushBack( Renderable( &node, renderer ) );
- }
+ layer->colorRenderables.PushBack( Renderable( &node, renderer ) );
+ }
+ else
+ {
+ layer->overlayRenderables.PushBack( Renderable( &node, renderer ) );
for( NodeIter iter = children.Begin(); iter != endIter; ++iter )
{
Node& child = **iter;
for( NodeIter iter = children.Begin(); iter != endIter; ++iter )
{
Node& child = **iter;
- bool childResourcesComplete = AddRenderablesForTask( updateBufferIndex, child, *layer, renderTask, inheritedDrawMode, currentClippingId, clippingDepth );
- resourcesFinished &= childResourcesComplete;
+ AddRenderablesForTask( updateBufferIndex, child, *layer, renderTask, inheritedDrawMode, currentClippingId, clippingDepth );
-
- return resourcesFinished;
}
} // Anonymous namespace.
}
} // Anonymous namespace.
- bool resourcesFinished = false;
if( renderTask.IsRenderRequired() )
{
size_t layerCount( sortedLayers.size() );
if( renderTask.IsRenderRequired() )
{
size_t layerCount( sortedLayers.size() );
sortedLayers[i]->ClearRenderables();
}
sortedLayers[i]->ClearRenderables();
}
- resourcesFinished = AddRenderablesForTask( updateBufferIndex,
- *sourceNode,
- *layer,
- renderTask,
- sourceNode->GetDrawMode(),
- clippingId,
- 0u );
-
- renderTask.SetResourcesFinished( resourcesFinished );
+ AddRenderablesForTask( updateBufferIndex,
+ *sourceNode,
+ *layer,
+ renderTask,
+ sourceNode->GetDrawMode(),
+ clippingId,
+ 0u );
// If the clipping Id is still 0 after adding all Renderables, there is no clipping required for this RenderTaskList.
hasClippingNodes = clippingId != 0u;
// If the clipping Id is still 0 after adding all Renderables, there is no clipping required for this RenderTaskList.
hasClippingNodes = clippingId != 0u;
hasClippingNodes,
instructions );
}
hasClippingNodes,
instructions );
}
- else
- {
- renderTask.SetResourcesFinished( resourcesFinished );
- }
}
DALI_LOG_INFO( gRenderTaskLogFilter, Debug::General, "RenderTaskProcessor::Process() Onscreen\n" );
}
DALI_LOG_INFO( gRenderTaskLogFilter, Debug::General, "RenderTaskProcessor::Process() Onscreen\n" );
- bool resourcesFinished = false;
if( renderTask.IsRenderRequired() )
{
size_t layerCount( sortedLayers.size() );
if( renderTask.IsRenderRequired() )
{
size_t layerCount( sortedLayers.size() );
sortedLayers[i]->ClearRenderables();
}
sortedLayers[i]->ClearRenderables();
}
- resourcesFinished = AddRenderablesForTask( updateBufferIndex,
- *sourceNode,
- *layer,
- renderTask,
- sourceNode->GetDrawMode(),
- clippingId,
- 0u );
+ AddRenderablesForTask( updateBufferIndex,
+ *sourceNode,
+ *layer,
+ renderTask,
+ sourceNode->GetDrawMode(),
+ clippingId,
+ 0u );
// If the clipping Id is still 0 after adding all Renderables, there is no clipping required for this RenderTaskList.
hasClippingNodes = clippingId != 0;
// If the clipping Id is still 0 after adding all Renderables, there is no clipping required for this RenderTaskList.
hasClippingNodes = clippingId != 0;
hasClippingNodes,
instructions );
}
hasClippingNodes,
instructions );
}
-
- renderTask.SetResourcesFinished( resourcesFinished );
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
-void RenderTask::SetResourcesFinished( bool resourcesFinished )
-{
- // resourcesFinished tells us that this render task will render to its FBO
- mResourcesFinished = resourcesFinished;
-}
-
// Called every frame regardless of whether render was required.
// If render was not required, ignore resourcesFinished.
void RenderTask::UpdateState()
{
// Called every frame regardless of whether render was required.
// If render was not required, ignore resourcesFinished.
void RenderTask::UpdateState()
{
- TASK_LOG_FMT( Debug::General, "(mResourcesFinished:%s) FC:%d State:%s RR:%d\n", mResourcesFinished?"T":"F", mFrameCounter, STATE_STRING(mState), mRefreshRate );
+ TASK_LOG_FMT( Debug::General, "FC:%d State:%s RR:%d\n", mFrameCounter, STATE_STRING(mState), mRefreshRate );
{
if( mFrameCounter == 0 )
{
{
if( mFrameCounter == 0 )
{
- if( mResourcesFinished )
- {
- ++mFrameCounter; // Only start skipping frames when resources are loaded
- }
+ ++mFrameCounter; // Only start skipping frames when resources are loaded
}
else // Continue counting to skip frames
{
}
else // Continue counting to skip frames
{
case RENDER_ONCE_WAITING_FOR_RESOURCES:
{
case RENDER_ONCE_WAITING_FOR_RESOURCES:
{
- if( mResourcesFinished )
- {
- mState = RENDERED_ONCE;
- }
+ mState = RENDERED_ONCE;
mClearEnabled ? &GetClearColor( updateBufferIndex ) : NULL );
if( mRequiresSync &&
mClearEnabled ? &GetClearColor( updateBufferIndex ) : NULL );
if( mRequiresSync &&
- mRefreshRate == Dali::RenderTask::REFRESH_ONCE &&
- mResourcesFinished )
+ mRefreshRate == Dali::RenderTask::REFRESH_ONCE )
{
// create tracker if one doesn't yet exist.
if( !mRenderSyncTracker )
{
// create tracker if one doesn't yet exist.
if( !mRenderSyncTracker )
mCameraNode( NULL ),
mCamera( NULL ),
mFrameBuffer(0),
mCameraNode( NULL ),
mCamera( NULL ),
mFrameBuffer(0),
- mResourcesFinished( false ),
mWaitingToRender( false ),
mNotifyTrigger( false ),
mExclusive( Dali::RenderTask::DEFAULT_EXCLUSIVE ),
mWaitingToRender( false ),
mNotifyTrigger( false ),
mExclusive( Dali::RenderTask::DEFAULT_EXCLUSIVE ),
#define __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_H__
/*
#define __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
bool IsRenderRequired();
/**
bool IsRenderRequired();
/**
- * Set whether all resources were available when the render-task was processed
- * @param[in] resourcesComplete True if the resources of the source tree are completely loaded.
- */
- void SetResourcesFinished( bool resourcesFinished );
-
- /**
* Process a frame. This method is called each frame for every ready render task, regardless
* of whether it needs to render (so that the frame counter can be updated).
*/
* Process a frame. This method is called each frame for every ready render task, regardless
* of whether it needs to render (so that the frame counter can be updated).
*/
SceneGraph::Camera* mCamera;
Render::FrameBuffer* mFrameBuffer;
SceneGraph::Camera* mCamera;
Render::FrameBuffer* mFrameBuffer;
- bool mResourcesFinished:1; ///< True if all resources were available when the render-task was processed
bool mWaitingToRender:1; ///< True when an render once to FBO is waiting
bool mNotifyTrigger:1; ///< True if a render once render task has finished renderering
bool mExclusive: 1; ///< Whether the render task has exclusive access to the source actor (node in the scene graph implementation).
bool mWaitingToRender:1; ///< True when an render once to FBO is waiting
bool mNotifyTrigger:1; ///< True if a render once render task has finished renderering
bool mExclusive: 1; ///< Whether the render task has exclusive access to the source actor (node in the scene graph implementation).
mBlendMode( BlendMode::AUTO ),
mDepthWriteMode( DepthWriteMode::AUTO ),
mDepthTestMode( DepthTestMode::AUTO ),
mBlendMode( BlendMode::AUTO ),
mDepthWriteMode( DepthWriteMode::AUTO ),
mDepthTestMode( DepthTestMode::AUTO ),
- mResourcesReady( false ),
- mFinishedResourceAcquisition( false ),
mPremultipledAlphaEnabled( false ),
mDepthIndex( 0 )
{
mPremultipledAlphaEnabled( false ),
mDepthIndex( 0 )
{
void Renderer::PrepareRender( BufferIndex updateBufferIndex )
{
void Renderer::PrepareRender( BufferIndex updateBufferIndex )
{
- mResourcesReady = false;
- mFinishedResourceAcquisition = false;
-
- // Can only be considered ready when all the scene graph objects are connected to the renderer
- if( mGeometry && mShader )
- {
- mResourcesReady = true;
- mFinishedResourceAcquisition = true;
- }
-
if( mRegenerateUniformMap > UNIFORM_MAP_READY )
{
if( mRegenerateUniformMap > UNIFORM_MAP_READY )
{
- DALI_ASSERT_DEBUG( mGeometry != NULL && "No geometry available in PrepareRender()" );
- DALI_ASSERT_DEBUG( mShader != NULL && "No shader available in PrepareRender()" );
-
if( mRegenerateUniformMap == REGENERATE_UNIFORM_MAP)
{
CollectedUniformMap& localMap = mCollectedUniformMap[ updateBufferIndex ];
if( mRegenerateUniformMap == REGENERATE_UNIFORM_MAP)
{
CollectedUniformMap& localMap = mCollectedUniformMap[ updateBufferIndex ];
{
typedef MessageValue1< Render::Renderer, Render::Geometry* > DerivedType;
unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
{
typedef MessageValue1< Render::Renderer, Render::Geometry* > DerivedType;
unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
new (slot) DerivedType( mRenderer, &Render::Renderer::SetGeometry, mGeometry );
}
new (slot) DerivedType( mRenderer, &Render::Renderer::SetGeometry, mGeometry );
}
return mCollectedUniformMap[bufferIndex];
}
return mCollectedUniformMap[bufferIndex];
}
-void Renderer::GetReadyAndComplete( bool& ready, bool& complete ) const
-{
- ready = mResourcesReady;
- complete = mFinishedResourceAcquisition;
-}
-
Renderer::Opacity Renderer::GetOpacity( BufferIndex updateBufferIndex, const Node& node ) const
{
Renderer::Opacity opacity = Renderer::OPAQUE;
Renderer::Opacity Renderer::GetOpacity( BufferIndex updateBufferIndex, const Node& node ) const
{
Renderer::Opacity opacity = Renderer::OPAQUE;
Render::Renderer& GetRenderer();
/**
Render::Renderer& GetRenderer();
/**
- * Check whether the renderer has been marked as ready to render
- * ready means that renderer has all resources and should produce correct result
- * complete means all resources have finished loading
- * It's possible that renderer is complete but not ready,
- * for example in case of resource load failed
- * @param[out] ready TRUE if the renderer has resources to render
- * @param[out] complete TRUE if the renderer resources are complete
- */
- void GetReadyAndComplete( bool& ready, bool& complete ) const;
-
- /**
* Query whether the renderer is fully opaque, fully transparent or transparent.
* @param[in] updateBufferIndex The current update buffer index.
* @return OPAQUE if fully opaque, TRANSPARENT if fully transparent and TRANSLUCENT if in between
* Query whether the renderer is fully opaque, fully transparent or transparent.
* @param[in] updateBufferIndex The current update buffer index.
* @return OPAQUE if fully opaque, TRANSPARENT if fully transparent and TRANSLUCENT if in between
DepthTestMode::Type mDepthTestMode:2; ///< Local copy of the depth test mode
bool mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
DepthTestMode::Type mDepthTestMode:2; ///< Local copy of the depth test mode
bool mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
- bool mResourcesReady; ///< Set during the Update algorithm; true if the renderer has resources ready for the current frame.
- bool mFinishedResourceAcquisition; ///< Set during DoPrepareResources; true if ready & all resource acquisition has finished (successfully or otherwise)
bool mPremultipledAlphaEnabled:1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
public:
int mDepthIndex; ///< Used only in PrepareRenderInstructions
bool mPremultipledAlphaEnabled:1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
public:
int mDepthIndex; ///< Used only in PrepareRenderInstructions