Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI_PASS constant is not public #1408

Closed
glfmn opened this issue Feb 6, 2021 · 4 comments
Closed

UI_PASS constant is not public #1408

glfmn opened this issue Feb 6, 2021 · 4 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior

Comments

@glfmn
Copy link
Contributor

glfmn commented Feb 6, 2021

Version
Bevy 0.4
OS Ubuntu 20.04.1

Context

I'm working on a plugin which adds an immediate mode drawing context for debugging purposes with simple shapes, arrows, etc, to avoid needing to spawn and manage entities.

I have implemented this functionality in a render node which I have running after the main pass, taking as input the color texture and the depth texture.

Discord.

The problem

My render pass is randomly missing depth information from the main pass. I noticed a render pass which has no draw calls but which clears the depth texture seems to be the culprit. Sometimes it runs in the same color pass as, but after, my debug node and things look fine. Sometimes it appears as a separate color pass that happens before my render pass. Where does this render pass come from? Am I missing a node I need to add a dependency on?

Frame Capture Description
Shapes have expected depth test results Capture shows color pass #2 has my draw calls before the render pass which clears the depth buffer. The blue and green cubes appear as desired, and the depth texture from the main pass is cleared immediately after my draw calls.
Shapes appear superimposed above main pass Capture shows color pass 2 which cleared the depth texture The blue and green cubes appear superimposed, and the depth texture from the main pass seems to have been cleared by Color Pass 2 (which is in-between the main pass and my debug pass)

Render Graph Setup

From bevy_debug_draw/src/renderer.rs:312

use bevy_render::render_graph::base;
render_graph.add_node(node::DEBUG_DRAW, DebugDrawNode::new());
render_graph
    .add_slot_edge(
        base::node::PRIMARY_SWAP_CHAIN,
        WindowSwapChainNode::OUT_TEXTURE,
        node::DEBUG_DRAW,
        DebugDrawNode::COLOR_ATTACHMENT_SLOT,
    )
    .expect("Failed to link node to color output");

render_graph
    .add_slot_edge(
        base::node::MAIN_DEPTH_TEXTURE,
        WindowTextureNode::OUT_TEXTURE,
        node::DEBUG_DRAW,
        DebugDrawNode::DEPTH_ATTACHMENT_SLOT,
    )
    .expect("Failed to link node to depth texture");

render_graph
    .add_node_edge(base::node::MAIN_PASS, node::DEBUG_DRAW)
    .expect("Failed to schedule debug node after main pass");

Pass descriptor is found here. Pipeline descriptor is found here.

@glfmn glfmn changed the title Render Pass with no draw calls clears Main Pass's depth texture Unaccounted for Render Pass with no draw calls clears Main Pass's depth texture Feb 6, 2021
@glfmn
Copy link
Contributor Author

glfmn commented Feb 7, 2021

I took another look through the base render graph but I don't see anything other than the main pass node which actually creates a render pass. I have updated to bevy master and the issue persists roughly as before.

@glfmn
Copy link
Contributor Author

glfmn commented Feb 11, 2021

I think it was the UI_PASS which also runs after main pass.

Adding render_graph.add_node_edge(node::DEBUG_DRAW, "ui_pass") seems to have solved the issue.

However, on master I was unable to find the actual UI_PASS constant. It seems like it should be exported from bevy_ui but I don't see it anywhere when I use cargo doc --open and I can't get my program to compile using what it seems should be the path to the node module.

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen labels Feb 16, 2021
@glfmn glfmn changed the title Unaccounted for Render Pass with no draw calls clears Main Pass's depth texture UI_PASS constant is not public Aug 18, 2021
@james7132
Copy link
Member

james7132 commented Jan 22, 2023

It does seem to be public as of #3312. Does that resolve this issue?

@glfmn
Copy link
Contributor Author

glfmn commented Jun 22, 2023

I am indeed able to see UI_PASS in docs.rs

@glfmn glfmn closed this as completed Jun 22, 2023
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-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

3 participants