From: Eunki, Hong Date: Tue, 22 Feb 2022 12:48:33 +0000 (+0900) Subject: Implement some more speed-up : don't copy geometry X-Git-Tag: dali_2.1.11~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F34%2F271534%2F1;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Implement some more speed-up : don't copy geometry Make some GraphicsCommand API's input as const vector<>& These will not copy the internal values. and also we can assume that inputed data didn't change in that API. Change-Id: Iffd0e53aa114ccf194b63b1ae9648d7729e9b763 Signed-off-by: Eunki, Hong --- 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 3df3219..96b0021 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 @@ -2,7 +2,7 @@ #define DALI_TEST_GRAPHICS_COMMAND_BUFFER_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -647,9 +647,9 @@ public: { } - void BindVertexBuffers(uint32_t firstBinding, - std::vector buffers, - std::vector offsets) override + void BindVertexBuffers(uint32_t firstBinding, + const std::vector& buffers, + const std::vector& offsets) override { mCommands.emplace_back(); mCommands.back().type = CommandType::BIND_VERTEX_BUFFERS; @@ -712,7 +712,7 @@ public: mCallStack.PushCall("BindPipeline", ""); } - void BindTextures(std::vector& textureBindings) override + void BindTextures(const std::vector& textureBindings) override { mCommands.emplace_back(); mCommands.back().type = CommandType::BIND_TEXTURES; @@ -720,7 +720,7 @@ public: mCallStack.PushCall("BindTextures", ""); } - void BindSamplers(std::vector& samplerBindings) override + void BindSamplers(const std::vector& samplerBindings) override { mCommands.emplace_back(); mCommands.back().data.bindSamplers.samplerBindings = std::move(samplerBindings); @@ -747,10 +747,10 @@ public: } void BeginRenderPass( - Graphics::RenderPass* renderPass, - Graphics::RenderTarget* renderTarget, - Graphics::Rect2D renderArea, - std::vector clearValues) override + Graphics::RenderPass* renderPass, + Graphics::RenderTarget* renderTarget, + Graphics::Rect2D renderArea, + const std::vector& clearValues) override { mCommands.emplace_back(CommandType::BEGIN_RENDER_PASS); auto& cmd = mCommands.back(); 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 98f4830..8a4cfc9 100644 --- a/dali/internal/graphics/gles-impl/gles-graphics-command-buffer.cpp +++ b/dali/internal/graphics/gles-impl/gles-graphics-command-buffer.cpp @@ -32,8 +32,8 @@ namespace Dali::Graphics::GLES class CommandPool { static constexpr uint32_t COMMAND_POOL_DEFAULT_INCREMENT = 1024 * 32 / sizeof(Command); // 32kb banks - static const uint32_t MEMORY_POOL_DEFAULT_INCREMENT = 1024; // 1kb memory pool increment - static const uint32_t MEMORY_POOL_DEFAULT_ALIGNMENT = 64; // 64bytes alignment + static const uint32_t MEMORY_POOL_DEFAULT_INCREMENT = 1024; // 1kb memory pool increment + static const uint32_t MEMORY_POOL_DEFAULT_ALIGNMENT = 64; // 64bytes alignment template struct Block @@ -234,9 +234,9 @@ CommandBuffer::CommandBuffer(const Graphics::CommandBufferCreateInfo& createInfo CommandBuffer::~CommandBuffer() = default; -void CommandBuffer::BindVertexBuffers(uint32_t firstBinding, - std::vector buffers, - std::vector offsets) +void CommandBuffer::BindVertexBuffers(uint32_t firstBinding, + const std::vector& buffers, + const std::vector& offsets) { auto command = mCommandPool->AllocateCommand(CommandType::BIND_VERTEX_BUFFERS); command->bindVertexBuffers.vertexBufferBindingsCount = firstBinding + buffers.size(); @@ -314,7 +314,7 @@ void CommandBuffer::BindPipeline(const Graphics::Pipeline& pipeline) command->bindPipeline.pipeline = static_cast(&pipeline); } -void CommandBuffer::BindTextures(std::vector& textureBindings) +void CommandBuffer::BindTextures(const std::vector& textureBindings) { auto command = mCommandPool->AllocateCommand(CommandType::BIND_TEXTURES); auto& bindTexturesCmd = command->bindTextures; @@ -323,7 +323,7 @@ void CommandBuffer::BindTextures(std::vector& textureBindings) memcpy(bindTexturesCmd.textureBindings.Ptr(), textureBindings.data(), sizeof(TextureBinding) * textureBindings.size()); } -void CommandBuffer::BindSamplers(std::vector& samplerBindings) +void CommandBuffer::BindSamplers(const std::vector& samplerBindings) { auto command = mCommandPool->AllocateCommand(CommandType::BIND_SAMPLERS); auto& bindSamplersCmd = command->bindSamplers; @@ -349,10 +349,10 @@ void CommandBuffer::BindIndexBuffer(const Graphics::Buffer& buffer, } void CommandBuffer::BeginRenderPass( - Graphics::RenderPass* renderPass, - Graphics::RenderTarget* renderTarget, - Rect2D renderArea, - std::vector clearValues) + Graphics::RenderPass* renderPass, + Graphics::RenderTarget* renderTarget, + Rect2D renderArea, + const std::vector& clearValues) { auto command = mCommandPool->AllocateCommand(CommandType::BEGIN_RENDERPASS); auto& cmd = *command; 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 8e2aeac..983bc9c 100644 --- a/dali/internal/graphics/gles-impl/gles-graphics-command-buffer.h +++ b/dali/internal/graphics/gles-impl/gles-graphics-command-buffer.h @@ -2,7 +2,7 @@ #define DALI_GRAPHICS_GLES_COMMAND_BUFFER_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -230,9 +230,9 @@ public: /** * @copydoc Dali::Graphics::CommandBuffer::BindVertexBuffers */ - void BindVertexBuffers(uint32_t firstBinding, - std::vector buffers, - std::vector offsets) override; + void BindVertexBuffers(uint32_t firstBinding, + const std::vector& buffers, + const std::vector& offsets) override; /** * @copydoc Dali::Graphics::CommandBuffer::BindUniformBuffers @@ -247,12 +247,12 @@ public: /** * @copydoc Dali::Graphics::CommandBuffer::BindTextures */ - void BindTextures(std::vector& textureBindings) override; + void BindTextures(const std::vector& textureBindings) override; /** * @copydoc Dali::Graphics::CommandBuffer::BindSamplers */ - void BindSamplers(std::vector& samplerBindings) override; + void BindSamplers(const std::vector& samplerBindings) override; /** * @copydoc Dali::Graphics::CommandBuffer::BindPushConstants @@ -272,10 +272,10 @@ public: * @copydoc Dali::Graphics::CommandBuffer::BeginRenderPass */ void BeginRenderPass( - Graphics::RenderPass* renderPass, - Graphics::RenderTarget* renderTarget, - Rect2D renderArea, - std::vector clearValues) override; + Graphics::RenderPass* renderPass, + Graphics::RenderTarget* renderTarget, + Rect2D renderArea, + const std::vector& clearValues) override; /** * @copydoc Dali::Graphics::CommandBuffer::EndRenderPass