{"id":20625956,"url":"https://github.com/joatin/wgpu_tokio","last_synced_at":"2025-11-08T22:02:49.539Z","repository":{"id":57672131,"uuid":"468710338","full_name":"Joatin/wgpu_tokio","owner":"Joatin","description":"Async methods for wgpu using tokio runtime","archived":false,"fork":false,"pushed_at":"2022-12-03T22:11:40.000Z","size":58,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-15T15:13:39.097Z","etag":null,"topics":["async-await","rust","tokio-rs","wgpu"],"latest_commit_sha":null,"homepage":"https://docs.rs/wgpu_tokio/0.12.5/wgpu_tokio/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Joatin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-11T10:43:27.000Z","updated_at":"2025-01-29T12:24:39.000Z","dependencies_parsed_at":"2023-01-24T04:31:27.376Z","dependency_job_id":null,"html_url":"https://github.com/Joatin/wgpu_tokio","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Joatin%2Fwgpu_tokio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Joatin%2Fwgpu_tokio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Joatin%2Fwgpu_tokio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Joatin%2Fwgpu_tokio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Joatin","download_url":"https://codeload.github.com/Joatin/wgpu_tokio/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249094933,"owners_count":21211837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async-await","rust","tokio-rs","wgpu"],"created_at":"2024-11-16T13:11:31.061Z","updated_at":"2025-11-08T22:02:49.505Z","avatar_url":"https://github.com/Joatin.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WGPU Tokio\n\nThis crate provide helper traits for working with [wgpu](https://github.com/gfx-rs/wgpu) in an async fashion. This \ncrate depends on tokio for it's async scheduling.\n\n## Why\nUsing tokio in gamedev brings a lot of benefits. Using multiple threads allows us to utilize the cpu to it's fullest. \nAnd tokios green thread abstraction is cheap and performant. \n\nHowever, straight of calling wgpu's api from the tokio context is not a good idea. Most them will block the code in \norder to do some chit-chatting with the gpu, etc. This will block the current worker thread and block other task from \nexecuting while we are waiting for wgpu to finnish.\n\nA better solution if to offload this work to a dedicated thread pool and let them run, and then notify tokio once their \nfinnished.\n\nThis crate does all of this and puts it inside a nice and tidy trait.\n\n## Usage\n\nMake sure you have the dependencies in place\n\n```toml\n[dependencies]\nwgpu = \"0.12\"\nwgpu_tokio = \"0.12\"\n```\n\nThen in you code make sure you are using the trait\n\n```rust\nuse wgpu_tokio::DeviceAsyncExt;\n```\n\nThe trait requires that the device is behind and ```Arc```. Then just go ahead and do something.\n\n```rust\nasync fn do_something(device: Arc\u003cDevice\u003e) {\n    let my_buffer = device.create_buffer_async(...).await;\n}\n```\n\n## License\n\nThis project is licensed under the [MIT license].\n\n[MIT license]: https://github.com/joatin/wgpu_tokio/blob/main/LICENSE.txt","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoatin%2Fwgpu_tokio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoatin%2Fwgpu_tokio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoatin%2Fwgpu_tokio/lists"}