Merge pull request #104480 from BlueCube3310/image-unsuported-format
Renderer: Warn when images need to be converted due to their formats being unsupported by hardware
This commit is contained in:
@@ -1782,6 +1782,7 @@ uint64_t TextureStorage::texture_get_native_handle(RID p_texture, bool p_srgb) c
|
||||
}
|
||||
|
||||
Ref<Image> TextureStorage::_validate_texture_format(const Ref<Image> &p_image, TextureToRDFormat &r_format) {
|
||||
Image::Format original_format = p_image->get_format();
|
||||
Ref<Image> image = p_image->duplicate();
|
||||
|
||||
switch (p_image->get_format()) {
|
||||
@@ -2270,6 +2271,12 @@ Ref<Image> TextureStorage::_validate_texture_format(const Ref<Image> &p_image, T
|
||||
}
|
||||
}
|
||||
|
||||
// RGB formats are often not supported, only print warnings about them when launched with the --verbose flag.
|
||||
const bool is_rgb_format = original_format == Image::FORMAT_RGB8 || original_format == Image::FORMAT_RGBH || original_format == Image::FORMAT_RGBF;
|
||||
if ((is_print_verbose_enabled() || !is_rgb_format) && original_format != image->get_format()) {
|
||||
WARN_PRINT(vformat("Image format %s not supported by hardware, converting to %s.", Image::get_format_name(original_format), Image::get_format_name(image->get_format())));
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user