Blender
V5.3
source
blender
gpu
metal
mtl_push_constant.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2025 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9
#pragma once
10
11
#include "
gpu_shader_create_info.hh
"
12
13
namespace
blender::gpu
{
14
15
/* Metal Shader Uniform data store.
16
* This blocks is used to store current shader push_constant
17
* data before it is submitted to the GPU. This is currently
18
* stored per shader instance, though depending on GPU module
19
* functionality, this could potentially be a global data store.
20
* This data is associated with the PushConstantBlock. */
21
class
MTLPushConstantBuf
{
22
private
:
23
uint8_t
*data_ =
nullptr
;
24
/* Offset inside buffer for allocating push constants. */
25
size_t
offset_ = 0;
26
/* Size of the allocated buffer in `data_`. */
27
size_t
size_ = 0;
28
/* True if the data has been touched and must be resent to GPU. */
29
bool
is_dirty_ =
true
;
30
31
public
:
32
MTLPushConstantBuf
(
const
shader::ShaderCreateInfo
&info);
33
~MTLPushConstantBuf
();
34
35
/* Append uniform description to the buffer and return the location inside the buffer. */
36
int
append
(
shader::ShaderCreateInfo::PushConst
push_constant
);
37
38
uint8_t
*
data
()
39
{
40
return
data_;
41
}
42
43
const
uint8_t
*
data
()
const
44
{
45
return
data_;
46
}
47
48
size_t
size
()
const
49
{
50
return
size_;
51
}
52
53
bool
is_dirty
()
const
54
{
55
return
is_dirty_;
56
}
57
58
void
tag_dirty
()
59
{
60
is_dirty_ =
true
;
61
}
62
63
void
tag_updated
()
64
{
65
is_dirty_ =
false
;
66
}
67
};
68
69
}
// namespace blender::gpu
blender::gpu::MTLPushConstantBuf::data
const uint8_t * data() const
Definition
mtl_push_constant.hh:43
blender::gpu::MTLPushConstantBuf::MTLPushConstantBuf
MTLPushConstantBuf(const shader::ShaderCreateInfo &info)
Definition
mtl_push_constant.cc:42
blender::gpu::MTLPushConstantBuf::append
int append(shader::ShaderCreateInfo::PushConst push_constant)
Definition
mtl_push_constant.cc:72
blender::gpu::MTLPushConstantBuf::data
uint8_t * data()
Definition
mtl_push_constant.hh:38
blender::gpu::MTLPushConstantBuf::is_dirty
bool is_dirty() const
Definition
mtl_push_constant.hh:53
blender::gpu::MTLPushConstantBuf::size
size_t size() const
Definition
mtl_push_constant.hh:48
blender::gpu::MTLPushConstantBuf::tag_updated
void tag_updated()
Definition
mtl_push_constant.hh:63
blender::gpu::MTLPushConstantBuf::tag_dirty
void tag_dirty()
Definition
mtl_push_constant.hh:58
gpu_shader_create_info.hh
push_constant
#define push_constant
Definition
gpu_shader_cxx_attribute.hh:126
blender::gpu
Definition
blf_internal_types.hh:35
blender::uint8_t
unsigned char uint8_t
Definition
BKE_text.h:79
blender::gpu::shader::ShaderCreateInfo::PushConst
Definition
gpu_shader_create_info.hh:1129
blender::gpu::shader::ShaderCreateInfo
Describe inputs & outputs, stage interfaces, resources and sources of a shader. If all data is correc...
Definition
gpu_shader_create_info.hh:799
Generated on
for Blender by
doxygen
1.18.0