From 59e711cbb69c258397c49827804e3904af0f3ce8 Mon Sep 17 00:00:00 2001 From: David Steele Date: Wed, 21 Apr 2021 18:00:28 +0100 Subject: [PATCH] Changes to constness of command buffer Change-Id: Ibfab9d24b937d3a616db5f41ad9caabd14603116 --- .../test-graphics-command-buffer.cpp | 8 ++++---- .../test-graphics-command-buffer.h | 10 +++++----- .../dali-test-suite-utils/test-graphics-controller.cpp | 17 +---------------- .../dali-test-suite-utils/test-graphics-controller.h | 4 ++++ .../graphics/gles-impl/egl-graphics-controller.cpp | 6 +++--- .../graphics/gles-impl/egl-graphics-controller.h | 18 +++++++++--------- .../gles-impl/gles-graphics-command-buffer.cpp | 6 +++--- .../graphics/gles-impl/gles-graphics-command-buffer.h | 4 ++-- 8 files changed, 31 insertions(+), 42 deletions(-) diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-command-buffer.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-command-buffer.cpp index 78c6fbb..e34b852 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-command-buffer.cpp +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-command-buffer.cpp @@ -60,9 +60,9 @@ void TestGraphicsCommandBuffer::GetStateForDrawCall(int drawCallIndex) } } -std::vector TestGraphicsCommandBuffer::GetCommandsByType(CommandTypeMask mask) +std::vector TestGraphicsCommandBuffer::GetCommandsByType(CommandTypeMask mask) const { - std::vector mCommandStack{}; + std::vector mCommandStack{}; for(auto& cmd : mCommands) { if(uint32_t(cmd.type) == (mask & uint32_t(cmd.type))) @@ -73,9 +73,9 @@ std::vector TestGraphicsCommandBuffer::GetCommandsByType(CommandTypeMa return mCommandStack; } -std::vector TestGraphicsCommandBuffer::GetChildCommandsByType(CommandTypeMask mask) +std::vector TestGraphicsCommandBuffer::GetChildCommandsByType(CommandTypeMask mask) const { - std::vector mCommandStack{}; + std::vector mCommandStack{}; for(auto& cmd : mCommands) { if(uint32_t(cmd.type) == (mask & uint32_t(cmd.type))) diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-command-buffer.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-command-buffer.h index bc1ea7b..a68cb7f 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-command-buffer.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-command-buffer.h @@ -477,7 +477,7 @@ struct Command struct { - std::vector buffers; + std::vector buffers; } executeCommandBuffers; } data; @@ -624,7 +624,7 @@ public: mCallStack.PushCall("EndRenderPass", ""); } - void ExecuteCommandBuffers(std::vector&& commandBuffers) override + void ExecuteCommandBuffers(std::vector&& commandBuffers) override { mCommands.emplace_back(); auto& cmd = mCommands.back(); @@ -632,7 +632,7 @@ public: cmd.data.executeCommandBuffers.buffers.reserve(commandBuffers.size()); for(auto&& item : commandBuffers) { - cmd.data.executeCommandBuffers.buffers.emplace_back(static_cast(item)); + cmd.data.executeCommandBuffers.buffers.emplace_back(static_cast(item)); } mCallStack.PushCall("ExecuteCommandBuffers", ""); } @@ -768,9 +768,9 @@ public: /** * Retrieves commands of specified type */ - std::vector GetCommandsByType(CommandTypeMask mask); + std::vector GetCommandsByType(CommandTypeMask mask) const; - std::vector GetChildCommandsByType(CommandTypeMask mask); + std::vector GetChildCommandsByType(CommandTypeMask mask) const; private: TraceCallStack& mCallStack; diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.cpp index e398236..ddcf0f5 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.cpp +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.cpp @@ -543,21 +543,6 @@ void TestGraphicsController::ProcessCommandBuffer(TestGraphicsCommandBuffer& com case CommandType::BIND_PIPELINE: { currentPipeline = Uncast(cmd.data.bindPipeline.pipeline); - - // Bind framebuffer if different. @todo Move to RenderPass - auto framebuffer = currentPipeline->framebufferState.framebuffer; - if(framebuffer && framebuffer != currentFramebuffer) - { - auto graphicsFramebuffer = Uncast(framebuffer); - graphicsFramebuffer->Bind(); - } - else - { - if(currentFramebuffer) - currentFramebuffer->Bind(); - else - mGl.BindFramebuffer(GL_FRAMEBUFFER, 0); - } BindPipeline(currentPipeline); break; } @@ -622,7 +607,7 @@ void TestGraphicsController::ProcessCommandBuffer(TestGraphicsCommandBuffer& com // Process secondary command buffers for(auto& buf : cmd.data.executeCommandBuffers.buffers) { - ProcessCommandBuffer(*static_cast(buf)); + ProcessCommandBuffer(*Uncast(buf)); } break; } diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.h index f777053..1d93bfa 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.h @@ -406,6 +406,10 @@ public: }; std::vector mProgramCache; + struct PipelineCache + { + }; + std::vector mCustomUniforms; }; diff --git a/dali/internal/graphics/gles-impl/egl-graphics-controller.cpp b/dali/internal/graphics/gles-impl/egl-graphics-controller.cpp index b17e6f8..f4f7e60 100644 --- a/dali/internal/graphics/gles-impl/egl-graphics-controller.cpp +++ b/dali/internal/graphics/gles-impl/egl-graphics-controller.cpp @@ -301,7 +301,7 @@ void EglGraphicsController::ProcessCreateQueues() ProcessCreateQueue(mCreateFramebufferQueue); } -void EglGraphicsController::ProcessCommandBuffer(GLES::CommandBuffer& commandBuffer) +void EglGraphicsController::ProcessCommandBuffer(const GLES::CommandBuffer& commandBuffer) { for(auto& cmd : commandBuffer.GetCommands()) { @@ -397,7 +397,7 @@ void EglGraphicsController::ProcessCommandBuffer(GLES::CommandBuffer& commandBuf ResolvePresentRenderTarget(cmd.presentRenderTarget.targetToPresent); // push this command buffer to the discard queue - mDiscardCommandBufferQueue.push(&commandBuffer); + mDiscardCommandBufferQueue.push(const_cast(&commandBuffer)); break; } case GLES::CommandType::EXECUTE_COMMAND_BUFFERS: @@ -408,7 +408,7 @@ void EglGraphicsController::ProcessCommandBuffer(GLES::CommandBuffer& commandBuf // within secondaries. for(auto& buf : cmd.executeCommandBuffers.buffers) { - ProcessCommandBuffer(*static_cast(buf)); + ProcessCommandBuffer(*static_cast(buf)); } break; } diff --git a/dali/internal/graphics/gles-impl/egl-graphics-controller.h b/dali/internal/graphics/gles-impl/egl-graphics-controller.h index 702b028..b806126 100644 --- a/dali/internal/graphics/gles-impl/egl-graphics-controller.h +++ b/dali/internal/graphics/gles-impl/egl-graphics-controller.h @@ -478,7 +478,7 @@ public: { while(!queue.empty()) { - auto* object = queue.front(); + auto* object = const_cast(queue.front()); // Destroy object->DestroyResource(); @@ -553,7 +553,7 @@ public: return mIsShuttingDown; } - void ProcessCommandBuffer(GLES::CommandBuffer& commandBuffer); + void ProcessCommandBuffer(const GLES::CommandBuffer& commandBuffer); // Resolves presentation void ResolvePresentRenderTarget(GLES::RenderTarget* renderTarget); @@ -571,13 +571,13 @@ private: std::queue mCreateBufferQueue; ///< Create queue for buffer resource std::queue mDiscardBufferQueue; ///< Discard queue for buffer resource - std::queue mDiscardProgramQueue; ///< Discard queue for program resource - std::queue mDiscardPipelineQueue; ///< Discard queue of pipelines - std::queue mDiscardShaderQueue; ///< Discard queue of shaders - std::queue mDiscardSamplerQueue; ///< Discard queue of samplers - std::queue mDiscardCommandBufferQueue; ///< Discard queue of command buffers - std::queue mCreateFramebufferQueue; ///< Create queue for framebuffer resource - std::queue mDiscardFramebufferQueue; ///< Discard queue for framebuffer resource + std::queue mDiscardProgramQueue; ///< Discard queue for program resource + std::queue mDiscardPipelineQueue; ///< Discard queue of pipelines + std::queue mDiscardShaderQueue; ///< Discard queue of shaders + std::queue mDiscardSamplerQueue; ///< Discard queue of samplers + std::queue mDiscardCommandBufferQueue; ///< Discard queue of command buffers + std::queue mCreateFramebufferQueue; ///< Create queue for framebuffer resource + std::queue mDiscardFramebufferQueue; ///< Discard queue for framebuffer resource std::queue mCommandQueue; ///< we may have more in the future diff --git a/dali/internal/graphics/gles-impl/gles-graphics-command-buffer.cpp b/dali/internal/graphics/gles-impl/gles-graphics-command-buffer.cpp index c200de5..83f010e 100644 --- a/dali/internal/graphics/gles-impl/gles-graphics-command-buffer.cpp +++ b/dali/internal/graphics/gles-impl/gles-graphics-command-buffer.cpp @@ -142,14 +142,14 @@ void CommandBuffer::EndRenderPass() mCommands.emplace_back(CommandType::END_RENDERPASS); } -void CommandBuffer::ExecuteCommandBuffers(std::vector&& commandBuffers) +void CommandBuffer::ExecuteCommandBuffers(std::vector&& commandBuffers) { mCommands.emplace_back(CommandType::EXECUTE_COMMAND_BUFFERS); auto& cmd = mCommands.back(); cmd.executeCommandBuffers.buffers.reserve(commandBuffers.size()); for(auto&& item : commandBuffers) { - cmd.executeCommandBuffers.buffers.emplace_back(static_cast(item)); + cmd.executeCommandBuffers.buffers.emplace_back(static_cast(item)); } } @@ -255,4 +255,4 @@ void CommandBuffer::DiscardResource() GetController().DiscardResource(this); } -} // namespace Dali::Graphics::GLES \ No newline at end of file +} // namespace Dali::Graphics::GLES diff --git a/dali/internal/graphics/gles-impl/gles-graphics-command-buffer.h b/dali/internal/graphics/gles-impl/gles-graphics-command-buffer.h index 5996863..214f19c 100644 --- a/dali/internal/graphics/gles-impl/gles-graphics-command-buffer.h +++ b/dali/internal/graphics/gles-impl/gles-graphics-command-buffer.h @@ -389,7 +389,7 @@ struct Command struct { - std::vector buffers; + std::vector buffers; } executeCommandBuffers; struct @@ -445,7 +445,7 @@ public: */ void EndRenderPass() override; - void ExecuteCommandBuffers(std::vector&& commandBuffers) override; + void ExecuteCommandBuffers(std::vector&& commandBuffers) override; void Draw( uint32_t vertexCount, -- 2.7.4