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

Draft: Update to Bevy 0.12 #42

Conversation

Weasy666
Copy link

Updates the crate to Bevy 0.12.

I am currently still getting a crash when i run the example:

thread 'main' panicked at ...\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_render-0.12.0\src\render_phase\draw.rs:274:54:
called `Result::unwrap()` on an `Err` value: QueryDoesNotMatch(2v0)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::renderer::render_system`!
error: process didn't exit successfully: `target\debug\examples\simple.exe` (exit code: 101)

the actual bevy code which breaks this is here:

impl<P: PhaseItem, C: RenderCommand<P> + Send + Sync + 'static> Draw<P> for RenderCommandState<P, C>
where
    C::Param: ReadOnlySystemParam,
{
    /// Prepares the render command to be used. This is called once and only once before the phase
    /// begins. There may be zero or more [`draw`](RenderCommandState::draw) calls following a call to this function.
    fn prepare(&mut self, world: &'_ World) {
        self.state.update_archetypes(world);
        self.view.update_archetypes(world);
        self.entity.update_archetypes(world);
    }

    /// Fetches the ECS parameters for the wrapped [`RenderCommand`] and then renders it.
    fn draw<'w>(
        &mut self,
        world: &'w World,
        pass: &mut TrackedRenderPass<'w>,
        view: Entity,
        item: &P,
    ) {
        let param = self.state.get_manual(world);
+       let view = self.view.get_manual(world, view).unwrap();
        let entity = self.entity.get_manual(world, item.entity()).unwrap();
        // TODO: handle/log `RenderCommand` failure
        C::render(item, view, entity, param, pass);
    }
}

If anyone has an idea, you are very welcome. Otherwise, i will take a look at it tomorrow, i don't have any more time today.

Copy link

fmsc-bot bot commented Nov 11, 2023

Atlantis commands can't be run on fork pull requests. To enable, set --allow-fork-prs or, to disable this message, set --silence-fork-pr-errors

Copy link

fmsc-bot bot commented Nov 11, 2023

Error parsing command: EOF found when expecting closing quote

@sphw
Copy link

sphw commented Nov 13, 2023

@Weasy666 I'm not sure if you fixed your crashing issue yet, but I have a branch of this crate that is upgraded to 0.12. Everything works except shadows, which was enough for my use-case. Feel free to incorporate any of the changes into your PR. elodin-sys@4ad4daf

@Weasy666
Copy link
Author

Nice, thanks! No, i didn't find time to take a deeper look at it, but i should be able to do that tomorrow. This time for real 😅. I did take a cursory look at your code, and doesn't look that much different. Well, i'll hopefully figure out tomorrow which of my changes brake it, when i compare it to your working code. 🙂

Without doing this, the app would crash. Thanks @sphw (Sascha Wise) for
helping out here!
Copy link

fmsc-bot bot commented Nov 14, 2023

Atlantis commands can't be run on fork pull requests. To enable, set --allow-fork-prs or, to disable this message, set --silence-fork-pr-errors

Copy link

fmsc-bot bot commented Nov 14, 2023

Error parsing command: EOF found when expecting closing quote

@Weasy666
Copy link
Author

Got it working after replacing the write_buffers everywhere with uniform_writers. But shadows are also still broken for me.

@rlidwka
Copy link

rlidwka commented Nov 17, 2023

Doesn't work for me either unfortunately. :(

2023-11-17T14:32:59.981858Z ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default    
thread '<unnamed>' panicked at 'wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `<CommandBuffer-(0, 2, Vulkan)>`
    In a set_bind_group command
      note: bind group = `grid-view-bind-group`
    Dynamic binding offset index 0 with offset 1600 would overrun the buffer bound to bind group 0 -> binding 0. Buffer size is 320 bytes, the binding binds bytes 0..272, meaning the maximum the binding can be offset is 48 bytes

', C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-0.17.2\src\backend\direct.rs:3056:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in exclusive system `bevy_render::renderer::render_system`!

@Weasy666
Copy link
Author

That's the error with the shadow. If you uncomment shadow_color: None, in the example, then it works.

@ProfFan
Copy link

ProfFan commented Dec 14, 2023

I have fixed the shadow issue @Weasy666 opened a PR on your fork

@Weasy666
Copy link
Author

Weasy666 commented Dec 15, 2023

Nice, thank you! I'll take a look and merge it in a few hours 🙂

@Weasy666
Copy link
Author

Hm... funnily, my last commit seems to work now with Bevy 0.12.1. At least it doesn't panic, but no shadow is being rendered.

@pcwalton
Copy link
Contributor

This didn't work for me, but my own PR #43 works.

@IceSentry
Copy link
Collaborator

Closing this since it was done in #43

@IceSentry IceSentry closed this Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants