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_]);
82 BLI_assert(metal_buffer_->get_metal_buffer() != nil);
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);
171 if (bound_ctx_ !=
nullptr && bind_slot_ > -1) {
173 bound_ctx_->pipeline_state.ubo_bindings[bind_slot_];
174 if (ctx_ubo_bind_slot.
bound && ctx_ubo_bind_slot.
ubo ==
this) {
175 ctx_ubo_bind_slot.
bound =
false;
176 ctx_ubo_bind_slot.
ubo =
nullptr;
183 bound_ctx_ =
nullptr;
189 if (metal_buffer_ !=
nullptr && has_data_) {
190 metal_buffer_->debug_ensure_used();
191 return metal_buffer_->get_metal_buffer();
void BLI_kdtree_nd_ free(KDTree *tree)
#define UNUSED_VARS_NDEBUG(...)
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
gpu::MTLBuffer * allocate_with_data(uint64_t size, bool cpu_visible, const void *data=nullptr)
void set_label(NSString *str)
static MTLContext * get()
MTLContextGlobalShaderPipelineState pipeline_state
static MTLBufferPool * get_global_memory_manager()
#define MTL_MAX_BUFFER_BINDINGS
#define MTL_LOG_WARNING(info,...)
MTLUniformBufferBinding ubo_bindings[MTL_MAX_BUFFER_BINDINGS]