Skip to content

Solari: Denoiser motion vector metal compat - #25787

Merged
alice-i-cecile merged 5 commits into
bevyengine:mainfrom
mate-h:m/solari-metal-motionvec
Sep 17, 2026
Merged

alice-i-cecile merged 5 commits into
bevyengine:mainfrom
mate-h:m/solari-metal-motionvec

Conversation

@mate-h

@mate-h mate-h commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Objective

It changed Solari’s motion vectors from a sampled texture_2d<f32> to texture_storage_2d<rg16float, read_write>.

Presently on main we get a crash on Metal:

2026-09-14T18:43:13.274411Z ERROR bevy_render::error_handler: Caught rendering error: Validation Error

Caused by:
  In Device::create_bind_group_layout, label = 'solari_lighting_bind_group_layout'
    Binding index 5: ReadWrite access to storage textures with format Rg16Float is not supported

rg16float can't be bound as a read-write storage texture on Metal. Vulkan and DX12 usually can.

Solution

ReSTIR only samples motion vectors to reproject last frame's reservoir. The only writer is DLSS Ray Reconstruction PSR, and only for perfect mirrors — everything else already goes to specular_motion_vectors.

At pipeline init we check whether the adapter supports STORAGE_READ_WRITE on rg16float. If it does, we keep the storage binding and write PSR motion in place. If not, we sample a texture_2d<f32> and skip the write. DLSS RR doesn't run on those GPUs anyway.

Testing

  • Ran the Solari example on Metal (Apple M5), no crash
  • Could not test the DLSS in-place path (no DLSS_SDK / NVIDIA GPU on this machine)
  • CI check for Metal + Solari is still missing (no available hw to test on?)

@mate-h
mate-h requested a review from JMS55 September 14, 2026 18:50
@mate-h mate-h added A-Rendering Drawing game state to the screen O-Metal Specific to the Metal render API S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Sep 14, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Sep 14, 2026
@stuartparmenter stuartparmenter added this to the 0.20 milestone Sep 15, 2026
@stuartparmenter

Copy link
Copy Markdown
Contributor

Would like to land this in 0.20 so solari on metal isn't broken

Comment thread crates/bevy_solari/src/realtime/prepare.rs Outdated
@mate-h mate-h changed the title Solari: Split denoiser motion vector binding for metal compat Solari: Denoiser motion vector metal compat Sep 16, 2026

@JMS55 JMS55 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lgtm but some nits

Comment thread crates/bevy_solari/src/realtime/bindings.wesl Outdated
Comment thread crates/bevy_solari/src/realtime/bindings.wesl Outdated
@mate-h mate-h added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Sep 17, 2026
@alice-i-cecile
alice-i-cecile added this pull request to the merge queue Sep 17, 2026
Merged via the queue into bevyengine:main with commit f4918bb Sep 17, 2026
40 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in Rendering Sep 17, 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 O-Metal Specific to the Metal render API S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants