Repository navigation
refactor: split emberwave-wgpu out of emberwave-core (D75, steps 1 and 2) - #175
Merged
Merged
Conversation
…d 2) The core's public API showed about thirty wgpu types, which a new major version of wgpu would break, so a 1.0 of the core could not promise a stable Rust API (#165). D75 decided to move the GPU code into a crate of its own. - `crates/emberwave-core/src/gpu` moves to `crates/emberwave-wgpu/src` with git mv (`mod.rs` becomes `lib.rs`), with the GPU tests (`gpu.rs`, `gpu_encoder.rs`, `gpu_hooks.rs`, `shaders.rs`); the shared test helpers are included from the core's tests by `#[path]`, with the GPU's own beside them. - The core loses its `gpu` feature, `pub use wgpu` and its wgpu, pollster and bytemuck dependencies. `emberwave-wgpu` re-exports wgpu and takes the core at its exact version. - The core opens, as `#[doc(hidden)] pub`, what the GPU encoder shares with the CPU one: the modules `encode::{fdwt, quant, rate}`, `Bands`, `Block32`, the helpers of the stream's headers and of the planes' checks, the CPU encoder's `transform` and `quantise`, and `color::check_rgb`. The compiler named them; D75's search had found six. - The GPU code handles an RGB order it does not know (`RgbOrder` is non_exhaustive) with `GpuError::InvalidArgument`; its tests build the core's non_exhaustive structs field by field. - `emberwave-cli`, `emberwave-ffi` and `emberwave-web` take the GPU types from `emberwave_wgpu`; the C API does not change. - CI checks that the core does not depend on wgpu, lints the new crate for the browser, and reports the adapter from its tests; CONTRIBUTING, the README's layout tables and D75 follow. The rest of the docs is the next step. The workspace's tests pass in the same numbers as before. Claude-Session: https://claude.ai/code/session_019fJGoCTvP5e7n599q3ZQ42
…ow the docs
A review of the split found it sound and six small things, all taken:
- The core had made all 27 items of `encode::{fdwt, quant, rate}` public; 18
of them are not used by emberwave-wgpu and are crate-private again. What
stays open: `fdwt::sample_level`, `quant::{DROP_STEPS, BandQuant::{new,
max_drop}, Block8, Blocks8}` and `rate::{BlockCost, choose}`.
- The CI check that the core does not depend on wgpu matched only `wgpu` and
`naga` and passed when `cargo tree` failed; it now reads the tree first, for
every target, and matches the whole family (`wgpu-types` holds the API types).
- The browser build of the docs links to calls it leaves out: the allow that
the core had for it moves to emberwave-wgpu.
- The soak test's command names emberwave-wgpu; two comments name the right
crate.
- CONTRIBUTING's release step: emberwave-cli cannot be published until
emberwave-wgpu has a name on crates.io, the order then, and that the next
release is a minor version.
- The docs: ARCHITECTURE's status line, its table of modules and the GPU
paths of its other sections, the README's 1.0 checklist in both languages,
and an Unreleased entry in the CHANGELOG for the change of the Rust paths.
Claude-Session: https://claude.ai/code/session_019fJGoCTvP5e7n599q3ZQ42
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes for a client, and how to revert
emberwave_core::gpu::to the new crateemberwave_wgpu::(same names), andemberwave_core::wgpubecomesemberwave_wgpu::wgpu.emberwave-coreno longer has agpufeature or depends on wgpu.emberwave-wgpuispublish = falseuntil the maintainer takes the name on crates.io; until then the nextemberwave-coreandemberwave-clicannot be published as they are (the cli depends onemberwave-wgpu), which D75 states. The published 0.19.0 crates are unaffected.Purpose
Decision D75, choice 2 (issue #165): about thirty public items of
emberwave-coretook or returned wgpu's types, which every wgpu major would break, so the core could not promise a stable Rust API at 1.0. The GPU code moves toemberwave-wgpu, whose version follows wgpu's; the core keeps the bitstream, the CPU decoder and encoder and the colour code, with no wgpu.Changes
crates/emberwave-core/src/gpu→crates/emberwave-wgpu/srcbygit mv(mod.rs→lib.rs), with the GPU tests; paths rewritten. The shared test helpers are included from the core's tests by#[path], the GPU's own beside them.#[doc(hidden)] pub:encode::{fdwt, quant, rate},Bands,Block32, the header and plane-check helpers, the CPU encoder'stransformandquantise,color::check_rgb. The compiler named them (D75's search found six; the list is now in D75).RgbOrderisnon_exhaustive) returnsGpuError::InvalidArgument; tests build the core's non-exhaustive structs field by field or withColorParams::new.emberwave-cli,emberwave-ffi,emberwave-webuseemberwave_wgpu. The workspace takesemberwave-coreandemberwave-wgpuat their exact version.Testing
cargo test --workspace: every binary passes, with the same counts as before (the core's 141 unit tests are 109 in the core and 32 inemberwave-wgpu; gpu 32 + 1 ignored, gpu_encoder 18, gpu_hooks 1, shaders 6).cargo clippy --workspace --all-targets -D warnings, the wasm32 clippy of web, wgpu and core,cargo fmt. A reviewer agent is reading it.