Skip to content

Change bevy_pbr::morph shader functions to use descriptor index#24085

Open
komadori wants to merge 4 commits intobevyengine:mainfrom
komadori:expose-morph-descr
Open

Change bevy_pbr::morph shader functions to use descriptor index#24085
komadori wants to merge 4 commits intobevyengine:mainfrom
komadori:expose-morph-descr

Conversation

@komadori
Copy link
Copy Markdown
Contributor

@komadori komadori commented May 2, 2026

Objective

The shader functions bevy_pbr::morph take an instance_index as a parameter and use it solely to look up the morph_descriptor_index in the mesh array. This prevents these functions from being used in an environment without instance indices and the mesh array available.

This is closely related to #24083 and porting bevy_mod_outline to 0.19-dev. I have put them in separate PRs because I consider #24083 a prerequisite to supporting morphed meshes without significant duplication both of code and work at runtime, and it is a very trivial change. I am in favour of this PR also, but if it is not merged for 0.19 then it is tractable to duplicate Bevy's morph shader functions inside bevy_mod_outline.

Solution

  • Change the shader functions in bevy_pbr::morph take the descriptor index as a parameter instead of the instance index and to not bind the mesh array.

Testing

  • Ran the morph_targets and many_morph_targets examples.

@kfc35 kfc35 added A-Rendering Drawing game state to the screen S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels May 2, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering May 2, 2026
@kfc35 kfc35 added the D-Shaders This code uses GPU shader languages label May 2, 2026
Comment thread crates/bevy_pbr/src/prepass/prepass.wgsl Outdated
Co-authored-by: Greeble <166992735+greeble-dev@users.noreply.github.com>
@greeble-dev greeble-dev requested a review from pcwalton May 3, 2026 09:41
@greeble-dev greeble-dev added C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels May 3, 2026
@cart cart closed this May 5, 2026
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in Rendering May 5, 2026
@cart cart reopened this May 5, 2026
@github-project-automation github-project-automation Bot moved this from Done to Needs SME Triage in Rendering May 5, 2026
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 C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Shaders This code uses GPU shader languages D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

4 participants