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 clip children and rendering artefacts #102161

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

stuartcarnie
Copy link
Contributor

Closes #102147

Fixes both GLES3 and RendererRD implementations

Note

This fix also addresses the root cause of #101998, which was that instance buffers were reused in the same draw call, causing rendering artefacts.

Both issues resolved
clip children rendering artefact

@stuartcarnie stuartcarnie requested a review from a team as a code owner January 29, 2025 20:15
@@ -1567,7 +1567,9 @@ void RasterizerCanvasGLES3::_add_to_batch(uint32_t &r_index, bool &r_batch_broke

void RasterizerCanvasGLES3::_new_batch(bool &r_batch_broken) {
if (state.canvas_instance_batches.size() == 0) {
state.canvas_instance_batches.push_back(Batch());
Batch new_batch;
new_batch.instance_buffer_index = state.current_instance_buffer_index;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to start at the last instance buffer, even when starting the first batch. This is 0 when starting a new canvas draw, but will be non-zero if there are multiple draws in a single canvas draw.

Fixes both GLES3 and RendererRD implementations

Closes godotengine#102147
@stuartcarnie stuartcarnie added this to the 4.4 milestone Jan 29, 2025
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.

Makes sense

@Repiteo Repiteo merged commit c02b4e5 into godotengine:master Jan 29, 2025
19 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Jan 29, 2025

Thanks!

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.

CanvasItem.clip_children has no effect
3 participants