瀏覽代碼

Merge pull request #51555 from mortarroad/3.x-fix-mipmap-loading

[3.x] Fix loading mipmaps, if the mipmap levels have different formats.
Rémi Verschelde 4 年之前
父節點
當前提交
07c70efcbb
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      scene/resources/texture.cpp

+ 4 - 0
scene/resources/texture.cpp

@@ -566,6 +566,10 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &tw_
 				ERR_FAIL_COND_V(img.is_null() || img->empty(), ERR_FILE_CORRUPT);
 			}
 
+			if (i != 0) {
+				img->convert(mipmap_images[0]->get_format()); // ensure the same format for all mipmaps
+			}
+
 			total_size += img->get_data().size();
 
 			mipmap_images.push_back(img);