GithubHelp home page GithubHelp logo

Comments (4)

leudz avatar leudz commented on June 3, 2024

I don't know why you have something !Send + !Sync where the bunny demo doesn't. Maybe wgpu changed, the demo uses wgpu 0.15 which is not the latest version.

Regardless of why, if you have a !Send/!Sync type you can still store it in World, you'll need to add the thread_local cargo feature to shipyard.
Then use World::add_unique_non_send_sync instead of World::add_unique.
Finally when you borrow/define a system you'll have to use NonSendSync<UniqueView<Render>> instead of UniqueView<Render>.

Note: adding thread_local feature will make World: !Send

from shipyard.

Umenokin avatar Umenokin commented on June 3, 2024

Thank you, @leudz! Your explanation worked perfectly! I was confused by combination of factors that wgpu removed Send Sync from version 0.16 and that it is not add_unique which will act differently but dedicated method add_unique_non_send_sync. So what I have now is this:

    #[cfg(feature = "web")]
    pub fn add_unique<T: Unique>(&mut self, component: T) -> &mut Self {
        self.world.add_unique_non_send_sync(component);
        self
    }

    #[cfg(not(feature = "web"))]
    pub fn add_unique<T: Send + Sync + Unique>(&mut self, component: T) -> &mut Self {
        self.world.add_unique(component);
        self
    }

from shipyard.

Umenokin avatar Umenokin commented on June 3, 2024

@leudz are there other limitations? I am using workloads and when I add system with |mut render: NonSendSync<UniqueView<Render>>| { it will panic. Even if my Render is empty struct without !Sync properties. And works fine if I do it this way ``|mut render: UniqueView`. It panics not when add into workload but when run workload of multiple systems. Can you actually mix sync and non sync systems inside one workload?

from shipyard.

Umenokin avatar Umenokin commented on June 3, 2024

@leudz thank you for your support. I did not find the solution to this problem but closing the ticket because of migration to another ECS.

from shipyard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.