Merge pull request #41346 from lawnjelly/kessel_useless_transform_bug

GLES2 batching - Fix redundant transform synchronization in batches
This commit is contained in:
Rémi Verschelde 2020-08-19 10:26:32 +02:00 committed by GitHub
commit a43bb5927d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -372,11 +372,18 @@ inline void RasterizerCanvasGLES2::_prefill_default_batch(FillState &r_fill_stat
// another default command, just add to the existing batch // another default command, just add to the existing batch
r_fill_state.curr_batch->num_commands++; r_fill_state.curr_batch->num_commands++;
} else { } else {
#ifdef DEBUG_ENABLED #if defined(TOOLS_ENABLED) && defined(DEBUG_ENABLED)
if (r_fill_state.transform_extra_command_number_p1 != p_command_num) { if (r_fill_state.transform_extra_command_number_p1 != p_command_num) {
WARN_PRINT_ONCE("_prefill_default_batch : transform_extra_command_number_p1 != p_command_num"); WARN_PRINT_ONCE("_prefill_default_batch : transform_extra_command_number_p1 != p_command_num");
} }
#endif #endif
// if the first member of the batch is a transform we have to be careful
if (!r_fill_state.curr_batch->num_commands) {
// there can be leading useless extra transforms (sometimes happens with debug collision polys)
// we need to rejig the first_command for the first useful transform
r_fill_state.curr_batch->first_command += r_fill_state.transform_extra_command_number_p1 - 1;
}
// we do have a pending extra transform command to flush // we do have a pending extra transform command to flush
// either the extra transform is in the prior command, or not, in which case we need 2 batches // either the extra transform is in the prior command, or not, in which case we need 2 batches
r_fill_state.curr_batch->num_commands += 2; r_fill_state.curr_batch->num_commands += 2;