1 #ifndef DALI_INTERNAL_UNIFORM_BUFFER_MANAGER_H
2 #define DALI_INTERNAL_UNIFORM_BUFFER_MANAGER_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/graphics-api/graphics-controller.h>
24 namespace Dali::Internal::Render
27 class UniformBufferView;
28 class UniformBufferViewPool;
31 * Class UniformBufferManager
33 * Manages the uniform buffers.
36 class UniformBufferManager
40 explicit UniformBufferManager(Dali::Graphics::Controller* controller);
42 ~UniformBufferManager();
45 * Allocates uniform buffer with given size and alignment
46 * @param size Size of uniform buffer
47 * @param alignment Alignment
48 * @return new UniformBuffer
50 Graphics::UniquePtr<UniformBuffer> AllocateUniformBuffer(uint32_t size, uint32_t alignment = 256);
53 * Creates a view on UniformBuffer
55 * @param uniformBuffer
57 * @return Uniform buffer view
59 Graphics::UniquePtr<UniformBufferView> CreateUniformBufferView( UniformBuffer* uniformBuffer, uint32_t offset, uint32_t size);
62 * Creates uniform buffer pool view
66 Graphics::UniquePtr<UniformBufferViewPool> CreateUniformBufferViewPool();
69 * Returns Controller object
70 * @return controller object
72 [[nodiscard]] Graphics::Controller& GetController() const
78 * Returns embedded uniform buffer pool view for specified DAli buffer index
79 * @return Pointer to valid uniform buffer pool view
81 [[nodiscard]] UniformBufferViewPool* GetUniformBufferViewPool( uint32_t bufferIndex );
85 Dali::Graphics::Controller* mController;
87 Graphics::UniquePtr<UniformBufferViewPool> mUniformBufferPoolStorage[2u]; ///< The pool view into UniformBuffer (double buffered)
92 #endif // DALI_INTERNAL_UNIFORM_BUFFER_MANAGER_H