From 47e2058146f8567cbb9fd71528cb90c5ad96a191 Mon Sep 17 00:00:00 2001 From: David Steele Date: Thu, 29 Apr 2021 16:26:51 +0100 Subject: [PATCH] Clean up in Aisle #3 Change-Id: I0807cee43c041a6f0ace5a0a2784580b12c4e489 --- dali/internal/render/common/render-algorithms.cpp | 4 +- dali/internal/render/common/render-algorithms.h | 9 ++- .../render/common/render-instruction-container.cpp | 5 -- .../render/common/render-instruction-container.h | 6 -- dali/internal/render/common/render-instruction.cpp | 4 +- dali/internal/render/common/render-instruction.h | 20 +++---- dali/internal/render/common/render-list.h | 13 ++--- dali/internal/render/common/render-manager.cpp | 63 +++++++------------- dali/internal/render/common/render-manager.h | 6 -- .../render/data-providers/render-data-provider.h | 6 +- .../data-providers/uniform-map-data-provider.h | 4 +- dali/internal/render/queue/render-queue.cpp | 4 +- dali/internal/render/renderers/render-geometry.cpp | 6 +- dali/internal/render/renderers/render-geometry.h | 6 +- dali/internal/render/renderers/render-renderer.cpp | 28 ++++----- dali/internal/render/renderers/render-renderer.h | 68 +++++++--------------- dali/internal/render/renderers/render-sampler.cpp | 5 -- dali/internal/render/renderers/render-sampler.h | 13 ++--- dali/internal/render/renderers/render-texture.h | 16 ++--- .../render/renderers/render-vertex-buffer.h | 41 +++---------- dali/internal/render/shaders/program-cache.h | 27 --------- .../internal/render/shaders/program-controller.cpp | 45 +------------- dali/internal/render/shaders/program-controller.h | 40 +------------ dali/internal/render/shaders/program.cpp | 11 ++-- .../manager/render-instruction-processor.cpp | 4 +- 25 files changed, 114 insertions(+), 340 deletions(-) diff --git a/dali/internal/render/common/render-algorithms.cpp b/dali/internal/render/common/render-algorithms.cpp index ad80970..9727826 100644 --- a/dali/internal/render/common/render-algorithms.cpp +++ b/dali/internal/render/common/render-algorithms.cpp @@ -439,7 +439,7 @@ inline void RenderAlgorithms::SetupScissorClipping( // The scissor test is enabled if we have any children on the stack, OR, if there are none but it is a user specified layer scissor box. // IE. It is not enabled if we are at the top of the stack and the layer does not have a specified clipping box. - const bool scissorEnabled = (mScissorStack.size() > 0u) || mHasLayerScissor; + const bool scissorEnabled = (!mScissorStack.empty()) || mHasLayerScissor; // Enable the scissor test based on the above calculation if(scissorEnabled) @@ -751,7 +751,7 @@ void RenderAlgorithms::ProcessRenderInstruction(const RenderInstruction& } } } - if(buffers.size() > 0) + if(!buffers.empty()) { mGraphicsCommandBuffer->ExecuteCommandBuffers(std::move(buffers)); } diff --git a/dali/internal/render/common/render-algorithms.h b/dali/internal/render/common/render-algorithms.h index cc76d49..8cfcacc 100644 --- a/dali/internal/render/common/render-algorithms.h +++ b/dali/internal/render/common/render-algorithms.h @@ -46,8 +46,11 @@ public: * * @param[in] graphicsController The graphics controller */ - RenderAlgorithms(Graphics::Controller& graphicsController); + explicit RenderAlgorithms(Graphics::Controller& graphicsController); + RenderAlgorithms(RenderAlgorithms& rhs) = delete; // Prevent copying + + RenderAlgorithms& operator=(const RenderAlgorithms& rhs) = delete; // Prevent Copying /** * Process a render-instruction. * @param[in] instruction The render-instruction to process. @@ -161,10 +164,6 @@ private: const Rect& rootClippingRect, int orientation); - // Prevent copying: - RenderAlgorithms(RenderAlgorithms& rhs); - RenderAlgorithms& operator=(const RenderAlgorithms& rhs); - // Member variables: using ScissorStackType = std::vector; ///< The container type used to maintain the applied scissor hierarchy diff --git a/dali/internal/render/common/render-instruction-container.cpp b/dali/internal/render/common/render-instruction-container.cpp index 6803b41..6ae3c5b 100644 --- a/dali/internal/render/common/render-instruction-container.cpp +++ b/dali/internal/render/common/render-instruction-container.cpp @@ -62,11 +62,6 @@ void RenderInstructionContainer::PushBack(BufferIndex bufferIndex, RenderInstruc mInstructions.push_back(renderInstruction); } -void RenderInstructionContainer::DiscardCurrentInstruction(BufferIndex updateBufferIndex) -{ - mInstructions.pop_back(); -} - } // namespace SceneGraph } // namespace Internal diff --git a/dali/internal/render/common/render-instruction-container.h b/dali/internal/render/common/render-instruction-container.h index 66e6496..9417afe 100644 --- a/dali/internal/render/common/render-instruction-container.h +++ b/dali/internal/render/common/render-instruction-container.h @@ -75,12 +75,6 @@ public: */ void PushBack(BufferIndex index, RenderInstruction* renderInstruction); - /** - * Discard an instruction from the end of the container - * @param bufferIndex to use - */ - void DiscardCurrentInstruction(BufferIndex updateBufferIndex); - private: std::vector mInstructions; }; diff --git a/dali/internal/render/common/render-instruction.cpp b/dali/internal/render/common/render-instruction.cpp index e9709b5..acde57b 100644 --- a/dali/internal/render/common/render-instruction.cpp +++ b/dali/internal/render/common/render-instruction.cpp @@ -43,9 +43,7 @@ RenderInstruction::RenderInstruction() mRenderLists.Reserve(6); } -RenderInstruction::~RenderInstruction() -{ // pointer container releases the renderlists -} +RenderInstruction::~RenderInstruction() = default; RenderList& RenderInstruction::GetNextFreeRenderList(size_t capacityRequired) { diff --git a/dali/internal/render/common/render-instruction.h b/dali/internal/render/common/render-instruction.h index 93c8257..52e7e68 100644 --- a/dali/internal/render/common/render-instruction.h +++ b/dali/internal/render/common/render-instruction.h @@ -57,6 +57,10 @@ public: */ ~RenderInstruction(); + RenderInstruction(const RenderInstruction&) = delete; + + RenderInstruction& operator=(const RenderInstruction& rhs) = delete; + /** * Get the next free Renderlist * @param capacityRequired in this list @@ -73,7 +77,7 @@ public: /** * @return the count of active Renderlists */ - RenderListContainer::SizeType RenderListCount() const; + [[nodiscard]] RenderListContainer::SizeType RenderListCount() const; /** * Return the renderlist at given index @@ -81,7 +85,7 @@ public: * @param index of list to return * @return pointer to the renderlist, or null if the index is out of bounds. */ - const RenderList* GetRenderList(RenderListContainer::SizeType index) const; + [[nodiscard]] const RenderList* GetRenderList(RenderListContainer::SizeType index) const; /** * Reset render-instruction @@ -103,7 +107,7 @@ public: * @param index of the rendering side * @return the view matrix */ - const Matrix* GetViewMatrix(BufferIndex index) const + [[nodiscard]] const Matrix* GetViewMatrix(BufferIndex index) const { // inlined as this is called once per frame per render instruction return &mCamera->GetViewMatrix(index); @@ -114,23 +118,17 @@ public: * @param index of the rendering side * @return the projection matrix */ - const Matrix* GetProjectionMatrix(BufferIndex index) const + [[nodiscard]] const Matrix* GetProjectionMatrix(BufferIndex index) const { // inlined as this is called once per frame per render instruction return &mCamera->GetFinalProjectionMatrix(index); } // for reflection effect - const Camera* GetCamera() const + [[nodiscard]] const Camera* GetCamera() const { return mCamera; } -private: - // Undefined - RenderInstruction(const RenderInstruction&); - // Undefined - RenderInstruction& operator=(const RenderInstruction& rhs); - public: // Data Render::RenderTracker* mRenderTracker; ///< Pointer to an optional tracker object (not owned) diff --git a/dali/internal/render/common/render-list.h b/dali/internal/render/common/render-list.h index c0b7026..a694624 100644 --- a/dali/internal/render/common/render-list.h +++ b/dali/internal/render/common/render-list.h @@ -73,6 +73,12 @@ public: delete mClippingBox; } + /* + * Copy constructor and assignment operator not defined + */ + RenderList(const RenderList& rhs) = delete; + const RenderList& operator=(const RenderList& rhs) = delete; + /** * Reset the render list for next frame */ @@ -182,7 +188,6 @@ public: { delete mClippingBox; mClippingBox = new ClippingBox(box); - ; } } @@ -272,12 +277,6 @@ public: } private: - /* - * Copy constructor and assignment operator not defined - */ - RenderList(const RenderList& rhs); - const RenderList& operator=(const RenderList& rhs); - RenderItemContainer mItems; ///< Each item is a renderer and matrix pair uint32_t mNextFree; ///< index for the next free item to use diff --git a/dali/internal/render/common/render-manager.cpp b/dali/internal/render/common/render-manager.cpp index 077af4f..db74f37 100644 --- a/dali/internal/render/common/render-manager.cpp +++ b/dali/internal/render/common/render-manager.cpp @@ -94,7 +94,7 @@ struct RenderManager::Impl void AddRenderTracker(Render::RenderTracker* renderTracker) { - DALI_ASSERT_DEBUG(renderTracker != NULL); + DALI_ASSERT_DEBUG(renderTracker != nullptr); mRenderTrackers.PushBack(renderTracker); } @@ -152,8 +152,8 @@ RenderManager* RenderManager::New(Graphics::Controller& graphicsCo Integration::StencilBufferAvailable stencilBufferAvailable, Integration::PartialUpdateAvailable partialUpdateAvailable) { - RenderManager* manager = new RenderManager; - manager->mImpl = new Impl(graphicsController, + auto* manager = new RenderManager; + manager->mImpl = new Impl(graphicsController, depthBufferAvailable, stencilBufferAvailable, partialUpdateAvailable); @@ -177,7 +177,6 @@ RenderQueue& RenderManager::GetRenderQueue() void RenderManager::SetShaderSaver(ShaderSaver& upstream) { - mImpl->programController.SetShaderSaver(upstream); } void RenderManager::AddRenderer(OwnerPointer& renderer) @@ -258,7 +257,7 @@ void RenderManager::AddFrameBuffer(OwnerPointer& frameBuffe void RenderManager::RemoveFrameBuffer(Render::FrameBuffer* frameBuffer) { - DALI_ASSERT_DEBUG(NULL != frameBuffer); + DALI_ASSERT_DEBUG(nullptr != frameBuffer); // Find the sampler, use reference so we can safely do the erase for(auto&& iter : mImpl->frameBufferContainer) @@ -345,7 +344,7 @@ void RenderManager::RemoveGeometry(Render::Geometry* geometry) void RenderManager::AttachVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer) { - DALI_ASSERT_DEBUG(NULL != geometry); + DALI_ASSERT_DEBUG(nullptr != geometry); // Find the geometry for(auto&& iter : mImpl->geometryContainer) @@ -360,7 +359,7 @@ void RenderManager::AttachVertexBuffer(Render::Geometry* geometry, Render::Verte void RenderManager::RemoveVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer) { - DALI_ASSERT_DEBUG(NULL != geometry); + DALI_ASSERT_DEBUG(nullptr != geometry); // Find the geometry for(auto&& iter : mImpl->geometryContainer) @@ -388,11 +387,6 @@ void RenderManager::RemoveRenderTracker(Render::RenderTracker* renderTracker) mImpl->RemoveRenderTracker(renderTracker); } -ProgramCache* RenderManager::GetProgramCache() -{ - return &(mImpl->programController); -} - void RenderManager::PreRender(Integration::RenderStatus& status, bool forceClear, bool uploadOnly) { DALI_PRINT_RENDER_START(mImpl->renderBufferIndex); @@ -404,9 +398,9 @@ void RenderManager::PreRender(Integration::RenderStatus& status, bool forceClear mImpl->renderQueue.ProcessMessages(mImpl->renderBufferIndex); uint32_t count = 0u; - for(uint32_t i = 0; i < mImpl->sceneContainer.size(); ++i) + for(auto& i : mImpl->sceneContainer) { - count += mImpl->sceneContainer[i]->GetRenderInstructions().Count(mImpl->renderBufferIndex); + count += i->GetRenderInstructions().Count(mImpl->renderBufferIndex); } const bool haveInstructions = count > 0u; @@ -419,9 +413,9 @@ void RenderManager::PreRender(Integration::RenderStatus& status, bool forceClear DALI_LOG_INFO(gLogFilter, Debug::General, "Render: Processing\n"); // Upload the geometries - for(uint32_t i = 0; i < mImpl->sceneContainer.size(); ++i) + for(auto& i : mImpl->sceneContainer) { - RenderInstructionContainer& instructions = mImpl->sceneContainer[i]->GetRenderInstructions(); + RenderInstructionContainer& instructions = i->GetRenderInstructions(); for(uint32_t j = 0; j < instructions.Count(mImpl->renderBufferIndex); ++j) { RenderInstruction& instruction = instructions.At(mImpl->renderBufferIndex, j); @@ -479,7 +473,7 @@ void RenderManager::PreRender(Integration::Scene& scene, std::vector>& class DamagedRectsCleaner { public: - DamagedRectsCleaner(std::vector>& damagedRects) + explicit DamagedRectsCleaner(std::vector>& damagedRects) : mDamagedRects(damagedRects), mCleanOnReturn(true) { @@ -516,8 +510,8 @@ void RenderManager::PreRender(Integration::Scene& scene, std::vector>& dirtyRect.visited = false; } - uint32_t count = sceneObject->GetRenderInstructions().Count(mImpl->renderBufferIndex); - for(uint32_t i = 0; i < count; ++i) + uint32_t instructionCount = sceneObject->GetRenderInstructions().Count(mImpl->renderBufferIndex); + for(uint32_t i = 0; i < instructionCount; ++i) { RenderInstruction& instruction = sceneObject->GetRenderInstructions().At(mImpl->renderBufferIndex, i); @@ -581,10 +575,10 @@ void RenderManager::PreRender(Integration::Scene& scene, std::vector>& const RenderList* renderList = instruction.GetRenderList(index); if(renderList && !renderList->IsEmpty()) { - const std::size_t count = renderList->Count(); - for(uint32_t index = 0u; index < count; ++index) + const std::size_t listCount = renderList->Count(); + for(uint32_t listIndex = 0u; listIndex < listCount; ++listIndex) { - RenderItem& item = renderList->GetItem(index); + RenderItem& item = renderList->GetItem(listIndex); // If the item does 3D transformation, do early exit and clean the damaged rect array if(item.mUpdateSize == Vector3::ZERO) { @@ -720,16 +714,6 @@ void RenderManager::RenderScene(Integration::RenderStatus& status, Integration:: status.SetNeedsPostRender(true); Rect viewportRect; - Vector4 clearColor; - - if(instruction.mIsClearColorSet) - { - clearColor = instruction.mClearColor; - } - else - { - clearColor = Dali::RenderTask::DEFAULT_CLEAR_COLOR; - } Rect surfaceRect = sceneObject->GetSurfaceRect(); int32_t surfaceOrientation = sceneObject->GetSurfaceOrientation(); @@ -744,7 +728,7 @@ void RenderManager::RenderScene(Integration::RenderStatus& status, Integration:: if(instruction.mFrameBuffer) { - // Ensure graphics framebuffer is created, bind atachments and create render passes + // Ensure graphics framebuffer is created, bind attachments and create render passes // Only happens once per framebuffer. If the create fails, e.g. no attachments yet, // then don't render to this framebuffer. if(!instruction.mFrameBuffer->GetGraphicsObject()) @@ -759,7 +743,7 @@ void RenderManager::RenderScene(Integration::RenderStatus& status, Integration:: auto& clearValues = instruction.mFrameBuffer->GetGraphicsRenderPassClearValues(); // Set the clear color for first color attachment - if(instruction.mIsClearColorSet && clearValues.size() > 0) + if(instruction.mIsClearColorSet && !clearValues.empty()) { clearValues[0].color = { instruction.mClearColor.r, @@ -859,17 +843,12 @@ void RenderManager::RenderScene(Integration::RenderStatus& status, Integration:: // was: mImpl->currentContext->SetSurfaceOrientation(surfaceOrientation); /*** Clear region of framebuffer or surface before drawing ***/ - - bool clearFullFrameRect = true; + bool clearFullFrameRect = (surfaceRect == viewportRect); if(instruction.mFrameBuffer != nullptr) { Viewport frameRect(0, 0, instruction.mFrameBuffer->GetWidth(), instruction.mFrameBuffer->GetHeight()); clearFullFrameRect = (frameRect == viewportRect); } - else - { - clearFullFrameRect = (surfaceRect == viewportRect); - } if(!clippingRect.IsEmpty()) { @@ -1008,9 +987,9 @@ void RenderManager::PostRender(bool uploadOnly) mImpl->UpdateTrackers(); uint32_t count = 0u; - for(uint32_t i = 0; i < mImpl->sceneContainer.size(); ++i) + for(auto& scene : mImpl->sceneContainer) { - count += mImpl->sceneContainer[i]->GetRenderInstructions().Count(mImpl->renderBufferIndex); + count += scene->GetRenderInstructions().Count(mImpl->renderBufferIndex); } const bool haveInstructions = count > 0u; diff --git a/dali/internal/render/common/render-manager.h b/dali/internal/render/common/render-manager.h index 4243b4c..2af477b 100644 --- a/dali/internal/render/common/render-manager.h +++ b/dali/internal/render/common/render-manager.h @@ -317,12 +317,6 @@ public: */ void RemoveRenderTracker(Render::RenderTracker* renderTracker); - /** - * returns the Program controller for sending program messages - * @return the ProgramController - */ - ProgramCache* GetProgramCache(); - // This method should be called from Core::PreRender() /** diff --git a/dali/internal/render/data-providers/render-data-provider.h b/dali/internal/render/data-providers/render-data-provider.h index f828f2e..3568666 100644 --- a/dali/internal/render/data-providers/render-data-provider.h +++ b/dali/internal/render/data-providers/render-data-provider.h @@ -58,7 +58,7 @@ public: * The RendererAttachment that creates this object will initialize the members * directly. */ - RenderDataProvider(AnimatableProperty& opacity); + explicit RenderDataProvider(AnimatableProperty& opacity); /** * Destructor @@ -75,7 +75,7 @@ public: /** * Get the uniform map data provider */ - const UniformMapDataProvider& GetUniformMap() const; + [[nodiscard]] const UniformMapDataProvider& GetUniformMap() const; /** * Set the shader data provider @@ -87,7 +87,7 @@ public: * Returns the shader * @return The shader */ - Shader& GetShader() const; + [[nodiscard]] Shader& GetShader() const; /** * Returns the list of samplers diff --git a/dali/internal/render/data-providers/uniform-map-data-provider.h b/dali/internal/render/data-providers/uniform-map-data-provider.h index 2802c6b..5d9d83d 100644 --- a/dali/internal/render/data-providers/uniform-map-data-provider.h +++ b/dali/internal/render/data-providers/uniform-map-data-provider.h @@ -50,7 +50,7 @@ public: * @param[in] bufferIndex The buffer index * @return true if the uniform map has changed */ - virtual bool GetUniformMapChanged(BufferIndex bufferIndex) const = 0; + [[nodiscard]] virtual bool GetUniformMapChanged(BufferIndex bufferIndex) const = 0; /** * Get the complete map of uniforms to property value addresses @@ -59,7 +59,7 @@ public: * @param[in] bufferIndex The bufferIndex * @return the uniform map */ - virtual const CollectedUniformMap& GetUniformMap(BufferIndex bufferIndex) const = 0; + [[nodiscard]] virtual const CollectedUniformMap& GetUniformMap(BufferIndex bufferIndex) const = 0; protected: /** diff --git a/dali/internal/render/queue/render-queue.cpp b/dali/internal/render/queue/render-queue.cpp index fee9a5f..49cd12f 100644 --- a/dali/internal/render/queue/render-queue.cpp +++ b/dali/internal/render/queue/render-queue.cpp @@ -50,7 +50,7 @@ RenderQueue::~RenderQueue() { MessageBase* message = reinterpret_cast(iter.Get()); - // Call virtual destructor explictly; since delete will not be called after placement new + // Call virtual destructor explicitly; since delete will not be called after placement new message->~MessageBase(); } @@ -63,7 +63,7 @@ RenderQueue::~RenderQueue() { MessageBase* message = reinterpret_cast(iter.Get()); - // Call virtual destructor explictly; since delete will not be called after placement new + // Call virtual destructor explicitly; since delete will not be called after placement new message->~MessageBase(); } diff --git a/dali/internal/render/renderers/render-geometry.cpp b/dali/internal/render/renderers/render-geometry.cpp index cae66e1..cd6f8f6 100644 --- a/dali/internal/render/renderers/render-geometry.cpp +++ b/dali/internal/render/renderers/render-geometry.cpp @@ -123,7 +123,7 @@ bool Geometry::Draw( uint32_t elementBufferCount) { //Bind buffers to attribute locations - const uint32_t vertexBufferCount = static_cast(mVertexBuffers.Count()); + const auto vertexBufferCount = static_cast(mVertexBuffers.Count()); std::vector buffers; std::vector offsets; @@ -143,7 +143,7 @@ bool Geometry::Draw( } //@todo Figure out why this is being drawn without geometry having been uploaded } - if(buffers.size() == 0) + if(buffers.empty()) { return false; } @@ -183,7 +183,7 @@ bool Geometry::Draw( } else { - //Unindex draw call + // Un-indexed draw call GLsizei numVertices(0u); if(vertexBufferCount > 0) { diff --git a/dali/internal/render/renderers/render-geometry.h b/dali/internal/render/renderers/render-geometry.h index adaa940..429ec1f 100644 --- a/dali/internal/render/renderers/render-geometry.h +++ b/dali/internal/render/renderers/render-geometry.h @@ -77,7 +77,7 @@ public: * Get the vertex buffers * @return the list of vertex buffers */ - const Vector& GetVertexBuffers() const; + [[nodiscard]] const Vector& GetVertexBuffers() const; /** * Called from RenderManager to notify the geometry that current rendering pass has finished. @@ -88,7 +88,7 @@ public: * Check if the attributes for the geometry have changed * @return True if vertex buffers have been added or removed since last frame, false otherwise */ - bool AttributesChanged() const + [[nodiscard]] bool AttributesChanged() const { return mAttributesChanged; } @@ -105,7 +105,7 @@ public: /** * @return the topology of this geometry */ - Graphics::PrimitiveTopology GetTopology() const; + [[nodiscard]] Graphics::PrimitiveTopology GetTopology() const; /** * Upload the geometry if it has changed diff --git a/dali/internal/render/renderers/render-renderer.cpp b/dali/internal/render/renderers/render-renderer.cpp index 22847b9..8136005 100644 --- a/dali/internal/render/renderers/render-renderer.cpp +++ b/dali/internal/render/renderers/render-renderer.cpp @@ -95,10 +95,6 @@ Dali::Graphics::VertexInputFormat GetPropertyVertexFormat(Property::Type propert break; } case Property::MATRIX3: - { - type = Dali::Graphics::VertexInputFormat::FLOAT; - break; - } case Property::MATRIX: { type = Dali::Graphics::VertexInputFormat::FLOAT; @@ -257,7 +253,7 @@ Renderer::Renderer(SceneGraph::RenderDataProvider* dataProvider, mDepthWriteMode(depthWriteMode), mDepthTestMode(depthTestMode), mUpdateAttributeLocations(true), - mPremultipledAlphaEnabled(preMultipliedAlphaEnabled), + mPremultipliedAlphaEnabled(preMultipliedAlphaEnabled), mShaderChanged(false), mUpdated(true) { @@ -317,7 +313,7 @@ void Renderer::BindTextures(Graphics::CommandBuffer& commandBuffer, Vector 0) + if(!textureBindings.empty()) { commandBuffer.BindTextures(textureBindings); } @@ -355,8 +351,8 @@ void Renderer::SetIndexedDrawElementsCount(uint32_t elementsCount) void Renderer::EnablePreMultipliedAlpha(bool enable) { - mPremultipledAlphaEnabled = enable; - mUpdated = true; + mPremultipliedAlphaEnabled = enable; + mUpdated = true; } void Renderer::SetDepthWriteMode(DepthWriteMode::Type depthWriteMode) @@ -523,7 +519,7 @@ bool Renderer::Render(Graphics::CommandBuffer& comma // Set blending mode if(!mDrawCommands.empty()) { - blend = (commands[0]->queue == DevelRenderer::RENDER_QUEUE_OPAQUE ? false : blend); + blend = (commands[0]->queue != DevelRenderer::RENDER_QUEUE_OPAQUE) && blend; } // Create Program @@ -741,7 +737,7 @@ void Renderer::WriteUniformBuffer( Vector4 finalColor; const Vector4& color = node.GetRenderColor(bufferIndex); - if(mPremultipledAlphaEnabled) + if(mPremultipliedAlphaEnabled) { float alpha = color.a * mRenderDataProvider->GetOpacity(bufferIndex); finalColor = Vector4(color.r * alpha, color.g * alpha, color.b * alpha, alpha); @@ -906,8 +902,7 @@ void Renderer::FillUniformBuffer(Program& p offset = dataOffset; } -void Renderer::SetSortAttributes(BufferIndex bufferIndex, - SceneGraph::RenderInstructionProcessor::SortAttributes& sortAttributes) const +void Renderer::SetSortAttributes(SceneGraph::RenderInstructionProcessor::SortAttributes& sortAttributes) const { sortAttributes.shader = &(mRenderDataProvider->GetShader()); sortAttributes.geometry = mGeometry; @@ -1006,7 +1001,7 @@ Graphics::Pipeline& Renderer::PrepareGraphicsPipeline( mAttributeLocations.PushBack(pLocation); } - uint32_t location = static_cast(mAttributeLocations[base + i]); + auto location = static_cast(mAttributeLocations[base + i]); vertexInputState.attributes.emplace_back(location, bindingIndex, @@ -1089,7 +1084,7 @@ Graphics::Pipeline& Renderer::PrepareGraphicsPipeline( Graphics::BlendOp rgbOp = ConvertBlendEquation(mBlendingOptions.GetBlendEquationRgb()); Graphics::BlendOp alphaOp = ConvertBlendEquation(mBlendingOptions.GetBlendEquationRgb()); - if(mBlendingOptions.IsAdvancedBlendEquationApplied() && mPremultipledAlphaEnabled) + if(mBlendingOptions.IsAdvancedBlendEquationApplied() && mPremultipliedAlphaEnabled) { if(rgbOp != alphaOp) { @@ -1107,7 +1102,7 @@ Graphics::Pipeline& Renderer::PrepareGraphicsPipeline( .SetAlphaBlendOp(alphaOp); // Blend color is optional and rarely used - Vector4* blendColor = const_cast(mBlendingOptions.GetBlendColor()); + auto* blendColor = const_cast(mBlendingOptions.GetBlendColor()); if(blendColor) { colorBlendState.SetBlendConstants(blendColor->AsFloat()); @@ -1123,8 +1118,7 @@ Graphics::Pipeline& Renderer::PrepareGraphicsPipeline( .SetVertexInputState(&vertexInputState) .SetRasterizationState(&rasterizationState) .SetColorBlendState(&colorBlendState) - .SetProgramState(&programState) - .SetNextExtension(&mLegacyProgram); + .SetProgramState(&programState); // Store a pipeline per renderer per render (renderer can be owned by multiple nodes, // and re-drawn in multiple instructions). diff --git a/dali/internal/render/renderers/render-renderer.h b/dali/internal/render/renderers/render-renderer.h index 6cd2459..62b82f7 100644 --- a/dali/internal/render/renderers/render-renderer.h +++ b/dali/internal/render/renderers/render-renderer.h @@ -48,8 +48,7 @@ namespace SceneGraph class SceneController; class Shader; class NodeDataProvider; - -class RenderInstruction; //for relfection effect +class RenderInstruction; //for reflection effect } // namespace SceneGraph namespace Render @@ -152,7 +151,7 @@ public: * @brief Returns a reference to an array of draw commands * @return Valid array of draw commands (may be empty) */ - const std::vector& GetDrawCommands() const + [[nodiscard]] const std::vector& GetDrawCommands() const { return mDrawCommands; } @@ -222,7 +221,7 @@ public: * Query the Renderer's depth write mode * @return The renderer depth write mode */ - DepthWriteMode::Type GetDepthWriteMode() const; + [[nodiscard]] DepthWriteMode::Type GetDepthWriteMode() const; /** * Sets the depth test mode @@ -234,7 +233,7 @@ public: * Query the Renderer's depth test mode * @return The renderer depth test mode */ - DepthTestMode::Type GetDepthTestMode() const; + [[nodiscard]] DepthTestMode::Type GetDepthTestMode() const; /** * Sets the depth function @@ -246,7 +245,7 @@ public: * Query the Renderer's depth function * @return The renderer depth function */ - DepthFunction::Type GetDepthFunction() const; + [[nodiscard]] DepthFunction::Type GetDepthFunction() const; /** * Sets the render mode @@ -258,7 +257,7 @@ public: * Gets the render mode * @return The render mode */ - RenderMode::Type GetRenderMode() const; + [[nodiscard]] RenderMode::Type GetRenderMode() const; /** * Sets the stencil function @@ -270,7 +269,7 @@ public: * Gets the stencil function * @return The stencil function */ - StencilFunction::Type GetStencilFunction() const; + [[nodiscard]] StencilFunction::Type GetStencilFunction() const; /** * Sets the stencil function mask @@ -282,7 +281,7 @@ public: * Gets the stencil function mask * @return The stencil function mask */ - int GetStencilFunctionMask() const; + [[nodiscard]] int GetStencilFunctionMask() const; /** * Sets the stencil function reference @@ -294,7 +293,7 @@ public: * Gets the stencil function reference * @return The stencil function reference */ - int GetStencilFunctionReference() const; + [[nodiscard]] int GetStencilFunctionReference() const; /** * Sets the stencil mask @@ -306,7 +305,7 @@ public: * Gets the stencil mask * @return The stencil mask */ - int GetStencilMask() const; + [[nodiscard]] int GetStencilMask() const; /** * Sets the stencil operation for when the stencil test fails @@ -318,7 +317,7 @@ public: * Gets the stencil operation for when the stencil test fails * @return The stencil operation */ - StencilOperation::Type GetStencilOperationOnFail() const; + [[nodiscard]] StencilOperation::Type GetStencilOperationOnFail() const; /** * Sets the stencil operation for when the depth test fails @@ -330,7 +329,7 @@ public: * Gets the stencil operation for when the depth test fails * @return The stencil operation */ - StencilOperation::Type GetStencilOperationOnZFail() const; + [[nodiscard]] StencilOperation::Type GetStencilOperationOnZFail() const; /** * Sets the stencil operation for when the depth test passes @@ -342,7 +341,7 @@ public: * Gets the stencil operation for when the depth test passes * @return The stencil operation */ - StencilOperation::Type GetStencilOperationOnZPass() const; + [[nodiscard]] StencilOperation::Type GetStencilOperationOnZPass() const; /** * Called to upload during RenderManager::Render(). @@ -380,10 +379,9 @@ public: /** * Write the renderer's sort attributes to the passed in reference * - * @param[in] bufferIndex The current update buffer index. * @param[out] sortAttributes */ - void SetSortAttributes(BufferIndex bufferIndex, SceneGraph::RenderInstructionProcessor::SortAttributes& sortAttributes) const; + void SetSortAttributes(SceneGraph::RenderInstructionProcessor::SortAttributes& sortAttributes) const; /** * Sets the flag indicating whether shader changed. @@ -418,19 +416,6 @@ public: const void* data, uint32_t size); - /** - * Returns the pointer to valid command buffer - * - * CommandBuffer associated with Renderer contains baked commands - * needed to issue draw call for this renderer. - * - * @return Pointer to valid CommandBuffer - */ - [[nodiscard]] Graphics::CommandBuffer* GetGraphicsCommandBuffer() const - { - return mGraphicsCommandBuffer.get(); - } - private: struct UniformIndexMap; @@ -516,16 +501,12 @@ private: Render::Geometry* mGeometry; - Graphics::UniquePtr mGraphicsCommandBuffer{}; - ProgramCache* mProgramCache{nullptr}; Render::ShaderCache* mShaderCache{nullptr}; Render::UniformBufferManager* mUniformBufferManager{}; std::vector mUniformBufferBindings{}; - std::vector mShaderStates{}; - using Hash = unsigned long; struct UniformIndexMap { @@ -559,24 +540,17 @@ private: uint32_t mIndexedDrawFirstElement; ///< Offset of first element to draw uint32_t mIndexedDrawElementsCount; ///< Number of elements to draw - DepthFunction::Type mDepthFunction : 4; ///< The depth function - FaceCullingMode::Type mFaceCullingMode : 3; ///< The mode of face culling - DepthWriteMode::Type mDepthWriteMode : 3; ///< The depth write mode - DepthTestMode::Type mDepthTestMode : 3; ///< The depth test mode - bool mUpdateAttributeLocations : 1; ///< Indicates attribute locations have changed - bool mPremultipledAlphaEnabled : 1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required - bool mShaderChanged : 1; ///< Flag indicating the shader changed and uniform maps have to be updated + DepthFunction::Type mDepthFunction : 4; ///< The depth function + FaceCullingMode::Type mFaceCullingMode : 3; ///< The mode of face culling + DepthWriteMode::Type mDepthWriteMode : 3; ///< The depth write mode + DepthTestMode::Type mDepthTestMode : 3; ///< The depth test mode + bool mUpdateAttributeLocations : 1; ///< Indicates attribute locations have changed + bool mPremultipliedAlphaEnabled : 1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required + bool mShaderChanged : 1; ///< Flag indicating the shader changed and uniform maps have to be updated bool mUpdated : 1; std::vector mDrawCommands; // Devel stuff - struct LegacyProgram : Graphics::ExtensionCreateInfo - { - uint32_t programId{0}; - }; - - LegacyProgram mLegacyProgram; ///< The structure to pass the program ID into Graphics::PipelineCreateInfo - Graphics::UniquePtr mUniformBuffer[2]{nullptr, nullptr}; ///< The double-buffered uniform buffer }; diff --git a/dali/internal/render/renderers/render-sampler.cpp b/dali/internal/render/renderers/render-sampler.cpp index c5d96dd..40fc41a 100644 --- a/dali/internal/render/renderers/render-sampler.cpp +++ b/dali/internal/render/renderers/render-sampler.cpp @@ -47,11 +47,6 @@ const Dali::Graphics::Sampler* Sampler::GetGraphicsObject() return mGraphicsSampler.get(); } -void Sampler::DestroyGraphicsObjects() -{ - mGraphicsSampler.reset(); -} - void Sampler::Initialize(Graphics::Controller& graphicsController) { mGraphicsController = &graphicsController; diff --git a/dali/internal/render/renderers/render-sampler.h b/dali/internal/render/renderers/render-sampler.h index 21a461f..68c8f2f 100644 --- a/dali/internal/render/renderers/render-sampler.h +++ b/dali/internal/render/renderers/render-sampler.h @@ -68,9 +68,7 @@ struct Sampler */ const Dali::Graphics::Sampler* GetGraphicsObject(); - void DestroyGraphicsObjects(); - - inline Graphics::SamplerAddressMode GetGraphicsSamplerAddressMode(WrapMode mode) const + [[nodiscard]] static inline Graphics::SamplerAddressMode GetGraphicsSamplerAddressMode(WrapMode mode) { switch(mode) { @@ -79,23 +77,20 @@ struct Sampler case WrapMode::MIRRORED_REPEAT: return Graphics::SamplerAddressMode::MIRRORED_REPEAT; case WrapMode::CLAMP_TO_EDGE: - return Graphics::SamplerAddressMode::CLAMP_TO_EDGE; case WrapMode::DEFAULT: return Graphics::SamplerAddressMode::CLAMP_TO_EDGE; } return {}; } - inline Graphics::SamplerMipmapMode GetGraphicsSamplerMipmapMode(FilterMode mode) const + [[nodiscard]] static inline Graphics::SamplerMipmapMode GetGraphicsSamplerMipmapMode(FilterMode mode) { switch(mode) { case FilterMode::LINEAR_MIPMAP_LINEAR: - return Graphics::SamplerMipmapMode::LINEAR; case FilterMode::NEAREST_MIPMAP_LINEAR: return Graphics::SamplerMipmapMode::LINEAR; case FilterMode::NEAREST_MIPMAP_NEAREST: - return Graphics::SamplerMipmapMode::NEAREST; case FilterMode::LINEAR_MIPMAP_NEAREST: return Graphics::SamplerMipmapMode::NEAREST; default: @@ -104,7 +99,7 @@ struct Sampler return {}; } - inline Graphics::SamplerFilter GetGraphicsFilter(FilterMode mode) const + [[nodiscard]] static inline Graphics::SamplerFilter GetGraphicsFilter(FilterMode mode) { switch(mode) { @@ -157,7 +152,7 @@ struct Sampler /** * Check if the sampler has default values */ - inline bool IsDefaultSampler() + [[nodiscard]] inline bool IsDefaultSampler() const { return (mMagnificationFilter == FilterMode::DEFAULT && mMinificationFilter == FilterMode::DEFAULT && diff --git a/dali/internal/render/renderers/render-texture.h b/dali/internal/render/renderers/render-texture.h index 34363e4..d38bc81 100644 --- a/dali/internal/render/renderers/render-texture.h +++ b/dali/internal/render/renderers/render-texture.h @@ -59,7 +59,7 @@ public: * Constructor from native image * @param[in] nativeImageInterface The native image */ - Texture(NativeImageInterfacePtr nativeImageInterface); + explicit Texture(NativeImageInterfacePtr nativeImageInterface); /** * Destructor @@ -99,12 +99,6 @@ public: void Upload(PixelDataPtr pixelData, const Internal::Texture::UploadParams& params); /** - * Called when the texture is about to be used for drawing. - * Allows native textures to be set up appropriately. - */ - void Prepare(); - - /** * Auto generates mipmaps for the texture */ void GenerateMipmaps(); @@ -113,18 +107,18 @@ public: * Retrieve whether the texture has an alpha channel * @return True if the texture has alpha channel, false otherwise */ - bool HasAlphaChannel() const; + [[nodiscard]] bool HasAlphaChannel() const; /** * Get the graphics object associated with this texture */ - Graphics::Texture* GetGraphicsObject() const; + [[nodiscard]] Graphics::Texture* GetGraphicsObject() const; /** * Get the type of the texture * @return Type of the texture */ - Type GetType() const + [[nodiscard]] Type GetType() const { return mType; } @@ -133,7 +127,7 @@ public: * Check if the texture is a native image * @return if the texture is a native image */ - bool IsNativeImage() const + [[nodiscard]] bool IsNativeImage() const { return mNativeImage; } diff --git a/dali/internal/render/renderers/render-vertex-buffer.h b/dali/internal/render/renderers/render-vertex-buffer.h index 6138841..b7074ef 100644 --- a/dali/internal/render/renderers/render-vertex-buffer.h +++ b/dali/internal/render/renderers/render-vertex-buffer.h @@ -81,12 +81,6 @@ public: void SetData(Dali::Vector* data, uint32_t size); /** - * @brief Set the number of elements - * @param[in] size The number of elements - */ - void SetSize(uint32_t size); - - /** * Perform the upload of the buffer only when required * @param[in] graphicsController The controller */ @@ -96,7 +90,7 @@ public: * Get the number of attributes present in the buffer * @return The number of attributes stored in this buffer */ - inline uint32_t GetAttributeCount() const + [[nodiscard]] inline uint32_t GetAttributeCount() const { DALI_ASSERT_DEBUG(mFormat && "Format should be set "); return static_cast(mFormat->components.size()); @@ -107,7 +101,7 @@ public: * @param[in] index The index of the attribute * @return The name of the attribute */ - inline ConstString GetAttributeName(uint32_t index) const + [[nodiscard]] inline ConstString GetAttributeName(uint32_t index) const { DALI_ASSERT_DEBUG(mFormat && "Format should be set "); return mFormat->components[index].name; @@ -117,7 +111,7 @@ public: * Retrieve the size of the buffer in bytes * @return The total size of the buffer */ - inline uint32_t GetDataSize() const + [[nodiscard]] inline uint32_t GetDataSize() const { DALI_ASSERT_DEBUG(mFormat && "Format should be set "); return mFormat->size * mSize; @@ -127,7 +121,7 @@ public: * Retrieve the size of one element of the buffer * @return The size of one element */ - inline uint32_t GetElementSize() const + [[nodiscard]] inline uint32_t GetElementSize() const { DALI_ASSERT_DEBUG(mFormat && "Format should be set "); return mFormat->size; @@ -137,38 +131,17 @@ public: * Retrieve the number of elements in the buffer * @return The total number of elements */ - inline uint32_t GetElementCount() const + [[nodiscard]] inline uint32_t GetElementCount() const { return mSize; } - /** - * Retrieve reference to the data storage vector - * @return Reference to the data storage - */ - inline const Dali::Vector& GetData() const - { - return *mData.Get(); - } - - /** - * Retrieve data writeable pointer ( direct access to the buffer data ) - * @return Pointer to data converted to requested type - */ - template - inline T* GetDataTypedPtr() - { - Dali::Vector* data = mData.Release(); - mData = data; - return reinterpret_cast(&data->operator[](0)); - } - - inline const VertexBuffer::Format* GetFormat() const + [[nodiscard]] inline const VertexBuffer::Format* GetFormat() const { return mFormat.Get(); } - inline const GpuBuffer* GetGpuBuffer() const + [[nodiscard]] inline const GpuBuffer* GetGpuBuffer() const { return mGpuBuffer.Get(); } diff --git a/dali/internal/render/shaders/program-cache.h b/dali/internal/render/shaders/program-cache.h index 00d4d5c..01c0bae 100644 --- a/dali/internal/render/shaders/program-cache.h +++ b/dali/internal/render/shaders/program-cache.h @@ -59,33 +59,6 @@ public: // API */ virtual void AddProgram(size_t shaderHash, Program* program) = 0; - /** - * Get currently bound program - * @return program that is currently used - */ - virtual Program* GetCurrentProgram() = 0; - - /** - * Set the currently bound program - * @param program that is used - */ - virtual void SetCurrentProgram(Program* program) = 0; - - /** - * @return true if program binaries are supported - */ - virtual bool IsBinarySupported() = 0; - - /** - * @return the binary format to use - */ - virtual GLenum ProgramBinaryFormat() = 0; - - /** - * @param programData to store/save - */ - virtual void StoreBinary(Internal::ShaderDataPtr programData) = 0; - ProgramCache(const ProgramCache& rhs) = delete; ProgramCache& operator=(const ProgramCache& rhs) = delete; }; diff --git a/dali/internal/render/shaders/program-controller.cpp b/dali/internal/render/shaders/program-controller.cpp index f01f6d4..41f77f5 100644 --- a/dali/internal/render/shaders/program-controller.cpp +++ b/dali/internal/render/shaders/program-controller.cpp @@ -28,13 +28,8 @@ namespace Dali namespace Internal { ProgramController::ProgramController(Graphics::Controller& graphicsController) -: mShaderSaver(nullptr), - mGraphicsController(graphicsController), - mCurrentProgram(nullptr), - mProgramBinaryFormat(0), - mNumberOfProgramBinaryFormats(0) +: mGraphicsController(graphicsController) { - // we have 17 default programs so make room for those and a few custom ones as well mProgramCache.Reserve(32); } @@ -69,47 +64,11 @@ Program* ProgramController::GetProgram(size_t shaderHash) void ProgramController::AddProgram(size_t shaderHash, Program* program) { - // we expect unique hash values so its event thread sides job to guarantee that + // we expect unique hash values so it is event thread side's job to guarantee that // AddProgram is only called after program checks that GetProgram returns NULL mProgramCache.PushBack(new ProgramPair(program, shaderHash)); } -Program* ProgramController::GetCurrentProgram() -{ - return mCurrentProgram; -} - -void ProgramController::SetCurrentProgram(Program* program) -{ - mCurrentProgram = program; -} - -bool ProgramController::IsBinarySupported() -{ - return mNumberOfProgramBinaryFormats > 0; -} - -GLenum ProgramController::ProgramBinaryFormat() -{ - return mProgramBinaryFormat; -} - -void ProgramController::StoreBinary(Internal::ShaderDataPtr programData) -{ - DALI_ASSERT_DEBUG(programData->GetBufferSize() > 0); - DALI_ASSERT_DEBUG(mShaderSaver && "SetShaderSaver() should have been called during startup."); - - if(mShaderSaver != nullptr) - { - mShaderSaver->SaveBinary(programData); - } -} - -void ProgramController::SetShaderSaver(ShaderSaver& shaderSaver) -{ - mShaderSaver = &shaderSaver; -} - } // namespace Internal } // namespace Dali diff --git a/dali/internal/render/shaders/program-controller.h b/dali/internal/render/shaders/program-controller.h index bac7102..0ea1a7a 100644 --- a/dali/internal/render/shaders/program-controller.h +++ b/dali/internal/render/shaders/program-controller.h @@ -32,7 +32,7 @@ namespace Internal class ShaderSaver; /** - * This class is the owner of GL shader programs + * This class is the owner of shader programs */ class ProgramController : public ProgramCache { @@ -75,7 +75,7 @@ public: * Inline getter for the hash * @return the hash */ - inline size_t GetHash() const + [[nodiscard]] inline size_t GetHash() const { return mShaderHash; } @@ -108,12 +108,6 @@ public: // API */ void ResetProgramMatrices(); - /** - * Set the destination for compiler shader binaries so they can be saved. - * @note Must be called during initialisation. - */ - void SetShaderSaver(ShaderSaver& shaderSaver); - private: // From ProgramCache /** * @copydoc ProgramCache::GetProgram @@ -125,42 +119,12 @@ private: // From ProgramCache */ void AddProgram(size_t shaderHash, Program* program) override; - /** - * @copydoc ProgramCache::GetCurrentProgram - */ - Program* GetCurrentProgram() override; - - /** - * @copydoc ProgramCache::SetCurrentProgram - */ - void SetCurrentProgram(Program* program) override; - - /** - * @copydoc ProgramCache::IsBinarySupported - */ - bool IsBinarySupported() override; - - /** - * @copydoc ProgramCache::ProgramBinaryFormat - */ - GLenum ProgramBinaryFormat() override; - - /** - * @copydoc ProgramCache::StoreBinary - */ - void StoreBinary(Internal::ShaderDataPtr programData) override; - private: // Data - ShaderSaver* mShaderSaver; Graphics::Controller& mGraphicsController; - Program* mCurrentProgram; using ProgramContainer = OwnerContainer; using ProgramIterator = ProgramContainer::Iterator; ProgramContainer mProgramCache; - - GLint mProgramBinaryFormat; - GLint mNumberOfProgramBinaryFormats; }; } // namespace Internal diff --git a/dali/internal/render/shaders/program.cpp b/dali/internal/render/shaders/program.cpp index 28c5d34..8a9d1c5 100644 --- a/dali/internal/render/shaders/program.cpp +++ b/dali/internal/render/shaders/program.cpp @@ -20,7 +20,6 @@ // EXTERNAL INCLUDES #include -#include #include // INTERNAL INCLUDES @@ -97,9 +96,7 @@ Program::Program(ProgramCache& cache, Internal::ShaderDataPtr shaderData, Graphi BuildReflection(controller.GetProgramReflection(*mGfxProgram.get())); } -Program::~Program() -{ -} +Program::~Program() = default; void Program::BuildReflection(const Graphics::Reflection& graphicsReflection) { @@ -124,11 +121,11 @@ void Program::BuildReflection(const Graphics::Reflection& graphicsReflection) mReflection.back().uniformInfo.bufferIndex = i; // Update default uniforms - for(auto i = 0u; i < NUMBER_OF_DEFAULT_UNIFORMS; ++i) + for(auto j = 0u; j < NUMBER_OF_DEFAULT_UNIFORMS; ++j) { - if(hashValue == DEFAULT_UNIFORM_HASHTABLE[i]) + if(hashValue == DEFAULT_UNIFORM_HASHTABLE[j]) { - mReflectionDefaultUniforms[i] = mReflection.back(); + mReflectionDefaultUniforms[j] = mReflection.back(); break; } } diff --git a/dali/internal/update/manager/render-instruction-processor.cpp b/dali/internal/update/manager/render-instruction-processor.cpp index a33b57d..2436ff3 100644 --- a/dali/internal/update/manager/render-instruction-processor.cpp +++ b/dali/internal/update/manager/render-instruction-processor.cpp @@ -376,7 +376,7 @@ inline void RenderInstructionProcessor::SortRenderItems(BufferIndex bufferIndex, if(item.mRenderer) { - item.mRenderer->SetSortAttributes(bufferIndex, mSortingHelper[index]); + item.mRenderer->SetSortAttributes(mSortingHelper[index]); } // texture set @@ -396,7 +396,7 @@ inline void RenderInstructionProcessor::SortRenderItems(BufferIndex bufferIndex, { RenderItem& item = renderList.GetItem(index); - item.mRenderer->SetSortAttributes(bufferIndex, mSortingHelper[index]); + item.mRenderer->SetSortAttributes(mSortingHelper[index]); // texture set mSortingHelper[index].textureSet = item.mTextureSet; -- 2.7.4