gfx icon indicating copy to clipboard operation
gfx copied to clipboard

Compiling to WebAssembly with gfx-backend-gl

Open iilatt opened this issue 5 years ago • 2 comments

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.

iilatt avatar Jun 22 '20 14:06 iilatt

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?

GabrielMajeri avatar Jul 04 '20 10:07 GabrielMajeri

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.

kvark avatar Jul 04 '20 15:07 kvark