Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
AssetChanged
query filter (#16810)
# Objective Implement a new `AssetChanged` query filter that allows users to query for entities whose related assets may have changed. - Closes #5069 - Unblocks #16420. Currently, `cold-specialization`, a key rendering optimization for unlocking ancillary benefits of the retained render world, is blocked on being unable detect all scenarios in which an entity's mesh/material changes using events and observers. An `AssetChanged` filter will drastically simplify our implementation and be more robust to future changes. Originally implemented by @nicopap in #5080. ## Solution - Adds a new `AssetChanged` query filter that initializes a `AssetChanges<A>` resource that tracks changed assets and ticks in `asset_events`. - ~Reverts #13343 and changes the api of `get_state` to accept `impl Into<UnsafeWorldCell<'w>>` to allow accessing the `AssetChanges<A>` resource.~ - Adds a `AsAssetId` trait used for newtype handle wrappers (e.g. `Mesh3d`) that allows associating a component with the underlying `Asset` it represents. ## Testing - Tests are added for `AssetChanged`. - TBD on performance. We are going to add this `Mesh3d` and `MeshMaterial3d` (etc) in the renderer. Long term wins in render performance this unblocks should swamp tracking overhead for any realistic workload. ## Migration Guide - The `asset_events` system is no longer public. Users should order their systems relative to the `AssetEvents` system set. --------- Co-authored-by: Nicola Papale <[email protected]> Co-authored-by: Patrick Walton <[email protected]> Co-authored-by: Alice Cecile <[email protected]> Co-authored-by: Chris Russell <[email protected]>
- Loading branch information