You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
GLES3: Fix errors baking light map with compatibility renderer
Helps #102696
This commit is contained in:
@@ -1047,6 +1047,7 @@ Ref<Image> RasterizerSceneGLES3::sky_bake_panorama(RID p_sky, float p_energy, bo
|
|||||||
glDeleteFramebuffers(1, &rad_fbo);
|
glDeleteFramebuffers(1, &rad_fbo);
|
||||||
// Create a dummy texture so we can use texture_2d_get.
|
// Create a dummy texture so we can use texture_2d_get.
|
||||||
RID tex_rid = GLES3::TextureStorage::get_singleton()->texture_allocate();
|
RID tex_rid = GLES3::TextureStorage::get_singleton()->texture_allocate();
|
||||||
|
{
|
||||||
GLES3::Texture texture;
|
GLES3::Texture texture;
|
||||||
texture.width = p_size.width;
|
texture.width = p_size.width;
|
||||||
texture.height = p_size.height;
|
texture.height = p_size.height;
|
||||||
@@ -1060,13 +1061,15 @@ Ref<Image> RasterizerSceneGLES3::sky_bake_panorama(RID p_sky, float p_energy, bo
|
|||||||
texture.target = GL_TEXTURE_2D;
|
texture.target = GL_TEXTURE_2D;
|
||||||
texture.active = true;
|
texture.active = true;
|
||||||
texture.tex_id = rad_tex;
|
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);
|
GLES3::TextureStorage::get_singleton()->texture_2d_initialize_from_texture(tex_rid, texture);
|
||||||
|
}
|
||||||
|
|
||||||
Ref<Image> img = GLES3::TextureStorage::get_singleton()->texture_2d_get(tex_rid);
|
Ref<Image> img = GLES3::TextureStorage::get_singleton()->texture_2d_get(tex_rid);
|
||||||
GLES3::Utilities::get_singleton()->texture_free_data(rad_tex);
|
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;
|
texture.tex_id = 0;
|
||||||
GLES3::TextureStorage::get_singleton()->texture_free(tex_rid);
|
GLES3::TextureStorage::get_singleton()->texture_free(tex_rid);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user