diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-09-25 15:14:05 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-09-26 17:02:28 +0200 |
commit | c06627a230ea758c64ac70a9962a69c843fd0e08 (patch) | |
tree | 572108587051de8c235b6f4735bb8730b6aa4a05 /src/gui/rhi/qrhimetal.mm | |
parent | 22d22eb2824fb06f69f87bda27b1cfdf45efbc1f (diff) | |
download | qtbase-c06627a230ea758c64ac70a9962a69c843fd0e08.tar.gz |
rhi: metal: Eliminate redundant setCullMode and setFrontFaceWinding calls
Task-number: QTBUG-78605
Change-Id: Icc3a9636055b5f45418da28cc05aa02e19370c02
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhimetal.mm')
-rw-r--r-- | src/gui/rhi/qrhimetal.mm | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index bfd6944cdb..d4043f00a5 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -838,8 +838,15 @@ void QRhiMetal::setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline [cbD->d->currentRenderPassEncoder setRenderPipelineState: psD->d->ps]; [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; @@ -3450,6 +3457,10 @@ void QMetalCommandBuffer::resetPerPassCachedState() currentSrbGeneration = 0; currentResSlot = -1; currentIndexBuffer = nullptr; + currentIndexOffset = 0; + currentIndexFormat = QRhiCommandBuffer::IndexUInt16; + currentCullMode = -1; + currentFrontFaceWinding = -1; d->currentFirstVertexBinding = -1; d->currentVertexInputsBuffers.clear(); |