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;