bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Improper batching of non-mesh phase items.

Open james-j-obrien opened this issue 7 months ago • 0 comments

Bevy version

v0.14.0

What you did

Run bevy_vector_shapes examples with all features enabled.

What went wrong

The batch_range of custom phase items was being trampled causing failure to render, upon investigation I discovered that this was happening in the gpu_preprocessing variant of batch_and_prepare_sorted_render_phase. The result is non-deterministic due to system ordering.

When GFBD::get_index_and_compare_data() returns None it should skip batching for that item in it's entirety as it may already be being batched by some other pipeline. The batch_range of those items should not be modified.

I was able to mitigate the issue in the repro I have by adding this at line 426:

if current_batch_input_index.is_none() {
    continue;
}

There may be a more appropriate way to handle this in the context of mesh batching at large but the current behavior is definitely incorrect.

Additional information

Original bug: https://github.com/james-j-obrien/bevy_vector_shapes/issues/42

james-j-obrien avatar Jul 13 '24 20:07 james-j-obrien