bevyengine / bevyengine/bevy

Resolve multisampled depth to `DepthPrepass` texture instead of copying it

Open
#22,831 0 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Feature D-Modest S-Needs-Review
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## What problem does this solve or what need does it fill?

Related to #22830 which proposes to resolve multisampled normal and motion vector textures. For multisampled depth prepass texture we can't resolve it during rendering (like `vk_khr_depth_stencil_resolve`), but we can use a separate render pass to manually resolve it to a unsampled `R32Float` texture. This saves VRAM, and it's anti-aliased and more convenient to sample which doesn't need `sample_index`.

## What solution would you like?

After prepass, if msaa is enabled, add a render pass to resolve depth as unsampled `R32Float` texture. If msaa is disabled, we still render depth to a `R32Float` texture to be consistent.

## What alternative(s) have you considered?

Doesn't resolve depth and leave it as is.

Contributor guide

Open the contributing guide

Research direction

Start by reading related issue #22830 and tracing the depth prepass and render-pass flow described here. Done means multisampled depth is manually resolved after the prepass into an unsampled R32Float texture, while non-MSAA rendering also uses R32Float consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.