bevy/assets/shaders
robtfm 979c4094d4
pbr shader cleanup (#10105)
# Objective

cleanup some pbr shader code. improve shader stage io consistency and
make pbr.wgsl (probably many people's first foray into bevy shader code)
a little more human-readable. also fix a couple of small issues with
deferred rendering.

## Solution

mesh_vertex_output: 
- rename to forward_io (to align with prepass_io)
- rename `MeshVertexOutput` to `VertexOutput` (to align with prepass_io)
- move `Vertex` from mesh.wgsl into here (to align with prepass_io)

prepass_io: 
- remove `FragmentInput`, use `VertexOutput` directly (to align with
forward_io)
- rename `VertexOutput::clip_position` to `position` (to align with
forward_io)

pbr.wgsl:
- restructure so we don't need `#ifdefs` on the actual entrypoint, use
VertexOutput and FragmentOutput in all cases and use #ifdefs to import
the right struct definitions.
- rearrange to make the flow clearer
- move alpha_discard up from `pbr_functions::pbr` to avoid needing to
call it on some branches and not others
- add a bunch of comments

deferred_lighting:
- move ssao into the `!unlit` block to reflect forward behaviour
correctly
- fix compile error with deferred + premultiply_alpha

## Migration Guide

in custom material shaders:
- `pbr_functions::pbr` no longer calls to
`pbr_functions::alpha_discard`. if you were using the `pbr` function in
a custom shader with alpha mask mode you now also need to call
alpha_discard manually
- rename imports of `bevy_pbr::mesh_vertex_output` to
`bevy_pbr::forward_io`
- rename instances of `MeshVertexOutput` to `VertexOutput`

in custom material prepass shaders:
- rename instances of `VertexOutput::clip_position` to
`VertexOutput::position`
2023-10-13 19:12:40 +00:00
..
animate_shader.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
array_texture.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
cubemap_unlit.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
custom_gltf_2d.wgsl Automatic batching/instancing of draw commands (#9685) 2023-09-21 22:12:34 +00:00
custom_material.frag improve shader import model (#5703) 2023-06-27 00:29:22 +00:00
custom_material.vert fix shader_material_glsl example (#9513) 2023-08-21 07:58:21 +00:00
custom_material.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
custom_material_import.wgsl fix custom shader imports (#10030) 2023-10-06 01:34:57 +00:00
custom_material_screenspace_texture.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
custom_vertex_attribute.wgsl Use a single line for of large binding lists (#9849) 2023-09-19 22:17:44 +00:00
fallback_image_test.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
game_of_life.wgsl Use a single line for of large binding lists (#9849) 2023-09-19 22:17:44 +00:00
instancing.wgsl Fix shader_instancing example (#9448) 2023-08-15 07:28:45 +00:00
line_material.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
post_processing.wgsl Use a single line for of large binding lists (#9849) 2023-09-19 22:17:44 +00:00
shader_defs.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
show_prepass.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
texture_binding_array.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
tonemapping_test_patterns.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00