bevy/crates/bevy_core_pipeline/src
Alice Cecile a7e9330af9
Implement WorldQuery for MainWorld and RenderWorld components (#15745)
# Objective

#15320 is a particularly painful breaking change, and the new
`RenderEntity` in particular is very noisy, with a lot of `let entity =
entity.id()` spam.

## Solution

Implement `WorldQuery`, `QueryData` and `ReadOnlyQueryData` for
`RenderEntity` and `WorldEntity`.

These work the same as the `Entity` impls from a user-facing
perspective: they simply return an owned (copied) `Entity` identifier.
This dramatically reduces noise and eases migration.

Under the hood, these impls defer to the implementations for `&T` for
everything other than the "call .id() for the user" bit, as they involve
read-only access to component data. Doing it this way (as opposed to
implementing a custom fetch, as tried in the first commit) dramatically
reduces the maintenance risk of complex unsafe code outside of
`bevy_ecs`.

To make this easier (and encourage users to do this themselves!), I've
made `ReadFetch` and `WriteFetch` slightly more public: they're no
longer `doc(hidden)`. This is a good change, since trying to vendor the
logic is much worse than just deferring to the existing tested impls.

## Testing

I've run a handful of rendering examples (breakout, alien_cake_addict,
auto_exposure, fog_volumes, box_shadow) and nothing broke.

## Follow-up

We should lint for the uses of `&RenderEntity` and `&MainEntity` in
queries: this is just less nice for no reason.

---------

Co-authored-by: Trashtalk217 <trashtalk217@gmail.com>
2024-10-13 20:58:46 +00:00
..
auto_exposure Implement WorldQuery for MainWorld and RenderWorld components (#15745) 2024-10-13 20:58:46 +00:00
blit Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bloom fix: Skip some rendering logics when the viewport width or height is zero (#15654) 2024-10-08 22:52:19 +00:00
contrast_adaptive_sharpening Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00
core_2d Implement WorldQuery for MainWorld and RenderWorld components (#15745) 2024-10-13 20:58:46 +00:00
core_3d Implement WorldQuery for MainWorld and RenderWorld components (#15745) 2024-10-13 20:58:46 +00:00
deferred Type safe retained render world (#15756) 2024-10-10 18:47:04 +00:00
dof Implement WorldQuery for MainWorld and RenderWorld components (#15745) 2024-10-13 20:58:46 +00:00
fullscreen_vertex_shader Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
fxaa Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00
motion_blur Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
oit Fix OIT shaders error with DX12 backend (#15782) 2024-10-10 14:17:09 +00:00
post_process Start a built-in postprocessing stack, and implement chromatic aberration in it. (#13695) 2024-07-15 13:59:02 +00:00
prepass Type safe retained render world (#15756) 2024-10-10 18:47:04 +00:00
skybox Allow to expect (adopted) (#15301) 2024-09-20 19:16:42 +00:00
smaa Rename rendering components for improved consistency and clarity (#15035) 2024-09-10 01:11:46 +00:00
taa Implement WorldQuery for MainWorld and RenderWorld components (#15745) 2024-10-13 20:58:46 +00:00
tonemapping Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
upscaling Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00
lib.rs Fix oit webgl (#15728) 2024-10-08 14:50:35 +00:00
msaa_writeback.rs Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00