Commit 64d135bc authored by Andy Nichols's avatar Andy Nichols Committed by Andy Nichols
Browse files

Don't try and execute a draw call with an instance count of 0

It is invalid to call a draw call with an instance count of 0 with metal
and this can lead to a validation error. Better to bail out as soon as
we know the instance count will be 0.

Pick-to: 6.4
Change-Id: I16fdc17ebb1d75624f04cd680bf9e4df9e27729d
Reviewed-by: default avatarLaszlo Agocs <>
parent 5317f6c5
......@@ -4078,6 +4078,12 @@ static void rhiRenderRenderable(QSSGRhiContext *rhiCtx,
quint32 instances = 1;
if ( subsetRenderable.modelContext.model.instancing()) {
instances = subsetRenderable.modelContext.model.instanceCount();
// If the instance count is 0, the bail out before trying to do any
// draw calls. Making an instanced draw call with a count of 0 is invalid
// for Metal and likely other API's as well.
// It is possible that the particale system may produce 0 instances here
if (instances == 0)
vertexBuffers[1] = QRhiCommandBuffer::VertexInput(subsetRenderable.instanceBuffer, 0);
vertexBufferCount = 2;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment