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

Screenshot does not contains the bevy_egui GUI in 0.15 anymore #16689

Open
thmxv opened this issue Dec 6, 2024 · 4 comments
Open

Screenshot does not contains the bevy_egui GUI in 0.15 anymore #16689

thmxv opened this issue Dec 6, 2024 · 4 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior P-Regression Functionality that used to work but no longer does. Add a test for this! S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Comments

@thmxv
Copy link

thmxv commented Dec 6, 2024

Bevy version

0.15

What you did

I ported my application to Bevy 0.15. Now the screenshot does not contains the bevy_egui GUI anymore. It did in Bevy 0.14.

What went wrong

I was expecting the screenshot to capture everything in the primary window like it was in 0.14.

Additional information

I tried to change the system order to make sure the command to spawn the Screenshot component was done after drawing the GUI and after some bevy_egui internal systems, and every order I thought could fix the issue but without any luck.

I also opened a bevy_egui issue thinking this might be a issue related to this plugin: vladbat00/bevy_egui#329

I do not know what to try or what to look for in order to try new workaround. Any suggestion is welcome.

@thmxv thmxv added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Dec 6, 2024
@thmxv
Copy link
Author

thmxv commented Dec 6, 2024

Here are some screenshots generated.
Bevy 0.14:
Image
Bevy 0.15:
Image

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen S-Needs-Investigation This issue requires detective work to figure out what's going wrong and removed S-Needs-Triage This issue needs to be labelled labels Dec 11, 2024
@alice-i-cecile
Copy link
Member

#14833 is the most likely candidate.

@BenjaminBrienen BenjaminBrienen added the P-Regression Functionality that used to work but no longer does. Add a test for this! label Dec 24, 2024
@vladbat00
Copy link
Contributor

vladbat00 commented Dec 29, 2024

Is there anything I can do on the bevy_egui end to adapt to the changes? I've looked through the screenshots related code, but I haven't found any obvious changes that could lead to this.
My first thought was "maybe we can just add an edge to a node that renders screenshots", but there isn't really a node, submitting screenshot commands is supposed to happen in the end of the whole render graph if I'm reading the code correctly:

    let res = RenderGraphRunner::run(
        graph,
        render_device.clone(), // TODO: is this clone really necessary?
        diagnostics_recorder,
        &render_queue.0,
        &render_adapter.0,
        world,
        |encoder| {
            crate::view::screenshot::submit_screenshot_commands(world, encoder);
            crate::gpu_readback::submit_readback_commands(world, encoder);
        },
    );

the last lambda is passed as the finalizer: impl FnOnce(&mut wgpu::CommandEncoder) argument, which supposedly means that it's expected to submit its render commands last?..

Or maybe bevy_egui just shouldn't render to a window's swapchain texture directly? I noticed this comment for ExtractedWindow::swap_chain_texture_view, I'm not sure if this has any implications for the way we render, and I couldn't find where the it changes to point to an alternative texture for taking screenshots.

    /// Note: this will not always be the swap chain texture view. When taking a screenshot,
    /// this will point to an alternative texture instead to allow for copying the render result
    /// to CPU memory.
    pub swap_chain_texture_view: Option<TextureView>,

Or this is something that needs to be fixed just on the Bevy's end...
I don't have a good grasp on rendering so these are just my random thoughts and observations.

Anyone's help with an understanding of render systems would be really welcome! Thank you.

@alice-i-cecile
Copy link
Member

Or maybe bevy_egui just shouldn't render to a window's swapchain texture directly?

This is my expectation, but I'm far from a rendering expert. It feels like you're stepping outside of Bevy's preferred rendering model by doing that.

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 P-Regression Functionality that used to work but no longer does. Add a test for this! S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
Development

No branches or pull requests

4 participants