From 4a13250fb1ef5da3fa8db70373d3f9a8f78ee9b6 Mon Sep 17 00:00:00 2001 From: Kimmo Hoikka Date: Wed, 14 Oct 2015 16:38:22 +0100 Subject: [PATCH] Remove some dead and non-thread safe internal uniforms Change-Id: I70635a012f67b75d22a411ac06d7b34f27be4659 --- .../render/common/render-algorithms.cpp | 62 ++----------------- .../render/common/render-algorithms.h | 4 +- .../internal/render/common/render-manager.cpp | 21 +------ dali/internal/render/common/render-manager.h | 3 +- .../render/renderers/render-renderer.cpp | 10 +-- .../render/renderers/render-renderer.h | 2 - dali/internal/render/shaders/program.cpp | 5 -- dali/internal/render/shaders/program.h | 5 -- .../update/manager/update-manager.cpp | 3 - 9 files changed, 10 insertions(+), 105 deletions(-) diff --git a/dali/internal/render/common/render-algorithms.cpp b/dali/internal/render/common/render-algorithms.cpp index 48799259f..646053d06 100644 --- a/dali/internal/render/common/render-algorithms.cpp +++ b/dali/internal/render/common/render-algorithms.cpp @@ -109,7 +109,6 @@ inline void SetRenderFlags( const RenderList& renderList, Context& context ) * @param[in] context The GL context. * @param[in] defaultShader The default shader to use. * @param[in] buffer The current render buffer index (previous update buffer) - * @param[in] frameTime The elapsed time between the last two updates. * @param[in] viewMatrix The view matrix from the appropriate camera. * @param[in] projectionMatrix The projection matrix from the appropriate camera. * @param[in] cullMode True if the renderers should be subjected to clipspace culling @@ -120,7 +119,6 @@ inline void ProcessRenderList( SceneGraph::TextureCache& textureCache, SceneGraph::Shader& defaultShader, BufferIndex bufferIndex, - float frameTime, const Matrix& viewMatrix, const Matrix& projectionMatrix, bool cullMode ) @@ -142,7 +140,7 @@ inline void ProcessRenderList( //Enable depth writes if depth buffer is enabled and item is opaque context.DepthMask( depthBufferEnabled && item.IsOpaque() ); - item.GetRenderer().Render( context, textureCache, bufferIndex, item.GetNode(), defaultShader, item.GetModelViewMatrix(), viewMatrix, projectionMatrix, frameTime, cullMode, !item.IsOpaque() ); + item.GetRenderer().Render( context, textureCache, bufferIndex, item.GetNode(), defaultShader, item.GetModelViewMatrix(), viewMatrix, projectionMatrix, cullMode, !item.IsOpaque() ); } } else @@ -153,69 +151,17 @@ inline void ProcessRenderList( const RenderItem& item = renderList.GetItem( index ); DALI_PRINT_RENDER_ITEM( item ); - item.GetRenderer().Render( context, textureCache, bufferIndex, item.GetNode(), defaultShader, item.GetModelViewMatrix(), viewMatrix, projectionMatrix, frameTime, cullMode, !item.IsOpaque() ); + item.GetRenderer().Render( context, textureCache, bufferIndex, item.GetNode(), defaultShader, item.GetModelViewMatrix(), viewMatrix, projectionMatrix, cullMode, !item.IsOpaque() ); } } } -/** - * Render items from the currentIndex until the depth index changes. - * Leaves currentIndex pointing at the - * - * @param[in] renderList The render-list to process. - * @param[in] context The GL context. - * @param[in] defaultShader The default shader to use. - * @param[in] buffer The current render buffer index (previous update buffer) - * @param[in] frameTime The elapsed time between the last two updates. - * @param[in] viewMatrix The view matrix from the appropriate camera. - * @param[in] projectionMatrix The projection matrix from the appropriate camera. - * @param[in] cullMode True if the renderers should be subjected to clipspace culling - * @param[in] depthIndex The current depth index - * @param[inout] currentIndex On entry, the index in the render list of the first item at the given depth index. On exit, the index of the first item at the next depth index. - */ -inline void RenderItemsAtDepthIndex( - const RenderList& renderList, - Context& context, - SceneGraph::TextureCache& textureCache, - SceneGraph::Shader& defaultShader, - BufferIndex bufferIndex, - float frameTime, - const Matrix& viewMatrix, - const Matrix& projectionMatrix, - bool cullMode, - int depthIndex, - size_t& currentIndex ) // Out parameter -{ - const size_t count = renderList.Count(); - - // Don't initialise currentIndex. Ever. - for( ; currentIndex < count ; currentIndex++ ) - { - const RenderItem& renderItem = renderList.GetItem( currentIndex ); - DALI_PRINT_RENDER_ITEM( renderItem ); - - if( renderItem.GetDepthIndex() == depthIndex ) - { - const Matrix& modelViewMatrix = renderItem.GetModelViewMatrix(); - renderItem.GetRenderer().Render( context, textureCache, bufferIndex, renderItem.GetNode(), defaultShader, modelViewMatrix, viewMatrix, projectionMatrix, frameTime, cullMode, !renderItem.IsOpaque() ); - - } - else - { - break; // Stop iterating when we reach a new depth index - } - } -} - - - void ProcessRenderInstruction( const RenderInstruction& instruction, Context& context, SceneGraph::TextureCache& textureCache, SceneGraph::Shader& defaultShader, - BufferIndex bufferIndex, - float frameTime ) + BufferIndex bufferIndex ) { DALI_PRINT_RENDER_INSTRUCTION( instruction, bufferIndex ); @@ -239,7 +185,7 @@ void ProcessRenderInstruction( const RenderInstruction& instruction, if( renderList && !renderList->IsEmpty() ) { - ProcessRenderList( *renderList, context, textureCache, defaultShader, bufferIndex, frameTime, *viewMatrix, *projectionMatrix, instruction.mCullMode ); + ProcessRenderList( *renderList, context, textureCache, defaultShader, bufferIndex, *viewMatrix, *projectionMatrix, instruction.mCullMode ); } } } diff --git a/dali/internal/render/common/render-algorithms.h b/dali/internal/render/common/render-algorithms.h index f06cecad9..b84d68df5 100644 --- a/dali/internal/render/common/render-algorithms.h +++ b/dali/internal/render/common/render-algorithms.h @@ -44,14 +44,12 @@ namespace Render * @param[in] textureCache The texture cache used to get textures. * @param[in] defaultShader The default shader. * @param[in] buffer The current render buffer index (previous update buffer) - * @param[in] frameTime The elapsed time between the last two updates. */ void ProcessRenderInstruction( const SceneGraph::RenderInstruction& instruction, Context& context, SceneGraph::TextureCache& textureCache, SceneGraph::Shader& defaultShader, - BufferIndex bufferIndex, - float frameTime ); + BufferIndex bufferIndex ); } // namespace Render diff --git a/dali/internal/render/common/render-manager.cpp b/dali/internal/render/common/render-manager.cpp index dd6a9c64b..83c254667 100644 --- a/dali/internal/render/common/render-manager.cpp +++ b/dali/internal/render/common/render-manager.cpp @@ -96,8 +96,6 @@ struct RenderManager::Impl resourcePostProcessQueue( resourcePostProcessQ ), instructions(), backgroundColor( Dali::Stage::DEFAULT_BACKGROUND_COLOR ), - frameTime( 0.0f ), - lastFrameTime( 0.0f ), frameCount( 0 ), renderBufferIndex( SceneGraphBuffers::INITIAL_UPDATE_BUFFER_INDEX ), defaultSurfaceRect(), @@ -154,9 +152,6 @@ struct RenderManager::Impl Vector4 backgroundColor; ///< The glClear color used at the beginning of each frame. - float frameTime; ///< The elapsed time since the previous frame - float lastFrameTime; ///< Last frame delta. - unsigned int frameCount; ///< The current frame count BufferIndex renderBufferIndex; ///< The index of the buffer to read from; this is opposite of the "update" buffer @@ -252,11 +247,6 @@ void RenderManager::SetBackgroundColor( const Vector4& color ) mImpl->backgroundColor = color; } -void RenderManager::SetFrameDeltaTime( float deltaTime ) -{ - mImpl->frameTime = deltaTime; -} - void RenderManager::SetDefaultSurfaceRect(const Rect& rect) { mImpl->defaultSurfaceRect = rect; @@ -453,7 +443,6 @@ bool RenderManager::Render( Integration::RenderStatus& status ) // reset the program matrices for all programs once per frame // this ensures we will set view and projection matrix once per program per camera - // @todo move programs out of context onto a program controller and let that handle this mImpl->programController.ResetProgramMatrices(); // if we don't have default shader, no point doing the render calls @@ -464,7 +453,7 @@ bool RenderManager::Render( Integration::RenderStatus& status ) { RenderInstruction& instruction = mImpl->instructions.At( mImpl->renderBufferIndex, i ); - DoRender( instruction, *mImpl->defaultShader, mImpl->lastFrameTime ); + DoRender( instruction, *mImpl->defaultShader ); const RenderListContainer::SizeType countRenderList = instruction.RenderListCount(); if ( countRenderList > 0 ) @@ -483,9 +472,6 @@ bool RenderManager::Render( Integration::RenderStatus& status ) PERF_MONITOR_END(PerformanceMonitor::DRAW_NODES); - // Update the frame time - mImpl->lastFrameTime = mImpl->frameTime; - // check if anything has been posted to the update thread bool updateRequired = !mImpl->resourcePostProcessQueue[ mImpl->renderBufferIndex ].empty(); @@ -510,7 +496,7 @@ bool RenderManager::Render( Integration::RenderStatus& status ) return updateRequired; } -void RenderManager::DoRender( RenderInstruction& instruction, Shader& defaultShader, float elapsedTime ) +void RenderManager::DoRender( RenderInstruction& instruction, Shader& defaultShader ) { Rect viewportRect; Vector4 clearColor; @@ -591,8 +577,7 @@ void RenderManager::DoRender( RenderInstruction& instruction, Shader& defaultSha mImpl->context, mImpl->textureCache, defaultShader, - mImpl->renderBufferIndex, - elapsedTime ); + mImpl->renderBufferIndex ); if(instruction.mOffscreenTextureId != 0) { diff --git a/dali/internal/render/common/render-manager.h b/dali/internal/render/common/render-manager.h index 62f19860d..91e2cc645 100644 --- a/dali/internal/render/common/render-manager.h +++ b/dali/internal/render/common/render-manager.h @@ -256,9 +256,8 @@ private: * Helper to process a single RenderInstruction. * @param[in] instruction A description of the rendering operation. * @param[in] defaultShader default shader to use. - * @param[in] elapsedTime from previous render. */ - void DoRender( RenderInstruction& instruction, Shader& defaultShader, float elapsedTime ); + void DoRender( RenderInstruction& instruction, Shader& defaultShader ); private: diff --git a/dali/internal/render/renderers/render-renderer.cpp b/dali/internal/render/renderers/render-renderer.cpp index 90650efa3..ff016aacc 100644 --- a/dali/internal/render/renderers/render-renderer.cpp +++ b/dali/internal/render/renderers/render-renderer.cpp @@ -141,12 +141,9 @@ void Renderer::Render( Context& context, const Matrix& modelViewMatrix, const Matrix& viewMatrix, const Matrix& projectionMatrix, - float frametime, bool cull, - bool blend) + bool blend ) { - // @todo MESH_REWORK Fix when merging! :D - NewRenderer* renderer = dynamic_cast(this); if( renderer ) @@ -215,11 +212,6 @@ void Renderer::Render( Context& context, const Vector4& color = node.GetRenderColor( bufferIndex ); program->SetUniform4f( loc, color.r, color.g, color.b, color.a ); } - loc = program->GetUniformLocation(Program::UNIFORM_TIME_DELTA); - if( Program::UNIFORM_UNKNOWN != loc ) - { - program->SetUniform1f( loc, frametime ); - } //@todo MESH_REWORK Remove after removing ImageRenderer DoSetUniforms(context, bufferIndex, mShader, program ); diff --git a/dali/internal/render/renderers/render-renderer.h b/dali/internal/render/renderers/render-renderer.h index 642f59775..d5e91a905 100644 --- a/dali/internal/render/renderers/render-renderer.h +++ b/dali/internal/render/renderers/render-renderer.h @@ -106,7 +106,6 @@ public: * @param[in] modelViewMatrix The model-view matrix. * @param[in] viewMatrix The view matrix. * @param[in] projectionMatrix The projection matrix. - * @param[in] frametime The elapsed time between the last two updates. * @param[in] cull Whether to frustum cull this renderer */ void Render( Context& context, @@ -117,7 +116,6 @@ public: const Matrix& modelViewMatrix, const Matrix& viewMatrix, const Matrix& projectionMatrix, - float frametime, bool cull, bool blend); diff --git a/dali/internal/render/shaders/program.cpp b/dali/internal/render/shaders/program.cpp index 7c1282bdd..c10089545 100644 --- a/dali/internal/render/shaders/program.cpp +++ b/dali/internal/render/shaders/program.cpp @@ -95,14 +95,9 @@ const char* gStdUniforms[ Program::UNIFORM_TYPE_LAST ] = "uViewMatrix", // UNIFORM_VIEW_MATRIX, "uNormalMatrix", // UNIFORM_NORMAL_MATRIX "uColor", // UNIFORM_COLOR - "uCustomTextureCoords", // UNIFORM_CUSTOM_TEXTURE_COORDS "sTexture", // UNIFORM_SAMPLER "sTextureRect", // UNIFORM_SAMPLER_RECT "sEffect", // UNIFORM_EFFECT_SAMPLER - "sEffectRect", // UNIFORM_EFFECT_SAMPLER_RECT - "uTimeDelta", // UNIFORM_TIME_DELTA - "sOpacityTexture", // UNIFORM_SAMPLER_OPACITY - "sNormalMapTexture", // UNIFORM_SAMPLER_NORMAL_MAP "uSize" // UNIFORM_SIZE }; diff --git a/dali/internal/render/shaders/program.h b/dali/internal/render/shaders/program.h index e1e47cd45..9c30efbba 100644 --- a/dali/internal/render/shaders/program.h +++ b/dali/internal/render/shaders/program.h @@ -96,14 +96,9 @@ public: UNIFORM_VIEW_MATRIX, UNIFORM_NORMAL_MATRIX, UNIFORM_COLOR, - UNIFORM_CUSTOM_TEXTURE_COORDS, UNIFORM_SAMPLER, UNIFORM_SAMPLER_RECT, UNIFORM_EFFECT_SAMPLER, - UNIFORM_EFFECT_SAMPLER_RECT, - UNIFORM_TIME_DELTA, - UNIFORM_SAMPLER_OPACITY, - UNIFORM_SAMPLER_NORMAL_MAP, UNIFORM_SIZE, UNIFORM_TYPE_LAST diff --git a/dali/internal/update/manager/update-manager.cpp b/dali/internal/update/manager/update-manager.cpp index 31425a18a..f03be4f4e 100644 --- a/dali/internal/update/manager/update-manager.cpp +++ b/dali/internal/update/manager/update-manager.cpp @@ -981,9 +981,6 @@ unsigned int UpdateManager::Update( float elapsedSeconds, const BufferIndex bufferIndex = mSceneGraphBuffers.GetUpdateBufferIndex(); - // Update the frame time delta on the render thread. - mImpl->renderManager.SetFrameDeltaTime(elapsedSeconds); - // 1) Clear nodes/resources which were previously discarded mImpl->discardQueue.Clear( bufferIndex ); -- 2.34.1