From 74b6f587941cd322428a3eeccd0a4f67304a3749 Mon Sep 17 00:00:00 2001 From: Roz K Date: Tue, 3 Jan 2023 21:41:03 +0100 Subject: [PATCH] Fix redondant modification test in batch sorting. --- cpp/render/render_opengles.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cpp/render/render_opengles.cpp b/cpp/render/render_opengles.cpp index ce16bda..3399222 100644 --- a/cpp/render/render_opengles.cpp +++ b/cpp/render/render_opengles.cpp @@ -770,26 +770,23 @@ static void rk_sort_batch( bucket.indices[bucket.count++] = index; } } - bool modified = false; rk_ushort * __restrict indices = batch.indices; rk_command * __restrict command = batch.commands; rk_mesh const * __restrict mesh = batch.vertices->meshes; for (rk_bucket const * __restrict bucket = rk_buckets; bucket < last_bucket; ++bucket, ++mesh) { if (bucket->count) { + memcpy(indices, bucket->indices, bucket->count * sizeof(rk_ushort)); command->nvertices = static_cast(mesh->ntriangles) * 3; command->ninstances = bucket->count; command->base_index = mesh->base_index; command->base_instance = indices - batch.indices; - modified |= rk_cmp_memcpy(indices, bucket->indices, bucket->count * sizeof(rk_ushort)); indices += bucket->count; ++command; } } - unsigned const ninstances = indices - batch.indices; - modified |= (ninstances != batch.ninstances); - batch.ninstances = ninstances; + batch.ninstances = indices - batch.indices; batch.ncommands = command - batch.commands; - if (modified && rk_MultiDrawElementsIndirect) { + if (rk_MultiDrawElementsIndirect) { glBufferSubData(GL_DRAW_INDIRECT_BUFFER, 0, batch.ncommands * sizeof(rk_command), batch.commands); } batch.state = RK_BATCH_STATE_SORTED;