28 if (metal_buffer_ !=
nullptr) {
29 metal_buffer_->
free();
30 metal_buffer_ =
nullptr;
41 if (slot.
bound && slot.
ubo ==
this) {
50 ssbo_wrapper_ =
nullptr;
62 if (metal_buffer_ !=
nullptr) {
63 metal_buffer_->
free();
64 metal_buffer_ =
nullptr;
73 if (data !=
nullptr) {
79 metal_buffer_->
set_label([NSString stringWithFormat:
@"Uniform Buffer %s",
name_]);
87 metal_buffer_ =
nullptr;
103 MTL_LOG_WARNING(
"Failed to bind UBO %p. uniform location %d invalid.",
this, slot);
114 ctx_ubo_bind_slot.
ubo =
this;
115 ctx_ubo_bind_slot.
bound =
true;
121 if (
data_ !=
nullptr) {
127 if (metal_buffer_ ==
nullptr) {
135 MTL_LOG_WARNING(
"Failed to bind UBO %p as SSBO. uniform location %d invalid.",
this, slot);
141 if (metal_buffer_ ==
nullptr) {
143 if (
data_ !=
nullptr) {
153 if (ssbo_wrapper_ ==
nullptr) {
157 ssbo_wrapper_->
bind(slot);
170 if (bound_ctx_ !=
nullptr && bind_slot_ > -1) {
173 if (ctx_ubo_bind_slot.
bound && ctx_ubo_bind_slot.
ubo ==
this) {
174 ctx_ubo_bind_slot.
bound =
false;
175 ctx_ubo_bind_slot.
ubo =
nullptr;
182 bound_ctx_ =
nullptr;
188 if (metal_buffer_ !=
nullptr && has_data_) {
void BLI_kdtree_nd_ free(KDTree *tree)
#define UNUSED_VARS_NDEBUG(...)
gpu::MTLBuffer * allocate_with_data(uint64_t size, bool cpu_visible, const void *data=nullptr)
void set_label(NSString *str)
id< MTLBuffer > get_metal_buffer() const
static MTLContext * get()
MTLContextGlobalShaderPipelineState pipeline_state
static MTLBufferPool * get_global_memory_manager()
void bind(int slot) override
#define MTL_MAX_BUFFER_BINDINGS
#define MTL_LOG_WARNING(info,...)
MTLUniformBufferBinding ubo_bindings[MTL_MAX_BUFFER_BINDINGS]