#bevy migration shader wgsl

5 messages · Page 1 of 1 (latest)

hollow lagoon
#

I'm starting to work with shaders and wanted to upgrade bevy_atmosphere for private purpose for my project and ran into this issue

error: failed to build a valid final module: Entry point fragment at Fragment is invalid
  ┌─ C:\Users\Elias\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_pbr-0.11.0\src\render\mesh_vertex_output.wgsl:3:13 │ ╭ struct MeshVertexOutput {
4 │ │     // this is `clip position` when the struct is used as a vertex stage output 
5 │ │     // and `frag coord` when used as a fragment stage input
6 │ │     @builtin(position) position: vec4<f32>,
7 │ │     @location(0) world_position: vec4<f32>,
8 │ │     @location(1) world_normal: vec3<f32>,
  │ ╰────────────────────────────────────────^ naga::Type [3]
  │
  = Argument 1 varying error
  = Built-in Position { invariant: false } is present more than once
@group(1) @binding(0)
var sky_texture: texture_cube<f32>;
@group(1) @binding(1)
var sky_sampler: sampler;

#import bevy_pbr::mesh_vertex_output MeshVertexOutput

@fragment
fn fragment(
    @builtin(position) position: vec4<f32>,
    mesh: MeshVertexOutput
) -> @location(0) vec4<f32> {
    let color = textureSample(sky_texture, sky_sampler, mesh.world_normal).xyz;
#ifdef DITHER
    return vec4<f32>(color + dither(position.xy), 1f);
#else
    return vec4<f32>(color, 1f);
#endif
}
terse ivy
#

hi, there's a pr on the repo to update it to 0.11

#

for reference, the solution here is to remove the position param and use the one inside the MeshVertexOutput instead, so you don't try to bind it twice

hollow lagoon
#

I know there is a pr, I did the first one like a few days ago and changed the atmosphere macros to syn 2.0

terse ivy
#

ok, well perhaps you could look at the pr then. it has this ported already