mirror of
https://github.com/bevyengine/bevy
synced 2024-09-20 06:22:01 +00:00
27e1cf92ad
# 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:
cc3a8ac737
## Solution
- Disable MSAA in the example, and check if it's enabled in the shader
38 lines
1.1 KiB
WebGPU Shading Language
38 lines
1.1 KiB
WebGPU Shading Language
#import bevy_pbr::mesh_types
|
|
#import bevy_pbr::mesh_view_bindings
|
|
#import bevy_pbr::prepass_utils
|
|
|
|
struct ShowPrepassSettings {
|
|
show_depth: u32,
|
|
show_normals: u32,
|
|
show_motion_vectors: u32,
|
|
padding_1: u32,
|
|
padding_2: u32,
|
|
}
|
|
@group(1) @binding(0)
|
|
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);
|
|
} else if settings.show_normals == 1u {
|
|
let normal = prepass_normal(frag_coord, sample_index);
|
|
return vec4(normal, 1.0);
|
|
} else if settings.show_motion_vectors == 1u {
|
|
let motion_vector = prepass_motion_vector(frag_coord, sample_index);
|
|
return vec4(motion_vector / globals.delta_time, 0.0, 1.0);
|
|
}
|
|
|
|
return vec4(0.0);
|
|
}
|