Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use super::{CasPipeline, CasUniform};
pub fn cas(
view: ViewQuery<
(
&ViewTarget,
&mut ViewTarget,
&ViewCasPipeline,
&DynamicUniformIndex<CasUniform>,
),
Expand All @@ -28,7 +28,7 @@ pub fn cas(
mut ctx: RenderContext,
mut cached_bind_group: Local<Option<(BufferId, TextureViewId, BindGroup)>>,
) {
let (target, pipeline, uniform_index) = view.into_inner();
let (mut target, pipeline, uniform_index) = view.into_inner();

let uniforms_id = uniforms.buffer().unwrap().id();
let Some(uniforms_binding) = uniforms.binding() else {
Expand Down
16 changes: 11 additions & 5 deletions crates/bevy_anti_alias/src/dlss/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,20 @@ pub fn dlss_super_resolution(
&DlssRenderContext<DlssSuperResolutionFeature>,
&MainPassResolutionOverride,
&TemporalJitter,
&ViewTarget,
&mut ViewTarget,
&ViewPrepassTextures,
)>,
adapter: Res<RenderAdapter>,
mut ctx: RenderContext,
) {
let (dlss, dlss_context, resolution_override, temporal_jitter, view_target, prepass_textures) =
view.into_inner();
let (
dlss,
dlss_context,
resolution_override,
temporal_jitter,
mut view_target,
prepass_textures,
) = view.into_inner();
Comment on lines -33 to +40

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mechanical edit, haven't been able to verify this yet since I don't have an NVidia card easily avaibale for testing


let (Some(prepass_depth_texture), Some(prepass_motion_vectors_texture)) =
(&prepass_textures.depth, &prepass_textures.motion_vectors)
Expand Down Expand Up @@ -74,7 +80,7 @@ pub fn dlss_ray_reconstruction(
&DlssRenderContext<DlssRayReconstructionFeature>,
&MainPassResolutionOverride,
&TemporalJitter,
&ViewTarget,
&mut ViewTarget,
&ViewPrepassTextures,
&ViewDlssRayReconstructionTextures,
)>,
Expand All @@ -86,7 +92,7 @@ pub fn dlss_ray_reconstruction(
dlss_context,
resolution_override,
temporal_jitter,
view_target,
mut view_target,
prepass_textures,
ray_reconstruction_textures,
) = view.into_inner();
Expand Down
10 changes: 8 additions & 2 deletions crates/bevy_anti_alias/src/fxaa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,17 @@ impl Plugin for FxaaPlugin {
)
.add_systems(
Core3d,
fxaa.after(tonemapping).in_set(Core3dSystems::PostProcess),
fxaa.after(tonemapping)
.in_set(Core3dSystems::PostProcess)
.in_set(crate::AntiAliasingSystems)
.ambiguous_with(crate::AntiAliasingSystems),
)
.add_systems(
Core2d,
fxaa.after(tonemapping).in_set(Core2dSystems::PostProcess),
fxaa.after(tonemapping)
.in_set(Core2dSystems::PostProcess)
.in_set(crate::AntiAliasingSystems)
.ambiguous_with(crate::AntiAliasingSystems),
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_anti_alias/src/fxaa/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ use bevy_render::{
};

pub fn fxaa(
view: ViewQuery<(&ViewTarget, &CameraFxaaPipeline, &Fxaa)>,
view: ViewQuery<(&mut ViewTarget, &CameraFxaaPipeline, &Fxaa)>,
fxaa_pipeline: Res<FxaaPipeline>,
pipeline_cache: Res<PipelineCache>,
mut ctx: RenderContext,
mut cached_bind_group: Local<Option<(TextureViewId, BindGroup)>>,
) {
let (target, pipeline, fxaa) = view.into_inner();
let (mut target, pipeline, fxaa) = view.into_inner();

if !fxaa.enabled {
return;
Expand Down
12 changes: 12 additions & 0 deletions crates/bevy_anti_alias/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
)]

use bevy_app::Plugin;
use bevy_ecs::schedule::SystemSet;
use contrast_adaptive_sharpening::CasPlugin;
use fxaa::FxaaPlugin;
use smaa::SmaaPlugin;
Expand All @@ -18,6 +19,17 @@ pub mod fxaa;
pub mod smaa;
pub mod taa;

/// A [`SystemSet`] for Anti-aliasing technique systems.
///
/// Nothing prevents a camera from enabling more than one of these, but in practice
/// only one is usually active, and the ordering between them is not meaningful.
///
/// Members should declare `.ambiguous_with(AntiAliasingSystems)` to suppress the
/// ambiguity report. These systems take `&mut ViewTarget` and so are never run
/// concurrently.
#[derive(SystemSet, Debug, Clone, PartialEq, Eq, Hash)]
pub struct AntiAliasingSystems;

/// Adds fxaa, smaa, taa, contrast aware sharpening, and optional dlss support.
#[derive(Default)]
pub struct AntiAliasPlugin;
Expand Down
14 changes: 10 additions & 4 deletions crates/bevy_anti_alias/src/smaa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,17 @@ impl Plugin for SmaaPlugin {
)
.add_systems(
Core3d,
smaa.after(tonemapping).in_set(Core3dSystems::PostProcess),
smaa.after(tonemapping)
.in_set(Core3dSystems::PostProcess)
.in_set(crate::AntiAliasingSystems)
.ambiguous_with(crate::AntiAliasingSystems),
)
.add_systems(
Core2d,
smaa.after(tonemapping).in_set(Core2dSystems::PostProcess),
smaa.after(tonemapping)
.in_set(Core2dSystems::PostProcess)
.in_set(crate::AntiAliasingSystems)
.ambiguous_with(crate::AntiAliasingSystems),
);
}
}
Expand Down Expand Up @@ -834,7 +840,7 @@ impl SmaaPreset {

pub fn smaa(
view: ViewQuery<(
&ViewTarget,
&mut ViewTarget,
&ViewSmaaPipelines,
&SmaaInfoUniformOffset,
&SmaaTextures,
Expand All @@ -846,7 +852,7 @@ pub fn smaa(
mut ctx: RenderContext,
) {
let (
view_target,
mut view_target,
view_pipelines,
view_smaa_uniform_offset,
smaa_textures,
Expand Down
9 changes: 6 additions & 3 deletions crates/bevy_anti_alias/src/taa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ impl Plugin for TemporalAntiAliasPlugin {

render_app.add_systems(
Core3d,
temporal_anti_alias.in_set(Core3dSystems::EarlyPostProcess),
temporal_anti_alias
.in_set(Core3dSystems::EarlyPostProcess)
.in_set(crate::AntiAliasingSystems)
.ambiguous_with(crate::AntiAliasingSystems),
);
}
}
Expand Down Expand Up @@ -136,7 +139,7 @@ impl SyncComponent<RenderApp> for TemporalAntiAliasing {
pub fn temporal_anti_alias(
view: ViewQuery<(
&ExtractedCamera,
&ViewTarget,
&mut ViewTarget,
&TemporalAntiAliasHistoryTextures,
&ViewPrepassTextures,
&TemporalAntiAliasPipelineId,
Expand All @@ -146,7 +149,7 @@ pub fn temporal_anti_alias(
pipeline_cache: Res<PipelineCache>,
mut ctx: RenderContext,
) {
let (camera, view_target, taa_history_textures, prepass_textures, taa_pipeline_id, msaa) =
let (camera, mut view_target, taa_history_textures, prepass_textures, taa_pipeline_id, msaa) =
view.into_inner();

if *msaa != Msaa::Off {
Expand Down
12 changes: 6 additions & 6 deletions crates/bevy_core_pipeline/src/fullscreen_material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ fn prepare_bind_groups<T: FullscreenMaterial>(
mut commands: Commands,
mut view: Query<(
Entity,
&ViewTarget,
&mut ViewTarget,
Option<&mut FullscreenMaterialBindGroup<T>>,
Option<&T>,
)>,
Expand Down Expand Up @@ -274,12 +274,12 @@ fn prepare_bind_groups<T: FullscreenMaterial>(
});

if let Some(bind_groups) = &mut maybe_bind_groups {
if bind_groups.cache.should_update(view_target) {
bind_groups.cache.update(view_target, builder);
if bind_groups.cache.should_update(&view_target) {
bind_groups.cache.update(&view_target, builder);
}
} else {
commands.entity(entity).insert(FullscreenMaterialBindGroup {
cache: builder.generate_bind_groups(view_target),
cache: builder.generate_bind_groups(&view_target),
_marker: PhantomData::<T>,
});
}
Expand All @@ -288,15 +288,15 @@ fn prepare_bind_groups<T: FullscreenMaterial>(

pub fn fullscreen_material_system<T: FullscreenMaterial>(
view: ViewQuery<(
&ViewTarget,
&mut ViewTarget,
&DynamicUniformIndex<T>,
&FullscreenMaterialBindGroup<T>,
&FullscreenMaterialPipelineId,
)>,
pipeline_cache: Res<PipelineCache>,
mut ctx: RenderContext,
) {
let (view_target, settings_index, bind_groups, pipeline_id) = view.into_inner();
let (mut view_target, settings_index, bind_groups, pipeline_id) = view.into_inner();

let Some(pipeline) = pipeline_cache.get_render_pipeline(pipeline_id.0) else {
return;
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_core_pipeline/src/tonemapping/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn tonemapping(
view: ViewQuery<(
&ExtractedCamera,
&ViewUniformOffset,
&ViewTarget,
&mut ViewTarget,
&ViewTonemappingPipeline,
&Tonemapping,
)>,
Expand All @@ -40,7 +40,7 @@ pub fn tonemapping(
mut cache: Local<TonemappingBindGroupCache>,
mut ctx: RenderContext,
) {
let (camera, view_uniform_offset, target, view_tonemapping_pipeline, tonemapping) =
let (camera, view_uniform_offset, mut target, view_tonemapping_pipeline, tonemapping) =
view.into_inner();

if *tonemapping == Tonemapping::None {
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_dev_tools/src/render_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ fn prepare_debug_overlay_resources(

fn render_debug_overlay(
view: ViewQuery<(
&ViewTarget,
&mut ViewTarget,
&RenderDebugOverlay,
&RenderDebugOverlayPipelineId,
&RenderDebugOverlayUniformOffset,
Expand All @@ -642,7 +642,7 @@ fn render_debug_overlay(
fallback_image: Res<FallbackImage>,
mut ctx: RenderContext,
) {
let (target, config, pipeline_id, uniform_offset, mesh_view_bind_group, depth_pyramid) =
let (mut target, config, pipeline_id, uniform_offset, mesh_view_bind_group, depth_pyramid) =
view.into_inner();

if !config.enabled {
Expand Down
10 changes: 6 additions & 4 deletions crates/bevy_pbr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,19 +413,21 @@ impl Plugin for PbrPlugin {
per_view_shadow_pass::<EARLY_SHADOW_PASS>
.after(early_prepass_build_indirect_parameters)
.before(early_downsample_depth)
.before(per_view_shadow_pass::<LATE_SHADOW_PASS>),
.before(per_view_shadow_pass::<LATE_SHADOW_PASS>)
.in_set(Core3dSystems::Prepass),
per_view_shadow_pass::<LATE_SHADOW_PASS>
.after(late_prepass_build_indirect_parameters)
.before(main_build_indirect_parameters)
.before(Core3dSystems::MainPass),
.in_set(Core3dSystems::Prepass),
shared_shadow_pass::<EARLY_SHADOW_PASS>
.after(early_prepass_build_indirect_parameters)
.before(early_downsample_depth)
.before(shared_shadow_pass::<LATE_SHADOW_PASS>),
.before(shared_shadow_pass::<LATE_SHADOW_PASS>)
.in_set(Core3dSystems::Prepass),
shared_shadow_pass::<LATE_SHADOW_PASS>
.after(late_prepass_build_indirect_parameters)
.before(main_build_indirect_parameters)
.before(Core3dSystems::MainPass),
.in_set(Core3dSystems::Prepass),
),
);
}
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_pbr/src/ssr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl Default for ScreenSpaceReflections {

pub fn screen_space_reflections(
view: ViewQuery<(
&ViewTarget,
&mut ViewTarget,
&MeshViewBindGroup,
&ScreenSpaceReflectionsPipelineId,
)>,
Expand All @@ -254,7 +254,7 @@ pub fn screen_space_reflections(
render_images: Res<RenderAssets<GpuImage>>,
mut ctx: RenderContext,
) {
let (view_target, view_bind_group, ssr_pipeline_id) = view.into_inner();
let (mut view_target, view_bind_group, ssr_pipeline_id) = view.into_inner();

// Grab the render pipeline.
let Some(render_pipeline) = pipeline_cache.get_render_pipeline(**ssr_pipeline_id) else {
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_post_process/src/dof/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ impl DepthOfFieldPipelines {
pub(crate) fn depth_of_field(
view: ViewQuery<(
&ViewUniformOffset,
&ViewTarget,
&mut ViewTarget,
&ViewDepthStencilTexture,
&DepthOfFieldPipelines,
&ViewDepthOfFieldBindGroupLayouts,
Expand All @@ -777,7 +777,7 @@ pub(crate) fn depth_of_field(
) {
let (
view_uniform_offset,
view_target,
mut view_target,
view_depth_texture,
view_pipelines,
view_bind_group_layouts,
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_post_process/src/effect_stack/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ impl SpecializedRenderPipeline for PostProcessingPipeline {

pub(crate) fn post_processing(
view: ViewQuery<(
&ViewTarget,
&mut ViewTarget,
&PostProcessingPipelineId,
AnyOf<(&ChromaticAberration, &Vignette, &LensDistortion)>,
&PostProcessingUniformBufferOffsets,
Expand All @@ -254,7 +254,7 @@ pub(crate) fn post_processing(
default_lut: Res<DefaultChromaticAberrationLut>,
mut ctx: RenderContext,
) {
let (view_target, pipeline_id, post_effects, post_processing_uniform_buffer_offsets) =
let (mut view_target, pipeline_id, post_effects, post_processing_uniform_buffer_offsets) =
view.into_inner();

let (maybe_chromatic_aberration, maybe_vignette, maybe_lens_distortion) = post_effects;
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_post_process/src/motion_blur/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl Plugin for MotionBlurPlugin {

pub fn motion_blur(
view: ViewQuery<(
&ViewTarget,
&mut ViewTarget,
&MotionBlurPipelineId,
&ViewPrepassTextures,
&ViewDepthStencilTexture,
Expand All @@ -196,7 +196,7 @@ pub fn motion_blur(
globals_buffer: Res<GlobalsBuffer>,
mut ctx: RenderContext,
) {
let (view_target, pipeline_id, prepass_textures, depth, motion_blur_uniform, msaa) =
let (mut view_target, pipeline_id, prepass_textures, depth, motion_blur_uniform, msaa) =
view.into_inner();
let Some(depth_view) = depth.attachment.depth_stencil_views().depth_only_view() else {
return;
Expand Down
Loading