Blender V5.3
vk_uniform_buffer.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "BLI_utility_mixins.hh"
12
14
15#include "vk_buffer.hh"
16
17namespace blender::gpu {
18
20 VKBuffer buffer_;
21
26 bool data_uploaded_ = false;
27
28 public:
29 VKUniformBuffer(size_t size, const char *name) : UniformBuf(size, name) {}
30
31 void update(const void *data) override;
32 void clear_to_zero() override;
33 void bind(int slot) override;
34 void bind_as_ssbo(int slot) override;
35
39 void unbind() override;
40
41 VkBuffer vk_handle() const
42 {
43 return buffer_.vk_handle();
44 }
46 {
47 return buffer_.resource();
48 }
49 inline VkDeviceAddress device_address_get() const
50 {
51 return buffer_.device_address_get();
52 }
53
54 size_t size_in_bytes() const
55 {
56 return size_in_bytes_;
57 }
58
59 void ensure_updated();
60
66 {
67 data_uploaded_ = false;
68 }
69
70 private:
71 void allocate();
72};
73
75{
76 return static_cast<UniformBuf *>(uniform_buffer);
77}
78
79} // namespace blender::gpu
#define BLI_INLINE
NonCopyable(const NonCopyable &other)=delete
UniformBuf(size_t size, const char *name)
void bind_as_ssbo(int slot) override
void update(const void *data) override
VKUniformBuffer(size_t size, const char *name)
VkDeviceAddress device_address_get() const
const VKResourceWithHandle< VkBuffer > & resource() const
void bind(int slot) override
static GPUContext * wrap(Context *ctx)
BMesh const char void * data