mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
Merge pull request #94233 from ChristopheClaustre/screenshot_compat_broken_with_hdr
Fix black `get_texture()` on viewport in compatibility mode with HDR enabled
This commit is contained in:
commit
de27d3a7fc
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user