Blender V5.0
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 }
45 inline VkDeviceAddress device_address_get() const
46 {
47 return buffer_.device_address_get();
48 }
49
50 size_t size_in_bytes() const
51 {
52 return size_in_bytes_;
53 }
54
55 void ensure_updated();
56
62 {
63 data_uploaded_ = false;
64 }
65
66 private:
67 void allocate();
68};
69
71{
72 return static_cast<UniformBuf *>(uniform_buffer);
73}
74
75} // namespace blender::gpu
#define BLI_INLINE
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
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
void bind(int slot) override
static GPUContext * wrap(Context *ctx)
const char * name