Metal: unbind descriptor sets upon destruction (#8268)
This commit is contained in:
committed by
Benjamin Doherty
parent
e726964b85
commit
2a9dcd7c40
@@ -861,10 +861,20 @@ void MetalDriver::destroyDescriptorSetLayout(Handle<HwDescriptorSetLayout> dslh)
|
||||
|
||||
void MetalDriver::destroyDescriptorSet(Handle<HwDescriptorSet> dsh) {
|
||||
DEBUG_LOG("destroyDescriptorSet(dsh = %d)\n", dsh.getId());
|
||||
if (dsh) {
|
||||
executeAfterCurrentCommandBufferCompletes(
|
||||
[this, dsh]() mutable { destruct_handle<MetalDescriptorSet>(dsh); });
|
||||
if (!dsh) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Unbind this descriptor set.
|
||||
auto* descriptorSet = handle_cast<MetalDescriptorSet>(dsh);
|
||||
for (size_t i = 0; i < MAX_DESCRIPTOR_SET_COUNT; i++) {
|
||||
if (UTILS_UNLIKELY(mContext->currentDescriptorSets[i] == descriptorSet)) {
|
||||
mContext->currentDescriptorSets[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
executeAfterCurrentCommandBufferCompletes(
|
||||
[this, dsh]() mutable { destruct_handle<MetalDescriptorSet>(dsh); });
|
||||
}
|
||||
|
||||
void MetalDriver::terminate() {
|
||||
|
||||
Reference in New Issue
Block a user