chore(gx): minor clarity improvements in BATCHEDRENDERFONTDESC::RenderBatch

This commit is contained in:
fallenoak 2025-12-21 21:11:59 -06:00
parent da51f7e4fc
commit 1352f0ba50
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D

View File

@ -173,23 +173,26 @@ void BATCHEDRENDERFONTDESC::RenderBatch() {
int32_t sliceOffset = 0; int32_t sliceOffset = 0;
while (vertsNeeded) { while (vertsNeeded) {
// Clamp slice vertex count to remaining batch capacity
int32_t sliceCount = std::min(vertsNeeded, batchCapacity); int32_t sliceCount = std::min(vertsNeeded, batchCapacity);
// Write string vertices within slice to buffer
string->WriteGeometry(vertexBuf, lineIndex, sliceOffset, sliceCount); string->WriteGeometry(vertexBuf, lineIndex, sliceOffset, sliceCount);
vertsNeeded -= sliceCount; vertsNeeded -= sliceCount;
sliceOffset += sliceCount;
batchCapacity -= sliceCount; batchCapacity -= sliceCount;
sliceOffset += sliceCount;
vertexBuf += sliceCount; vertexBuf += sliceCount;
if (!batchCapacity) { // Render full buffer and reset capacity
if (batchCapacity == 0) {
vertexBuf = this->UnlockVertexPtrAndRender(vertexStream, maxBatchCapacity); vertexBuf = this->UnlockVertexPtrAndRender(vertexStream, maxBatchCapacity);
batchCapacity = maxBatchCapacity; batchCapacity = maxBatchCapacity;
} }
} }
} }
// Render used portion of buffer and reset // Render used portion of buffer and reset capacity
if (batchCapacity != maxBatchCapacity) { if (batchCapacity != maxBatchCapacity) {
vertexBuf = this->UnlockVertexPtrAndRender(vertexStream, maxBatchCapacity - batchCapacity); vertexBuf = this->UnlockVertexPtrAndRender(vertexStream, maxBatchCapacity - batchCapacity);
batchCapacity = maxBatchCapacity; batchCapacity = maxBatchCapacity;