From 062fb8b0dc53bfa1fffb293d6bee5bf7730ddf4c Mon Sep 17 00:00:00 2001 From: clayjohn Date: Tue, 3 Jan 2023 09:26:15 -0800 Subject: Ignore depth draw optimization when using depth draw alpha prepass This is necessary as the scene shader still uses alpha in this case so we can't discard fragments that weren't written to the depth buffer --- drivers/gles3/storage/material_storage.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/gles3/storage/material_storage.cpp') diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp index ebafdc88d8..53ab3d2367 100644 --- a/drivers/gles3/storage/material_storage.cpp +++ b/drivers/gles3/storage/material_storage.cpp @@ -3237,7 +3237,7 @@ void SceneShaderData::set_code(const String &p_code) { uses_alpha = false; uses_alpha_clip = false; uses_blend_alpha = false; - uses_depth_pre_pass = false; + uses_depth_prepass_alpha = false; uses_discard = false; uses_roughness = false; uses_normal = false; @@ -3288,7 +3288,7 @@ void SceneShaderData::set_code(const String &p_code) { // Use alpha clip pipeline for alpha hash/dither. // This prevents sorting issues inherent to alpha blending and allows such materials to cast shadows. actions.usage_flag_pointers["ALPHA_HASH_SCALE"] = &uses_alpha_clip; - actions.render_mode_flags["depth_prepass_alpha"] = &uses_depth_pre_pass; + actions.render_mode_flags["depth_prepass_alpha"] = &uses_depth_prepass_alpha; actions.usage_flag_pointers["SSS_STRENGTH"] = &uses_sss; actions.usage_flag_pointers["SSS_TRANSMITTANCE_DEPTH"] = &uses_transmittance; @@ -3398,7 +3398,7 @@ bool SceneShaderData::casts_shadows() const { bool has_base_alpha = (uses_alpha && !uses_alpha_clip) || has_read_screen_alpha; bool has_alpha = has_base_alpha || uses_blend_alpha; - return !has_alpha || (uses_depth_pre_pass && !(depth_draw == DEPTH_DRAW_DISABLED || depth_test == DEPTH_TEST_DISABLED)); + return !has_alpha || (uses_depth_prepass_alpha && !(depth_draw == DEPTH_DRAW_DISABLED || depth_test == DEPTH_TEST_DISABLED)); } RS::ShaderNativeSourceCode SceneShaderData::get_native_source_code() const { -- cgit v1.2.3