Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenGL: Condition "t->is_render_target" is true. is printed every time LightmapGI is baked with Environment mode set to Scene or Custom Sky #94407

Open
Tracked by #56033 ...
Calinou opened this issue Jul 15, 2024 · 1 comment

Comments

@Calinou
Copy link
Member

Calinou commented Jul 15, 2024

Tested versions

  • Reproducible in: 4.3.beta 92c8e87

System information

Godot v4.3.beta (92c8e87) - Fedora Linux 40 (KDE Plasma) - X11 - GLES3 (Compatibility) - NVIDIA GeForce RTX 4090 (nvidia; 555.58.02) - 13th Gen Intel(R) Core(TM) i9-13900K (32 Threads)

Issue description

Every time you bake lightmaps with the Scene or Custom Sky environment node in Compatibility, you get this error:

 drivers/gles3/storage/texture_storage.cpp:717 - Condition "t->is_render_target" is true.

Baking still succeeds and the texture is saved to disk correctly.

This error does not occur when baking using Forward+ or Mobile, or when using another environment mode in LightmapGI.

Steps to reproduce

  • Bake lightmaps with environment mode set to Scene (the default).

Minimal reproduction project (MRP)

test_lightmap_environment.zip

@jsjtxietian
Copy link
Contributor

Looks like the bake function uses is_render_target to avoid the created texture being cached in the editor. And texture_free is not happy about freeing a render target.

// 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;
texture.alloc_width = p_size.width;
texture.alloc_height = p_size.height;
texture.format = Image::FORMAT_RGBAF;
texture.real_format = Image::FORMAT_RGBAF;
texture.gl_format_cache = GL_RGBA;
texture.gl_type_cache = GL_FLOAT;
texture.type = GLES3::Texture::TYPE_2D;
texture.target = GL_TEXTURE_2D;
texture.active = true;
texture.tex_id = rad_tex;
texture.is_render_target = true;
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;
texture.tex_id = 0;
GLES3::TextureStorage::get_singleton()->texture_free(tex_rid);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants