Skip to content

Commit

Permalink
IGL: Apply iOS 16 fix to instanced drawing
Browse files Browse the repository at this point in the history
Summary: This is a quick attempt to fix more issues related to instanced drawing in IGL. This feature is only available in newer GPUs. We're using iOS 16 as a proxy for these features being available. Later diffs will apply a proper fix.

Reviewed By: anthonydito

Differential Revision: D52606631

fbshipit-source-id: 2cb586429c4a6397266b5da2463e4f2b0615afdf
  • Loading branch information
Eric Griffith authored and facebook-github-bot committed Jan 8, 2024
1 parent ece419c commit 9c0e7ee
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/igl/metal/RenderCommandEncoder.mm
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,19 @@
getCommandBuffer().incrementCurrentDrawCount();
IGL_ASSERT(encoder_);
MTLPrimitiveType metalPrimitive = convertPrimitiveType(primitiveType);
[encoder_ drawPrimitives:metalPrimitive
vertexStart:vertexStart
vertexCount:vertexCount
instanceCount:instanceCount
baseInstance:baseInstance];
#if IGL_PLATFORM_IOS
if (@available(iOS 16, *)) {
#endif // IGL_PLATFORM_IOS
[encoder_ drawPrimitives:metalPrimitive
vertexStart:vertexStart
vertexCount:vertexCount
instanceCount:instanceCount
baseInstance:baseInstance];
#if IGL_PLATFORM_IOS
} else {
[encoder_ drawPrimitives:metalPrimitive vertexStart:vertexStart vertexCount:vertexCount];
}
#endif // IGL_PLATFORM_IOS
}

void RenderCommandEncoder::drawIndexed(PrimitiveType primitiveType,
Expand Down

0 comments on commit 9c0e7ee

Please sign in to comment.