Skip to content

Commit cd737ee

Browse files
committed
Fix disallow stencil mode outline and xray for RENDER_PRIORITY_MAX
1 parent 2d113cc commit cd737ee

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scene/resources/material.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Ref<Material> Material::get_next_pass() const {
6464
void Material::set_render_priority(int p_priority) {
6565
ERR_FAIL_COND(p_priority < RENDER_PRIORITY_MIN);
6666
ERR_FAIL_COND(p_priority > RENDER_PRIORITY_MAX);
67+
6768
render_priority = p_priority;
6869

6970
if (material.is_valid()) {
@@ -3217,6 +3218,11 @@ void BaseMaterial3D::set_stencil_mode(StencilMode p_stencil_mode) {
32173218
return;
32183219
}
32193220

3221+
if (p_stencil_mode == StencilMode::STENCIL_MODE_OUTLINE || p_stencil_mode == StencilMode::STENCIL_MODE_XRAY) {
3222+
ERR_FAIL_COND_EDMSG(get_render_priority() >= RENDER_PRIORITY_MAX,
3223+
vformat("Cannot use stencil mode Outline or Xray, when render priority is RENDER_PRIORITY_MAX(%d).", RENDER_PRIORITY_MAX));
3224+
}
3225+
32203226
stencil_mode = p_stencil_mode;
32213227
_prepare_stencil_effect();
32223228
_queue_shader_change();

0 commit comments

Comments
 (0)