gfx
gfx copied to clipboard
Compiling to WebAssembly with gfx-backend-gl
I'm trying to compile to a GL backend. I've added this to my Cargo.toml:
[target.'cfg(target_arch = "wasm32")'.dependencies.backend]
package = "gfx-backend-gl"
version = "0.5.1"
But I'm getting this error:
Compiling gfx-backend-gl v0.5.1
error[E0204]: the trait `Copy` may not be implemented for this type
--> C:\Users\Julek\.cargo\registry\src\github.com-1ecc6299db9ec823\gfx-backend-gl-0.5.1\src\native.rs:315:17
|
315 | #[derive(Clone, Copy, Debug)]
| ^^^^
316 | pub struct UniformDesc {
317 | pub(crate) location: UniformLocation,
| ------------------------------------ this field does not implement `Copy`
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
For more information about this error, try `rustc --explain E0204`.
error: could not compile `gfx-backend-gl`.
On other backends it compiles just fine.
After a bit of investigation, it looks like this is fixed on master as of 2ed4a875e0b98fc5884a76590c21cf6a5136e621 but that change doesn't exist in the published version.
@kvark is it ok to backport that commit onto hal-0.5 or should I just make a new commit removing the Copy derive?
I don't think it makes sense to patch the released GL backend for this, since the backend is heavily in flux (especially for the Web target), and not yet ready for active use. If there are interested users, they should work with master and ideally help with issues they encounter.
We can still do it if @jgrajewsky finds it useful. Either a new commit, or backporting an existing one is fine. Just please don't forget the version bump and changelog update.