Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion plume_metal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2491,6 +2491,10 @@ namespace plume {
void MetalCommandList::drawInstanced(const uint32_t vertexCountPerInstance, const uint32_t instanceCount, const uint32_t startVertexLocation, const uint32_t startInstanceLocation) {
assert(activeGraphicsPipelineLayout != nullptr);

// Skip draws whose pipeline failed to compile; encoding with a null PSO is undefined behavior.
if (activeRenderState == nullptr || activeRenderState->renderPipelineState == nullptr)
return;

MetalAutoreleasePool releasePool;
checkActiveRenderEncoder();
checkForUpdatesInGraphicsState();
Expand All @@ -2501,6 +2505,10 @@ namespace plume {
void MetalCommandList::drawIndexedInstanced(const uint32_t indexCountPerInstance, const uint32_t instanceCount, const uint32_t startIndexLocation, const int32_t baseVertexLocation, const uint32_t startInstanceLocation) {
assert(activeGraphicsPipelineLayout != nullptr);

// Skip draws whose pipeline failed to compile; encoding with a null PSO is undefined behavior.
if (activeRenderState == nullptr || activeRenderState->renderPipelineState == nullptr)
return;

MetalAutoreleasePool releasePool;
checkActiveRenderEncoder();
checkForUpdatesInGraphicsState();
Expand Down Expand Up @@ -3395,7 +3403,7 @@ namespace plume {
void MetalCommandList::checkForUpdatesInGraphicsState() {
// Pipeline state - only update if the actual pipeline object changed
if (dirtyGraphicsState.pipelineState) {
if (activeRenderState && activeRenderState->renderPipelineState != stateCache.lastPipelineState) {
if (activeRenderState && activeRenderState->renderPipelineState != nullptr && activeRenderState->renderPipelineState != stateCache.lastPipelineState) {
activeRenderEncoder->setRenderPipelineState(activeRenderState->renderPipelineState);
stateCache.lastPipelineState = activeRenderState->renderPipelineState;
}
Expand Down