Conversation
There was a problem hiding this comment.
Pull request overview
This PR ports the bevy_atmosphere plugin from Bevy 0.16 to Bevy 0.17, updating the rendering pipeline, system parameters, and shader handling to match the new API requirements. The port includes fixes for shader bind groups, material implementations, and the events-to-messages migration.
Key changes:
- Updated Bevy dependency to 0.17 and added explicit bevy_mesh dependency
- Migrated from Events to Messages API for render pipeline communication
- Updated SystemParam trait implementations to match Bevy 0.17's split init_state/init_access pattern
- Replaced weak_handle with uuid_handle and updated shader bind group references to use preprocessor variables
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| Cargo.toml | Updated Bevy dependencies to 0.17 and added bevy_mesh, changed default features to include gradient |
| src/system_param.rs | Updated SystemParam implementations with new init_state/init_access API signatures |
| src/skybox.rs | Updated Material trait implementation, changed shader imports and bind group handling |
| src/shaders/skybox.wgsl | Updated bind group references to use #{MATERIAL_BIND_GROUP} preprocessor variable |
| src/plugin.rs | Moved system registration, removed deprecated components, updated to use new plugin lifecycle |
| src/pipeline.rs | Migrated from Events to Messages, updated RenderSet to RenderSystems, improved error handling |
| src/collection/gradient.rs | Implemented manual Atmospheric trait for gradient model with proper bind group handling |
| macros/src/model.rs | Updated handle generation from weak_handle to uuid_handle, updated load_internal_asset usage |
| BEVY_0.17_MIGRATION.md | Added migration documentation describing all changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| _state: &Self::State, | ||
| _meta: &mut SystemMeta, | ||
| _access: &mut FilteredAccessSet, | ||
| _world: &mut World, | ||
| ) { | ||
| // Access is handled by ResMut<AtmosphereModel> |
There was a problem hiding this comment.
The init_access implementation is empty but the comment claims "Access is handled by ResMut". However, for SystemParam implementations in Bevy 0.17, access tracking must be explicitly set up. You should call ResMut::<AtmosphereModel>::init_access(state, _meta, _access, _world) to properly track write access to the AtmosphereModel resource.
| _state: &Self::State, | |
| _meta: &mut SystemMeta, | |
| _access: &mut FilteredAccessSet, | |
| _world: &mut World, | |
| ) { | |
| // Access is handled by ResMut<AtmosphereModel> | |
| state: &Self::State, | |
| meta: &mut SystemMeta, | |
| access: &mut FilteredAccessSet, | |
| world: &mut World, | |
| ) { | |
| ResMut::<AtmosphereModel>::init_access(state, meta, access, world); |
| |source: String, path: Option<std::borrow::Cow<'static, str>>| { | ||
| Shader::from_wgsl(source, path.unwrap_or_default().into_owned()) |
There was a problem hiding this comment.
The load_internal_asset! macro call is using an invalid closure signature. The closure should accept String and return Shader, not take an Option<Cow<'static, str>> parameter. The correct signature for Bevy 0.17 should be Shader::from_wgsl.
| |source: String, path: Option<std::borrow::Cow<'static, str>>| { | |
| Shader::from_wgsl(source, path.unwrap_or_default().into_owned()) | |
| |source: String| { | |
| Shader::from_wgsl(source) |
| - Added new `init_access()` method to match Bevy 0.17 API: | ||
|
|
||
| ```rust | ||
| fn init_access(_world: &World) -> Self::InitAccess { | ||
| SystemParamInitAccess::null() | ||
| } | ||
| ``` | ||
|
|
There was a problem hiding this comment.
The migration document states that the init_access() method implementation uses SystemParamInitAccess::null(), but the actual implementation in the code is different - it's an empty function body with just a comment. The documentation should accurately reflect the actual implementation or the code should be updated to match the documentation.
| - Added new `init_access()` method to match Bevy 0.17 API: | |
| ```rust | |
| fn init_access(_world: &World) -> Self::InitAccess { | |
| SystemParamInitAccess::null() | |
| } | |
| ``` | |
| - Added new `init_access()` method to match Bevy 0.17 API. In this crate, the method is currently implemented with an empty body and a descriptive comment, since no special `SystemParamInitAccess` handling is required. |
| ### 8. Cargo Features | ||
|
|
||
| - Disabled `gradient` and `nishita` models in default features (they depend on internal Bevy shaders) | ||
| - Default features now: `["basic"]` |
There was a problem hiding this comment.
The migration document claims that gradient and nishita models are disabled in default features and that default features are now ["basic"]. However, the actual Cargo.toml shows default features as ["basic", "gradient"], which includes gradient. This inconsistency between documentation and code should be corrected.
| ## Known Limitations | ||
|
|
||
| - Gradient and Nishita atmosphere models are currently disabled due to dependency on Bevy internal shaders | ||
| - These models may need additional work to be compatible with Bevy 0.17's shader system |
There was a problem hiding this comment.
The migration document mentions "Some models (gradient, nishita) still have issues with internal shaders" and later states "Gradient and Nishita atmosphere models are currently disabled". However, the gradient model is actually implemented in the code changes and included in the default features. This documentation is misleading about the actual state of the gradient model.
| - Updated `bevy` dependency from `0.16.0` to `0.17.3` | ||
| - Added explicit `bevy_mesh` dependency version `0.17` |
There was a problem hiding this comment.
The migration document states Bevy was updated from 0.16.0 to 0.17.3, but the actual Cargo.toml uses version "0.17" without a patch version. This documentation should accurately reflect what's in the code.
|
|
||
| - Changed `Events<UpdatePipeline>` to `Messages<UpdatePipeline>` | ||
| - Added `#[derive(Message)]` to `UpdatePipeline` struct | ||
| - Updated `EventWriter` to `MessageWriter` |
There was a problem hiding this comment.
The migration document mentions "Updated EventWriter to MessageWriter", but this isn't accurate. The code actually uses ResMut<Messages<AtmosphereUpdateEvent>> and calls .write() method directly on Messages, rather than using a MessageWriter type. The documentation should accurately describe the actual API changes.
| - Updated `EventWriter` to `MessageWriter` | |
| - Replaced `EventWriter<AtmosphereUpdateEvent>` system param with `ResMut<Messages<AtmosphereUpdateEvent>>` and now call `.write()` directly on `Messages` |
| _state: &Self::State, | ||
| _meta: &mut SystemMeta, | ||
| _access: &mut FilteredAccessSet, | ||
| _world: &mut World, | ||
| ) { | ||
| // Access is handled by Res<AtmosphereModel> |
There was a problem hiding this comment.
The init_access implementation is empty but the comment claims "Access is handled by Res". However, for SystemParam implementations in Bevy 0.17, access tracking must be explicitly set up. You should call Res::<AtmosphereModel>::init_access(state, _meta, _access, _world) to properly track read access to the AtmosphereModel resource.
| _state: &Self::State, | |
| _meta: &mut SystemMeta, | |
| _access: &mut FilteredAccessSet, | |
| _world: &mut World, | |
| ) { | |
| // Access is handled by Res<AtmosphereModel> | |
| state: &Self::State, | |
| meta: &mut SystemMeta, | |
| access: &mut FilteredAccessSet, | |
| world: &mut World, | |
| ) { | |
| Res::<AtmosphereModel>::init_access(state, meta, access, world); |
Ports bevy_atmosphere to Bevy 0.17 (API + render pipeline updates) and fixes shader/material bind group handling.