From: Eunki, Hong Date: Mon, 14 Apr 2025 01:17:10 +0000 (+0900) Subject: Make UBOV2::AlignSize() API as inline X-Git-Tag: dali_2.4.15~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d85ce4822eaa5c5741ad5ab74ba88e8b1ae9d920;p=platform%2Fcore%2Fuifw%2Fdali-core.git Make UBOV2::AlignSize() API as inline Since we don't change mAlighment ever, we can mark it as const, and move calculate Aligned size as inline function. Change-Id: I7aeab753325aff16dca19ab53d13e9cb9f94d975 Signed-off-by: Eunki, Hong --- diff --git a/dali/internal/render/renderers/uniform-buffer.cpp b/dali/internal/render/renderers/uniform-buffer.cpp index 99bdbf7b0..4f664fed4 100644 --- a/dali/internal/render/renderers/uniform-buffer.cpp +++ b/dali/internal/render/renderers/uniform-buffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Samsung Electronics Co., Ltd. + * Copyright (c) 2025 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. @@ -29,6 +29,7 @@ namespace Dali::Internal::Render { // GPU UBOs need to be double-buffered in order to avoid stalling the CPU during mapping/unmapping constexpr uint32_t INTERNAL_UBO_BUFFER_COUNT = 2u; +constexpr uint32_t DEFAUT_MEMORY_ALIGNMENT{1}; Graphics::UniquePtr UniformBufferV2::New(Dali::Graphics::Controller* controller, bool emulated, uint32_t alignment) { @@ -37,7 +38,7 @@ Graphics::UniquePtr UniformBufferV2::New(Dali::Graphics::Contro UniformBufferV2::UniformBufferV2(Dali::Graphics::Controller* controller, bool emulated, uint32_t alignment) : mController(controller), - mBlockAlignment(alignment), + mBlockAlignment(alignment ? alignment : DEFAUT_MEMORY_ALIGNMENT), mCurrentGraphicsBufferIndex(0), mEmulated(emulated) { @@ -132,15 +133,6 @@ void UniformBufferV2::Rollback() } } -uint32_t UniformBufferV2::AlignSize(uint32_t size) -{ - if(size % mBlockAlignment != 0) - { - size = ((size / mBlockAlignment) + 1) * mBlockAlignment; - } - return size; -} - uint32_t UniformBufferV2::IncrementOffsetBy(uint32_t value) { if(mEmulated && !mBufferList.empty()) diff --git a/dali/internal/render/renderers/uniform-buffer.h b/dali/internal/render/renderers/uniform-buffer.h index 2b5396cbf..d1e4f3835 100644 --- a/dali/internal/render/renderers/uniform-buffer.h +++ b/dali/internal/render/renderers/uniform-buffer.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_UNIFORM_BUFFER_H /* - * Copyright (c) 2024 Samsung Electronics Co., Ltd. + * Copyright (c) 2025 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. @@ -66,7 +66,14 @@ public: /** * Align size to the current block size */ - uint32_t AlignSize(uint32_t size); + uint32_t AlignSize(uint32_t size) const + { + if(size % mBlockAlignment != 0) + { + size = ((size / mBlockAlignment) + 1) * mBlockAlignment; + } + return size; + } uint32_t IncrementOffsetBy(uint32_t value); @@ -102,7 +109,7 @@ private: private: Graphics::Controller* mController{nullptr}; - uint32_t mBlockAlignment{0u}; + const uint32_t mBlockAlignment; struct GfxBuffer {