mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 16:22:45 +03:00
chore(gx): minor clarity improvements in BATCHEDRENDERFONTDESC::RenderBatch
This commit is contained in:
parent
da51f7e4fc
commit
1352f0ba50
@ -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;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user