Skip to content

Port to Bevy 0.17#91

Open
hasnocool wants to merge 1 commit intoJonahPlusPlus:masterfrom
hasnocool:bevy-0.17.3-port
Open

Port to Bevy 0.17#91
hasnocool wants to merge 1 commit intoJonahPlusPlus:masterfrom
hasnocool:bevy-0.17.3-port

Conversation

@hasnocool
Copy link
Copy Markdown

Ports bevy_atmosphere to Bevy 0.17 (API + render pipeline updates) and fixes shader/material bind group handling.

Copilot AI review requested due to automatic review settings January 2, 2026 22:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/system_param.rs
Comment on lines +99 to +104
_state: &Self::State,
_meta: &mut SystemMeta,
_access: &mut FilteredAccessSet,
_world: &mut World,
) {
// Access is handled by ResMut<AtmosphereModel>
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
_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);

Copilot uses AI. Check for mistakes.
Comment thread macros/src/model.rs
Comment on lines +168 to +169
|source: String, path: Option<std::borrow::Cow<'static, str>>| {
Shader::from_wgsl(source, path.unwrap_or_default().into_owned())
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
|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)

Copilot uses AI. Check for mistakes.
Comment thread BEVY_0.17_MIGRATION.md
Comment on lines +30 to +37
- Added new `init_access()` method to match Bevy 0.17 API:

```rust
fn init_access(_world: &World) -> Self::InitAccess {
SystemParamInitAccess::null()
}
```

Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
- 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.

Copilot uses AI. Check for mistakes.
Comment thread BEVY_0.17_MIGRATION.md
Comment on lines +54 to +57
### 8. Cargo Features

- Disabled `gradient` and `nishita` models in default features (they depend on internal Bevy shaders)
- Default features now: `["basic"]`
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread BEVY_0.17_MIGRATION.md
Comment on lines +90 to +93
## 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
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread BEVY_0.17_MIGRATION.md
Comment on lines +13 to +14
- Updated `bevy` dependency from `0.16.0` to `0.17.3`
- Added explicit `bevy_mesh` dependency version `0.17`
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread BEVY_0.17_MIGRATION.md

- Changed `Events<UpdatePipeline>` to `Messages<UpdatePipeline>`
- Added `#[derive(Message)]` to `UpdatePipeline` struct
- Updated `EventWriter` to `MessageWriter`
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
- Updated `EventWriter` to `MessageWriter`
- Replaced `EventWriter<AtmosphereUpdateEvent>` system param with `ResMut<Messages<AtmosphereUpdateEvent>>` and now call `.write()` directly on `Messages`

Copilot uses AI. Check for mistakes.
Comment thread src/system_param.rs
Comment on lines +42 to +47
_state: &Self::State,
_meta: &mut SystemMeta,
_access: &mut FilteredAccessSet,
_world: &mut World,
) {
// Access is handled by Res<AtmosphereModel>
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
_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);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants