Skip to content

Depth buffer is cleared after MainPass3d before custom rendering nodes #3776

@robojeb

Description

@robojeb

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions