Skip to content

Commit

Permalink
Merge pull request #980 from qw-ctf/modernbatching
Browse files Browse the repository at this point in the history
MODERN: Unbreak and enable draw call batching.
  • Loading branch information
dsvensson authored Jan 2, 2025
2 parents 1678bb1 + d4557c1 commit 5dda74f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/glm_rsurf.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,6 @@ static void GLM_DrawWorldExecuteCalls(glm_brushmodel_drawcall_t* drawcall, uintp
{
int i;
int prevSampler = -1;
const qbool batch = false;
qbool prev_alphaTested = false;

for (i = begin; i < begin + count; ++i) {
Expand All @@ -679,10 +678,8 @@ static void GLM_DrawWorldExecuteCalls(glm_brushmodel_drawcall_t* drawcall, uintp
prev_alphaTested = req->isAlphaTested;
}

if (batch) {
while (i + batchCount < begin + count && drawcall->worldmodel_requests[i + batchCount].nonDynamicSampler == sampler && drawcall->worldmodel_requests[i + batchCount].isAlphaTested == req->isAlphaTested) {
++batchCount;
}
while (i + batchCount < begin + count && drawcall->worldmodel_requests[i + batchCount].nonDynamicSampler == sampler && drawcall->worldmodel_requests[i + batchCount].isAlphaTested == req->isAlphaTested) {
++batchCount;
}

if (batchCount == 1) {
Expand All @@ -697,8 +694,7 @@ static void GLM_DrawWorldExecuteCalls(glm_brushmodel_drawcall_t* drawcall, uintp
);
}
else {
GL_MultiDrawElementsIndirect(GL_TRIANGLE_STRIP, GL_UNSIGNED_INT, (void*)(offset + sizeof(drawcall->worldmodel_requests[0]) * i), batchCount, sizeof(drawcall->worldmodel_requests[0]));

GL_MultiDrawElementsIndirect(GL_TRIANGLE_STRIP, GL_UNSIGNED_INT, (void*)(offset + (i - begin) * sizeof(drawcall->worldmodel_requests[0])), batchCount, sizeof(drawcall->worldmodel_requests[0]));
i += batchCount - 1;
}
}
Expand Down

0 comments on commit 5dda74f

Please sign in to comment.