&p_colors, float p_width, bool p_antialiased) {
@@ -609,6 +1055,7 @@ void RenderingServerCanvas::canvas_item_add_multiline(RID p_item, const Vectorrect_dirty = true;
canvas_item->commands.push_back(pline);
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_add_rect(RID p_item, const Rect2 &p_rect, const Color &p_color) {
@@ -622,6 +1069,7 @@ void RenderingServerCanvas::canvas_item_add_rect(RID p_item, const Rect2 &p_rect
canvas_item->rect_dirty = true;
canvas_item->commands.push_back(rect);
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color) {
@@ -635,6 +1083,7 @@ void RenderingServerCanvas::canvas_item_add_circle(RID p_item, const Point2 &p_p
circle->radius = p_radius;
canvas_item->commands.push_back(circle);
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile, const Color &p_modulate, bool p_transpose, RID p_normal_map) {
@@ -668,6 +1117,7 @@ void RenderingServerCanvas::canvas_item_add_texture_rect(RID p_item, const Rect2
rect->normal_map = p_normal_map;
canvas_item->rect_dirty = true;
canvas_item->commands.push_back(rect);
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_add_texture_multirect_region(RID p_item, const Vector &p_rects, RID p_texture, const Vector &p_src_rects, const Color &p_modulate, uint32_t p_canvas_rect_flags, RID p_normal_map) {
@@ -738,6 +1188,7 @@ void RenderingServerCanvas::canvas_item_add_texture_rect_region(RID p_item, cons
canvas_item->rect_dirty = true;
canvas_item->commands.push_back(rect);
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, RS::NinePatchAxisMode p_x_axis_mode, RS::NinePatchAxisMode p_y_axis_mode, bool p_draw_center, const Color &p_modulate, RID p_normal_map) {
@@ -761,6 +1212,7 @@ void RenderingServerCanvas::canvas_item_add_nine_patch(RID p_item, const Rect2 &
canvas_item->rect_dirty = true;
canvas_item->commands.push_back(style);
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_add_primitive(RID p_item, const Vector &p_points, const Vector &p_colors, const Vector &p_uvs, RID p_texture, float p_width, RID p_normal_map) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
@@ -777,6 +1229,7 @@ void RenderingServerCanvas::canvas_item_add_primitive(RID p_item, const Vectorrect_dirty = true;
canvas_item->commands.push_back(prim);
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_add_polygon(RID p_item, const Vector &p_points, const Vector &p_colors, const Vector &p_uvs, RID p_texture, RID p_normal_map, bool p_antialiased) {
@@ -807,6 +1260,7 @@ void RenderingServerCanvas::canvas_item_add_polygon(RID p_item, const Vectorrect_dirty = true;
canvas_item->commands.push_back(polygon);
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector &p_indices, const Vector &p_points, const Vector &p_colors, const Vector &p_uvs, const Vector &p_bones, const Vector &p_weights, RID p_texture, int p_count, RID p_normal_map, bool p_antialiased, bool p_antialiasing_use_indices) {
@@ -852,6 +1306,7 @@ void RenderingServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vec
canvas_item->rect_dirty = true;
canvas_item->commands.push_back(polygon);
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_add_set_transform(RID p_item, const Transform2D &p_transform) {
@@ -863,6 +1318,7 @@ void RenderingServerCanvas::canvas_item_add_set_transform(RID p_item, const Tran
tr->xform = p_transform;
canvas_item->commands.push_back(tr);
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_add_mesh(RID p_item, const RID &p_mesh, const Transform2D &p_transform, const Color &p_modulate, RID p_texture, RID p_normal_map) {
@@ -878,6 +1334,7 @@ void RenderingServerCanvas::canvas_item_add_mesh(RID p_item, const RID &p_mesh,
m->modulate = p_modulate;
canvas_item->commands.push_back(m);
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture, RID p_normal_map) {
@@ -892,6 +1349,7 @@ void RenderingServerCanvas::canvas_item_add_multimesh(RID p_item, RID p_mesh, RI
canvas_item->rect_dirty = true;
canvas_item->commands.push_back(mm);
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_add_clip_ignore(RID p_item, bool p_ignore) {
@@ -903,6 +1361,7 @@ void RenderingServerCanvas::canvas_item_add_clip_ignore(RID p_item, bool p_ignor
ci->ignore = p_ignore;
canvas_item->commands.push_back(ci);
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_set_sort_children_by_y(RID p_item, bool p_enable) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
@@ -911,6 +1370,7 @@ void RenderingServerCanvas::canvas_item_set_sort_children_by_y(RID p_item, bool
canvas_item->sort_y = p_enable;
_mark_ysort_dirty(canvas_item, canvas_item_owner);
+ _check_bound_integrity(canvas_item);
}
void RenderingServerCanvas::canvas_item_set_z_index(RID p_item, int p_z) {
ERR_FAIL_COND(p_z < RS::CANVAS_ITEM_Z_MIN || p_z > RS::CANVAS_ITEM_Z_MAX);
@@ -919,12 +1379,14 @@ void RenderingServerCanvas::canvas_item_set_z_index(RID p_item, int p_z) {
ERR_FAIL_COND(!canvas_item);
canvas_item->z_index = p_z;
+ _check_bound_integrity(canvas_item);
}
void RenderingServerCanvas::canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->z_relative = p_enable;
+ _check_bound_integrity(canvas_item);
}
Rect2 RenderingServerCanvas::_debug_canvas_item_get_rect(RID p_item) {
@@ -963,7 +1425,34 @@ void RenderingServerCanvas::canvas_item_attach_skeleton(RID p_item, RID p_skelet
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
- canvas_item->skeleton = p_skeleton;
+ if (_canvas_cull_mode == CANVAS_CULL_MODE_NODE) {
+ // No op?
+ if (canvas_item->skeleton == p_skeleton) {
+ return;
+ }
+
+ // Detach from any previous skeleton.
+ if (canvas_item->skeleton.is_valid()) {
+ RSG::storage->skeleton_attach_canvas_item(canvas_item->skeleton, p_item, false);
+ }
+
+ canvas_item->skeleton = p_skeleton;
+
+ // Attach to new skeleton.
+ if (p_skeleton.is_valid()) {
+ RSG::storage->skeleton_attach_canvas_item(p_skeleton, p_item, true);
+ }
+
+ _make_bound_dirty(canvas_item);
+ } else {
+ canvas_item->skeleton = p_skeleton;
+ }
+}
+
+void RenderingServerCanvas::_canvas_item_skeleton_moved(RID p_item) {
+ Item *canvas_item = canvas_item_owner.getornull(p_item);
+ ERR_FAIL_COND(!canvas_item);
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable, const Rect2 &p_rect) {
@@ -982,12 +1471,14 @@ void RenderingServerCanvas::canvas_item_set_copy_to_backbuffer(RID p_item, bool
canvas_item->copy_back_buffer->rect = p_rect;
canvas_item->copy_back_buffer->full = p_rect == Rect2();
}
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_clear(RID p_item) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
+ _make_bound_dirty(canvas_item);
canvas_item->clear();
}
void RenderingServerCanvas::canvas_item_set_draw_index(RID p_item, int p_index) {
@@ -1007,6 +1498,8 @@ void RenderingServerCanvas::canvas_item_set_draw_index(RID p_item, int p_index)
canvas->children_order_dirty = true;
return;
}
+
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_set_material(RID p_item, RID p_material) {
@@ -1014,6 +1507,7 @@ void RenderingServerCanvas::canvas_item_set_material(RID p_item, RID p_material)
ERR_FAIL_COND(!canvas_item);
canvas_item->material = p_material;
+ _make_bound_dirty(canvas_item);
}
void RenderingServerCanvas::canvas_item_set_use_parent_material(RID p_item, bool p_enable) {
@@ -1021,6 +1515,7 @@ void RenderingServerCanvas::canvas_item_set_use_parent_material(RID p_item, bool
ERR_FAIL_COND(!canvas_item);
canvas_item->use_parent_material = p_enable;
+ _make_bound_dirty(canvas_item);
}
RID RenderingServerCanvas::canvas_light_create() {
@@ -1362,6 +1857,7 @@ bool RenderingServerCanvas::free(RID p_rid) {
} else if (canvas_item_owner.owns(p_rid)) {
Item *canvas_item = canvas_item_owner.get(p_rid);
ERR_FAIL_COND_V(!canvas_item, true);
+ _make_bound_dirty(canvas_item);
if (canvas_item->parent.is_valid()) {
if (canvas_owner.owns(canvas_item->parent)) {
@@ -1374,6 +1870,7 @@ bool RenderingServerCanvas::free(RID p_rid) {
if (item_owner->sort_y) {
_mark_ysort_dirty(item_owner, canvas_item_owner);
}
+ _check_bound_integrity(item_owner);
}
}
@@ -1449,11 +1946,122 @@ bool RenderingServerCanvas::free(RID p_rid) {
return true;
}
+#ifdef RENDERING_SERVER_CANVAS_CHECK_BOUNDS
+// Debugging function to check that the bound dirty flags in the tree make sense.
+// Any item that has is dirty, all parents should be dirty up to the root
+// (except in hidden branches, which are not kept track of for performance reasons).
+bool RenderingServerCanvas::_check_bound_integrity(const Item *p_item) {
+ while (p_item) {
+ if (canvas_item_owner.owns(p_item->parent)) {
+ p_item = canvas_item_owner.get(p_item->parent);
+ } else {
+ return _check_bound_integrity_down(p_item, p_item->bound_dirty);
+ }
+ }
+
+ return true;
+}
+
+bool RenderingServerCanvas::_check_bound_integrity_down(const Item *p_item, bool p_bound_dirty) {
+ // don't care about integrity into invisible branches
+ if (!p_item->visible) {
+ return true;
+ }
+
+ if (p_item->bound_dirty) {
+ if (!p_bound_dirty) {
+ _print_tree(p_item);
+ ERR_PRINT("bound integrity check failed");
+ return false;
+ }
+ }
+
+ // go through children
+ int child_item_count = p_item->child_items.size();
+ Item *const *child_items = p_item->child_items.ptr();
+
+ for (int n = 0; n < child_item_count; n++) {
+ if (!_check_bound_integrity_down(child_items[n], p_bound_dirty)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+void RenderingServerCanvas::_print_tree(const Item *p_item) {
+ const Item *highlight = p_item;
+
+ while (p_item) {
+ if (canvas_item_owner.owns(p_item->parent)) {
+ p_item = canvas_item_owner.get(p_item->parent);
+ } else {
+ _print_tree_down(0, 0, p_item, highlight);
+ return;
+ }
+ }
+}
+
+void RenderingServerCanvas::_print_tree_down(int p_child_id, int p_depth, const Item *p_item, const Item *p_highlight, bool p_hidden) {
+ String sz;
+ for (int n = 0; n < p_depth; n++) {
+ sz += "\t";
+ }
+ if (p_item == p_highlight) {
+ sz += "* ";
+ }
+ sz += itos(p_child_id) + " ";
+#ifdef RENDERING_SERVER_CANVAS_DEBUG_ITEM_NAMES
+ sz += p_item->name + "\t";
+#endif
+ sz += String(Variant(p_item->global_rect_cache)) + " ";
+
+ if (!p_item->visible) {
+ sz += "(H) ";
+ p_hidden = true;
+ } else if (p_hidden) {
+ sz += "(HI) ";
+ }
+
+ if (p_item->bound_dirty) {
+ sz += "(dirty) ";
+ }
+
+ if (p_item->parent == RID()) {
+ sz += "(parent NULL) ";
+ }
+
+ print_line(sz);
+
+ // go through children
+ int child_item_count = p_item->child_items.size();
+ Item *const *child_items = p_item->child_items.ptr();
+
+ for (int n = 0; n < child_item_count; n++) {
+ _print_tree_down(n, p_depth + 1, child_items[n], p_highlight, p_hidden);
+ }
+}
+
+#endif
+
RenderingServerCanvas::RenderingServerCanvas() {
+ _canvas_cull_mode = CANVAS_CULL_MODE_NODE;
+
z_list = (RasterizerCanvas::Item **)memalloc(z_range * sizeof(RasterizerCanvas::Item *));
z_last_list = (RasterizerCanvas::Item **)memalloc(z_range * sizeof(RasterizerCanvas::Item *));
disable_scale = false;
+
+ int mode = GLOBAL_DEF("rendering/2d/options/culling_mode", 1);
+ ProjectSettings::get_singleton()->set_custom_property_info("rendering/2d/options/culling_mode", PropertyInfo(Variant::INT, "rendering/2d/options/culling_mode", PROPERTY_HINT_ENUM, "Item,Node"));
+
+ switch (mode) {
+ default: {
+ _canvas_cull_mode = CANVAS_CULL_MODE_NODE;
+ } break;
+ case 0: {
+ _canvas_cull_mode = CANVAS_CULL_MODE_ITEM;
+ } break;
+ }
}
RenderingServerCanvas::~RenderingServerCanvas() {
diff --git a/servers/rendering/rendering_server_canvas.h b/servers/rendering/rendering_server_canvas.h
index f23c6af60..29fa414ba 100644
--- a/servers/rendering/rendering_server_canvas.h
+++ b/servers/rendering/rendering_server_canvas.h
@@ -1,5 +1,6 @@
#ifndef RENDERINGSERVERCANVAS_H
#define RENDERINGSERVERCANVAS_H
+
/*************************************************************************/
/* rendering_server_canvas.h */
/*************************************************************************/
@@ -31,6 +32,7 @@
/*************************************************************************/
#include "rasterizer.h"
+#include "rendering_server_constants.h"
#include "rendering_server_viewport.h"
class RenderingServerCanvas {
@@ -51,6 +53,9 @@ public:
Transform2D ysort_xform;
Vector2 ysort_pos;
int ysort_index;
+#ifdef RENDERING_SERVER_CANVAS_DEBUG_ITEM_NAMES
+ String name;
+#endif
Vector- child_items;
@@ -153,13 +158,50 @@ public:
bool disable_scale;
private:
+ enum CanvasCullMode {
+ CANVAS_CULL_MODE_ITEM,
+ CANVAS_CULL_MODE_NODE,
+ };
+ CanvasCullMode _canvas_cull_mode;
+
void _render_canvas_item_tree(Item *p_canvas_item, const Transform2D &p_transform, const Rect2 &p_clip_rect, const Color &p_modulate, RasterizerCanvas::Light *p_lights);
- void _render_canvas_item(Item *p_canvas_item, const Transform2D &p_transform, const Rect2 &p_clip_rect, const Color &p_modulate, int p_z, RasterizerCanvas::Item **z_list, RasterizerCanvas::Item **z_last_list, Item *p_canvas_clip, Item *p_material_owner);
+
void _light_mask_canvas_items(int p_z, RasterizerCanvas::Item *p_canvas_item, RasterizerCanvas::Light *p_masked_lights, int p_canvas_layer_id);
RasterizerCanvas::Item **z_list;
RasterizerCanvas::Item **z_last_list;
+ // 3.5 and earlier had no hierarchical culling.
+ void _render_canvas_item_cull_by_item(Item *p_canvas_item, const Transform2D &p_transform, const Rect2 &p_clip_rect, const Color &p_modulate, int p_z, RasterizerCanvas::Item **z_list, RasterizerCanvas::Item **z_last_list, Item *p_canvas_clip, Item *p_material_owner);
+
+ // Hierarchical culling by scene tree node ///////////////////////////////////
+ void _render_canvas_item_cull_by_node(Item *p_canvas_item, const Transform2D &p_transform, const Rect2 &p_clip_rect, const Color &p_modulate, int p_z, RasterizerCanvas::Item **z_list, RasterizerCanvas::Item **z_last_list, Item *p_canvas_clip, Item *p_material_owner, bool p_enclosed);
+
+ void _prepare_tree_bounds(Item *p_root);
+ void _calculate_canvas_item_bound(Item *p_canvas_item, Rect2 *r_branch_bound);
+
+ void _finalize_and_merge_local_bound_to_branch(Item *p_canvas_item, Rect2 *r_branch_bound);
+ void _merge_local_bound_to_branch(Item *p_canvas_item, Rect2 *r_branch_bound);
+
+ // If bounds flags are attempted to be modified multithreaded, the
+ // tree could become corrupt. Multithread access may not be possible,
+ // but just in case we use a mutex until proven otherwise.
+ Mutex _bound_mutex;
+
+ void _make_bound_dirty_reparent(Item *p_item);
+ void _make_bound_dirty(Item *p_item, bool p_changing_visibility = false);
+ void _make_bound_dirty_down(Item *p_item);
+
+#ifdef RENDERING_SERVER_CANVAS_CHECK_BOUNDS
+ bool _check_bound_integrity(const Item *p_item);
+ bool _check_bound_integrity_down(const Item *p_item, bool p_bound_dirty);
+ void _print_tree(const Item *p_item);
+ void _print_tree_down(int p_child_id, int p_depth, const Item *p_item, const Item *p_highlight, bool p_hidden = false);
+#else
+ bool _check_bound_integrity(const Item *p_item) { return true; }
+#endif
+ //////////////////////////////////////////////////////////////////////////////
+
public:
void render_canvas(Canvas *p_canvas, const Transform2D &p_transform, RasterizerCanvas::Light *p_lights, RasterizerCanvas::Light *p_masked_lights, const Rect2 &p_clip_rect, int p_canvas_layer_id);
@@ -171,6 +213,7 @@ public:
RID canvas_item_create();
void canvas_item_set_parent(RID p_item, RID p_parent);
+ void canvas_item_set_name(RID p_item, String p_name);
void canvas_item_set_visible(RID p_item, bool p_visible);
void canvas_item_set_light_mask(RID p_item, int p_mask);
@@ -206,17 +249,17 @@ public:
void canvas_item_set_z_index(RID p_item, int p_z);
void canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable);
void canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable, const Rect2 &p_rect);
- void canvas_item_attach_skeleton(RID p_item, RID p_skeleton);
- void canvas_item_set_skeleton_relative_xform(RID p_item, Transform2D p_relative_xform);
- Rect2 _debug_canvas_item_get_rect(RID p_item);
void canvas_item_clear(RID p_item);
void canvas_item_set_draw_index(RID p_item, int p_index);
-
void canvas_item_set_material(RID p_item, RID p_material);
-
void canvas_item_set_use_parent_material(RID p_item, bool p_enable);
+ void canvas_item_attach_skeleton(RID p_item, RID p_skeleton);
+ void canvas_item_set_skeleton_relative_xform(RID p_item, Transform2D p_relative_xform);
+ Rect2 _debug_canvas_item_get_rect(RID p_item);
+ void _canvas_item_skeleton_moved(RID p_item);
+
RID canvas_light_create();
void canvas_light_attach_to_canvas(RID p_light, RID p_canvas);
void canvas_light_set_enabled(RID p_light, bool p_enabled);
diff --git a/servers/rendering/rendering_server_constants.h b/servers/rendering/rendering_server_constants.h
new file mode 100644
index 000000000..2c5831e81
--- /dev/null
+++ b/servers/rendering/rendering_server_constants.h
@@ -0,0 +1,59 @@
+
+#ifndef RENDERING_SERVER_CONSTANTS_H
+#define RENDERING_SERVER_CONSTANTS_H
+
+/**************************************************************************/
+/* rendering_server_constants.h */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/**************************************************************************/
+
+// Use for constants etc that need not be included as often as VisualServer.h
+// to reduce dependencies and prevent slow compilation.
+
+// This is a "cheap" include, and can be used from scene side code as well as servers.
+
+// Uncomment to provide comparison of node culling versus item culling
+// #define RENDERING_SERVER_CANVAS_TIME_NODE_CULLING
+
+// N.B. ONLY allow these defined in DEV_ENABLED builds, they will slow
+// performance, and are only necessary to use for debugging.
+#ifdef DEV_ENABLED
+
+// Uncomment this define to store canvas item names in VisualServerCanvas.
+// This is relatively expensive, but is invaluable for debugging the canvas scene tree
+// especially using _print_tree() in VisualServerCanvas.
+// #define RENDERING_SERVER_CANVAS_DEBUG_ITEM_NAMES
+
+// Uncomment this define to verify local bounds of canvas items,
+// to check that the hierarchical culling is working correctly.
+// This is expensive.
+// #define RENDERING_SERVER_CANVAS_CHECK_BOUNDS
+
+#endif // DEV_ENABLED
+
+#endif // RENDERING_SERVER_CONSTANTS_H
\ No newline at end of file
diff --git a/servers/rendering/rendering_server_raster.h b/servers/rendering/rendering_server_raster.h
index 6e80a282d..d6fa079b4 100644
--- a/servers/rendering/rendering_server_raster.h
+++ b/servers/rendering/rendering_server_raster.h
@@ -572,6 +572,7 @@ public:
BIND0R(RID, canvas_item_create)
BIND2(canvas_item_set_parent, RID, RID)
+ BIND2(canvas_item_set_name, RID, String)
BIND2(canvas_item_set_visible, RID, bool)
BIND2(canvas_item_set_light_mask, RID, int)
diff --git a/servers/rendering/rendering_server_wrap_mt.h b/servers/rendering/rendering_server_wrap_mt.h
index 42245719a..7fbf46e9f 100644
--- a/servers/rendering/rendering_server_wrap_mt.h
+++ b/servers/rendering/rendering_server_wrap_mt.h
@@ -485,6 +485,7 @@ public:
FUNCRID(canvas_item)
FUNC2(canvas_item_set_parent, RID, RID)
+ FUNC2(canvas_item_set_name, RID, String)
FUNC2(canvas_item_set_visible, RID, bool)
FUNC2(canvas_item_set_light_mask, RID, int)
diff --git a/servers/rendering_server.h b/servers/rendering_server.h
index ed4013442..0c6d62363 100644
--- a/servers/rendering_server.h
+++ b/servers/rendering_server.h
@@ -895,6 +895,7 @@ public:
virtual RID canvas_item_create() = 0;
virtual void canvas_item_set_parent(RID p_item, RID p_parent) = 0;
+ virtual void canvas_item_set_name(RID p_item, String p_name) = 0;
virtual void canvas_item_set_visible(RID p_item, bool p_visible) = 0;
virtual void canvas_item_set_light_mask(RID p_item, int p_mask) = 0;