Skip to content

Commit

Permalink
Hierarchical culling - Add extra check to skeleton_attach_canvas_item
Browse files Browse the repository at this point in the history
Although this check shouldn't be able to fail currently, it provides a small level of extra logic checking at only small cost in DEV builds.
  • Loading branch information
lawnjelly committed Aug 6, 2023
1 parent b776cf5 commit d7cca42
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/gles2/rasterizer_storage_gles2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3780,6 +3780,13 @@ void RasterizerStorageGLES2::skeleton_attach_canvas_item(RID p_skeleton, RID p_c
ERR_FAIL_COND(!p_canvas_item.is_valid());

if (p_attach) {
#ifdef DEV_ENABLED
// skeleton_attach_canvas_item() is not bound,
// and checks in canvas_item_attach_skeleton() should prevent this,
// but there isn't much harm in a DEV_ENABLED check here.
int64_t found = skeleton->linked_canvas_items.find(p_canvas_item);
ERR_FAIL_COND(found != -1);
#endif
skeleton->linked_canvas_items.push_back(p_canvas_item);
} else {
int64_t found = skeleton->linked_canvas_items.find(p_canvas_item);
Expand Down
7 changes: 7 additions & 0 deletions drivers/gles3/rasterizer_storage_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5322,6 +5322,13 @@ void RasterizerStorageGLES3::skeleton_attach_canvas_item(RID p_skeleton, RID p_c
ERR_FAIL_COND(!p_canvas_item.is_valid());

if (p_attach) {
#ifdef DEV_ENABLED
// skeleton_attach_canvas_item() is not bound,
// and checks in canvas_item_attach_skeleton() should prevent this,
// but there isn't much harm in a DEV_ENABLED check here.
int64_t found = skeleton->linked_canvas_items.find(p_canvas_item);
ERR_FAIL_COND(found != -1);
#endif
skeleton->linked_canvas_items.push_back(p_canvas_item);
} else {
int64_t found = skeleton->linked_canvas_items.find(p_canvas_item);
Expand Down

0 comments on commit d7cca42

Please sign in to comment.