Explorar o código

Issue 56488 fail when image and texture size are different

(cherry picked from commit 5e57b850b6664d5c0c7bf057bb8013e23830ae5b)
Paweł Fertyk %!s(int64=3) %!d(string=hai) anos
pai
achega
e0f95f1f63
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      scene/resources/texture.cpp

+ 3 - 0
scene/resources/texture.cpp

@@ -2353,6 +2353,9 @@ void TextureLayered::create(uint32_t p_width, uint32_t p_height, uint32_t p_dept
 void TextureLayered::set_layer_data(const Ref<Image> &p_image, int p_layer) {
 	ERR_FAIL_COND(!texture.is_valid());
 	ERR_FAIL_COND(!p_image.is_valid());
+	ERR_FAIL_COND_MSG(
+			p_image->get_width() > width || p_image->get_height() > height,
+			vformat("Image size(%dx%d) is bigger than texture size (%dx%d).", p_image->get_width(), p_image->get_height(), width, height));
 	VS::get_singleton()->texture_set_data(texture, p_image, p_layer);
 }