close
Skip to content

Make items public that are necessary to add custom prepasses in application code.#21962

Merged
mockersf merged 1 commit into
bevyengine:mainfrom
pcwalton:public-prepass-items
Nov 28, 2025
Merged

Make items public that are necessary to add custom prepasses in application code.#21962
mockersf merged 1 commit into
bevyengine:mainfrom
pcwalton:public-prepass-items

Conversation

@pcwalton
Copy link
Copy Markdown
Contributor

@pcwalton pcwalton commented Nov 28, 2025

Currently, custom prepasses can't be easily added outside the bevy_pbr crate for two reasons:

  1. The fields in PrepassSpecializer are private to the bevy_pbr crate, so a PrepassSpecializer can't be constructed. Furthermore, the PrepassSpecializer::specialize method itself calls private APIs, so a developer can't even copy and paste the PrepassSpecializer into application code.

  2. The set_mesh_motion_vector_flags system is private, meaning that specialization systems for custom prepasses can't be ordered after it. This is a problem because those specialization systems may need to read the motion vector flags that that system sets.

This commit changes the fields in PrepassSpecializer to be public and also changes the set_mesh_motion_vector_flags system to be public.

application code.

Currently, custom prepasses can't be easily added outside the `bevy_pbr`
crate for two reasons:

1. The fields in `PrepassSpecializer` are private to the `bevy_pbr`
   crate, so a `PrepassSpecializer` can't be constructed. Furthermore,
   the `PrepassSpecializer::specialize` method itself calls private
   APIs, so a developer can't even copy and paste the
   `PrepassSpecializer` into application code.

2. The `set_mesh_motion_vector_flags` system is private, meaning that
   specialization systems for custom prepasses can't be ordered after
   it. This is a problem because those specialization systems may need
   to read the motion vector flags that that system sets.

This commit changes the fields in `PrepassSpecializer` to be public, and
also changes the `set_mesh_motion_vector_flags` system to be public.
Copy link
Copy Markdown
Contributor

@atlv24 atlv24 left a comment

Choose a reason for hiding this comment

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

makes sense to me

@IceSentry IceSentry added A-Rendering Drawing game state to the screen S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Nov 28, 2025
@mockersf mockersf added this pull request to the merge queue Nov 28, 2025
Merged via the queue into bevyengine:main with commit 0861b19 Nov 28, 2025
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants