Revert rendering-related associated type name changes (#11027)

# Objective

> Can anyone explain to me the reasoning of renaming all the types named
Query to Data. I'm talking about this PR
https://github.com/bevyengine/bevy/pull/10779 It doesn't make sense to
me that a bunch of types that are used to run queries aren't named Query
anymore. Like ViewQuery on the ViewNode is the type of the Query. I
don't really understand the point of the rename, it just seems like it
hides the fact that a query will run based on those types.


[@IceSentry](https://discord.com/channels/691052431525675048/692572690833473578/1184946251431694387)

## Solution

Revert several renames in #10779.

## Changelog

- `ViewNode::ViewData` is now `ViewNode::ViewQuery` again.

## Migration Guide

- This PR amends the migration guide in
https://github.com/bevyengine/bevy/pull/10779

---------

Co-authored-by: atlas dostal <rodol@rivalrebels.com>
This commit is contained in:
Alice Cecile 2024-01-22 10:01:55 -05:00 committed by GitHub
parent 8afb3ceb89
commit eb07d16871
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 130 additions and 130 deletions

View file

@ -113,7 +113,7 @@ impl Plugin for BloomPlugin {
#[derive(Default)]
struct BloomNode;
impl ViewNode for BloomNode {
type ViewData = (
type ViewQuery = (
&'static ExtractedCamera,
&'static ViewTarget,
&'static BloomTexture,
@ -140,7 +140,7 @@ impl ViewNode for BloomNode {
bloom_settings,
upsampling_pipeline_ids,
downsampling_pipeline_ids,
): QueryItem<Self::ViewData>,
): QueryItem<Self::ViewQuery>,
world: &World,
) -> Result<(), NodeRunError> {
let downsampling_pipeline_res = world.resource::<BloomDownsamplingPipeline>();

View file

@ -182,12 +182,12 @@ pub enum BloomCompositeMode {
}
impl ExtractComponent for BloomSettings {
type Data = (&'static Self, &'static Camera);
type QueryData = (&'static Self, &'static Camera);
type Filter = ();
type QueryFilter = ();
type Out = (Self, BloomUniforms);
fn extract_component((settings, camera): QueryItem<'_, Self::Data>) -> Option<Self::Out> {
fn extract_component((settings, camera): QueryItem<'_, Self::QueryData>) -> Option<Self::Out> {
match (
camera.physical_viewport_rect(),
camera.physical_viewport_size(),

View file

@ -77,11 +77,11 @@ pub struct CASUniform {
}
impl ExtractComponent for ContrastAdaptiveSharpeningSettings {
type Data = &'static Self;
type Filter = With<Camera>;
type QueryData = &'static Self;
type QueryFilter = With<Camera>;
type Out = (DenoiseCAS, CASUniform);
fn extract_component(item: QueryItem<Self::Data>) -> Option<Self::Out> {
fn extract_component(item: QueryItem<Self::QueryData>) -> Option<Self::Out> {
if !item.enabled || item.sharpening_strength == 0.0 {
return None;
}

View file

@ -20,7 +20,7 @@ use super::AlphaMask3d;
#[derive(Default)]
pub struct MainOpaquePass3dNode;
impl ViewNode for MainOpaquePass3dNode {
type ViewData = (
type ViewQuery = (
&'static ExtractedCamera,
&'static RenderPhase<Opaque3d>,
&'static RenderPhase<AlphaMask3d>,
@ -44,7 +44,7 @@ impl ViewNode for MainOpaquePass3dNode {
skybox_pipeline,
skybox_bind_group,
view_uniform_offset,
): QueryItem<Self::ViewData>,
): QueryItem<Self::ViewQuery>,
world: &World,
) -> Result<(), NodeRunError> {
// Run the opaque pass, sorted front-to-back

View file

@ -18,7 +18,7 @@ use std::ops::Range;
pub struct MainTransmissivePass3dNode;
impl ViewNode for MainTransmissivePass3dNode {
type ViewData = (
type ViewQuery = (
&'static ExtractedCamera,
&'static Camera3d,
&'static RenderPhase<Transmissive3d>,
@ -32,7 +32,7 @@ impl ViewNode for MainTransmissivePass3dNode {
graph: &mut RenderGraphContext,
render_context: &mut RenderContext,
(camera, camera_3d, transmissive_phase, target, transmission, depth): QueryItem<
Self::ViewData,
Self::ViewQuery,
>,
world: &World,
) -> Result<(), NodeRunError> {

View file

@ -16,7 +16,7 @@ use bevy_utils::tracing::info_span;
pub struct MainTransparentPass3dNode;
impl ViewNode for MainTransparentPass3dNode {
type ViewData = (
type ViewQuery = (
&'static ExtractedCamera,
&'static RenderPhase<Transparent3d>,
&'static ViewTarget,
@ -26,7 +26,7 @@ impl ViewNode for MainTransparentPass3dNode {
&self,
graph: &mut RenderGraphContext,
render_context: &mut RenderContext,
(camera, transparent_phase, target, depth): QueryItem<Self::ViewData>,
(camera, transparent_phase, target, depth): QueryItem<Self::ViewQuery>,
world: &World,
) -> Result<(), NodeRunError> {
let view_entity = graph.view_entity();

View file

@ -61,7 +61,7 @@ impl CopyDeferredLightingIdNode {
}
impl ViewNode for CopyDeferredLightingIdNode {
type ViewData = (
type ViewQuery = (
&'static ViewTarget,
&'static ViewPrepassTextures,
&'static DeferredLightingIdDepthTexture,
@ -72,7 +72,7 @@ impl ViewNode for CopyDeferredLightingIdNode {
_graph: &mut RenderGraphContext,
render_context: &mut RenderContext,
(_view_target, view_prepass_textures, deferred_lighting_id_depth_texture): QueryItem<
Self::ViewData,
Self::ViewQuery,
>,
world: &World,
) -> Result<(), NodeRunError> {

View file

@ -26,7 +26,7 @@ use super::{AlphaMask3dDeferred, Opaque3dDeferred};
pub struct DeferredGBufferPrepassNode;
impl ViewNode for DeferredGBufferPrepassNode {
type ViewData = (
type ViewQuery = (
&'static ExtractedCamera,
&'static RenderPhase<Opaque3dDeferred>,
&'static RenderPhase<AlphaMask3dDeferred>,
@ -44,7 +44,7 @@ impl ViewNode for DeferredGBufferPrepassNode {
alpha_mask_deferred_phase,
view_depth_texture,
view_prepass_textures,
): QueryItem<Self::ViewData>,
): QueryItem<Self::ViewQuery>,
world: &World,
) -> Result<(), NodeRunError> {
let view_entity = graph.view_entity();

View file

@ -20,7 +20,7 @@ pub struct FxaaNode {
}
impl ViewNode for FxaaNode {
type ViewData = (
type ViewQuery = (
&'static ViewTarget,
&'static CameraFxaaPipeline,
&'static Fxaa,
@ -30,7 +30,7 @@ impl ViewNode for FxaaNode {
&self,
_graph: &mut RenderGraphContext,
render_context: &mut RenderContext,
(target, pipeline, fxaa): QueryItem<Self::ViewData>,
(target, pipeline, fxaa): QueryItem<Self::ViewQuery>,
world: &World,
) -> Result<(), NodeRunError> {
let pipeline_cache = world.resource::<PipelineCache>();

View file

@ -22,7 +22,7 @@ use super::{AlphaMask3dPrepass, DeferredPrepass, Opaque3dPrepass, ViewPrepassTex
pub struct PrepassNode;
impl ViewNode for PrepassNode {
type ViewData = (
type ViewQuery = (
&'static ExtractedCamera,
&'static RenderPhase<Opaque3dPrepass>,
&'static RenderPhase<AlphaMask3dPrepass>,
@ -42,7 +42,7 @@ impl ViewNode for PrepassNode {
view_depth_texture,
view_prepass_textures,
deferred_prepass,
): QueryItem<Self::ViewData>,
): QueryItem<Self::ViewQuery>,
world: &World,
) -> Result<(), NodeRunError> {
let view_entity = graph.view_entity();

View file

@ -80,12 +80,12 @@ pub struct Skybox {
}
impl ExtractComponent for Skybox {
type Data = (&'static Self, Option<&'static ExposureSettings>);
type Filter = ();
type QueryData = (&'static Self, Option<&'static ExposureSettings>);
type QueryFilter = ();
type Out = (Self, SkyboxUniforms);
fn extract_component(
(skybox, exposure_settings): QueryItem<'_, Self::Data>,
(skybox, exposure_settings): QueryItem<'_, Self::QueryData>,
) -> Option<Self::Out> {
let exposure = exposure_settings
.map(|e| e.exposure())

View file

@ -168,7 +168,7 @@ impl Default for TemporalAntiAliasSettings {
pub struct TemporalAntiAliasNode;
impl ViewNode for TemporalAntiAliasNode {
type ViewData = (
type ViewQuery = (
&'static ExtractedCamera,
&'static ViewTarget,
&'static TemporalAntiAliasHistoryTextures,
@ -181,7 +181,7 @@ impl ViewNode for TemporalAntiAliasNode {
_graph: &mut RenderGraphContext,
render_context: &mut RenderContext,
(camera, view_target, taa_history_textures, prepass_textures, taa_pipeline_id): QueryItem<
Self::ViewData,
Self::ViewQuery,
>,
world: &World,
) -> Result<(), NodeRunError> {

View file

@ -24,7 +24,7 @@ pub struct TonemappingNode {
}
impl ViewNode for TonemappingNode {
type ViewData = (
type ViewQuery = (
&'static ViewUniformOffset,
&'static ViewTarget,
&'static ViewTonemappingPipeline,
@ -36,7 +36,7 @@ impl ViewNode for TonemappingNode {
_graph: &mut RenderGraphContext,
render_context: &mut RenderContext,
(view_uniform_offset, target, view_tonemapping_pipeline, tonemapping): QueryItem<
Self::ViewData,
Self::ViewQuery,
>,
world: &World,
) -> Result<(), NodeRunError> {

View file

@ -18,7 +18,7 @@ pub struct UpscalingNode {
}
impl ViewNode for UpscalingNode {
type ViewData = (
type ViewQuery = (
&'static ViewTarget,
&'static ViewUpscalingPipeline,
Option<&'static ExtractedCamera>,
@ -28,7 +28,7 @@ impl ViewNode for UpscalingNode {
&self,
_graph: &mut RenderGraphContext,
render_context: &mut RenderContext,
(target, upscaling_target, camera): QueryItem<Self::ViewData>,
(target, upscaling_target, camera): QueryItem<Self::ViewQuery>,
world: &World,
) -> Result<(), NodeRunError> {
let pipeline_cache = world.get_resource::<PipelineCache>().unwrap();

View file

@ -343,14 +343,14 @@ fn prepare_line_gizmo_bind_group(
struct SetLineGizmoBindGroup<const I: usize>;
impl<const I: usize, P: PhaseItem> RenderCommand<P> for SetLineGizmoBindGroup<I> {
type Param = SRes<LineGizmoUniformBindgroup>;
type ViewData = ();
type ItemData = Read<DynamicUniformIndex<LineGizmoUniform>>;
type ViewQuery = ();
type ItemQuery = Read<DynamicUniformIndex<LineGizmoUniform>>;
#[inline]
fn render<'w>(
_item: &P,
_view: ROQueryItem<'w, Self::ViewData>,
uniform_index: ROQueryItem<'w, Self::ItemData>,
_view: ROQueryItem<'w, Self::ViewQuery>,
uniform_index: ROQueryItem<'w, Self::ItemQuery>,
bind_group: SystemParamItem<'w, '_, Self::Param>,
pass: &mut TrackedRenderPass<'w>,
) -> RenderCommandResult {
@ -366,14 +366,14 @@ impl<const I: usize, P: PhaseItem> RenderCommand<P> for SetLineGizmoBindGroup<I>
struct DrawLineGizmo;
impl<P: PhaseItem> RenderCommand<P> for DrawLineGizmo {
type Param = SRes<RenderAssets<LineGizmo>>;
type ViewData = ();
type ItemData = Read<Handle<LineGizmo>>;
type ViewQuery = ();
type ItemQuery = Read<Handle<LineGizmo>>;
#[inline]
fn render<'w>(
_item: &P,
_view: ROQueryItem<'w, Self::ViewData>,
handle: ROQueryItem<'w, Self::ItemData>,
_view: ROQueryItem<'w, Self::ViewQuery>,
handle: ROQueryItem<'w, Self::ItemQuery>,
line_gizmos: SystemParamItem<'w, '_, Self::Param>,
pass: &mut TrackedRenderPass<'w>,
) -> RenderCommandResult {

View file

@ -142,7 +142,7 @@ pub const DEFERRED_LIGHTING_PASS: &str = "deferred_opaque_pbr_lighting_pass_3d";
pub struct DeferredOpaquePass3dPbrLightingNode;
impl ViewNode for DeferredOpaquePass3dPbrLightingNode {
type ViewData = (
type ViewQuery = (
&'static ViewUniformOffset,
&'static ViewLightsUniformOffset,
&'static ViewFogUniformOffset,
@ -166,7 +166,7 @@ impl ViewNode for DeferredOpaquePass3dPbrLightingNode {
target,
deferred_lighting_id_depth_texture,
deferred_lighting_pipeline,
): QueryItem<Self::ViewData>,
): QueryItem<Self::ViewQuery>,
world: &World,
) -> Result<(), NodeRunError> {
let pipeline_cache = world.resource::<PipelineCache>();

View file

@ -185,11 +185,11 @@ pub(crate) enum RenderViewBindGroupEntries<'a> {
}
impl ExtractInstance for EnvironmentMapIds {
type Data = Read<EnvironmentMapLight>;
type QueryData = Read<EnvironmentMapLight>;
type Filter = ();
type QueryFilter = ();
fn extract(item: QueryItem<'_, Self::Data>) -> Option<Self> {
fn extract(item: QueryItem<'_, Self::QueryData>) -> Option<Self> {
Some(EnvironmentMapIds {
diffuse: item.diffuse_map.id(),
specular: item.specular_map.id(),

View file

@ -379,8 +379,8 @@ type DrawMaterial<M> = (
pub struct SetMaterialBindGroup<M: Material, const I: usize>(PhantomData<M>);
impl<P: PhaseItem, M: Material, const I: usize> RenderCommand<P> for SetMaterialBindGroup<M, I> {
type Param = (SRes<RenderMaterials<M>>, SRes<RenderMaterialInstances<M>>);
type ViewData = ();
type ItemData = ();
type ViewQuery = ();
type ItemQuery = ();
#[inline]
fn render<'w>(

View file

@ -895,11 +895,11 @@ pub fn queue_prepass_material_meshes<M: Material>(
pub struct SetPrepassViewBindGroup<const I: usize>;
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetPrepassViewBindGroup<I> {
type Param = SRes<PrepassViewBindGroup>;
type ViewData = (
type ViewQuery = (
Read<ViewUniformOffset>,
Option<Read<PreviousViewProjectionUniformOffset>>,
);
type ItemData = ();
type ItemQuery = ();
#[inline]
fn render<'w>(

View file

@ -1043,21 +1043,21 @@ pub fn prepare_mesh_bind_group(
pub struct SetMeshViewBindGroup<const I: usize>;
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMeshViewBindGroup<I> {
type Param = ();
type ViewData = (
type ViewQuery = (
Read<ViewUniformOffset>,
Read<ViewLightsUniformOffset>,
Read<ViewFogUniformOffset>,
Read<ViewLightProbesUniformOffset>,
Read<MeshViewBindGroup>,
);
type ItemData = ();
type ItemQuery = ();
#[inline]
fn render<'w>(
_item: &P,
(view_uniform, view_lights, view_fog, view_light_probes, mesh_view_bind_group): ROQueryItem<
'w,
Self::ViewData,
Self::ViewQuery,
>,
_entity: (),
_: SystemParamItem<'w, '_, Self::Param>,
@ -1087,8 +1087,8 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMeshBindGroup<I> {
SRes<MorphIndices>,
SRes<RenderLightmaps>,
);
type ViewData = ();
type ItemData = ();
type ViewQuery = ();
type ItemQuery = ();
#[inline]
fn render<'w>(
@ -1157,8 +1157,8 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMeshBindGroup<I> {
pub struct DrawMesh;
impl<P: PhaseItem> RenderCommand<P> for DrawMesh {
type Param = (SRes<RenderAssets<Mesh>>, SRes<RenderMeshInstances>);
type ViewData = ();
type ItemData = ();
type ViewQuery = ();
type ItemQuery = ();
#[inline]
fn render<'w>(
item: &P,

View file

@ -199,7 +199,7 @@ impl ScreenSpaceAmbientOcclusionQualityLevel {
struct SsaoNode {}
impl ViewNode for SsaoNode {
type ViewData = (
type ViewQuery = (
&'static ExtractedCamera,
&'static SsaoPipelineId,
&'static SsaoBindGroups,
@ -210,7 +210,7 @@ impl ViewNode for SsaoNode {
&self,
_graph: &mut RenderGraphContext,
render_context: &mut RenderContext,
(camera, pipeline_id, bind_groups, view_uniform_offset): QueryItem<Self::ViewData>,
(camera, pipeline_id, bind_groups, view_uniform_offset): QueryItem<Self::ViewQuery>,
world: &World,
) -> Result<(), NodeRunError> {
let pipelines = world.resource::<SsaoPipelines>();

View file

@ -38,12 +38,12 @@ pub fn derive_extract_component(input: TokenStream) -> TokenStream {
TokenStream::from(quote! {
impl #impl_generics #bevy_render_path::extract_component::ExtractComponent for #struct_name #type_generics #where_clause {
type Data = &'static Self;
type QueryData = &'static Self;
type Filter = #filter;
type QueryFilter = #filter;
type Out = Self;
fn extract_component(item: #bevy_ecs_path::query::QueryItem<'_, Self::Data>) -> Option<Self::Out> {
fn extract_component(item: #bevy_ecs_path::query::QueryItem<'_, Self::QueryData>) -> Option<Self::Out> {
Some(item.clone())
}
}

View file

@ -36,9 +36,9 @@ impl<C: Component> DynamicUniformIndex<C> {
/// in the [`ExtractSchedule`] step.
pub trait ExtractComponent: Component {
/// ECS [`ReadOnlyQueryData`] to fetch the components to extract.
type Data: ReadOnlyQueryData;
type QueryData: ReadOnlyQueryData;
/// Filters the entities with additional constraints.
type Filter: QueryFilter;
type QueryFilter: QueryFilter;
/// The output from extraction.
///
@ -58,7 +58,7 @@ pub trait ExtractComponent: Component {
// type Out: Component = Self;
/// Defines how the component is transferred into the "render world".
fn extract_component(item: QueryItem<'_, Self::Data>) -> Option<Self::Out>;
fn extract_component(item: QueryItem<'_, Self::QueryData>) -> Option<Self::Out>;
}
/// This plugin prepares the components of the corresponding type for the GPU
@ -195,12 +195,12 @@ impl<C: ExtractComponent> Plugin for ExtractComponentPlugin<C> {
}
impl<T: Asset> ExtractComponent for Handle<T> {
type Data = Read<Handle<T>>;
type Filter = ();
type QueryData = Read<Handle<T>>;
type QueryFilter = ();
type Out = Handle<T>;
#[inline]
fn extract_component(handle: QueryItem<'_, Self::Data>) -> Option<Self::Out> {
fn extract_component(handle: QueryItem<'_, Self::QueryData>) -> Option<Self::Out> {
Some(handle.clone_weak())
}
}
@ -209,7 +209,7 @@ impl<T: Asset> ExtractComponent for Handle<T> {
fn extract_components<C: ExtractComponent>(
mut commands: Commands,
mut previous_len: Local<usize>,
query: Extract<Query<(Entity, C::Data), C::Filter>>,
query: Extract<Query<(Entity, C::QueryData), C::QueryFilter>>,
) {
let mut values = Vec::with_capacity(*previous_len);
for (entity, query_item) in &query {
@ -225,7 +225,7 @@ fn extract_components<C: ExtractComponent>(
fn extract_visible_components<C: ExtractComponent>(
mut commands: Commands,
mut previous_len: Local<usize>,
query: Extract<Query<(Entity, &ViewVisibility, C::Data), C::Filter>>,
query: Extract<Query<(Entity, &ViewVisibility, C::QueryData), C::QueryFilter>>,
) {
let mut values = Vec::with_capacity(*previous_len);
for (entity, view_visibility, query_item) in &query {

View file

@ -29,12 +29,12 @@ use crate::{prelude::ViewVisibility, Extract, ExtractSchedule, RenderApp};
/// higher-performance because it avoids the ECS overhead.
pub trait ExtractInstance: Send + Sync + Sized + 'static {
/// ECS [`ReadOnlyQueryData`] to fetch the components to extract.
type Data: ReadOnlyQueryData;
type QueryData: ReadOnlyQueryData;
/// Filters the entities with additional constraints.
type Filter: QueryFilter;
type QueryFilter: QueryFilter;
/// Defines how the component is transferred into the "render world".
fn extract(item: QueryItem<'_, Self::Data>) -> Option<Self>;
fn extract(item: QueryItem<'_, Self::QueryData>) -> Option<Self>;
}
/// This plugin extracts one or more components into the "render world" as
@ -107,7 +107,7 @@ where
fn extract_all<EI>(
mut extracted_instances: ResMut<ExtractedInstances<EI>>,
query: Extract<Query<(Entity, EI::Data), EI::Filter>>,
query: Extract<Query<(Entity, EI::QueryData), EI::QueryFilter>>,
) where
EI: ExtractInstance,
{
@ -121,7 +121,7 @@ fn extract_all<EI>(
fn extract_visible<EI>(
mut extracted_instances: ResMut<ExtractedInstances<EI>>,
query: Extract<Query<(Entity, &ViewVisibility, EI::Data), EI::Filter>>,
query: Extract<Query<(Entity, &ViewVisibility, EI::QueryData), EI::QueryFilter>>,
) where
EI: ExtractInstance,
{
@ -139,10 +139,10 @@ impl<A> ExtractInstance for AssetId<A>
where
A: Asset,
{
type Data = Read<Handle<A>>;
type Filter = ();
type QueryData = Read<Handle<A>>;
type QueryFilter = ();
fn extract(item: QueryItem<'_, Self::Data>) -> Option<Self> {
fn extract(item: QueryItem<'_, Self::QueryData>) -> Option<Self> {
Some(item.id())
}
}

View file

@ -342,7 +342,7 @@ impl Node for RunGraphOnViewNode {
pub trait ViewNode {
/// The query that will be used on the view entity.
/// It is guaranteed to run on the view entity, so there's no need for a filter
type ViewData: ReadOnlyQueryData;
type ViewQuery: ReadOnlyQueryData;
/// Updates internal node state using the current render [`World`] prior to the run method.
fn update(&mut self, _world: &mut World) {}
@ -354,7 +354,7 @@ pub trait ViewNode {
&self,
graph: &mut RenderGraphContext,
render_context: &mut RenderContext,
view_query: QueryItem<Self::ViewData>,
view_query: QueryItem<Self::ViewQuery>,
world: &World,
) -> Result<(), NodeRunError>;
}
@ -364,7 +364,7 @@ pub trait ViewNode {
///
/// This [`Node`] exists to help reduce boilerplate when making a render node that runs on a view.
pub struct ViewNodeRunner<N: ViewNode> {
view_query: QueryState<N::ViewData>,
view_query: QueryState<N::ViewQuery>,
node: N,
}

View file

@ -142,8 +142,8 @@ impl<P: PhaseItem> DrawFunctions<P> {
/// Compared to the draw function the required ECS data is fetched automatically
/// (by the [`RenderCommandState`]) from the render world.
/// Therefore the three types [`Param`](RenderCommand::Param),
/// [`ViewData`](RenderCommand::ViewData) and
/// [`ItemData`](RenderCommand::ItemData) are used.
/// [`ViewQuery`](RenderCommand::ViewQuery) and
/// [`ItemQuery`](RenderCommand::ItemQuery) are used.
/// They specify which information is required to execute the render command.
///
/// Multiple render commands can be combined together by wrapping them in a tuple.
@ -185,19 +185,19 @@ pub trait RenderCommand<P: PhaseItem> {
/// The view entity refers to the camera, or shadow-casting light, etc. from which the phase
/// item will be rendered from.
/// All components have to be accessed read only.
type ViewData: ReadOnlyQueryData;
type ViewQuery: ReadOnlyQueryData;
/// Specifies the ECS data of the item entity required by [`RenderCommand::render`].
///
/// The item is the entity that will be rendered for the corresponding view.
/// All components have to be accessed read only.
type ItemData: ReadOnlyQueryData;
type ItemQuery: ReadOnlyQueryData;
/// Renders a [`PhaseItem`] by recording commands (e.g. setting pipelines, binding bind groups,
/// issuing draw calls, etc.) via the [`TrackedRenderPass`].
fn render<'w>(
item: &P,
view: ROQueryItem<'w, Self::ViewData>,
entity: ROQueryItem<'w, Self::ItemData>,
view: ROQueryItem<'w, Self::ViewQuery>,
entity: ROQueryItem<'w, Self::ItemQuery>,
param: SystemParamItem<'w, '_, Self::Param>,
pass: &mut TrackedRenderPass<'w>,
) -> RenderCommandResult;
@ -213,14 +213,14 @@ macro_rules! render_command_tuple_impl {
($(($name: ident, $view: ident, $entity: ident)),*) => {
impl<P: PhaseItem, $($name: RenderCommand<P>),*> RenderCommand<P> for ($($name,)*) {
type Param = ($($name::Param,)*);
type ViewData = ($($name::ViewData,)*);
type ItemData = ($($name::ItemData,)*);
type ViewQuery = ($($name::ViewQuery,)*);
type ItemQuery = ($($name::ItemQuery,)*);
#[allow(non_snake_case)]
fn render<'w>(
_item: &P,
($($view,)*): ROQueryItem<'w, Self::ViewData>,
($($entity,)*): ROQueryItem<'w, Self::ItemData>,
($($view,)*): ROQueryItem<'w, Self::ViewQuery>,
($($entity,)*): ROQueryItem<'w, Self::ItemQuery>,
($($name,)*): SystemParamItem<'w, '_, Self::Param>,
_pass: &mut TrackedRenderPass<'w>,
) -> RenderCommandResult {
@ -237,12 +237,12 @@ all_tuples!(render_command_tuple_impl, 0, 15, C, V, E);
/// Wraps a [`RenderCommand`] into a state so that it can be used as a [`Draw`] function.
///
/// The [`RenderCommand::Param`], [`RenderCommand::ViewData`] and
/// [`RenderCommand::ItemData`] are fetched from the ECS and passed to the command.
/// The [`RenderCommand::Param`], [`RenderCommand::ViewQuery`] and
/// [`RenderCommand::ItemQuery`] are fetched from the ECS and passed to the command.
pub struct RenderCommandState<P: PhaseItem + 'static, C: RenderCommand<P>> {
state: SystemState<C::Param>,
view: QueryState<C::ViewData>,
entity: QueryState<C::ItemData>,
view: QueryState<C::ViewQuery>,
entity: QueryState<C::ItemQuery>,
}
impl<P: PhaseItem, C: RenderCommand<P>> RenderCommandState<P, C> {

View file

@ -196,8 +196,8 @@ pub struct SetItemPipeline;
impl<P: CachedRenderPipelinePhaseItem> RenderCommand<P> for SetItemPipeline {
type Param = SRes<PipelineCache>;
type ViewData = ();
type ItemData = ();
type ViewQuery = ();
type ItemQuery = ();
#[inline]
fn render<'w>(
item: &P,

View file

@ -330,8 +330,8 @@ impl<P: PhaseItem, M: Material2d, const I: usize> RenderCommand<P>
SRes<RenderMaterials2d<M>>,
SRes<RenderMaterial2dInstances<M>>,
);
type ViewData = ();
type ItemData = ();
type ViewQuery = ();
type ItemQuery = ();
#[inline]
fn render<'w>(

View file

@ -613,13 +613,13 @@ pub fn prepare_mesh2d_view_bind_groups(
pub struct SetMesh2dViewBindGroup<const I: usize>;
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMesh2dViewBindGroup<I> {
type Param = ();
type ViewData = (Read<ViewUniformOffset>, Read<Mesh2dViewBindGroup>);
type ItemData = ();
type ViewQuery = (Read<ViewUniformOffset>, Read<Mesh2dViewBindGroup>);
type ItemQuery = ();
#[inline]
fn render<'w>(
_item: &P,
(view_uniform, mesh2d_view_bind_group): ROQueryItem<'w, Self::ViewData>,
(view_uniform, mesh2d_view_bind_group): ROQueryItem<'w, Self::ViewQuery>,
_view: (),
_param: SystemParamItem<'w, '_, Self::Param>,
pass: &mut TrackedRenderPass<'w>,
@ -633,8 +633,8 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMesh2dViewBindGroup<I
pub struct SetMesh2dBindGroup<const I: usize>;
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMesh2dBindGroup<I> {
type Param = SRes<Mesh2dBindGroup>;
type ViewData = ();
type ItemData = ();
type ViewQuery = ();
type ItemQuery = ();
#[inline]
fn render<'w>(
@ -662,8 +662,8 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMesh2dBindGroup<I> {
pub struct DrawMesh2d;
impl<P: PhaseItem> RenderCommand<P> for DrawMesh2d {
type Param = (SRes<RenderAssets<Mesh>>, SRes<RenderMesh2dInstances>);
type ViewData = ();
type ItemData = ();
type ViewQuery = ();
type ItemQuery = ();
#[inline]
fn render<'w>(

View file

@ -734,8 +734,8 @@ pub type DrawSprite = (
pub struct SetSpriteViewBindGroup<const I: usize>;
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetSpriteViewBindGroup<I> {
type Param = SRes<SpriteMeta>;
type ViewData = Read<ViewUniformOffset>;
type ItemData = ();
type ViewQuery = Read<ViewUniformOffset>;
type ItemQuery = ();
fn render<'w>(
_item: &P,
@ -755,8 +755,8 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetSpriteViewBindGroup<I
pub struct SetSpriteTextureBindGroup<const I: usize>;
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetSpriteTextureBindGroup<I> {
type Param = SRes<ImageBindGroups>;
type ViewData = ();
type ItemData = Read<SpriteBatch>;
type ViewQuery = ();
type ItemQuery = Read<SpriteBatch>;
fn render<'w>(
_item: &P,
@ -782,8 +782,8 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetSpriteTextureBindGrou
pub struct DrawSpriteBatch;
impl<P: PhaseItem> RenderCommand<P> for DrawSpriteBatch {
type Param = SRes<SpriteMeta>;
type ViewData = ();
type ItemData = Read<SpriteBatch>;
type ViewQuery = ();
type ItemQuery = Read<SpriteBatch>;
fn render<'w>(
_item: &P,

View file

@ -155,8 +155,8 @@ pub type DrawUi = (
pub struct SetUiViewBindGroup<const I: usize>;
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetUiViewBindGroup<I> {
type Param = SRes<UiMeta>;
type ViewData = Read<ViewUniformOffset>;
type ItemData = ();
type ViewQuery = Read<ViewUniformOffset>;
type ItemQuery = ();
fn render<'w>(
_item: &P,
@ -176,8 +176,8 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetUiViewBindGroup<I> {
pub struct SetUiTextureBindGroup<const I: usize>;
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetUiTextureBindGroup<I> {
type Param = SRes<UiImageBindGroups>;
type ViewData = ();
type ItemData = Read<UiBatch>;
type ViewQuery = ();
type ItemQuery = Read<UiBatch>;
#[inline]
fn render<'w>(
@ -195,8 +195,8 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetUiTextureBindGroup<I>
pub struct DrawUiNode;
impl<P: PhaseItem> RenderCommand<P> for DrawUiNode {
type Param = SRes<UiMeta>;
type ViewData = ();
type ItemData = Read<UiBatch>;
type ViewQuery = ();
type ItemQuery = Read<UiBatch>;
#[inline]
fn render<'w>(

View file

@ -263,8 +263,8 @@ pub type DrawUiMaterial<M> = (
pub struct SetMatUiViewBindGroup<M: UiMaterial, const I: usize>(PhantomData<M>);
impl<P: PhaseItem, M: UiMaterial, const I: usize> RenderCommand<P> for SetMatUiViewBindGroup<M, I> {
type Param = SRes<UiMaterialMeta<M>>;
type ViewData = Read<ViewUniformOffset>;
type ItemData = ();
type ViewQuery = Read<ViewUniformOffset>;
type ItemQuery = ();
fn render<'w>(
_item: &P,
@ -287,13 +287,13 @@ impl<P: PhaseItem, M: UiMaterial, const I: usize> RenderCommand<P>
for SetUiMaterialBindGroup<M, I>
{
type Param = SRes<RenderUiMaterials<M>>;
type ViewData = ();
type ItemData = Read<UiMaterialBatch<M>>;
type ViewQuery = ();
type ItemQuery = Read<UiMaterialBatch<M>>;
fn render<'w>(
_item: &P,
_view: (),
material_handle: ROQueryItem<'_, Self::ItemData>,
material_handle: ROQueryItem<'_, Self::ItemQuery>,
materials: SystemParamItem<'w, '_, Self::Param>,
pass: &mut TrackedRenderPass<'w>,
) -> RenderCommandResult {
@ -308,8 +308,8 @@ impl<P: PhaseItem, M: UiMaterial, const I: usize> RenderCommand<P>
pub struct DrawUiMaterialNode<M>(PhantomData<M>);
impl<P: PhaseItem, M: UiMaterial> RenderCommand<P> for DrawUiMaterialNode<M> {
type Param = SRes<UiMaterialMeta<M>>;
type ViewData = ();
type ItemData = Read<UiMaterialBatch<M>>;
type ViewQuery = ();
type ItemQuery = Read<UiMaterialBatch<M>>;
#[inline]
fn render<'w>(

View file

@ -116,7 +116,7 @@ impl ViewNode for PostProcessNode {
// but it's not a normal system so we need to define it manually.
//
// This query will only run on the view entity
type ViewData = (
type ViewQuery = (
&'static ViewTarget,
// This makes sure the node only runs on cameras with the PostProcessSettings component
&'static PostProcessSettings,
@ -133,7 +133,7 @@ impl ViewNode for PostProcessNode {
&self,
_graph: &mut RenderGraphContext,
render_context: &mut RenderContext,
(view_target, _post_process_settings): QueryItem<Self::ViewData>,
(view_target, _post_process_settings): QueryItem<Self::ViewQuery>,
world: &World,
) -> Result<(), NodeRunError> {
// Get the pipeline resource that contains the global data we need

View file

@ -68,11 +68,11 @@ fn setup(mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>) {
struct InstanceMaterialData(Vec<InstanceData>);
impl ExtractComponent for InstanceMaterialData {
type Data = &'static InstanceMaterialData;
type Filter = ();
type QueryData = &'static InstanceMaterialData;
type QueryFilter = ();
type Out = Self;
fn extract_component(item: QueryItem<'_, Self::Data>) -> Option<Self> {
fn extract_component(item: QueryItem<'_, Self::QueryData>) -> Option<Self> {
Some(InstanceMaterialData(item.0.clone()))
}
}
@ -237,8 +237,8 @@ pub struct DrawMeshInstanced;
impl<P: PhaseItem> RenderCommand<P> for DrawMeshInstanced {
type Param = (SRes<RenderAssets<Mesh>>, SRes<RenderMeshInstances>);
type ViewData = ();
type ItemData = Read<InstanceBuffer>;
type ViewQuery = ();
type ItemQuery = Read<InstanceBuffer>;
#[inline]
fn render<'w>(