1 #ifndef DALI_INTERNAL_RENDERERS_GPU_BUFFER_H
2 #define DALI_INTERNAL_RENDERERS_GPU_BUFFER_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>
29 * Used to create and update a GPU memory buffer.
31 * The buffer can be used for storing vertex data, index arrays (indices)
32 * or pixel data (PBO).
34 * The buffer allows data to be stored in high-performance
35 * graphics memory on the server side and
36 * promotes efficient data transfer.
43 * @param[in] graphicsController the graphics controller
44 * @param[in] usage The type of buffer
46 GpuBuffer(Graphics::Controller& graphicsController, Graphics::BufferUsageFlags usage);
49 * Destructor, non virtual as no virtual methods or inheritance
51 ~GpuBuffer() = default;
55 * Creates or updates a buffer object and binds it to the target.
56 * @param graphicsController The graphics controller
57 * @param size Specifies the size in bytes of the buffer object's new data store.
58 * @param data pointer to the data to load
60 void UpdateDataBuffer(Graphics::Controller& graphicsController, uint32_t size, const void* data);
63 * Get the size of the buffer
66 [[nodiscard]] uint32_t GetBufferSize() const
71 [[nodiscard]] inline const Graphics::Buffer* GetGraphicsObject() const
73 return mGraphicsObject.get();
77 * Destroy the graphics buffer and reset.
82 Graphics::UniquePtr<Graphics::Buffer> mGraphicsObject;
83 uint32_t mCapacity{0}; ///< buffer capacity
84 uint32_t mSize{0}; ///< buffer size
85 Graphics::BufferUsageFlags mUsage;
88 } // namespace Internal
91 #endif // DALI_INTERNAL_RENDERERS_GPU_BUFFER_H