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 b986afed46)
This commit is contained in:
clayjohn 2023-07-30 21:59:28 +02:00 committed by Yuri Sizov
parent 08bd6ba734
commit 5261d12a66
1 changed files with 3 additions and 1 deletions

View File

@ -2166,7 +2166,9 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
if (scene_state.current_depth_draw != shader->depth_draw) { if (scene_state.current_depth_draw != shader->depth_draw) {
switch (shader->depth_draw) { switch (shader->depth_draw) {
case GLES3::SceneShaderData::DEPTH_DRAW_OPAQUE: { 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; } break;
case GLES3::SceneShaderData::DEPTH_DRAW_ALWAYS: { case GLES3::SceneShaderData::DEPTH_DRAW_ALWAYS: {
glDepthMask(GL_TRUE); glDepthMask(GL_TRUE);