summaryrefslogtreecommitdiff
path: root/drivers/gles3/rasterizer_canvas_gles3.cpp
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 /drivers/gles3/rasterizer_canvas_gles3.cpp
parent551f5191e5dbc1d1a43f99b13d5dbbf7f598dc58 (diff)
Avoid crash when CanvasTexture used with light decal atlas
The decal atlas is used for Light2Ds, decals, and Light3Ds
Diffstat (limited to 'drivers/gles3/rasterizer_canvas_gles3.cpp')
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index c65c396591..7f381b3f3e 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -1499,6 +1499,9 @@ void RasterizerCanvasGLES3::light_set_texture(RID p_rid, RID p_texture) {
if (cl->texture == p_texture) {
return;
}
+
+ ERR_FAIL_COND(p_texture.is_valid() && !texture_storage->owns_texture(p_texture));
+
if (cl->texture.is_valid()) {
texture_storage->texture_remove_from_texture_atlas(cl->texture);
}