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

Update to Bevy 0.12.0 #488

Closed
doonv opened this issue Nov 5, 2023 · 27 comments
Closed

Update to Bevy 0.12.0 #488

doonv opened this issue Nov 5, 2023 · 27 comments
Labels
enhancement New feature or request

Comments

@doonv
Copy link

doonv commented Nov 5, 2023

Bevy 0.12.0 has released, please update to it.

@rparrett
Copy link
Collaborator

rparrett commented Nov 5, 2023

I have a branch in a "compiling but seemingly not even close to working" state here: https://github.com/rparrett/bevy_ecs_tilemap/tree/bevy-0.12. Unfortunately, the migration seems pretty involved and Bevy's migration guide leaves a lot to be desired. There were massive changes to rendering and I don't have time to become a rendering expert. I know the author is also very time-constrained. But I may have a few hours tonight or tomorrow to investigate.

Last update 👋 @mwbryant did most of the work. Any chance you're still working with bevy_ecs_tilemap?

@doonv
Copy link
Author

doonv commented Nov 5, 2023

I'll take a look at the branch and see if I can fix it.

@doonv
Copy link
Author

doonv commented Nov 5, 2023

I'm trying to port it to 0.12 myself, but it looks like someone forgot to implement Clone for VisibilityBundle. lol

image

guess i have to make a bevy PR. but just not implementing Clone works for now

@miketwenty1
Copy link

since people are piling on various issues.. i'll also add that compiling for web target/wasm is failing a bunch of different ways now. For some reason isn't getting picked up by Rust Analyzer.

871 |     type ComputePipelineData = Sendable<web_sys::GpuComputePipeline>;
    |                                                  ^^^^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0412]: cannot find type `GpuCommandEncoder` in crate `web_sys`
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:872:49
    |
872 |     type CommandEncoderId = Identified<web_sys::GpuCommandEncoder>;
    |                                                 ^^^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0412]: cannot find type `GpuCommandEncoder` in crate `web_sys`
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:873:49
    |
873 |     type CommandEncoderData = Sendable<web_sys::GpuCommandEncoder>;
    |                                                 ^^^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0412]: cannot find type `GpuComputePassEncoder` in crate `web_sys`
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:874:46
    |
874 |     type ComputePassId = Identified<web_sys::GpuComputePassEncoder>;
    |                                              ^^^^^^^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0412]: cannot find type `GpuComputePassEncoder` in crate `web_sys`
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:875:46
    |
875 |     type ComputePassData = Sendable<web_sys::GpuComputePassEncoder>;
    |                                              ^^^^^^^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0412]: cannot find type `GpuRenderPassEncoder` in crate `web_sys`
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:876:45
    |
876 |     type RenderPassId = Identified<web_sys::GpuRenderPassEncoder>;
    |                                             ^^^^^^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0412]: cannot find type `GpuRenderPassEncoder` in crate `web_sys`
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:877:45
    |
877 |     type RenderPassData = Sendable<web_sys::GpuRenderPassEncoder>;
    |                                             ^^^^^^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0412]: cannot find type `GpuCommandBuffer` in crate `web_sys`
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:878:48
    |
878 |     type CommandBufferId = Identified<web_sys::GpuCommandBuffer>;
    |                                                ^^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0412]: cannot find type `GpuCommandBuffer` in crate `web_sys`
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:879:48
    |
879 |     type CommandBufferData = Sendable<web_sys::GpuCommandBuffer>;
    |                                                ^^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0412]: cannot find type `GpuRenderBundleEncoder` in crate `web_sys`
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:880:54
    |
880 |     type RenderBundleEncoderId = Identified<web_sys::GpuRenderBundleEncoder>;
    |                                                      ^^^^^^^^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0412]: cannot find type `GpuRenderBundleEncoder` in crate `web_sys`
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:881:54
    |
881 |     type RenderBundleEncoderData = Sendable<web_sys::GpuRenderBundleEncoder>;
    |                                                      ^^^^^^^^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0412]: cannot find type `GpuRenderBundle` in crate `web_sys`
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:882:47
    |
882 |     type RenderBundleId = Identified<web_sys::GpuRenderBundle>;
    |                                               ^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0412]: cannot find type `GpuRenderBundle` in crate `web_sys`
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:883:47
    |
883 |     type RenderBundleData = Sendable<web_sys::GpuRenderBundle>;
    |                                               ^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0412]: cannot find type `GpuCanvasContext` in crate `web_sys`
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:884:51
    |
884 |     type SurfaceId = Identified<(Canvas, web_sys::GpuCanvasContext)>;
    |                                                   ^^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0412]: cannot find type `GpuCanvasContext` in crate `web_sys`
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:885:51
    |
885 |     type SurfaceData = Sendable<(Canvas, web_sys::GpuCanvasContext)>;
    |                                                   ^^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0412]: cannot find type `GpuUncapturedErrorEvent` in crate `web_sys`
    --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:1791:62
     |
