@@ -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