Fix regression caused by #1922

Needed to complete fix for #1874

We can't wait until getMTLComputeEncoder() is called to dirty the state,
because this call will be avoided by dirty checks themselves.
Those checks are comparing against leftover and now incorrect state since
the previous encoder has already ended.
It needs to be dirtied on encoder end.
This commit is contained in:
Malcolm Bechard's MacMini M1 2023-07-18 20:19:23 -04:00 committed by Malcolm Bechard
parent 42fa5117d9
commit 817038e8d8

View File

@ -839,6 +839,10 @@ void MVKCommandEncoder::endMetalRenderEncoding() {
void MVKCommandEncoder::endCurrentMetalEncoding() { void MVKCommandEncoder::endCurrentMetalEncoding() {
endMetalRenderEncoding(); endMetalRenderEncoding();
_computePipelineState.markDirty();
_computePushConstants.markDirty();
_computeResourcesState.markDirty();
if (_mtlComputeEncoder && _cmdBuffer->_hasStageCounterTimestampCommand) { [_mtlComputeEncoder updateFence: getStageCountersMTLFence()]; } if (_mtlComputeEncoder && _cmdBuffer->_hasStageCounterTimestampCommand) { [_mtlComputeEncoder updateFence: getStageCountersMTLFence()]; }
endMetalEncoding(_mtlComputeEncoder); endMetalEncoding(_mtlComputeEncoder);
_mtlComputeEncoderUse = kMVKCommandUseNone; _mtlComputeEncoderUse = kMVKCommandUseNone;
@ -856,7 +860,7 @@ id<MTLComputeCommandEncoder> MVKCommandEncoder::getMTLComputeEncoder(MVKCommandU
_mtlComputeEncoder = [_mtlCmdBuffer computeCommandEncoder]; _mtlComputeEncoder = [_mtlCmdBuffer computeCommandEncoder];
retainIfImmediatelyEncoding(_mtlComputeEncoder); retainIfImmediatelyEncoding(_mtlComputeEncoder);
beginMetalComputeEncoding(cmdUse); beginMetalComputeEncoding(cmdUse);
markCurrentComputeStateDirty = true; // Always mark current compute state dirty for new encoder markCurrentComputeStateDirty = false; // Already marked dirty above in endCurrentMetalEncoding()
} }
if(markCurrentComputeStateDirty) { if(markCurrentComputeStateDirty) {
_computePipelineState.markDirty(); _computePipelineState.markDirty();