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
31 changes: 31 additions & 0 deletions _release-content/migration-guides/extract-extract-b.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: Extract Extract
pull_requests: [24420]
---

Extraction used to be specific of Main World to Render World, but will now be generic

- When using extraction related traits e.g. `SyncComponent`, `ExtractComponent` and `ExtractResource`,
you must specify the `AppLabel` for the target world.

Before:

```rust,ignore
impl SyncComponent for TemporalAntiAliasing { ... }

#[derive(Component, ExtractComponent)]
#[extract_app(RenderApp)]
pub struct Foo { ... }
```

After:

```rust,ignore
impl SyncComponent<RenderApp> for TemporalAntiAliasing { ... }

#[derive(Component, ExtractComponent)]
#[extract_app(RenderApp)]
pub struct Foo { ... }
```

NOTE: more to come
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ pub struct CasUniform {
sharpness: f32,
}

impl SyncComponent for ContrastAdaptiveSharpening {
impl SyncComponent<RenderApp> for ContrastAdaptiveSharpening {
type Target = (DenoiseCas, CasUniform);
}

impl ExtractComponent for ContrastAdaptiveSharpening {
impl ExtractComponent<RenderApp> for ContrastAdaptiveSharpening {
type QueryData = &'static Self;
type QueryFilter = With<Camera>;
type Out = (DenoiseCas, CasUniform);
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_anti_alias/src/fxaa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ impl Sensitivity {
#[reflect(Component, Default, Clone)]
#[extract_component_filter(With<Camera>)]
#[doc(alias = "FastApproximateAntiAliasing")]
#[extract_app(RenderApp)]
pub struct Fxaa {
/// Enable render passes for FXAA.
pub enabled: bool,
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_anti_alias/src/smaa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ pub struct SmaaPlugin;
ViewSmaaPipelines,
))]
#[doc(alias = "SubpixelMorphologicalAntiAliasing")]
#[extract_app(RenderApp)]
pub struct Smaa {
/// A predefined set of SMAA parameters: i.e. a quality level.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_anti_alias/src/taa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl Default for TemporalAntiAliasing {
}
}

impl SyncComponent for TemporalAntiAliasing {
impl SyncComponent<RenderApp> for TemporalAntiAliasing {
type Target = Self;
}

Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_app/src/sub_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ type ExtractFn = Box<dyn FnMut(&mut World, &mut World) + Send>;
/// # Example
///
/// ```
/// # use bevy_app::{App, AppLabel, SubApp, Main};
/// # use bevy_app::{App, SubApp, Main};
/// # use bevy_derive::AppLabel;
/// # use bevy_ecs::prelude::*;
/// # use bevy_ecs::schedule::ScheduleLabel;
///
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/fullscreen_material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl<T: FullscreenMaterial> Plugin for FullscreenMaterialPlugin<T> {

/// A trait to define a material that will render to the entire screen using a fullscreen triangle.
pub trait FullscreenMaterial:
Component + ExtractComponent + Clone + Copy + ShaderType + WriteInto + Default
Component + ExtractComponent<RenderApp> + Clone + Copy + ShaderType + WriteInto + Default
{
/// The shader that will run on the entire screen using a fullscreen triangle.
fn fragment_shader() -> ShaderRef;
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_core_pipeline/src/oit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub mod resolve;
#[derive(Clone, Copy, ExtractComponent, Reflect, ShaderType, Component)]
#[extract_component_sync_target((Self, OrderIndependentTransparencySettingsOffset, OitResolvePipelineId))]
#[reflect(Clone, Default)]
#[extract_app(RenderApp)]
pub struct OrderIndependentTransparencySettings {
/// Controls how many fragments will be exactly sorted.
/// If the scene has more fragments than this, they will be merged approximately.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ use crate::{
#[reflect(Component, Default, Clone)]
pub struct NoBackgroundMotionVectors;

impl SyncComponent for NoBackgroundMotionVectors {
impl SyncComponent<RenderApp> for NoBackgroundMotionVectors {
type Target = Self;
}

impl ExtractComponent for NoBackgroundMotionVectors {
impl ExtractComponent<RenderApp> for NoBackgroundMotionVectors {
type QueryData = Read<NoBackgroundMotionVectors>;
type QueryFilter = ();
type Out = Self;
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/skybox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl Plugin for SkyboxPlugin {
}
}

impl SyncComponent<SkyboxPlugin> for Skybox {
impl SyncComponent<RenderApp, SkyboxPlugin> for Skybox {
type Target = (Self, SkyboxUniforms, SkyboxPipelineId, SkyboxBindGroup);
}

Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_core_pipeline/src/tonemapping/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use crate::FullscreenShader;

/// 3D LUT (look up table) textures used for tonemapping
#[derive(Resource, Clone, ExtractResource)]
#[extract_app(RenderApp)]
pub struct TonemappingLuts {
pub blender_filmic: Handle<Image>,
pub agx: Handle<Image>,
Expand Down Expand Up @@ -116,6 +117,7 @@ pub struct TonemappingPipeline {
)]
#[extract_component_filter(With<Camera>)]
#[reflect(Component, Debug, Hash, Default, PartialEq)]
#[extract_app(RenderApp)]
pub enum Tonemapping {
/// Bypass tonemapping.
None,
Expand Down Expand Up @@ -377,6 +379,7 @@ pub fn prepare_view_tonemapping_pipelines(
)]
#[extract_component_filter(With<Camera>)]
#[reflect(Component, Debug, Hash, Default, PartialEq)]
#[extract_app(RenderApp)]
pub enum DebandDither {
#[default]
Disabled,
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_dev_tools/src/render_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ pub enum RenderDebugOverlayEvent {
/// Overwrites the default [`GlobalRenderDebugOverlay`] resource.
#[derive(Component, Clone, ExtractComponent, Reflect, PartialEq)]
#[reflect(Component, Default)]
#[extract_app(RenderApp)]
pub struct RenderDebugOverlay {
/// Enables or disables drawing the overlay.
pub enabled: bool,
Expand All @@ -295,6 +296,7 @@ impl Default for RenderDebugOverlay {
/// Can be overwritten by using a [`RenderDebugOverlay`] component.
#[derive(Resource, Clone, ExtractResource, ExtractComponent, Reflect, PartialEq)]
#[reflect(Resource, Default)]
#[extract_app(RenderApp)]
pub struct GlobalRenderDebugOverlay {
/// Enables or disables drawing the overlay.
pub enabled: bool,
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_gizmos_render/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ fn line_joint_gizmo_vertex_buffer_layouts() -> Vec<VertexBufferLayout> {
/// can be added and therefore three potential entities.
#[derive(Clone, Reflect, Resource, ExtractResource)]
#[reflect(Clone, Resource)]
#[extract_app(RenderApp)]
pub struct LineGizmoEntities {
/// An entity that regular line phase items are associated with.
pub line_gizmo_renderer: MainEntity,
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_pbr/src/atmosphere/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ use bevy_render::{
renderer::{RenderContext, RenderDevice, ViewQuery},
texture::{CachedTexture, GpuImage},
view::{ViewUniform, ViewUniformOffset, ViewUniforms},
RenderApp,
};
use bevy_utils::default;
use tracing::warn;

// Render world representation of an environment map light for the atmosphere
#[derive(Component, ExtractComponent, Clone, FromTemplate)]
#[extract_app(RenderApp)]
pub struct AtmosphereEnvironmentMap {
pub environment_map: Handle<Image>,
pub size: UVec2,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/atmosphere/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ impl From<AtmosphereSettings> for GpuAtmosphereSettings {
}
}

impl SyncComponent for AtmosphereSettings {
impl SyncComponent<RenderApp> for AtmosphereSettings {
type Target = GpuAtmosphereSettings;
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/cluster/gpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,7 @@ pub(crate) fn prepare_clusters_for_gpu_clustering(
.retain(|view_main_entity, _| all_view_main_entities.contains(view_main_entity));
}

impl ExtractResource<GpuClusteringPlugin> for GlobalClusterSettings {
impl ExtractResource<RenderApp, GpuClusteringPlugin> for GlobalClusterSettings {
type Source = GlobalClusterSettings;

fn extract_resource(source: &Self::Source) -> Self {
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_pbr/src/contact_shadows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ impl From<ContactShadows> for ContactShadowsUniform {
}
}

impl SyncComponent for ContactShadows {
impl SyncComponent<RenderApp> for ContactShadows {
type Target = (Self, ViewContactShadowsUniformOffset);
}

impl ExtractComponent for ContactShadows {
impl ExtractComponent<RenderApp> for ContactShadows {
type QueryData = &'static ContactShadows;
type QueryFilter = ();
type Out = Self;
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/decal/clustered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl Plugin for ClusteredDecalPlugin {
}
}

impl SyncComponent<ClusteredDecalPlugin> for ClusteredDecal {
impl SyncComponent<RenderApp, ClusteredDecalPlugin> for ClusteredDecal {
type Target = Self;
}

Expand Down
1 change: 1 addition & 0 deletions crates/bevy_pbr/src/deferred/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pub const DEFAULT_PBR_DEFERRED_LIGHTING_PASS_ID: u8 = 1;
///
/// Will be automatically added to entities with the [`DeferredPrepass`] component that don't already have a [`PbrDeferredLightingDepthId`].
#[derive(Component, Clone, Copy, ExtractComponent, ShaderType)]
#[extract_app(RenderApp)]
pub struct PbrDeferredLightingDepthId {
depth_id: u32,

Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_pbr/src/fog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use bevy_color::{Color, ColorToComponents, LinearRgba};
use bevy_ecs::prelude::*;
use bevy_math::{ops, Vec3};
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_render::extract_component::ExtractComponent;
use bevy_render::{extract_component::ExtractComponent, RenderApp};

use crate::ViewFogUniformOffset;

Expand Down Expand Up @@ -52,6 +52,7 @@ use crate::ViewFogUniformOffset;
#[extract_component_filter(With<Camera>)]
#[extract_component_sync_target((Self, ViewFogUniformOffset))]
#[reflect(Component, Default, Debug, Clone)]
#[extract_app(RenderApp)]
pub struct DistanceFog {
/// The color of the fog effect.
///
Expand Down
12 changes: 6 additions & 6 deletions crates/bevy_pbr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ pub fn area_light_luts_placeholder() -> Image {
}
}

impl SyncComponent<PbrPlugin> for DirectionalLight {
impl SyncComponent<RenderApp, PbrPlugin> for DirectionalLight {
type Target = (
Self,
ExtractedDirectionalLight,
Expand All @@ -516,7 +516,7 @@ impl SyncComponent<PbrPlugin> for DirectionalLight {
DirectionalLightViewEntities,
);
}
impl SyncComponent<PbrPlugin> for PointLight {
impl SyncComponent<RenderApp, PbrPlugin> for PointLight {
type Target = (
Self,
ExtractedPointLight,
Expand All @@ -525,7 +525,7 @@ impl SyncComponent<PbrPlugin> for PointLight {
PointAndSpotLightViewEntities,
);
}
impl SyncComponent<PbrPlugin> for SpotLight {
impl SyncComponent<RenderApp, PbrPlugin> for SpotLight {
type Target = (
Self,
ExtractedPointLight,
Expand All @@ -534,12 +534,12 @@ impl SyncComponent<PbrPlugin> for SpotLight {
PointAndSpotLightViewEntities,
);
}
impl SyncComponent<PbrPlugin> for RectLight {
impl SyncComponent<RenderApp, PbrPlugin> for RectLight {
type Target = (Self, ExtractedRectLight);
}
impl SyncComponent<PbrPlugin> for AmbientLight {
impl SyncComponent<RenderApp, PbrPlugin> for AmbientLight {
type Target = Self;
}
impl SyncComponent<PbrPlugin> for ShadowFilteringMethod {
impl SyncComponent<RenderApp, PbrPlugin> for ShadowFilteringMethod {
type Target = Self;
}
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/light_probe/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,6 @@ pub fn generate_environment_map_light(
}
}

impl SyncComponent<EnvironmentMapGenerationPlugin> for GeneratedEnvironmentMapLight {
impl SyncComponent<RenderApp, EnvironmentMapGenerationPlugin> for GeneratedEnvironmentMapLight {
type Target = RenderEnvironmentMap;
}
1 change: 1 addition & 0 deletions crates/bevy_pbr/src/material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,7 @@ pub fn queue_material_meshes(
/// Default render method used for opaque materials.
#[derive(Default, Resource, Clone, Debug, ExtractResource, Reflect)]
#[reflect(Resource, Default, Debug, Clone)]
#[extract_app(RenderApp)]
pub struct DefaultOpaqueRendererMethod(OpaqueRendererMethod);

impl DefaultOpaqueRendererMethod {
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_pbr/src/ssao/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ impl Plugin for ScreenSpaceAmbientOcclusionPlugin {
#[require(DepthPrepass, NormalPrepass)]
#[extract_component_sync_target((Self, ScreenSpaceAmbientOcclusionResources, SsaoPipelineId, SsaoBindGroups))]
#[doc(alias = "Ssao")]
#[extract_app(RenderApp)]
pub struct ScreenSpaceAmbientOcclusion {
/// Quality of the SSAO effect.
pub quality_level: ScreenSpaceAmbientOcclusionQualityLevel,
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 @@ -445,15 +445,15 @@ pub fn prepare_ssr_settings(
}
}

impl SyncComponent for ScreenSpaceReflections {
impl SyncComponent<RenderApp> for ScreenSpaceReflections {
type Target = (
ScreenSpaceReflectionsUniform,
ViewScreenSpaceReflectionsUniformOffset,
ScreenSpaceReflectionsPipelineId,
);
}

impl ExtractComponent for ScreenSpaceReflections {
impl ExtractComponent<RenderApp> for ScreenSpaceReflections {
type QueryData = Read<ScreenSpaceReflections>;
type QueryFilter = ();
type Out = ScreenSpaceReflectionsUniform;
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_pbr/src/transmission/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ impl Plugin for ScreenSpaceTransmissionPlugin {
/// Configures transmission behavior, offering a trade-off between performance and visual fidelity.
#[derive(Component, Reflect, Clone, ExtractComponent)]
#[reflect(Component, Default, Clone)]
#[extract_app(RenderApp)]
pub struct ScreenSpaceTransmission {
/// How many individual steps should be performed in the `Transmissive3d` pass.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/volumetric_fog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ impl Plugin for VolumetricFogPlugin {
}
}

impl SyncComponent<VolumetricFogPlugin> for FogVolume {
impl SyncComponent<RenderApp, VolumetricFogPlugin> for FogVolume {
type Target = Self;
}
1 change: 1 addition & 0 deletions crates/bevy_pbr/src/wireframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@ pub enum WireframeTopology {

#[derive(Resource, Debug, Clone, ExtractResource, Reflect)]
#[reflect(Resource, Debug, Default)]
#[extract_app(RenderApp)]
pub struct WireframeConfig {
/// Whether to show wireframes for all meshes.
/// Can be overridden for individual meshes by adding a [`Wireframe`] or [`NoWireframe`] component.
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_post_process/src/auto_exposure/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use bevy_camera::Hdr;
use bevy_ecs::{prelude::Component, reflect::ReflectComponent};
use bevy_image::Image;
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_render::extract_component::ExtractComponent;
use bevy_render::{extract_component::ExtractComponent, RenderApp};
use bevy_utils::default;

/// Component that enables auto exposure for an HDR-enabled 2d or 3d camera.
Expand All @@ -27,6 +27,7 @@ use bevy_utils::default;
#[derive(Component, Clone, Reflect, ExtractComponent)]
#[reflect(Component, Default, Clone)]
#[require(Hdr)]
#[extract_app(RenderApp)]
pub struct AutoExposure {
/// The range of exposure values for the histogram.
///
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_post_process/src/bloom/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use bevy_ecs::{
};
use bevy_math::{AspectRatio, URect, UVec4, Vec2, Vec4};
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_render::{extract_component::ExtractComponent, sync_component::SyncComponent};
use bevy_render::{extract_component::ExtractComponent, sync_component::SyncComponent, RenderApp};

/// Applies a bloom effect to an HDR-enabled 2d or 3d camera.
///
Expand Down Expand Up @@ -220,11 +220,11 @@ pub enum BloomCompositeMode {
Additive,
}

impl SyncComponent for Bloom {
impl SyncComponent<RenderApp> for Bloom {
type Target = (Self, BloomUniforms);
}

impl ExtractComponent for Bloom {
impl ExtractComponent<RenderApp> for Bloom {
type QueryData = (&'static Self, &'static Camera);
type QueryFilter = With<Hdr>;
type Out = (Self, BloomUniforms);
Expand Down
Loading