From 3e5865660b7f2cf00f1afe6ec27377ad38dbdf9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Fri, 31 May 2024 12:00:00 +0200 Subject: [PATCH] RenderingDevice: Reject creation of textures with no usage --- servers/rendering/rendering_device.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/servers/rendering/rendering_device.cpp b/servers/rendering/rendering_device.cpp index 0227472d0e6..3636308f6d6 100644 --- a/servers/rendering/rendering_device.cpp +++ b/servers/rendering/rendering_device.cpp @@ -702,6 +702,8 @@ RID RenderingDevice::texture_create(const TextureFormat &p_format, const Texture ERR_FAIL_INDEX_V(format.samples, TEXTURE_SAMPLES_MAX, RID()); + ERR_FAIL_COND_V_MSG(format.usage_bits == 0, RID(), "No usage bits specified (at least one is needed)"); + format.height = format.texture_type != TEXTURE_TYPE_1D && format.texture_type != TEXTURE_TYPE_1D_ARRAY ? format.height : 1; format.depth = format.texture_type == TEXTURE_TYPE_3D ? format.depth : 1;