Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Fix post_processing and shader_prepass examples #7419

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions assets/shaders/custom_material_chromatic_aberration.wgsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import bevy_pbr::mesh_view_bindings
#import bevy_sprite::mesh2d_view_bindings
#import bevy_pbr::utils

@group(1) @binding(0)
Expand All @@ -22,7 +22,7 @@ fn fragment(
textureSample(texture, our_sampler, uv + vec2<f32>(-offset_strength, 0.0)).g,
textureSample(texture, our_sampler, uv + vec2<f32>(0.0, offset_strength)).b,
1.0
);
);

return output_color;
}
6 changes: 5 additions & 1 deletion crates/bevy_pbr/src/prepass/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use bevy_utils::{tracing::error, HashMap};
use crate::{
AlphaMode, DrawMesh, Material, MaterialPipeline, MaterialPipelineKey, MeshPipeline,
MeshPipelineKey, MeshUniform, RenderMaterials, SetMaterialBindGroup, SetMeshBindGroup,
MAX_DIRECTIONAL_LIGHTS,
MAX_CASCADES_PER_LIGHT, MAX_DIRECTIONAL_LIGHTS,
};

use std::{hash::Hash, marker::PhantomData};
Expand Down Expand Up @@ -211,6 +211,10 @@ where
"MAX_DIRECTIONAL_LIGHTS".to_string(),
MAX_DIRECTIONAL_LIGHTS as i32,
));
shader_defs.push(ShaderDefVal::Int(
"MAX_CASCADES_PER_LIGHT".to_string(),
MAX_CASCADES_PER_LIGHT as i32,
));

if layout.contains(Mesh::ATTRIBUTE_UV_0) {
shader_defs.push("VERTEX_UVS".into());
Expand Down