Renderer: Warn when images need to be converted due to their formats being unsupported by hardware

This commit is contained in:
BlueCube3310
2025-03-22 10:55:39 +01:00
parent a210fe6dbd
commit a861394e13
2 changed files with 16 additions and 4 deletions

View File

@@ -396,7 +396,6 @@ static inline Error _get_gl_uncompressed_format(const Ref<Image> &p_image, Image
r_gl_format = GL_RED;
r_gl_type = GL_FLOAT;
} else {
ERR_PRINT("R32 float texture not supported, converting to R16.");
if (p_image.is_valid()) {
p_image->convert(Image::FORMAT_RH);
}
@@ -412,7 +411,6 @@ static inline Error _get_gl_uncompressed_format(const Ref<Image> &p_image, Image
r_gl_format = GL_RG;
r_gl_type = GL_FLOAT;
} else {
ERR_PRINT("RG32 float texture not supported, converting to RG16.");
if (p_image.is_valid()) {
p_image->convert(Image::FORMAT_RGH);
}
@@ -428,7 +426,6 @@ static inline Error _get_gl_uncompressed_format(const Ref<Image> &p_image, Image
r_gl_format = GL_RGB;
r_gl_type = GL_FLOAT;
} else {
ERR_PRINT("RGB32 float texture not supported, converting to RGB16.");
if (p_image.is_valid()) {
p_image->convert(Image::FORMAT_RGBH);
}
@@ -444,7 +441,6 @@ static inline Error _get_gl_uncompressed_format(const Ref<Image> &p_image, Image
r_gl_format = GL_RGBA;
r_gl_type = GL_FLOAT;
} else {
ERR_PRINT("RGBA32 float texture not supported, converting to RGBA16.");
if (p_image.is_valid()) {
p_image->convert(Image::FORMAT_RGBAH);
}
@@ -497,6 +493,11 @@ Ref<Image> TextureStorage::_get_gl_image_and_format(const Ref<Image> &p_image, I
if (!Image::is_format_compressed(p_format)) {
Error err = _get_gl_uncompressed_format(p_image, p_format, r_real_format, r_gl_format, r_gl_internal_format, r_gl_type);
ERR_FAIL_COND_V_MSG(err != OK, Ref<Image>(), vformat("The image format %d is not supported by the Compatibility renderer.", p_format));
if (p_format != r_real_format) {
WARN_PRINT(vformat("Image format %s not supported by hardware, converting to %s.", Image::get_format_name(p_format), Image::get_format_name(r_real_format)));
}
return p_image;
}
@@ -745,6 +746,10 @@ Ref<Image> TextureStorage::_get_gl_image_and_format(const Ref<Image> &p_image, I
r_real_format = image->get_format();
r_compressed = false;
if (p_format != image->get_format()) {
WARN_PRINT(vformat("Image format %s not supported by hardware, converting to %s.", Image::get_format_name(p_format), Image::get_format_name(image->get_format())));
}
}
return image;