From 986907cb74eeb359ff345cbf60f141d582612a39 Mon Sep 17 00:00:00 2001 From: HolySkyMin Date: Thu, 30 Nov 2023 19:07:44 +0900 Subject: [PATCH] GLES3: Mark CLIP_IGNORE command while batching --- drivers/gles3/rasterizer_canvas_gles3.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 2db17e96f75e..c725b998364a 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -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) { + continue; + } + //setup clip if (current_clip != state.canvas_instance_batches[i].clip) { current_clip = state.canvas_instance_batches[i].clip; @@ -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;