Skip to content

Commit 61c6d40

Browse files
committed
Merge pull request #109052 from Squamto/108905
Fix overflowing render priority for stencil mode outline and xray
2 parents d86369a + cd737ee commit 61c6d40

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()) {
@@ -3220,6 +3221,11 @@ void BaseMaterial3D::set_stencil_mode(StencilMode p_stencil_mode) {
32203221
return;
32213222
}
32223223

3224+
if (p_stencil_mode == StencilMode::STENCIL_MODE_OUTLINE || p_stencil_mode == StencilMode::STENCIL_MODE_XRAY) {
3225+
ERR_FAIL_COND_EDMSG(get_render_priority() >= RENDER_PRIORITY_MAX,
3226+
vformat("Cannot use stencil mode Outline or Xray, when render priority is RENDER_PRIORITY_MAX(%d).", RENDER_PRIORITY_MAX));
3227+
}
3228+
32233229
stencil_mode = p_stencil_mode;
32243230
_prepare_stencil_effect();
32253231
_queue_shader_change();

0 commit comments

Comments
 (0)