Fix redondant modification test in batch sorting.
This commit is contained in:
parent
39a95e24c3
commit
74b6f58794
@ -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<GLuint>(mesh->ntriangles) * 3;
|
||||
command->ninstances = bucket->count;
|
||||
command->base_index = mesh->base_index;
|
||||
command->base_instance = indices - batch.indices;
|
||||
modified |= rk_cmp_memcpy<sizeof(rk_ushort)>(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;
|
||||
|
Loading…
Reference in New Issue
Block a user