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

GLES3: Mark CLIP_IGNORE command while batching #85533

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions drivers/gles3/rasterizer_canvas_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,13 @@ void RasterizerCanvasGLES3::_render_items(RID p_to_render_target, int p_item_cou
state.current_tex = RID();

for (uint32_t i = 0; i <= state.current_batch_index; i++) {
// Ignoring CLIP_IGNORE command.
// Normally this type of command should not exist in here, but
// in some cases it will exist as the debris of prior canvas item.
if (state.canvas_instance_batches[i].command_type == Item::Command::TYPE_CLIP_IGNORE) {
Copy link
Member

Choose a reason for hiding this comment

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

This should happen after clipping is applied, no? With this change, clipping would never get applied.

Copy link
Contributor Author

@HolySkyMin HolySkyMin Dec 2, 2023

Choose a reason for hiding this comment

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

CLIP_IGNORE command can't be recorded to the batch as far as I know(instance count remains zero and new batch will not be created in next command), except no other commands are following. So if it is alive in the batch, it's completely useless and can be trashed immediately I think.

continue;
}

//setup clip
if (current_clip != state.canvas_instance_batches[i].clip) {
current_clip = state.canvas_instance_batches[i].clip;
Expand Down Expand Up @@ -1204,6 +1211,8 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend
if (current_clip) {
if (ci->ignore != reclip) {
_new_batch(r_batch_broken);
state.canvas_instance_batches[state.current_batch_index].command = c;
state.canvas_instance_batches[state.current_batch_index].command_type = Item::Command::TYPE_CLIP_IGNORE;
if (ci->ignore) {
state.canvas_instance_batches[state.current_batch_index].clip = nullptr;
reclip = true;
Expand Down
Loading