mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
GLES2: Convert unsupported float texture types to 8-bit types
This commit is contained in:
parent
6d86450a83
commit
ac483345c4
1 changed files with 47 additions and 28 deletions
|
@ -120,9 +120,13 @@ Ref<Image> RasterizerStorageGLES2::_get_gl_image_and_format(const Ref<Image> &p_
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Image::FORMAT_RG8: {
|
case Image::FORMAT_RG8: {
|
||||||
|
ERR_PRINT("RG texture not supported, converting to RGB8.");
|
||||||
ERR_EXPLAIN("RG texture not supported");
|
if (image.is_valid())
|
||||||
ERR_FAIL_V(image);
|
image->convert(Image::FORMAT_RGB8);
|
||||||
|
r_real_format = Image::FORMAT_RGB8;
|
||||||
|
r_gl_internal_format = GL_RGB;
|
||||||
|
r_gl_format = GL_RGB;
|
||||||
|
r_gl_type = GL_UNSIGNED_BYTE;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case Image::FORMAT_RGB8: {
|
case Image::FORMAT_RGB8: {
|
||||||
|
@ -155,42 +159,57 @@ Ref<Image> RasterizerStorageGLES2::_get_gl_image_and_format(const Ref<Image> &p_
|
||||||
} break;
|
} break;
|
||||||
case Image::FORMAT_RF: {
|
case Image::FORMAT_RF: {
|
||||||
if (!config.float_texture_supported) {
|
if (!config.float_texture_supported) {
|
||||||
ERR_EXPLAIN("R float texture not supported");
|
ERR_PRINT("R float texture not supported, converting to RGB8.");
|
||||||
ERR_FAIL_V(image);
|
if (image.is_valid())
|
||||||
}
|
image->convert(Image::FORMAT_RGB8);
|
||||||
|
r_real_format = Image::FORMAT_RGB8;
|
||||||
|
r_gl_internal_format = GL_RGB;
|
||||||
|
r_gl_format = GL_RGB;
|
||||||
|
r_gl_type = GL_UNSIGNED_BYTE;
|
||||||
|
} else {
|
||||||
r_gl_internal_format = GL_ALPHA;
|
r_gl_internal_format = GL_ALPHA;
|
||||||
r_gl_format = GL_ALPHA;
|
r_gl_format = GL_ALPHA;
|
||||||
r_gl_type = GL_FLOAT;
|
r_gl_type = GL_FLOAT;
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
case Image::FORMAT_RGF: {
|
case Image::FORMAT_RGF: {
|
||||||
ERR_EXPLAIN("RG float texture not supported");
|
ERR_PRINT("RG float texture not supported, converting to RGB8.");
|
||||||
ERR_FAIL_V(image);
|
if (image.is_valid())
|
||||||
|
image->convert(Image::FORMAT_RGB8);
|
||||||
|
r_real_format = Image::FORMAT_RGB8;
|
||||||
|
r_gl_internal_format = GL_RGB;
|
||||||
|
r_gl_format = GL_RGB;
|
||||||
|
r_gl_type = GL_UNSIGNED_BYTE;
|
||||||
} break;
|
} break;
|
||||||
case Image::FORMAT_RGBF: {
|
case Image::FORMAT_RGBF: {
|
||||||
if (!config.float_texture_supported) {
|
if (!config.float_texture_supported) {
|
||||||
|
ERR_PRINT("RGB float texture not supported, converting to RGB8.");
|
||||||
ERR_EXPLAIN("RGB float texture not supported");
|
if (image.is_valid())
|
||||||
ERR_FAIL_V(image);
|
image->convert(Image::FORMAT_RGB8);
|
||||||
}
|
r_real_format = Image::FORMAT_RGB8;
|
||||||
|
r_gl_internal_format = GL_RGB;
|
||||||
|
r_gl_format = GL_RGB;
|
||||||
|
r_gl_type = GL_UNSIGNED_BYTE;
|
||||||
|
} else {
|
||||||
r_gl_internal_format = GL_RGB;
|
r_gl_internal_format = GL_RGB;
|
||||||
r_gl_format = GL_RGB;
|
r_gl_format = GL_RGB;
|
||||||
r_gl_type = GL_FLOAT;
|
r_gl_type = GL_FLOAT;
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
case Image::FORMAT_RGBAF: {
|
case Image::FORMAT_RGBAF: {
|
||||||
if (!config.float_texture_supported) {
|
if (!config.float_texture_supported) {
|
||||||
|
ERR_PRINT("RGBA float texture not supported, converting to RGBA8.");
|
||||||
ERR_EXPLAIN("RGBA float texture not supported");
|
if (image.is_valid())
|
||||||
ERR_FAIL_V(image);
|
image->convert(Image::FORMAT_RGBA8);
|
||||||
}
|
r_real_format = Image::FORMAT_RGBA8;
|
||||||
|
r_gl_internal_format = GL_RGBA;
|
||||||
|
r_gl_format = GL_RGBA;
|
||||||
|
r_gl_type = GL_UNSIGNED_BYTE;
|
||||||
|
} else {
|
||||||
r_gl_internal_format = GL_RGBA;
|
r_gl_internal_format = GL_RGBA;
|
||||||
r_gl_format = GL_RGBA;
|
r_gl_format = GL_RGBA;
|
||||||
r_gl_type = GL_FLOAT;
|
r_gl_type = GL_FLOAT;
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
case Image::FORMAT_RH: {
|
case Image::FORMAT_RH: {
|
||||||
need_decompress = true;
|
need_decompress = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue