mirror of
https://github.com/bevyengine/bevy
synced 2025-02-16 22:18:33 +00:00
Add MeshPipelineKey::LIGHTMAPPED
as applicable during the shadow map pass. (#11910)
I did this during the prepass, but I neglected to do it during the shadow map pass, causing a panic when directional lights with shadows were enabled with lightmapped meshes present. This patch fixes the issue. Closes #11898.
This commit is contained in:
parent
f81aa64ca4
commit
7883eea54f
1 changed files with 11 additions and 0 deletions
|
@ -1596,6 +1596,7 @@ pub fn queue_shadows<M: Material>(
|
||||||
render_material_instances: Res<RenderMaterialInstances<M>>,
|
render_material_instances: Res<RenderMaterialInstances<M>>,
|
||||||
mut pipelines: ResMut<SpecializedMeshPipelines<PrepassPipeline<M>>>,
|
mut pipelines: ResMut<SpecializedMeshPipelines<PrepassPipeline<M>>>,
|
||||||
pipeline_cache: Res<PipelineCache>,
|
pipeline_cache: Res<PipelineCache>,
|
||||||
|
render_lightmaps: Res<RenderLightmaps>,
|
||||||
view_lights: Query<(Entity, &ViewLightEntities)>,
|
view_lights: Query<(Entity, &ViewLightEntities)>,
|
||||||
mut view_light_shadow_phases: Query<(&LightEntity, &mut RenderPhase<Shadow>)>,
|
mut view_light_shadow_phases: Query<(&LightEntity, &mut RenderPhase<Shadow>)>,
|
||||||
point_light_entities: Query<&CubemapVisibleEntities, With<ExtractedPointLight>>,
|
point_light_entities: Query<&CubemapVisibleEntities, With<ExtractedPointLight>>,
|
||||||
|
@ -1661,6 +1662,16 @@ pub fn queue_shadows<M: Material>(
|
||||||
if is_directional_light {
|
if is_directional_light {
|
||||||
mesh_key |= MeshPipelineKey::DEPTH_CLAMP_ORTHO;
|
mesh_key |= MeshPipelineKey::DEPTH_CLAMP_ORTHO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Even though we don't use the lightmap in the shadow map, the
|
||||||
|
// `SetMeshBindGroup` render command will bind the data for it. So
|
||||||
|
// we need to include the appropriate flag in the mesh pipeline key
|
||||||
|
// to ensure that the necessary bind group layout entries are
|
||||||
|
// present.
|
||||||
|
if render_lightmaps.render_lightmaps.contains_key(&entity) {
|
||||||
|
mesh_key |= MeshPipelineKey::LIGHTMAPPED;
|
||||||
|
}
|
||||||
|
|
||||||
mesh_key |= match material.properties.alpha_mode {
|
mesh_key |= match material.properties.alpha_mode {
|
||||||
AlphaMode::Mask(_)
|
AlphaMode::Mask(_)
|
||||||
| AlphaMode::Blend
|
| AlphaMode::Blend
|
||||||
|
|
Loading…
Add table
Reference in a new issue