-
Notifications
You must be signed in to change notification settings - Fork 966
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
Move some types into shared wgpu-types crate #514
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! A few corrections are needed
@@ -0,0 +1,506 @@ | |||
use std::{io, slice}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's have a license header like we do in wgpu
source files, so that we don't have a problem vendoring this in Gecko
#[repr(u8)] | ||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
pub enum Backend { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one doesn't sounds like you'd want from the Web side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I debated whether to include this here. It's part of the public API wgpu-rs, so it's slightly easier to include another BrowserWebGpu
variant (possibly even BrowserWebGl
later) instead of trying to redefine Backend
for the wasm32 target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ship it!
bors r+
514: Move some types into shared wgpu-types crate r=kvark a=grovesNL As we discussed a while ago, we need to be able to share some types between wgpu-core/wgpu-native/wgpu-remote/wgpu-rs. The problem is that we want to avoid a dependency on wgpu-core and wgpu-native when building [wgpu-rs for the wasm32-unknown-unknown target](gfx-rs/wgpu-rs#101). We can avoid this by moving all shared types into a separate crate which is exposed on all targets. Let me know if we should use some other approach or organize the types somehow. This isn't complete yet, but it might be easier to integrate this over several PRs instead of diverging my branch too far. Co-authored-by: Joshua Groves <josh@joshgroves.com>
Build failed |
@kvark did you want to take another look at the updated |
wgpu-core/Cargo.toml
Outdated
path = "../wgpu-types" | ||
package = "wgpu-types" | ||
version = "0.1" | ||
features = ["serde"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so serde is now unconditional? that seems wrong - native users don't need it
@@ -71,7 +72,7 @@ pub enum PresentMode { | |||
#[derive(Clone, Debug)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the SwapChainDescriptor
and PresentMode
move as well?
I didn't do an exhaustive check, but I would think it should be everything re-exported here:
https://github.com/gfx-rs/wgpu-rs/blob/master/src/lib.rs#L19-L84
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah most likely, this PR isn't comprehensive because I didn't want this branch to diverge too much. I'm just moving types across whenever I need to use them with the web-sys backend (gfx-rs/wgpu-rs#193), so there will be some smaller PRs later
@kvark I added a |
You could make the feature name Example: https://github.com/RustCrypto/RSA/pull/41/files |
Interesting, let's try doing that instead. Thanks! |
need to update the attributes too: - #[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+ #[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate="serde_crate"))] |
@grovesNL please proceed when ready, unless you have specific spots that need a look/review. |
bors r=kvark |
514: Move some types into shared wgpu-types crate r=kvark a=grovesNL As we discussed a while ago, we need to be able to share some types between wgpu-core/wgpu-native/wgpu-remote/wgpu-rs. The problem is that we want to avoid a dependency on wgpu-core and wgpu-native when building [wgpu-rs for the wasm32-unknown-unknown target](gfx-rs/wgpu-rs#101). We can avoid this by moving all shared types into a separate crate which is exposed on all targets. Let me know if we should use some other approach or organize the types somehow. This isn't complete yet, but it might be easier to integrate this over several PRs instead of diverging my branch too far. Co-authored-by: Joshua Groves <josh@joshgroves.com>
Funny how we are getting 2x more crates in the repo between 0.4 and 0.5 releases :) |
It looks like bors couldn't authenticate with GitHub for some reason:
I guess we should try again – I don't think we configure bors credentials manually anywhere. bors retry |
Build succeeded |
514: Release version 0.6 r=kvark a=kvark Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
As we discussed a while ago, we need to be able to share some types between wgpu-core/wgpu-native/wgpu-remote/wgpu-rs.
The problem is that we want to avoid a dependency on wgpu-core and wgpu-native when building wgpu-rs for the wasm32-unknown-unknown target. We can avoid this by moving all shared types into a separate crate which is exposed on all targets.
Let me know if we should use some other approach or organize the types somehow. This isn't complete yet, but it might be easier to integrate this over several PRs instead of diverging my branch too far.