Skip to content

Commit

Permalink
Metal: unbind descriptor sets upon destruction
Browse files Browse the repository at this point in the history
  • Loading branch information
bejado committed Nov 12, 2024
1 parent 61c4df9 commit d929cbe
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions filament/backend/src/metal/MetalDriver.mm
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,15 @@

void MetalDriver::destroyDescriptorSet(Handle<HwDescriptorSet> dsh) {
DEBUG_LOG("destroyDescriptorSet(dsh = %d)\n", dsh.getId());

// 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;
}
}

if (dsh) {
executeAfterCurrentCommandBufferCompletes(
[this, dsh]() mutable { destruct_handle<MetalDescriptorSet>(dsh); });
Expand Down

0 comments on commit d929cbe

Please sign in to comment.