From 96c21bc7493f9fee78db6887ee3da6ff7f8562fa Mon Sep 17 00:00:00 2001 From: derammo <817160+derammo@users.noreply.github.com> Date: Sun, 8 May 2022 19:25:49 -0400 Subject: opengl3 driver now works on windows including multi window fixed and simplified gl_manager_windows swap buffers now called for all windows fixed missing pixel format setting in additional windows this makes them work in OpenGL contexts changed verbose error printing to write once this error message happens very frequently while opengl3 is not finished removed dead code no longer needed after changes fixed comments that were misinformation window messages during window creation now handled these were previously discarded messages now tunnel the required context changed failure to create opengl3 window on windows to be more fatal marked a problem with pen code conditional compilation of vulkan and opengl3 on windows fixed windows debug builds now show messages on debug console also rendering driver selection box now shows only compiled drivers marked some problematic code thanks to akien-mga for patiently rewriting my style mistakes --- drivers/gles3/rasterizer_gles3.cpp | 7 +++++++ drivers/gles3/storage/config.cpp | 2 +- drivers/gles3/storage/material_storage.cpp | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index e09355e433..b35134dcfb 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -210,6 +210,9 @@ RasterizerGLES3::RasterizerGLES3() { #ifdef GLAD_ENABLED if (!gladLoadGL()) { ERR_PRINT("Error initializing GLAD"); + // FIXME this is an early return from a constructor. Any other code using this instance will crash or the finalizer will crash, because none of + // the members of this instance are initialized, so this just makes debugging harder. It should either crash here intentionally, + // or we need to actually test for this situation before constructing this. return; } #endif @@ -289,6 +292,9 @@ void RasterizerGLES3::_blit_render_target_to_screen(RID p_render_target, Display // TODO: do we need a keep 3d linear option? + // Make sure we are drawing to the right context. + DisplayServer::get_singleton()->gl_window_make_current(p_screen); + if (rt->external.fbo != 0) { glBindFramebuffer(GL_READ_FRAMEBUFFER, rt->external.fbo); } else { @@ -296,6 +302,7 @@ void RasterizerGLES3::_blit_render_target_to_screen(RID p_render_target, Display } glReadBuffer(GL_COLOR_ATTACHMENT0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, GLES3::TextureStorage::system_fbo); + // Flip content upside down to correct for coordinates. glBlitFramebuffer(0, 0, rt->size.x, rt->size.y, 0, p_screen_rect.size.y, p_screen_rect.size.x, 0, GL_COLOR_BUFFER_BIT, GL_NEAREST); } diff --git a/drivers/gles3/storage/config.cpp b/drivers/gles3/storage/config.cpp index 369e523cc4..96f98a5ef2 100644 --- a/drivers/gles3/storage/config.cpp +++ b/drivers/gles3/storage/config.cpp @@ -44,7 +44,7 @@ Config::Config() { singleton = this; { - int max_extensions = 0; + GLint max_extensions = 0; glGetIntegerv(GL_NUM_EXTENSIONS, &max_extensions); for (int i = 0; i < max_extensions; i++) { const GLubyte *s = glGetStringi(GL_EXTENSIONS, i); diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp index d14d26346c..bc9409425c 100644 --- a/drivers/gles3/storage/material_storage.cpp +++ b/drivers/gles3/storage/material_storage.cpp @@ -2547,7 +2547,7 @@ RS::ShaderNativeSourceCode MaterialStorage::shader_get_native_source_code(RID p_ /* MATERIAL API */ -void MaterialStorage::_material_queue_update(Material *material, bool p_uniform, bool p_texture) { +void MaterialStorage::_material_queue_update(GLES3::Material *material, bool p_uniform, bool p_texture) { material->uniform_dirty = material->uniform_dirty || p_uniform; material->texture_dirty = material->texture_dirty || p_texture; -- cgit v1.2.3