mirror of
https://github.com/bevyengine/bevy
synced 2025-01-02 00:08:53 +00:00
cc4062ec43
# Objective - Split PBR and 2D mesh shaders into types and bindings to prepare the shaders to be more reusable. - See #3969 for details. I'm doing this in multiple steps to make review easier. --- ## Changelog - Changed: 2D and PBR mesh shaders are now split into types and bindings, the following shader imports are available: `bevy_pbr::mesh_view_types`, `bevy_pbr::mesh_view_bindings`, `bevy_pbr::mesh_types`, `bevy_pbr::mesh_bindings`, `bevy_sprite::mesh2d_view_types`, `bevy_sprite::mesh2d_view_bindings`, `bevy_sprite::mesh2d_types`, `bevy_sprite::mesh2d_bindings` ## Migration Guide - In shaders for 3D meshes: - `#import bevy_pbr::mesh_view_bind_group` -> `#import bevy_pbr::mesh_view_bindings` - `#import bevy_pbr::mesh_struct` -> `#import bevy_pbr::mesh_types` - NOTE: If you are using the mesh bind group at bind group index 2, you can remove those binding statements in your shader and just use `#import bevy_pbr::mesh_bindings` which itself imports the mesh types needed for the bindings. - In shaders for 2D meshes: - `#import bevy_sprite::mesh2d_view_bind_group` -> `#import bevy_sprite::mesh2d_view_bindings` - `#import bevy_sprite::mesh2d_struct` -> `#import bevy_sprite::mesh2d_types` - NOTE: If you are using the mesh2d bind group at bind group index 2, you can remove those binding statements in your shader and just use `#import bevy_sprite::mesh2d_bindings` which itself imports the mesh2d types needed for the bindings.
42 lines
1.3 KiB
WebGPU Shading Language
42 lines
1.3 KiB
WebGPU Shading Language
#define_import_path bevy_pbr::mesh_view_bindings
|
|
|
|
#import bevy_pbr::mesh_view_types
|
|
|
|
[[group(0), binding(0)]]
|
|
var<uniform> view: View;
|
|
[[group(0), binding(1)]]
|
|
var<uniform> lights: Lights;
|
|
#ifdef NO_ARRAY_TEXTURES_SUPPORT
|
|
[[group(0), binding(2)]]
|
|
var point_shadow_textures: texture_depth_cube;
|
|
#else
|
|
[[group(0), binding(2)]]
|
|
var point_shadow_textures: texture_depth_cube_array;
|
|
#endif
|
|
[[group(0), binding(3)]]
|
|
var point_shadow_textures_sampler: sampler_comparison;
|
|
#ifdef NO_ARRAY_TEXTURES_SUPPORT
|
|
[[group(0), binding(4)]]
|
|
var directional_shadow_textures: texture_depth_2d;
|
|
#else
|
|
[[group(0), binding(4)]]
|
|
var directional_shadow_textures: texture_depth_2d_array;
|
|
#endif
|
|
[[group(0), binding(5)]]
|
|
var directional_shadow_textures_sampler: sampler_comparison;
|
|
|
|
#ifdef NO_STORAGE_BUFFERS_SUPPORT
|
|
[[group(0), binding(6)]]
|
|
var<uniform> point_lights: PointLights;
|
|
[[group(0), binding(7)]]
|
|
var<uniform> cluster_light_index_lists: ClusterLightIndexLists;
|
|
[[group(0), binding(8)]]
|
|
var<uniform> cluster_offsets_and_counts: ClusterOffsetsAndCounts;
|
|
#else
|
|
[[group(0), binding(6)]]
|
|
var<storage> point_lights: PointLights;
|
|
[[group(0), binding(7)]]
|
|
var<storage> cluster_light_index_lists: ClusterLightIndexLists;
|
|
[[group(0), binding(8)]]
|
|
var<storage> cluster_offsets_and_counts: ClusterOffsetsAndCounts;
|
|
#endif
|