diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-11-25 12:50:33 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-11-26 14:22:05 +0100 |
commit | 99644a9e9441b0549fe2c178b34169c35036c46c (patch) | |
tree | f97b66e8077760b1c054627b0650eb88226aeebd /src | |
parent | c1899ca310cbd3a4ce5e8454a01a22638beb8d73 (diff) |
rhi: metal: Ignore baseInstance if not supported
A previous patch already introduced calling the correct
variant of drawIndexedPrimitives, but it was not done
for drawPrimitives.
When base vertex and instance is not supported (e.g. on the iOS
simulator), it does not mean that the value cannot be other than
0, but rather that the version of the function taking this
arguments must not be called at all, otherwise a Metal failure
occurs. The docs and logic is all in place, just add it to
draw() as well.
Amends 213755a86622ae8b3ed3d7ad34a6aecd051b2b03 which fixed this
for indexed draw calls. Now we also prevent aborting Qt Quick
applications that trigger non-indexed draw calls.
Change-Id: Icb4313ffd2d3a77a73f7b5f49d7ce63c935254d3
Pick-to: 6.2
Task-number: QTBUG-95795
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/rhi/qrhimetal.mm | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index 169d80251d..5219b5c71d 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -1330,9 +1330,15 @@ void QRhiMetal::draw(QRhiCommandBuffer *cb, quint32 vertexCount, QMetalCommandBuffer *cbD = QRHI_RES(QMetalCommandBuffer, cb); Q_ASSERT(cbD->recordingPass == QMetalCommandBuffer::RenderPass); - [cbD->d->currentRenderPassEncoder drawPrimitives: - QRHI_RES(QMetalGraphicsPipeline, cbD->currentGraphicsPipeline)->d->primitiveType - vertexStart: firstVertex vertexCount: vertexCount instanceCount: instanceCount baseInstance: firstInstance]; + if (caps.baseVertexAndInstance) { + [cbD->d->currentRenderPassEncoder drawPrimitives: + QRHI_RES(QMetalGraphicsPipeline, cbD->currentGraphicsPipeline)->d->primitiveType + vertexStart: firstVertex vertexCount: vertexCount instanceCount: instanceCount baseInstance: firstInstance]; + } else { + [cbD->d->currentRenderPassEncoder drawPrimitives: + QRHI_RES(QMetalGraphicsPipeline, cbD->currentGraphicsPipeline)->d->primitiveType + vertexStart: firstVertex vertexCount: vertexCount instanceCount: instanceCount]; + } } void QRhiMetal::drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount, |