From c51b59c1fc46330ae73d4aaafe884546ef522bbc Mon Sep 17 00:00:00 2001 From: HolySkyMin Date: Tue, 23 Jan 2024 20:20:18 +0100 Subject: [PATCH] GLES3: Skip batches with zero instance count while rendering (cherry picked from commit 51dcb388409095133261fb98c8822fbc6bb55c8e) --- drivers/gles3/rasterizer_canvas_gles3.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index b0b6cf4917a..e78d13c462d 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -660,6 +660,11 @@ 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++) { + // Skipping when there is no instances. + if (state.canvas_instance_batches[i].instance_count == 0) { + continue; + } + //setup clip if (current_clip != state.canvas_instance_batches[i].clip) { current_clip = state.canvas_instance_batches[i].clip;