Discard render instruction if it is empty 32/167332/6
authorHeeyong Song <heeyong.song@samsung.com>
Wed, 17 Jan 2018 05:53:38 +0000 (14:53 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Mon, 22 Jan 2018 06:48:23 +0000 (15:48 +0900)
Change-Id: I79b4ffff23bbb4a3a08a16e84d0fa8f3889670d8

dali/internal/render/common/render-instruction-container.cpp
dali/internal/render/common/render-instruction-container.h
dali/internal/render/common/render-manager.cpp
dali/internal/update/manager/render-instruction-processor.cpp

index 3cbff8a..9b16af8 100644 (file)
@@ -80,6 +80,10 @@ RenderInstruction& RenderInstructionContainer::At( BufferIndex bufferIndex, size
   return *mInstructions[ bufferIndex ][ index ];
 }
 
+void RenderInstructionContainer::DiscardCurrentInstruction( BufferIndex bufferIndex )
+{
+  mIndex[ bufferIndex ]--;
+}
 
 } // namespace SceneGraph
 
index 1bcff8b..9181243 100644 (file)
@@ -76,6 +76,12 @@ public:
    */
   RenderInstruction& At( BufferIndex bufferIndex, size_t index );
 
+  /**
+   * Discard the current container index
+   * @param bufferIndex to reset
+   */
+  void DiscardCurrentInstruction( BufferIndex bufferIndex );
+
 private:
 
   unsigned int mIndex[ 2 ]; ///< count of the elements that have been added
index 9261a6d..712d268 100644 (file)
@@ -472,8 +472,6 @@ void RenderManager::Render( Integration::RenderStatus& status )
     GLenum attachments[] = { GL_DEPTH, GL_STENCIL };
     mImpl->context.InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
 
-    mImpl->UpdateTrackers();
-
     //Notify RenderGeometries that rendering has finished
     for ( auto&& iter : mImpl->geometryContainer )
     {
@@ -481,6 +479,8 @@ void RenderManager::Render( Integration::RenderStatus& status )
     }
   }
 
+  mImpl->UpdateTrackers();
+
   // If this frame was rendered due to instructions existing, we mark this so we know to clear the next frame.
   mImpl->lastFrameWasRendered = haveInstructions;
 
index b4035e8..b95706f 100644 (file)
@@ -400,6 +400,7 @@ void RenderInstructionProcessor::Prepare( BufferIndex updateBufferIndex,
   RenderInstruction& instruction = instructions.GetNextInstruction( updateBufferIndex );
   renderTask.PrepareRenderInstruction( instruction, updateBufferIndex );
   bool viewMatrixHasNotChanged = !renderTask.ViewMatrixUpdated();
+  bool isRenderListAdded = false;
 
   const Matrix& viewMatrix = renderTask.GetViewMatrix( updateBufferIndex );
   SceneGraph::Camera& camera = renderTask.GetCamera();
@@ -430,6 +431,8 @@ void RenderInstructionProcessor::Prepare( BufferIndex updateBufferIndex,
         // We only use the clipping version of the sort comparitor if any clipping nodes exist within the RenderList.
         SortRenderItems( updateBufferIndex, *renderList, layer, hasClippingNodes );
       }
+
+      isRenderListAdded = true;
     }
 
     if( !layer.overlayRenderables.Empty() )
@@ -450,13 +453,19 @@ void RenderInstructionProcessor::Prepare( BufferIndex updateBufferIndex,
         // Clipping hierarchy is irrelevant when sorting overlay items, so we specify using the non-clipping version of the sort comparitor.
         SortRenderItems( updateBufferIndex, *renderList, layer, false );
       }
+
+      isRenderListAdded = true;
     }
   }
 
   // Inform the render instruction that all renderers have been added and this frame is complete.
   instruction.UpdateCompleted();
-}
 
+  if( !isRenderListAdded && !instruction.mIsClearColorSet )
+  {
+    instructions.DiscardCurrentInstruction( updateBufferIndex );
+  }
+}
 
 } // SceneGraph