1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-15 13:51:40 +00:00

Merge pull request #108044 from apples/107935-stencil-fixes

Fix opaque stencil rendering
This commit is contained in:
Thaddeus Crews
2025-07-31 10:39:08 -05:00
6 changed files with 36 additions and 8 deletions

View File

@@ -359,8 +359,9 @@ void SceneShaderForwardClustered::ShaderData::_create_pipeline(PipelineKey p_pip
}
}
depth_stencil_state.enable_stencil = stencil_enabled;
if (stencil_enabled) {
bool use_stencil = stencil_enabled && p_pipeline_key.version == PIPELINE_VERSION_COLOR_PASS;
depth_stencil_state.enable_stencil = use_stencil;
if (use_stencil) {
static const RD::CompareOperator stencil_compare_rd_table[STENCIL_COMPARE_MAX] = {
RD::COMPARE_OP_LESS,
RD::COMPARE_OP_EQUAL,

View File

@@ -293,7 +293,7 @@ public:
_FORCE_INLINE_ bool uses_shared_shadow_material() const {
bool backface_culling = cull_mode == RS::CULL_MODE_BACK;
return !uses_particle_trails && !writes_modelview_or_projection && !uses_vertex && !uses_position && !uses_discard && !uses_depth_prepass_alpha && !uses_alpha_clip && !uses_alpha_antialiasing && backface_culling && !uses_point_size && !uses_world_coordinates && !wireframe && !uses_z_clip_scale;
return !uses_particle_trails && !writes_modelview_or_projection && !uses_vertex && !uses_position && !uses_discard && !uses_depth_prepass_alpha && !uses_alpha_clip && !uses_alpha_antialiasing && backface_culling && !uses_point_size && !uses_world_coordinates && !wireframe && !uses_z_clip_scale && !stencil_enabled;
}
virtual void set_code(const String &p_Code);