Skip to content

Commit aa67352

Browse files
committed
2D: Fixes for godotengine#101998
1 parent eed9e61 commit aa67352

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

drivers/gles3/rasterizer_canvas_gles3.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,8 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
568568

569569
// Clear out state used in 2D pass
570570
reset_canvas();
571+
state.current_batch_index = 0;
572+
state.canvas_instance_batches.clear();
571573
state.current_data_buffer_index = (state.current_data_buffer_index + 1) % state.canvas_instance_data_buffers.size();
572574
state.current_instance_buffer_index = 0;
573575
}
@@ -662,8 +664,6 @@ void RasterizerCanvasGLES3::_render_items(RID p_to_render_target, int p_item_cou
662664

663665
if (index == 0) {
664666
// Nothing to render, just return.
665-
state.current_batch_index = 0;
666-
state.canvas_instance_batches.clear();
667667
return;
668668
}
669669

@@ -807,8 +807,6 @@ void RasterizerCanvasGLES3::_render_items(RID p_to_render_target, int p_item_cou
807807
}
808808

809809
glDisable(GL_SCISSOR_TEST);
810-
state.current_batch_index = 0;
811-
state.canvas_instance_batches.clear();
812810
state.last_item_index += index;
813811
}
814812

servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,9 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p
913913
RenderingServerDefault::redraw_request();
914914
}
915915

916+
texture_info_map.clear();
917+
state.current_batch_index = 0;
918+
state.canvas_instance_batches.clear();
916919
state.current_data_buffer_index = (state.current_data_buffer_index + 1) % BATCH_DATA_BUFFER_COUNT;
917920
state.current_instance_buffer_index = 0;
918921
}
@@ -2286,9 +2289,6 @@ void RendererCanvasRenderRD::_render_batch_items(RenderTarget p_to_render_target
22862289

22872290
RD::get_singleton()->draw_list_end();
22882291

2289-
texture_info_map.clear();
2290-
state.current_batch_index = 0;
2291-
state.canvas_instance_batches.clear();
22922292
state.last_instance_index += instance_index;
22932293
}
22942294

@@ -2975,7 +2975,7 @@ void RendererCanvasRenderRD::_canvas_texture_invalidation_callback(bool p_delete
29752975
KeyValue<RID, TightLocalVector<RID>> *kv = static_cast<KeyValue<RID, TightLocalVector<RID>> *>(p_userdata);
29762976
RD *rd = RD::get_singleton();
29772977
for (RID rid : kv->value) {
2978-
// the invalidation callback will take care of clearing rid_set_to_uniform_set cache also
2978+
// The invalidation callback will also take care of clearing rid_set_to_uniform_set cache.
29792979
rd->free(rid);
29802980
}
29812981
kv->value.clear();
@@ -3008,7 +3008,7 @@ void RendererCanvasRenderRD::_render_batch(RD::DrawListID p_draw_list, CanvasSha
30083008
uniform_set = &iter->data;
30093009
RD::get_singleton()->uniform_set_set_invalidation_callback(rid, RendererCanvasRenderRD::_uniform_set_invalidation_callback, (void *)&iter->key);
30103010

3011-
// If this is a CanvasTexture, it must be tracked so that any changes to the diffuse, normal
3011+
// If this is a CanvasTexture, it must be tracked so that any changes to the diffuse, normal,
30123012
// or specular channels invalidate all associated uniform sets.
30133013
if (ts->owns_canvas_texture(p_batch->tex_info->state.texture)) {
30143014
KeyValue<RID, TightLocalVector<RID>> *kv = nullptr;

0 commit comments

Comments
 (0)