summaryrefslogtreecommitdiffstats
path: root/drivers/gles3
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-07-18 10:45:30 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-07-18 10:45:30 +0200
commitde27d3a7fc13b37004e4e37c4b3a3db080c5a759 (patch)
tree1f8f04041c2d03a0e3747c6f55226329d686a2d4 /drivers/gles3
parent0f1e2c38a80b88a2f4a26d90add36fd2a6bcbd23 (diff)
parent626106da006dcc9d10a590504ed31ad69505ccc5 (diff)
downloadredot-engine-de27d3a7fc13b37004e4e37c4b3a3db080c5a759.tar.gz
Merge pull request #94233 from ChristopheClaustre/screenshot_compat_broken_with_hdr
Fix black `get_texture()` on viewport in compatibility mode with HDR enabled
Diffstat (limited to 'drivers/gles3')
-rw-r--r--drivers/gles3/storage/texture_storage.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp
index 2dcf623995..9138045653 100644
--- a/drivers/gles3/storage/texture_storage.cpp
+++ b/drivers/gles3/storage/texture_storage.cpp
@@ -1030,10 +1030,8 @@ Ref<Image> TextureStorage::texture_2d_get(RID p_texture) const {
if (texture->compressed) {
glPixelStorei(GL_PACK_ALIGNMENT, 4);
glGetCompressedTexImage(texture->target, i, &w[ofs]);
-
} else {
glPixelStorei(GL_PACK_ALIGNMENT, 1);
-
glGetTexImage(texture->target, i, texture->gl_format_cache, texture->gl_type_cache, &w[ofs]);
}
}
@@ -2123,7 +2121,7 @@ void TextureStorage::_update_render_target(RenderTarget *rt) {
texture->layers = 1;
}
texture->gl_format_cache = rt->color_format;
- texture->gl_type_cache = GL_UNSIGNED_BYTE;
+ texture->gl_type_cache = !rt->hdr ? GL_UNSIGNED_BYTE : GL_FLOAT; // to set HDR format size to 8 and keep 4 for LDR format
texture->gl_internal_format_cache = rt->color_internal_format;
texture->tex_id = rt->color;
texture->width = rt->size.x;