From d4c9ca39758ef0fb9ed27f8473faed5690994fef Mon Sep 17 00:00:00 2001 From: clayjohn Date: Tue, 11 Apr 2023 21:15:24 -0700 Subject: Ensure that depth write state is updated before transparent pass in OpenGL3 renderer (cherry picked from commit ed0c378bda98d41288c0f9eeb31707590853e215) --- drivers/gles3/rasterizer_scene_gles3.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'drivers') diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index b3d6b01c6c..3d8f7924a7 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1948,7 +1948,7 @@ void RasterizerSceneGLES3::render_scene(const Ref &p_render_ glDepthFunc(GL_LEQUAL); glDepthMask(GL_TRUE); scene_state.current_depth_test = GLES3::SceneShaderData::DEPTH_TEST_ENABLED; - scene_state.current_depth_draw = GLES3::SceneShaderData::DEPTH_DRAW_OPAQUE; + scene_state.current_depth_draw = GLES3::SceneShaderData::DEPTH_DRAW_ALWAYS; if (!fb_cleared) { glClearDepth(1.0f); @@ -1976,19 +1976,17 @@ void RasterizerSceneGLES3::render_scene(const Ref &p_render_ _render_list_template(&render_list_params, &render_data, 0, render_list[RENDER_LIST_OPAQUE].elements.size()); + glDepthMask(GL_FALSE); + scene_state.current_depth_draw = GLES3::SceneShaderData::DEPTH_DRAW_DISABLED; + if (draw_sky) { RENDER_TIMESTAMP("Render Sky"); - if (scene_state.current_depth_test != GLES3::SceneShaderData::DEPTH_TEST_ENABLED) { - glEnable(GL_DEPTH_TEST); - scene_state.current_depth_test = GLES3::SceneShaderData::DEPTH_TEST_ENABLED; - } + glEnable(GL_DEPTH_TEST); - glDepthMask(GL_FALSE); glDisable(GL_BLEND); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); scene_state.current_depth_test = GLES3::SceneShaderData::DEPTH_TEST_ENABLED; - scene_state.current_depth_draw = GLES3::SceneShaderData::DEPTH_DRAW_DISABLED; scene_state.cull_mode = GLES3::SceneShaderData::CULL_BACK; _draw_sky(render_data.environment, render_data.cam_projection, render_data.cam_transform, sky_energy_multiplier, p_camera_data->view_count > 1, flip_y); -- cgit v1.2.3