1 #ifndef DALI_INTERNAL_UNIFORM_BUFFER_VIEW_H
2 #define DALI_INTERNAL_UNIFORM_BUFFER_VIEW_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.
31 namespace Internal::Render
37 * Class UniformBufferView
39 * The class is responsible for providing view into the UniformBuffer object
40 * giving access to part or all of its memory. UniformBufferView doesn't own
43 * The memory accessed through the UniformBufferView should be addressed at
44 * the offset of 0 and up to specified size. The memory beyond the view may be
48 class UniformBufferView
52 UniformBufferView(UniformBuffer &ubo, uint32_t offset, size_t size);
56 void Write(const void *data, uint32_t size, uint32_t offset);
59 * Returns the size of the view
61 * @return size of view
63 [[nodiscard]] uint32_t GetSize() const
69 * Returns the offset within the UBO
72 [[nodiscard]] uint32_t GetOffset() const
78 * Returns Graphics buffer associated with this View
80 * If 'relativeOffset' isn't nullptr then the offset into the individual
81 * Graphics::Buffer is written.
83 * @param[out] relativeOffset the offset into individual Graphics::Buffer
85 * @return Pointer to a valid Graphics::Buffer object
87 [[nodiscard]] Graphics::Buffer *GetBuffer(uint32_t *relativeOffset = nullptr);
91 UniformBuffer *mUniformBuffer{nullptr}; ///< UniformBuffer that the view views
92 uint32_t mOffset{0u}; ///< Offset within the buffer
93 size_t mSize{0u}; ///< Size of view
95 } // Namespace Internal::Render
97 #endif //DALI_INTERNAL_UNIFORM_BUFFER_VIEW_H