Skip to content

Commit

Permalink
Remove dead code after #7784 (#7875)
Browse files Browse the repository at this point in the history
# Objective

- Remove dead code after #7784

# Changelog
- Removed `SetShadowViewBindGroup`, `queue_shadow_view_bind_group()`, and `LightMeta::shadow_view_bind_group` in favor of reusing the prepass view bind group.

# Migration Guide
- Removed `SetShadowViewBindGroup`, `queue_shadow_view_bind_group()`, and `LightMeta::shadow_view_bind_group` in favor of reusing the prepass view bind group.
  • Loading branch information
JMS55 committed Mar 2, 2023
1 parent 8b8078d commit 3f9e62c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 63 deletions.
10 changes: 2 additions & 8 deletions crates/bevy_pbr/src/material.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::{
queue_mesh_view_bind_groups, render, AlphaMode, DrawMesh, DrawPrepass, EnvironmentMapLight,
MeshPipeline, MeshPipelineKey, MeshUniform, PrepassPlugin, RenderLightSystems,
SetMeshBindGroup, SetMeshViewBindGroup, Shadow,
render, AlphaMode, DrawMesh, DrawPrepass, EnvironmentMapLight, MeshPipeline, MeshPipelineKey,
MeshUniform, PrepassPlugin, RenderLightSystems, SetMeshBindGroup, SetMeshViewBindGroup, Shadow,
};
use bevy_app::{App, IntoSystemAppConfig, Plugin};
use bevy_asset::{AddAsset, AssetEvent, AssetServer, Assets, Handle};
Expand Down Expand Up @@ -205,11 +204,6 @@ where
.after(PrepareAssetSet::PreAssetPrepare),
)
.add_system(render::queue_shadows::<M>.in_set(RenderLightSystems::QueueShadows))
.add_system(
render::queue_shadow_view_bind_group::<M>
.in_set(RenderSet::Queue)
.ambiguous_with(queue_mesh_view_bind_groups), // queue_mesh_view_bind_groups does not read `shadow_view_bind_group`),
)
.add_system(queue_material_meshes::<M>.in_set(RenderSet::Queue));
}

Expand Down
58 changes: 3 additions & 55 deletions crates/bevy_pbr/src/render/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use crate::{
};
use bevy_asset::Handle;
use bevy_core_pipeline::core_3d::Transparent3d;
use bevy_ecs::{
prelude::*,
system::{lifetimeless::*, SystemParamItem},
};
use bevy_ecs::prelude::*;
use bevy_math::{Mat4, UVec3, UVec4, Vec2, Vec3, Vec3Swizzles, Vec4, Vec4Swizzles};
use bevy_render::{
camera::Camera,
Expand All @@ -20,13 +17,12 @@ use bevy_render::{
render_asset::RenderAssets,
render_graph::{Node, NodeRunError, RenderGraphContext, SlotInfo, SlotType},
render_phase::{
CachedRenderPipelinePhaseItem, DrawFunctionId, DrawFunctions, PhaseItem, RenderCommand,
RenderCommandResult, RenderPhase, TrackedRenderPass,
CachedRenderPipelinePhaseItem, DrawFunctionId, DrawFunctions, PhaseItem, RenderPhase,
},
render_resource::*,
renderer::{RenderContext, RenderDevice, RenderQueue},
texture::*,
view::{ComputedVisibility, ExtractedView, ViewUniformOffset, ViewUniforms, VisibleEntities},
view::{ComputedVisibility, ExtractedView, VisibleEntities},
Extract,
};
use bevy_transform::{components::GlobalTransform, prelude::Transform};
Expand Down Expand Up @@ -579,7 +575,6 @@ impl GlobalLightMeta {
#[derive(Resource, Default)]
pub struct LightMeta {
pub view_gpu_lights: DynamicUniformBuffer<GpuLights>,
pub shadow_view_bind_group: Option<BindGroup>,
}

#[derive(Component)]
Expand Down Expand Up @@ -1549,25 +1544,6 @@ pub fn prepare_clusters(
}
}

pub fn queue_shadow_view_bind_group<M: Material>(
render_device: Res<RenderDevice>,
prepass_pipeline: Res<PrepassPipeline<M>>,
mut light_meta: ResMut<LightMeta>,
view_uniforms: Res<ViewUniforms>,
) {
if let Some(view_binding) = view_uniforms.uniforms.binding() {
light_meta.shadow_view_bind_group =
Some(render_device.create_bind_group(&BindGroupDescriptor {
entries: &[BindGroupEntry {
binding: 0,
resource: view_binding,
}],
label: Some("shadow_view_bind_group"),
layout: &prepass_pipeline.view_layout,
}));
}
}

#[allow(clippy::too_many_arguments)]
pub fn queue_shadows<M: Material>(
shadow_draw_functions: Res<DrawFunctions<Shadow>>,
Expand Down Expand Up @@ -1772,31 +1748,3 @@ impl Node for ShadowPassNode {
Ok(())
}
}

pub struct SetShadowViewBindGroup<const I: usize>;
impl<const I: usize> RenderCommand<Shadow> for SetShadowViewBindGroup<I> {
type Param = SRes<LightMeta>;
type ViewWorldQuery = Read<ViewUniformOffset>;
type ItemWorldQuery = ();

#[inline]
fn render<'w>(
_item: &Shadow,
view_uniform_offset: &'_ ViewUniformOffset,
_entity: (),
light_meta: SystemParamItem<'w, '_, Self::Param>,
pass: &mut TrackedRenderPass<'w>,
) -> RenderCommandResult {
pass.set_bind_group(
I,
light_meta
.into_inner()
.shadow_view_bind_group
.as_ref()
.unwrap(),
&[view_uniform_offset.offset],
);

RenderCommandResult::Success
}
}

0 comments on commit 3f9e62c

Please sign in to comment.