Skip to content

Commit

Permalink
MVKCmdDrawIndirect: Fix indirect index for triangle fans.
Browse files Browse the repository at this point in the history
Analogously to KhronosGroup#2419, this fixes generation to add `vertexStart` to the
_generated_ indices, and start from zero in the array.
  • Loading branch information
cdavis5e committed Jan 13, 2025
1 parent 1d2ec63 commit 947858b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,14 +334,14 @@ kernel void cmdDrawIndirectPopulateIndexes(const device char* srcBuff [[buffer(0
const device auto& src = *reinterpret_cast<const device MTLDrawPrimitivesIndirectArguments*>(srcBuff + idx * srcStride);\n\
device auto& dst = destBuff[idx]; \n\
dst.indexCount = src.vertexCount; \n\
dst.indexStart = src.vertexStart; \n\
dst.indexStart = 0; \n\
dst.baseVertex = 0; \n\
dst.instanceCount = src.instanceCount; \n\
dst.baseInstance = src.baseInstance; \n\
\n\
for (uint32_t idxIdx = 0; idxIdx < dst.indexCount; idxIdx++) { \n\
uint32_t idxBuffIdx = dst.indexStart + idxIdx; \n\
idxBuff[idxBuffIdx] = idxBuffIdx; \n\
idxBuff[idxBuffIdx] = src.vertexStart + idxBuffIdx; \n\
} \n\
} \n\
\n\
Expand Down

0 comments on commit 947858b

Please sign in to comment.