1791 |         let f = Closure::wrap(Box::new(move |event: web_sys::GpuUncapturedErrorEvent| {
     |                                                              ^^^^^^^^^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0599]: no method named `gpu` found for struct `Navigator` in the current scope
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:915:68
    |
915 |             global.unchecked_into::<web_sys::Window>().navigator().gpu()
    |                                                                    ^^^ method not found in `Navigator`

error[E0599]: no method named `gpu` found for struct `WorkerNavigator` in the current scope
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:920:18
    |
917 | /             global
918 | |                 .unchecked_into::<web_sys::WorkerGlobalScope>()
919 | |                 .navigator()
920 | |                 .gpu()
    | |                 -^^^ method not found in `WorkerNavigator`
    | |_________________|
    | 

@rparrett
Copy link
Collaborator

rparrett commented Nov 6, 2023

The troubles in my branch are definitely coming from not properly migrating bevyengine/bevy#9236 ("reorder render sets").

Someone wanting to help out might want to try to do the migration incrementally, starting there.

In that branch I did the bare minimum to get things compiling, but it seems like bevy_ecs_tilemaps's various prepare / queue systems might need to be reworked similarly to how bevy_sprite's did in that PR.

@ulfhermann
Copy link

I've also tried and failed to update to 0.12 yesterday: https://github.com/ulfhermann/bevy_ecs_tilemap/tree/bevy012

@doonv
Copy link
Author

doonv commented Nov 10, 2023

Any progress on this?

@EliottGaboreau
Copy link

I've started my own attempt, doing things incrementally as @rparrett suggested, right now I only got up to the commit right before the PR mentionned above, I plan to spend the day on it we'll see how far I get

@EliottGaboreau
Copy link

EliottGaboreau commented Nov 10, 2023

Quick update : I got past this commit with some examples working, and others broken

Non-exhaustive list of examples :

  • working: game_of_life, animation, custom_shader. chunking
  • broken : bench, tiled, random_map

I tried to compare specifically random_map and game_of_life examples, they seem to do very similar things, difference being that game_of_life updates tile visibility when random_map updates texture indexes but I don't really know what to do with this.

Another lead I have for debugging is the color example which behaves strangely : it only displays 1 of the 4 colors it's supposed to display, and the color is not consistent when running the example multiple times, which suggests some issue with tiles coordinates, maybe with some z-fighting idk, might be unrelated to why the other examples are broken.

Also please note that while working on this, it seems obvious that the way this crates does things (generating meshes for chunks for optimization) should be deeply re-worked with the new way bevy does instancing in mind, but this is beyond my abilites right now. What I did was more like trying some things out and stumbling on something that half-works without understanding much of what I was doing.

Can't work on this until at least a few days but I hope my attempt can somehow help someone picking this up

@rparrett
Copy link
Collaborator

rparrett commented Nov 10, 2023

Any progress on this?

Not from me, sorry. My bevy time has been spent fighting other bevy 0.12 bugs that are blocking my own projects.

Quick update : I got past bevyengine/bevy#9236 with some examples working, and others broken

That's great!

Another lead I have for debugging is the color example which behaves strangely : it only displays 1 of the 4 colors it's supposed to display, and the color is not consistent when running the example multiple times, which suggests some issue with tiles coordinates, maybe with some z-fighting idk, might be unrelated to why the other examples are broken.

This issue is also present in your commit 131e7d3. I believe that the chunk transforms are buggy -- all 4 "color quadrants" in the example are displaying on top of each other, and that shouldn't be the case.

@rparrett
Copy link
Collaborator

rparrett commented Nov 10, 2023

Here's my incremental branch: https://github.com/rparrett/bevy_ecs_tilemap/tree/bevy-0.12-incremental

I never got "render sets" working, but my e8b3892 commit seems to be working for the colors example, anyway.

@rparrett
Copy link
Collaborator

tiled and ldtk are also broken in mine though.

@rparrett
Copy link
Collaborator

rparrett commented Nov 10, 2023

Ah, right. tiled and ldtk can be fixed by adding the multi-threaded feature to bevy in dev-dependencies. Any app not using bevy's default features need to add this. I had hit this in another app earlier and didn't recognize it. (I think the issue with assets got fixed at some point before the 0.12.0 tag, but we still want to add this so that the examples will be multi-threaded.) bevyengine/bevy#10209 (comment)

I pushed my progress in bevy-0.12-incremental, but it's not much.

edit: random_map and bench are still broken / not displaying anything, I'm pretty sure because frustum culling is not working right. At least, adding FrustumCulling(false) makes stuff show up.

edit: Okay, so the frustum culling issue was specific to my migration of the affine3a stuff. But my version also lacked a bug that eliott's had. this line should be transform.affine(). This is reconciled in my branch now.

@rparrett
Copy link
Collaborator

rparrett commented Nov 11, 2023

Just a couple notes for anyone playing along:

  • cargo-examples is handy
  • text2d was completely broken for like... a lot of the bevy 0.12-dev cycle starting at PR 9236, so some examples aren't expected to work properly until mid-october-era commits.

@divark
Copy link
Contributor

divark commented Nov 12, 2023

I'm trying this out as well. Here's a link to my branch so far: https://github.com/divark/bevy_ecs_tilemap/tree/0.12-fixes

My methodology is as follows:

  1. Clone the repository with the v0.12-fixes branch with the following command: git clone -b 0.12-fixes --recursive-submodules https://github.com/divark/bevy_ecs_tilemap.git
  2. Open the bevy folder.
  3. In a terminal, run git bisect start.
  4. Run git bisect bad v0.12.0 to mark where we want to stop ultimately.
  5. Run git bisect good v0.11.0 to mark where we want to stop.
  6. Navigate back to the bevy_ecs_tilemap folder.
  7. Run ./test.sh in a terminal.
    • If everything compiles and looks as intended, navigate to the bevy folder and run git bisect good
    • If there's something wrong, navigate back to the bevy folder and run git bisect bad
  8. Repeat 6-7 until git's bisect feature returns the commit where the error first took place.
  9. Investigate the steps to migrate via pulling up the PR in bevy. Easiest way to do so is to get the PR number from git log --oneline found in the parentheses at the end of the commit. Example: Use a consistent scale factor and resolution in stress tests (#10474) and navigate to the URL like this: https://github.com/bevyengine/bevy/pull/10474
  10. Implement and commit the fixes.
  11. Repeat 4-10 until there are no more errors, but this time where git bisect good points to the PR commit in bevy where the errors were just fixed.

Currently, I'm stuck on trying to figure out how to work around the removal of anyhow errors from this PR: bevyengine/bevy#10003. Though, this might be a bug: bevyengine/bevy#10350. If anyone has an idea on how to work around this in the meantime, let me know. I'd be happy to collaborate in any way to get this working as soon as possible.

EDIT: Found a workaround. Still going strong.

EDIT2: Okay, I got everything to compile, and it looks like most of the examples work as-intended. I put up a PR with these changes: #489. More testing would be greatly appreciated, just in case I missed anything.

@feelingsonice
Copy link

Eagerly awaiting this T.T

@StarArawn
Copy link
Owner

StarArawn commented Dec 20, 2023

The Bevy 12 branch is merged in a release will go out in the next few days please let me know if you notice any issues in the meantime.

@StarArawn StarArawn added the enhancement New feature or request label Dec 20, 2023
@goto64
Copy link

goto64 commented Dec 25, 2023

The main branch with the 0.12 changes has worked well for me. I only noticed one small performance issue that occurs when transitioning from my main menu to in-game (the point where the tilemap is displayed). For some reason it hangs in a Vulkan driver function MainCRTStartup for about 300ms before displaying the tilemap and everything else. This did not happen with Bevy 0.11, but I have no evidence that it is caused by the tilemap crate.

@TheBlckbird
Copy link

The Bevy 12 branch is merged in a release will go out in the next few days please let me know if you notice any issues in the meantime.

When will you release it?

@sgbasaraner
Copy link

I've been using the master branch (12) for a while; I also confirm that it works fine.

@VergilUa
Copy link

So far so good. Looking forward to the crate release.

@linonetwo
Copy link

linonetwo commented Feb 2, 2024

How to use an unreleased package locally? Like python's pip install -e .? So before @StarArawn help release this package, I can test it in new project.

@rparrett
Copy link
Collaborator

rparrett commented Feb 2, 2024

You can specify a git dependency like

bevy_ecs_tilemap = { git = "https://github.com/StarArawn/bevy_ecs_tilemap.git" }

In your Cargo.toml. This works as long as your project is not a library that itself needs to be released as a crate.

@StarArawn
Copy link
Owner

v0.12.0 is out now this should be fixed.

@nablabla
Copy link

since people are piling on various issues.. i'll also add that compiling for web target/wasm is failing a bunch of different ways now. For some reason isn't getting picked up by Rust Analyzer.

871 |     type ComputePipelineData = Sendable<web_sys::GpuComputePipeline>;
    |                                                  ^^^^^^^^^^^^^^^^^^ not found in `web_sys`

error[E0412]: cannot find type `GpuCommandEncoder` in crate `web_sys`
   --> /somedir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/web.rs:872:49
    |
872 |     type CommandEncoderId = Identified<web_sys::GpuCommandEncoder>;
    |                                                 ^^^^^^^^^^^^^^^^^ not found in `web_sys`

I also get these problems. I am using 0.13.0
Or is there a fix? I did not understand some comments in the thread.

bevy = { version = "0.13.0" }
bevy-inspector-egui = "0.22.1"
wasm-bindgen = "0.2.91"
wasm-bindgen-futures = "0.4.39"
wasm-logger = "0.2.0"
js-sys = "0.3.63"

and building with this: "cargo" "build" "--lib" "--target" "wasm32-unknown-unknown"

@rparrett
Copy link
Collaborator

I also get these problems. I am using 0.13.0

See #516

@nablabla
Copy link

Thanks very much. I found out, that in a clean new install, as soon as you add inspector it has these problems. So I made the inspector depending on not-wasm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.