From 5261d12a6614f7a49906e2727ffcb3cc2a951e64 Mon Sep 17 00:00:00 2001 From: clayjohn Date: Sun, 30 Jul 2023 21:59:28 +0200 Subject: [PATCH] Enable depth writes during shadow pass and depth pass. Disable during color pass This fixes an unreported performance bug. Basically, without this change, the depth prepass did nothing (cherry picked from commit b986afed4658def08447516c9ca66e17e1cbc970) --- drivers/gles3/rasterizer_scene_gles3.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index e6e7dd6f171..798d430d8a8 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -2166,7 +2166,9 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params, if (scene_state.current_depth_draw != shader->depth_draw) { switch (shader->depth_draw) { case GLES3::SceneShaderData::DEPTH_DRAW_OPAQUE: { - glDepthMask(p_pass_mode == PASS_MODE_COLOR); + glDepthMask((p_pass_mode == PASS_MODE_COLOR && !GLES3::Config::get_singleton()->use_depth_prepass) || + p_pass_mode == PASS_MODE_DEPTH || + p_pass_mode == PASS_MODE_SHADOW); } break; case GLES3::SceneShaderData::DEPTH_DRAW_ALWAYS: { glDepthMask(GL_TRUE);