Skip to content

Fix skybox and horizon lines not being batched

Hanicef requested to merge Hanicef/SRB2:fix-sky-lines-batching into next

After an optimization that was done to improve OpenGL rendering performance, one thing that was overlooked was that the optimized code assumed that skybox and horizon lines cannot be batched. This assumption was made since they are order-sensitive, and as such must be rendered in the correct order. However, just because they must be rendered in a specific order doesn't mean that they cannot be batched - and they very much can because of how they are inserted in groups.

The code is now adjusted to no longer assume that a new batch is necessary when there's a hash mismatch, and now actually makes sure that the next polygon is different in a way that actually requires a new batch. This fixes the problem since all skybox and horizon lines have different hash values to preserve rendering order, so we cannot rely on just that to check if a new batch is needed or not.

Before: srb20053

After: srb20055

(Pay attention to the draw count - that's what matters here! Sampling doesn't make a difference here since the draw count doesn't change if the scene remains the same.)

Fixes #1303 (closed)

Merge request reports

Loading