Merge pull request #97379 from clayjohn/webgl-errors
Some checks are pending
🔗 GHA / 📊 Static checks (push) Waiting to run
🔗 GHA / 🤖 Android (push) Blocked by required conditions
🔗 GHA / 🍏 iOS (push) Blocked by required conditions
🔗 GHA / 🐧 Linux (push) Blocked by required conditions
🔗 GHA / 🍎 macOS (push) Blocked by required conditions
🔗 GHA / 🏁 Windows (push) Blocked by required conditions
🔗 GHA / 🌐 Web (push) Blocked by required conditions
🔗 GHA / 🪲 Godot CPP (push) Blocked by required conditions

Clean up two recently introduced WebGL errors
This commit is contained in:
Rémi Verschelde 2024-09-24 12:57:21 +02:00
commit c3e16cda00
No known key found for this signature in database
GPG Key ID: C3336907360768E1
4 changed files with 11 additions and 4 deletions

View File

@ -2184,7 +2184,9 @@ void RasterizerCanvasGLES3::canvas_begin(RID p_to_render_target, bool p_to_backb
glBindFramebuffer(GL_FRAMEBUFFER, render_target->fbo); glBindFramebuffer(GL_FRAMEBUFFER, render_target->fbo);
glActiveTexture(GL_TEXTURE0 + config->max_texture_image_units - 4); glActiveTexture(GL_TEXTURE0 + config->max_texture_image_units - 4);
glBindTexture(GL_TEXTURE_2D, render_target->backbuffer); glBindTexture(GL_TEXTURE_2D, render_target->backbuffer);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, p_backbuffer_has_mipmaps ? render_target->mipmap_count - 1 : 0); if (render_target->backbuffer != 0) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, p_backbuffer_has_mipmaps ? render_target->mipmap_count - 1 : 0);
}
} }
if (render_target->is_transparent || p_to_backbuffer) { if (render_target->is_transparent || p_to_backbuffer) {

View File

@ -349,9 +349,6 @@ RasterizerGLES3::RasterizerGLES3() {
} }
} }
// Disable OpenGL linear to sRGB conversion, because Godot will always do this conversion itself.
glDisable(GL_FRAMEBUFFER_SRGB);
// OpenGL needs to be initialized before initializing the Rasterizers // OpenGL needs to be initialized before initializing the Rasterizers
config = memnew(GLES3::Config); config = memnew(GLES3::Config);
utilities = memnew(GLES3::Utilities); utilities = memnew(GLES3::Utilities);
@ -368,6 +365,11 @@ RasterizerGLES3::RasterizerGLES3() {
fog = memnew(GLES3::Fog); fog = memnew(GLES3::Fog);
canvas = memnew(RasterizerCanvasGLES3()); canvas = memnew(RasterizerCanvasGLES3());
scene = memnew(RasterizerSceneGLES3()); scene = memnew(RasterizerSceneGLES3());
// Disable OpenGL linear to sRGB conversion, because Godot will always do this conversion itself.
if (config->srgb_framebuffer_supported) {
glDisable(GL_FRAMEBUFFER_SRGB);
}
} }
RasterizerGLES3::~RasterizerGLES3() { RasterizerGLES3::~RasterizerGLES3() {

View File

@ -88,6 +88,7 @@ Config::Config() {
etc2_supported = false; etc2_supported = false;
s3tc_supported = true; s3tc_supported = true;
rgtc_supported = true; //RGTC - core since OpenGL version 3.0 rgtc_supported = true; //RGTC - core since OpenGL version 3.0
srgb_framebuffer_supported = true;
} else { } else {
float_texture_supported = extensions.has("GL_EXT_color_buffer_float"); float_texture_supported = extensions.has("GL_EXT_color_buffer_float");
etc2_supported = true; etc2_supported = true;
@ -100,6 +101,7 @@ Config::Config() {
s3tc_supported = extensions.has("GL_EXT_texture_compression_dxt1") || extensions.has("GL_EXT_texture_compression_s3tc") || extensions.has("WEBGL_compressed_texture_s3tc"); s3tc_supported = extensions.has("GL_EXT_texture_compression_dxt1") || extensions.has("GL_EXT_texture_compression_s3tc") || extensions.has("WEBGL_compressed_texture_s3tc");
#endif #endif
rgtc_supported = extensions.has("GL_EXT_texture_compression_rgtc") || extensions.has("GL_ARB_texture_compression_rgtc") || extensions.has("EXT_texture_compression_rgtc"); rgtc_supported = extensions.has("GL_EXT_texture_compression_rgtc") || extensions.has("GL_ARB_texture_compression_rgtc") || extensions.has("EXT_texture_compression_rgtc");
srgb_framebuffer_supported = extensions.has("GL_EXT_sRGB_write_control");
} }
glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &max_vertex_texture_image_units); glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &max_vertex_texture_image_units);

View File

@ -80,6 +80,7 @@ public:
bool astc_supported = false; bool astc_supported = false;
bool astc_hdr_supported = false; bool astc_hdr_supported = false;
bool astc_layered_supported = false; bool astc_layered_supported = false;
bool srgb_framebuffer_supported = false;
bool force_vertex_shading = false; bool force_vertex_shading = false;