bevyengine / bevyengine/bevy

Depth buffer is cleared after `MainPass3d` before custom rendering nodes

Open
#3,776 0 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Bug
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

Bevy v0.6

## Operating system & version

Manjaro

## What you did

I implemented a custom `Node` with a "node edge" from the "MainPass3d" node to itself (so it always renders after.
The RenderPass for this node bound the Depth buffer from the view entity.

## What you expected to happen

I expected the depth buffer to contain depth information from the previous render pass.

## What actually happened

WGPU cleared the depth buffer prior to running the new Node's render pass.

## Additional information

This was discussed at length on the Bevy discord #rendering channel.
It appears that because the "main_transparent_pass_3d" sets `store: false` for the Depth buffer operations that if another render pass attempts to use the depth texture WGPU will consider the buffer invalid and re-initialize it.

the value `store:false` was set on recommendation of a rendering linter to reduce bandwidth of writing to the depth buffer when not needed.
This is true in the default case (when "main_transparent_pass_3d" is the last Render pass to be processed) but if a user tries to add a custom render pass after it breaks the expected behavior.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.