rhi: metal: Eliminate redundant setCullMode and setFrontFaceWinding calls
Task-number: QTBUG-78605 Change-Id: Icc3a9636055b5f45418da28cc05aa02e19370c02 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
This commit is contained in:
parent
22d22eb282
commit
c06627a230
@ -838,8 +838,15 @@ void QRhiMetal::setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline
|
|||||||
|
|
||||||
[cbD->d->currentRenderPassEncoder setRenderPipelineState: psD->d->ps];
|
[cbD->d->currentRenderPassEncoder setRenderPipelineState: psD->d->ps];
|
||||||
[cbD->d->currentRenderPassEncoder setDepthStencilState: psD->d->ds];
|
[cbD->d->currentRenderPassEncoder setDepthStencilState: psD->d->ds];
|
||||||
[cbD->d->currentRenderPassEncoder setCullMode: psD->d->cullMode];
|
|
||||||
[cbD->d->currentRenderPassEncoder setFrontFacingWinding: psD->d->winding];
|
if (cbD->currentCullMode == -1 || psD->d->cullMode != uint(cbD->currentCullMode)) {
|
||||||
|
[cbD->d->currentRenderPassEncoder setCullMode: psD->d->cullMode];
|
||||||
|
cbD->currentCullMode = int(psD->d->cullMode);
|
||||||
|
}
|
||||||
|
if (cbD->currentFrontFaceWinding == -1 || psD->d->winding != uint(cbD->currentFrontFaceWinding)) {
|
||||||
|
[cbD->d->currentRenderPassEncoder setFrontFacingWinding: psD->d->winding];
|
||||||
|
cbD->currentFrontFaceWinding = int(psD->d->winding);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
psD->lastActiveFrameSlot = currentFrameSlot;
|
psD->lastActiveFrameSlot = currentFrameSlot;
|
||||||
@ -3450,6 +3457,10 @@ void QMetalCommandBuffer::resetPerPassCachedState()
|
|||||||
currentSrbGeneration = 0;
|
currentSrbGeneration = 0;
|
||||||
currentResSlot = -1;
|
currentResSlot = -1;
|
||||||
currentIndexBuffer = nullptr;
|
currentIndexBuffer = nullptr;
|
||||||
|
currentIndexOffset = 0;
|
||||||
|
currentIndexFormat = QRhiCommandBuffer::IndexUInt16;
|
||||||
|
currentCullMode = -1;
|
||||||
|
currentFrontFaceWinding = -1;
|
||||||
|
|
||||||
d->currentFirstVertexBinding = -1;
|
d->currentFirstVertexBinding = -1;
|
||||||
d->currentVertexInputsBuffers.clear();
|
d->currentVertexInputsBuffers.clear();
|
||||||
|
@ -271,8 +271,11 @@ struct QMetalCommandBuffer : public QRhiCommandBuffer
|
|||||||
ComputePass
|
ComputePass
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// per-pass (render or compute command encoder) persistent state
|
||||||
PassType recordingPass;
|
PassType recordingPass;
|
||||||
QRhiRenderTarget *currentTarget;
|
QRhiRenderTarget *currentTarget;
|
||||||
|
|
||||||
|
// per-pass (render or compute command encoder) volatile (cached) state
|
||||||
QRhiGraphicsPipeline *currentGraphicsPipeline;
|
QRhiGraphicsPipeline *currentGraphicsPipeline;
|
||||||
QRhiComputePipeline *currentComputePipeline;
|
QRhiComputePipeline *currentComputePipeline;
|
||||||
uint currentPipelineGeneration;
|
uint currentPipelineGeneration;
|
||||||
@ -283,6 +286,8 @@ struct QMetalCommandBuffer : public QRhiCommandBuffer
|
|||||||
QRhiBuffer *currentIndexBuffer;
|
QRhiBuffer *currentIndexBuffer;
|
||||||
quint32 currentIndexOffset;
|
quint32 currentIndexOffset;
|
||||||
QRhiCommandBuffer::IndexFormat currentIndexFormat;
|
QRhiCommandBuffer::IndexFormat currentIndexFormat;
|
||||||
|
int currentCullMode;
|
||||||
|
int currentFrontFaceWinding;
|
||||||
|
|
||||||
const QRhiNativeHandles *nativeHandles();
|
const QRhiNativeHandles *nativeHandles();
|
||||||
void resetState();
|
void resetState();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user