summaryrefslogtreecommitdiff
path: root/servers/rendering/renderer_rd/storage_rd
diff options
context:
space:
mode:
authorclayjohn <claynjohn@gmail.com>2023-01-30 20:59:53 -0800
committerclayjohn <claynjohn@gmail.com>2023-01-30 20:59:53 -0800
commitcfd5fe0f29fcc06df81bfe764b072b8463aac969 (patch)
treef753a9c839d0b2020afb6b56b33f62909dd91b78 /servers/rendering/renderer_rd/storage_rd
parent551f5191e5dbc1d1a43f99b13d5dbbf7f598dc58 (diff)
Avoid crash when CanvasTexture used with light decal atlas
The decal atlas is used for Light2Ds, decals, and Light3Ds
Diffstat (limited to 'servers/rendering/renderer_rd/storage_rd')
-rw-r--r--servers/rendering/renderer_rd/storage_rd/light_storage.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/servers/rendering/renderer_rd/storage_rd/light_storage.cpp b/servers/rendering/renderer_rd/storage_rd/light_storage.cpp
index cdecb3828b..ff859a668a 100644
--- a/servers/rendering/renderer_rd/storage_rd/light_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/light_storage.cpp
@@ -232,6 +232,8 @@ void LightStorage::light_set_projector(RID p_light, RID p_texture) {
return;
}
+ ERR_FAIL_COND(p_texture.is_valid() && !texture_storage->owns_texture(p_texture));
+
if (light->type != RS::LIGHT_DIRECTIONAL && light->projector.is_valid()) {
texture_storage->texture_remove_from_decal_atlas(light->projector, light->type == RS::LIGHT_OMNI);
}