Skip to content

Commit

Permalink
shader_prepass example: disable MSAA for maximum compatibility (#8504)
Browse files Browse the repository at this point in the history
# Objective


Since #8446, example `shader_prepass` logs the following error on my mac
m1:
```
ERROR bevy_render::render_resource::pipeline_cache: failed to process shader:
error: Entry point fragment at Fragment is invalid
 = Argument 1 varying error
 = Capability MULTISAMPLED_SHADING is not supported
```
The example display the 3d scene but doesn't change with the preps
selected

Maybe related to this update in naga:
gfx-rs/naga@cc3a8ac

## Solution

- Disable MSAA in the example, and check if it's enabled in the shader
  • Loading branch information
mockersf committed May 29, 2023
1 parent 85a918a commit 27e1cf9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions assets/shaders/show_prepass.wgsl
Expand Up @@ -15,9 +15,14 @@ var<uniform> settings: ShowPrepassSettings;
@fragment
fn fragment(
@builtin(position) frag_coord: vec4<f32>,
#ifdef MULTISAMPLED
@builtin(sample_index) sample_index: u32,
#endif
#import bevy_pbr::mesh_vertex_output
) -> @location(0) vec4<f32> {
#ifndef MULTISAMPLED
let sample_index = 0u;
#endif
if settings.show_depth == 1u {
let depth = prepass_depth(frag_coord, sample_index);
return vec4(depth, depth, depth, 1.0);
Expand Down
2 changes: 2 additions & 0 deletions examples/shader/shader_prepass.rs
Expand Up @@ -28,6 +28,8 @@ fn main() {
})
.add_systems(Startup, setup)
.add_systems(Update, (rotate, toggle_prepass_view))
// Disabling MSAA for maximum compatibility. Shader prepass with MSAA needs GPU capability MULTISAMPLED_SHADING
.insert_resource(Msaa::Off)
.run();
}

Expand Down

0 comments on commit 27e1cf9

Please sign in to comment.