Skip to content

Commit

Permalink
Fix: Metal crashing when a render pass is abandoned (#8481)
Browse files Browse the repository at this point in the history
  • Loading branch information
bejado authored Mar 4, 2025
1 parent 11b0327 commit 0b5f95b
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 @@ -1411,6 +1411,9 @@

void MetalDriver::setPushConstant(backend::ShaderStage stage, uint8_t index,
backend::PushConstantVariant value) {
if (UTILS_UNLIKELY(mContext->currentRenderPassAbandoned)) {
return;
}
FILAMENT_CHECK_PRECONDITION(isInRenderPass(mContext))
<< "setPushConstant must be called inside a render pass.";
assert_invariant(static_cast<size_t>(stage) < mContext->currentPushConstants.size());
Expand Down Expand Up @@ -1718,6 +1721,9 @@
}

void MetalDriver::bindPipeline(PipelineState const& ps) {
if (UTILS_UNLIKELY(mContext->currentRenderPassAbandoned)) {
return;
}
FILAMENT_CHECK_PRECONDITION(mContext->currentRenderPassEncoder != nullptr)
<< "bindPipeline() without a valid command encoder.";
DEBUG_LOG("bindPipeline(ps = { program = %d }))\n", ps.program.getId());
Expand Down Expand Up @@ -1873,6 +1879,9 @@
}

void MetalDriver::bindRenderPrimitive(Handle<HwRenderPrimitive> rph) {
if (UTILS_UNLIKELY(mContext->currentRenderPassAbandoned)) {
return;
}
FILAMENT_CHECK_PRECONDITION(mContext->currentRenderPassEncoder != nullptr)
<< "bindRenderPrimitive() without a valid command encoder.";

Expand Down

0 comments on commit 0b5f95b

Please sign in to comment.