Update wgpu from upstream
Categories
(Core :: Graphics: WebGPU, task, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox101 | --- | fixed |
People
(Reporter: jimb, Assigned: jimb)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
Firefox needs fixes that have landed in the upstream wgpu sources:
Assignee | ||
Comment 1•3 years ago
|
||
Upstream wgpu changeset b1900036
breaks our build: cbindgen
is unhappy with some of the new public declarations.
commit b19000367c15ebc3f4aa51871e6d6b9b670126f8
Author: Alexander Guryanov <caiiiycuk@gmail.com>
Date: Tue Jan 25 17:35:45 2022 +0700
feature: emscripten
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 2•3 years ago
•
|
||
I believe the problem is that this change in commit b1900036
is running into cbindgen#286:
--- a/wgpu-hal/src/gles/egl.rs
+++ b/wgpu-hal/src/gles/egl.rs
@@ -26,6 +26,12 @@ type WlDisplayConnectFun =
type WlDisplayDisconnectFun = unsafe extern "system" fn(display: *const raw::c_void);
+#[cfg(not(feature = "emscripten"))]
+type EglInstance = egl::DynamicInstance<egl::EGL1_4>;
+
+#[cfg(feature = "emscripten")]
+type EglInstance = egl::Instance<egl::Static>;
+
type WlEglWindowCreateFun = unsafe extern "system" fn(
surface: *const raw::c_void,
width: raw::c_int,
Assignee | ||
Comment 3•3 years ago
|
||
Fix for the above submitted upstream:
Assignee | ||
Comment 4•3 years ago
|
||
This upstream PR breaks our current code:
Previously, wgpu_types::TextureFormat
was a plain C-style enum, so Firefox could use code like this:
ffi::WGPUTextureFormat depthStencilFormat = ffi::WGPUTextureFormat_Sentinel;
However, #2477 introduced a value-bearing variant to wgpu_types::TextureFormat
(defined in wgpu-types/src/lib.rs
):
/// block compressed texture. 16 bytes per block.
///
/// Features [`TEXTURE_COMPRESSION_ASTC_LDR`] or [`TEXTURE_COMPRESSION_ASTC_HDR`] must be enabled to use this texture format.
Astc {
/// compressed block dimensions
block: AstcBlock,
///
channel: AstcChannel,
},
so cbindgen
now renders TextureFormat
in C as a struct:
struct WGPUTextureFormat {
enum WGPUTextureFormat_Tag tag;
union {
struct WGPUTextureFormat_WGPUAstc_Body astc;
};
};
Assignee | ||
Comment 5•3 years ago
•
|
||
Okay, that's fixed. There was also a change to the IdentityHandlerFactory::spawn
trait method, and a new id32
feature to tell cbindgen about. I have a working FF build now, against current wgpu
sources.
Assignee | ||
Comment 6•3 years ago
|
||
New versions of several crates are introduced to third_party/rust, by
changing the versions requested in gfx/wgpu_bindings/Cargo.toml
and
running mach vendor rust
:
wgpu-core
,wgpu-hal
, andwgpu-types
, as used bywgpu_bindings
naga
,ash
, andmetal
, as used by the above
These are all exact copies of the upstream sources, at the git
revisions listed in .cargo/config.in
.
This brings in fixes for some upstream wgpu
bugs that were fuzzblockers:
-
Compute pipelines never freed at runtime, leaking memory #2564
https://github.com/gfx-rs/wgpu/issues/2564 -
Device::drop doesn't actually free the device when using backend::direct::Context #2563
https://github.com/gfx-rs/wgpu/issues/2563
The Firefox sources also needed some adjustments to catch up with
upstream changes:
-
The C type
mozilla::webgpu::ffi::WGPUTextureFormat
is now a struct
containing a tag enum and a union, not just an enum. This is needed
for gfx-rs/wgpu#2477.(Note that Firefox's
WebGPU.webidl
is behind the current spec,
so even though the newest ASTC texture formats are supported inwgpu
,
they're not available in Firefox yet.) -
wgpu
got a new feature,id32
, which cbindgen needed to be told
about so that it would generate preprocessor-protected code like
this:#if defined(WGPU_FEATURE_ID32) typedef uint32_t WGPUNonZeroId; #endif #if !defined(WGPU_FEATURE_ID32) typedef uint64_t WGPUNonZeroId; #endif
instead of just spitting out two conflicting definitions of
WGPUNonZeroId
. -
The
wgpu_core::hub::IdentityHandlerFactory
trait'sspawn
method
no longer takes amin_index
argument. (Our implementations of that
trait never used that argument anyway, so this was easy to
accommodate.)
Updated•3 years ago
|
Comment 8•3 years ago
|
||
Backed out for causing build bustages
- Backout link
- Push with failures
- Failure Log
- Failure line: gmake[4]: *** [/builds/worker/checkouts/gecko/config/makefiles/rust.mk:424: force-cargo-library-build] Error 101
Assignee | ||
Comment 9•3 years ago
|
||
This backout is due to wgpu having acquired a minimum supported Rust version of 1.59 in #2557, whereas Firefox is using Rust 1.57 for builds.
Comment 10•3 years ago
|
||
Comment 11•3 years ago
|
||
bugherder |
Updated•1 years ago
|
Description
•