From 7d730a6afe60d7aa8fb168a36da43acd0c72bfe8 Mon Sep 17 00:00:00 2001 From: newDINO Date: Tue, 18 Nov 2025 15:35:06 +0800 Subject: [PATCH 1/4] fix shader compile fail when using visibility range --- crates/bevy_pbr/src/render/pbr.wgsl | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/bevy_pbr/src/render/pbr.wgsl b/crates/bevy_pbr/src/render/pbr.wgsl index 1722ab9d91940..0cdf896a00945 100644 --- a/crates/bevy_pbr/src/render/pbr.wgsl +++ b/crates/bevy_pbr/src/render/pbr.wgsl @@ -8,6 +8,7 @@ #ifdef PREPASS_PIPELINE #import bevy_pbr::{ prepass_io::{VertexOutput, FragmentOutput}, + pbr_functions, pbr_deferred_functions::deferred_output, } #else From 5dcc4be2ceafdccc9ce69765512d19c106ab70f2 Mon Sep 17 00:00:00 2001 From: Nico Zweifel <34443492+NicoZweifel@users.noreply.github.com> Date: Tue, 18 Nov 2025 12:37:25 +0100 Subject: [PATCH 2/4] fix: imports --- crates/bevy_pbr/src/render/pbr.wgsl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/bevy_pbr/src/render/pbr.wgsl b/crates/bevy_pbr/src/render/pbr.wgsl index 0cdf896a00945..22156d926f556 100644 --- a/crates/bevy_pbr/src/render/pbr.wgsl +++ b/crates/bevy_pbr/src/render/pbr.wgsl @@ -5,16 +5,18 @@ decal::clustered::apply_decal_base_color, } +#ifdef VISIBILITY_RANGE_DITHER +#import bevy_pbr::pbr_functions::visibility_range_dither; +#endif + #ifdef PREPASS_PIPELINE #import bevy_pbr::{ prepass_io::{VertexOutput, FragmentOutput}, - pbr_functions, pbr_deferred_functions::deferred_output, } #else #import bevy_pbr::{ forward_io::{VertexOutput, FragmentOutput}, - pbr_functions, pbr_functions::{apply_pbr_lighting, main_pass_post_lighting_processing}, pbr_types::STANDARD_MATERIAL_FLAGS_UNLIT_BIT, } @@ -51,7 +53,7 @@ fn fragment( // If we're in the crossfade section of a visibility range, conditionally // discard the fragment according to the visibility pattern. #ifdef VISIBILITY_RANGE_DITHER - pbr_functions::visibility_range_dither(in.position, in.visibility_range_dither); + visibility_range_dither(in.position, in.visibility_range_dither); #endif #ifdef FORWARD_DECAL From b79dde8675a5722287b61df2decf617ccd9731c7 Mon Sep 17 00:00:00 2001 From: Nico Zweifel <34443492+NicoZweifel@users.noreply.github.com> Date: Tue, 18 Nov 2025 12:49:04 +0100 Subject: [PATCH 3/4] chore: move import down --- crates/bevy_pbr/src/render/pbr.wgsl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/bevy_pbr/src/render/pbr.wgsl b/crates/bevy_pbr/src/render/pbr.wgsl index 22156d926f556..b4e6ca7b1142b 100644 --- a/crates/bevy_pbr/src/render/pbr.wgsl +++ b/crates/bevy_pbr/src/render/pbr.wgsl @@ -5,9 +5,7 @@ decal::clustered::apply_decal_base_color, } -#ifdef VISIBILITY_RANGE_DITHER -#import bevy_pbr::pbr_functions::visibility_range_dither; -#endif + #ifdef PREPASS_PIPELINE #import bevy_pbr::{ @@ -22,6 +20,10 @@ } #endif +#ifdef VISIBILITY_RANGE_DITHER +#import bevy_pbr::pbr_functions::visibility_range_dither; +#endif + #ifdef MESHLET_MESH_MATERIAL_PASS #import bevy_pbr::meshlet_visibility_buffer_resolve::resolve_vertex_output #endif From 481f3c36c506898ee3cb710110e80d526745c9b3 Mon Sep 17 00:00:00 2001 From: newDINO <147262794+newDINO@users.noreply.github.com> Date: Tue, 18 Nov 2025 20:32:53 +0800 Subject: [PATCH 4/4] removing empty lines Co-authored-by: Nico Zweifel <34443492+NicoZweifel@users.noreply.github.com> --- crates/bevy_pbr/src/render/pbr.wgsl | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/bevy_pbr/src/render/pbr.wgsl b/crates/bevy_pbr/src/render/pbr.wgsl index b4e6ca7b1142b..e4d8fe63791d7 100644 --- a/crates/bevy_pbr/src/render/pbr.wgsl +++ b/crates/bevy_pbr/src/render/pbr.wgsl @@ -5,8 +5,6 @@ decal::clustered::apply_decal_base_color, } - - #ifdef PREPASS_PIPELINE #import bevy_pbr::{ prepass_io::{VertexOutput, FragmentOutput},