Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2D: Fix rendering artifacts when using BackBufferCopy. #101998

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

stuartcarnie
Copy link
Contributor

@stuartcarnie stuartcarnie commented Jan 24, 2025

Closes #101686
Addresses feedback from PR #101931 by @Repiteo

Instance buffer usage was being reset after calling _render_batch, rather than at the end of the draw pass in canvas_render_items for both the GLES3 and RendererRD implementations. This PR fixes both.

Before using MRP, notice artefacts
before after

Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove the clear from the early-out as well then?

// Nothing to render, just return.
state.current_batch_index = 0;
state.canvas_instance_batches.clear();
return;

@stuartcarnie
Copy link
Contributor Author

Should we remove the clear from the early-out as well then?

// Nothing to render, just return.
state.current_batch_index = 0;
state.canvas_instance_batches.clear();
return;

Probably should not be setting current_batch_index to 0 either

Fixes both GLES3 and RendererRD implementations
@stuartcarnie
Copy link
Contributor Author

Thanks – good catch @clayjohn. I've removed that early-exit code that resets the state in the gles3 driver.

@AThousandShips AThousandShips changed the title 2D: Fix rendering artefacts when using BackBufferCopy. 2D: Fix rendering artifacts when using BackBufferCopy. Jan 27, 2025
@Repiteo Repiteo merged commit 82199a8 into godotengine:master Jan 27, 2025
19 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Jan 27, 2025

Thanks!

@stuartcarnie stuartcarnie deleted the 2d_buffer_overwrite branch January 27, 2025 19:35
@mihe
Copy link
Contributor

mihe commented Jan 29, 2025

As best I can tell, this seems to have broken CanvasItem.clip_children: #102147

stuartcarnie added a commit to stuartcarnie/godot that referenced this pull request Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rendering issues using BackBufferCopy node in 4.4 beta 1
4 participants