-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move prepass functions to prepass_utils (#7354)
# Objective - The functions added to utils.wgsl by the prepass assume that mesh_view_bindings are present, which isn't always the case - Fixes #7353 ## Solution - Move these functions to their own `prepass_utils.wgsl` file Co-authored-by: IceSentry <IceSentry@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
35 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#define_import_path bevy_pbr::prepass_utils | ||
|
||
#ifndef NORMAL_PREPASS | ||
fn prepass_normal(frag_coord: vec4<f32>, sample_index: u32) -> vec3<f32> { | ||
#ifdef MULTISAMPLED | ||
let normal_sample = textureLoad(normal_prepass_texture, vec2<i32>(frag_coord.xy), i32(sample_index)); | ||
#else | ||
let normal_sample = textureLoad(normal_prepass_texture, vec2<i32>(frag_coord.xy), 0); | ||
#endif | ||
return normal_sample.xyz * 2.0 - vec3(1.0); | ||
} | ||
#endif // NORMAL_PREPASS | ||
|
||
#ifndef DEPTH_PREPASS | ||
fn prepass_depth(frag_coord: vec4<f32>, sample_index: u32) -> f32 { | ||
#ifdef MULTISAMPLED | ||
let depth_sample = textureLoad(depth_prepass_texture, vec2<i32>(frag_coord.xy), i32(sample_index)); | ||
#else | ||
let depth_sample = textureLoad(depth_prepass_texture, vec2<i32>(frag_coord.xy), 0); | ||
#endif | ||
return depth_sample; | ||
} | ||
#endif // DEPTH_PREPASS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters