diff --git a/doc/classes/BaseMaterial3D.xml b/doc/classes/BaseMaterial3D.xml index c497683c2237..217c807eb485 100644 --- a/doc/classes/BaseMaterial3D.xml +++ b/doc/classes/BaseMaterial3D.xml @@ -654,18 +654,18 @@ Depth check succeeds if less than existing depth. - - Depth check succeeds if greater than or equal to existing depth. + + Depth check succeeds if equal to existing depth. Depth check succeeds if greater than existing depth. - - Depth check succeeds if equal to existing depth. - - + Depth check succeeds if not equal to existing depth. + + Depth check succeeds if greater than or equal to existing depth. + Depth check always succeeds. diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index c517d06c84bb..2bd6be94857f 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -2174,10 +2174,10 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params, GLenum depth_function_table[GLES3::SceneShaderData::DEPTH_FUNCTION_MAX] = { GL_LEQUAL, GL_LESS, - GL_GEQUAL, - GL_GREATER, GL_EQUAL, + GL_GREATER, GL_NOTEQUAL, + GL_GEQUAL, GL_ALWAYS, GL_NEVER, }; diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp index de3b6d2f94a8..2038079b0ff7 100644 --- a/drivers/gles3/storage/material_storage.cpp +++ b/drivers/gles3/storage/material_storage.cpp @@ -2886,12 +2886,12 @@ void SceneShaderData::set_code(const String &p_code) { actions.render_mode_values["depth_test_disabled"] = Pair(&depth_testi, DEPTH_TEST_DISABLED); - actions.render_mode_values["depth_function_lequal"] = Pair(&depth_functioni, DEPTH_FUNCTION_LESS_OR_EQUAL); + actions.render_mode_values["depth_function_less_or_equal"] = Pair(&depth_functioni, DEPTH_FUNCTION_LESS_OR_EQUAL); actions.render_mode_values["depth_function_less"] = Pair(&depth_functioni, DEPTH_FUNCTION_LESS); - actions.render_mode_values["depth_function_gequal"] = Pair(&depth_functioni, DEPTH_FUNCTION_GREATER_OR_EQUAL); - actions.render_mode_values["depth_function_greater"] = Pair(&depth_functioni, DEPTH_FUNCTION_GREATER); actions.render_mode_values["depth_function_equal"] = Pair(&depth_functioni, DEPTH_FUNCTION_EQUAL); - actions.render_mode_values["depth_function_notequal"] = Pair(&depth_functioni, DEPTH_FUNCTION_NOT_EQUAL); + actions.render_mode_values["depth_function_greater"] = Pair(&depth_functioni, DEPTH_FUNCTION_GREATER); + actions.render_mode_values["depth_function_not_equal"] = Pair(&depth_functioni, DEPTH_FUNCTION_NOT_EQUAL); + actions.render_mode_values["depth_function_greater_or_equal"] = Pair(&depth_functioni, DEPTH_FUNCTION_GREATER_OR_EQUAL); actions.render_mode_values["depth_function_always"] = Pair(&depth_functioni, DEPTH_FUNCTION_ALWAYS); actions.render_mode_values["depth_function_never"] = Pair(&depth_functioni, DEPTH_FUNCTION_NEVER); diff --git a/drivers/gles3/storage/material_storage.h b/drivers/gles3/storage/material_storage.h index e95455741862..c20c8d6b6f21 100644 --- a/drivers/gles3/storage/material_storage.h +++ b/drivers/gles3/storage/material_storage.h @@ -255,10 +255,10 @@ struct SceneShaderData : public ShaderData { enum DepthFunction { DEPTH_FUNCTION_LESS_OR_EQUAL, DEPTH_FUNCTION_LESS, - DEPTH_FUNCTION_GREATER_OR_EQUAL, - DEPTH_FUNCTION_GREATER, DEPTH_FUNCTION_EQUAL, + DEPTH_FUNCTION_GREATER, DEPTH_FUNCTION_NOT_EQUAL, + DEPTH_FUNCTION_GREATER_OR_EQUAL, DEPTH_FUNCTION_ALWAYS, DEPTH_FUNCTION_NEVER, DEPTH_FUNCTION_MAX diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 573eb15e86d8..8d6be2698d1f 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -712,22 +712,22 @@ void BaseMaterial3D::_update_shader() { switch (depth_function) { case DEPTH_FUNCTION_LESS_OR_EQUAL: - code += ",depth_function_lequal"; + code += ",depth_function_less_or_equal"; break; case DEPTH_FUNCTION_LESS: code += ",depth_function_less"; break; - case DEPTH_FUNCTION_GREATER_OR_EQUAL: - code += ",depth_function_gequal"; + case DEPTH_FUNCTION_EQUAL: + code += ",depth_function_equal"; break; case DEPTH_FUNCTION_GREATER: code += ",depth_function_greater"; break; - case DEPTH_FUNCTION_EQUAL: - code += ",depth_function_equal"; - break; case DEPTH_FUNCTION_NOT_EQUAL: - code += ",depth_function_notequal"; + code += ",depth_function_not_equal"; + break; + case DEPTH_FUNCTION_GREATER_OR_EQUAL: + code += ",depth_function_greater_or_equal"; break; case DEPTH_FUNCTION_ALWAYS: code += ",depth_function_always"; @@ -3256,10 +3256,10 @@ void BaseMaterial3D::_bind_methods() { BIND_ENUM_CONSTANT(DEPTH_FUNCTION_LESS_OR_EQUAL); BIND_ENUM_CONSTANT(DEPTH_FUNCTION_LESS); - BIND_ENUM_CONSTANT(DEPTH_FUNCTION_GREATER_OR_EQUAL); - BIND_ENUM_CONSTANT(DEPTH_FUNCTION_GREATER); BIND_ENUM_CONSTANT(DEPTH_FUNCTION_EQUAL); + BIND_ENUM_CONSTANT(DEPTH_FUNCTION_GREATER); BIND_ENUM_CONSTANT(DEPTH_FUNCTION_NOT_EQUAL); + BIND_ENUM_CONSTANT(DEPTH_FUNCTION_GREATER_OR_EQUAL); BIND_ENUM_CONSTANT(DEPTH_FUNCTION_ALWAYS); BIND_ENUM_CONSTANT(DEPTH_FUNCTION_NEVER); diff --git a/scene/resources/material.h b/scene/resources/material.h index 7be26b991b20..8611bbac860a 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -230,10 +230,10 @@ class BaseMaterial3D : public Material { enum DepthFunction { DEPTH_FUNCTION_LESS_OR_EQUAL, DEPTH_FUNCTION_LESS, - DEPTH_FUNCTION_GREATER_OR_EQUAL, - DEPTH_FUNCTION_GREATER, DEPTH_FUNCTION_EQUAL, + DEPTH_FUNCTION_GREATER, DEPTH_FUNCTION_NOT_EQUAL, + DEPTH_FUNCTION_GREATER_OR_EQUAL, DEPTH_FUNCTION_ALWAYS, DEPTH_FUNCTION_NEVER, DEPTH_FUNCTION_MAX diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp index e02fed9f8b6d..de41fed2e03a 100644 --- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp @@ -105,12 +105,12 @@ void SceneShaderForwardClustered::ShaderData::set_code(const String &p_code) { actions.render_mode_values["depth_test_disabled"] = Pair(&depth_testi, DEPTH_TEST_DISABLED); - actions.render_mode_values["depth_function_lequal"] = Pair(&depth_functioni, DEPTH_FUNCTION_LESS_OR_EQUAL); + actions.render_mode_values["depth_function_less_or_equal"] = Pair(&depth_functioni, DEPTH_FUNCTION_LESS_OR_EQUAL); actions.render_mode_values["depth_function_less"] = Pair(&depth_functioni, DEPTH_FUNCTION_LESS); - actions.render_mode_values["depth_function_gequal"] = Pair(&depth_functioni, DEPTH_FUNCTION_GREATER_OR_EQUAL); - actions.render_mode_values["depth_function_greater"] = Pair(&depth_functioni, DEPTH_FUNCTION_GREATER); actions.render_mode_values["depth_function_equal"] = Pair(&depth_functioni, DEPTH_FUNCTION_EQUAL); - actions.render_mode_values["depth_function_notequal"] = Pair(&depth_functioni, DEPTH_FUNCTION_NOT_EQUAL); + actions.render_mode_values["depth_function_greater"] = Pair(&depth_functioni, DEPTH_FUNCTION_GREATER); + actions.render_mode_values["depth_function_not_equal"] = Pair(&depth_functioni, DEPTH_FUNCTION_NOT_EQUAL); + actions.render_mode_values["depth_function_greater_or_equal"] = Pair(&depth_functioni, DEPTH_FUNCTION_GREATER_OR_EQUAL); actions.render_mode_values["depth_function_always"] = Pair(&depth_functioni, DEPTH_FUNCTION_ALWAYS); actions.render_mode_values["depth_function_never"] = Pair(&depth_functioni, DEPTH_FUNCTION_NEVER); diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h index 70b35f9f6f0b..5845d5a29301 100644 --- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h +++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h @@ -123,10 +123,10 @@ class SceneShaderForwardClustered { enum DepthFunction { DEPTH_FUNCTION_LESS_OR_EQUAL, DEPTH_FUNCTION_LESS, - DEPTH_FUNCTION_GREATER_OR_EQUAL, - DEPTH_FUNCTION_GREATER, DEPTH_FUNCTION_EQUAL, + DEPTH_FUNCTION_GREATER, DEPTH_FUNCTION_NOT_EQUAL, + DEPTH_FUNCTION_GREATER_OR_EQUAL, DEPTH_FUNCTION_ALWAYS, DEPTH_FUNCTION_NEVER, DEPTH_FUNCTION_MAX diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp index 6c60571dfb53..643556890758 100644 --- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp @@ -106,12 +106,12 @@ void SceneShaderForwardMobile::ShaderData::set_code(const String &p_code) { actions.render_mode_values["depth_test_disabled"] = Pair(&depth_testi, DEPTH_TEST_DISABLED); - actions.render_mode_values["depth_function_lequal"] = Pair(&depth_functioni, DEPTH_FUNCTION_LESS_OR_EQUAL); + actions.render_mode_values["depth_function_less_or_equal"] = Pair(&depth_functioni, DEPTH_FUNCTION_LESS_OR_EQUAL); actions.render_mode_values["depth_function_less"] = Pair(&depth_functioni, DEPTH_FUNCTION_LESS); - actions.render_mode_values["depth_function_gequal"] = Pair(&depth_functioni, DEPTH_FUNCTION_GREATER_OR_EQUAL); - actions.render_mode_values["depth_function_greater"] = Pair(&depth_functioni, DEPTH_FUNCTION_GREATER); actions.render_mode_values["depth_function_equal"] = Pair(&depth_functioni, DEPTH_FUNCTION_EQUAL); - actions.render_mode_values["depth_function_notequal"] = Pair(&depth_functioni, DEPTH_FUNCTION_NOT_EQUAL); + actions.render_mode_values["depth_function_greater"] = Pair(&depth_functioni, DEPTH_FUNCTION_GREATER); + actions.render_mode_values["depth_function_not_equal"] = Pair(&depth_functioni, DEPTH_FUNCTION_NOT_EQUAL); + actions.render_mode_values["depth_function_greater_or_equal"] = Pair(&depth_functioni, DEPTH_FUNCTION_GREATER_OR_EQUAL); actions.render_mode_values["depth_function_always"] = Pair(&depth_functioni, DEPTH_FUNCTION_ALWAYS); actions.render_mode_values["depth_function_never"] = Pair(&depth_functioni, DEPTH_FUNCTION_NEVER); diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h index 4eaeadaedccb..04a415e01a3d 100644 --- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h +++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h @@ -73,10 +73,10 @@ class SceneShaderForwardMobile { enum DepthFunction { DEPTH_FUNCTION_LESS_OR_EQUAL, DEPTH_FUNCTION_LESS, - DEPTH_FUNCTION_GREATER_OR_EQUAL, - DEPTH_FUNCTION_GREATER, DEPTH_FUNCTION_EQUAL, + DEPTH_FUNCTION_GREATER, DEPTH_FUNCTION_NOT_EQUAL, + DEPTH_FUNCTION_GREATER_OR_EQUAL, DEPTH_FUNCTION_ALWAYS, DEPTH_FUNCTION_NEVER, DEPTH_FUNCTION_MAX diff --git a/servers/rendering/shader_types.cpp b/servers/rendering/shader_types.cpp index 0249b51852b0..7c9ce6735298 100644 --- a/servers/rendering/shader_types.cpp +++ b/servers/rendering/shader_types.cpp @@ -212,7 +212,7 @@ ShaderTypes::ShaderTypes() { { shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("blend"), "mix", "add", "sub", "mul" }); shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("depth_draw"), "opaque", "always", "never" }); - shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("depth_function"), { "lequal", "less", "gequal", "greater", "equal", "notequal", "always", "never" } }); + shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("depth_function"), { "less_or_equal", "less", "equal", "greater", "not_equal", "greater_or_equal", "always", "never" } }); shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("depth_prepass_alpha") }); shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("depth_test_disabled") }); shader_modes[RS::SHADER_SPATIAL].modes.push_back({ PNAME("sss_mode_skin") });