1
0
Fork 0

GLES3: Fix errors baking light map with compatibility renderer

Helps #102696
This commit is contained in:
Stuart Carnie 2025-02-13 05:43:13 +11:00
parent f418603522
commit d3aed427a5
1 changed files with 19 additions and 16 deletions

View File

@ -1052,6 +1052,7 @@ Ref<Image> RasterizerSceneGLES3::sky_bake_panorama(RID p_sky, float p_energy, bo
glDeleteFramebuffers(1, &rad_fbo);
// Create a dummy texture so we can use texture_2d_get.
RID tex_rid = GLES3::TextureStorage::get_singleton()->texture_allocate();
{
GLES3::Texture texture;
texture.width = p_size.width;
texture.height = p_size.height;
@ -1065,13 +1066,15 @@ Ref<Image> RasterizerSceneGLES3::sky_bake_panorama(RID p_sky, float p_energy, bo
texture.target = GL_TEXTURE_2D;
texture.active = true;
texture.tex_id = rad_tex;
texture.is_render_target = true;
texture.is_render_target = true; // HACK: Prevent TextureStorage from retaining a cached copy of the texture.
GLES3::TextureStorage::get_singleton()->texture_2d_initialize_from_texture(tex_rid, texture);
}
Ref<Image> img = GLES3::TextureStorage::get_singleton()->texture_2d_get(tex_rid);
GLES3::Utilities::get_singleton()->texture_free_data(rad_tex);
texture.is_render_target = false;
GLES3::Texture &texture = *GLES3::TextureStorage::get_singleton()->get_texture(tex_rid);
texture.is_render_target = false; // HACK: Avoid an error when freeing the texture.
texture.tex_id = 0;
GLES3::TextureStorage::get_singleton()->texture_free(tex_rid);