refactor(metal4): extract egui painter crate #506

Manually merged
github merged 2 commits from github-bot/gh-506 into gh-pr/506/base 2026-11-28 12:34:18 +00:00 AGit
Owner

@⁠maple-quartz18 on GitHub · 2026-11-27 20:54 UTC · original
maple-quartz18:feature/extract-egui-mtl4 → master · +712 −26 · 10 files · 2 commits · merged 2026-11-28 12:28 UTC

Summary

  • Rebase the extraction onto current master (SixNG 0.14.0).
  • Keep the Metal 4 egui painter as the in-repository workspace crate crates/egui-mtl4.
  • Use path = "../egui-mtl4" from sixng-gui.
  • Replace the SixNG-specific linear texture ID check with Painter::set_linear_texture_ids.
  • Keep Metal-Rust on the existing full revision 0aa2a1f694adf1a7e3ba877cc799e114d639df16.

The Metal IO zlib model-cache work was removed from this PR and will be submitted separately.
The separate maple-quartz18/egui-mtl4 repository remains a publishing/synchronization mirror only.

Validation

  • cargo check --workspace
  • python3 scripts/check_metal_rust_pin.py
  • cargo test --locked -p egui-mtl4 (3 passed)
  • cargo build --locked -p sixng-gui --features metal4-poc --example metal4_window
  • git diff --check
**@⁠maple-quartz18** on GitHub · 2026-11-27 20:54 UTC · [original](https://github.com/holdmysocks/SixNG/pull/506) `maple-quartz18:feature/extract-egui-mtl4` → `master` · +712 −26 · 10 files · 2 commits · merged 2026-11-28 12:28 UTC ## Summary - Rebase the extraction onto current `master` (SixNG `0.14.0`). - Keep the Metal 4 egui painter as the in-repository workspace crate `crates/egui-mtl4`. - Use `path = "../egui-mtl4"` from `sixng-gui`. - Replace the SixNG-specific linear texture ID check with `Painter::set_linear_texture_ids`. - Keep Metal-Rust on the existing full revision `0aa2a1f694adf1a7e3ba877cc799e114d639df16`. The Metal IO zlib model-cache work was removed from this PR and will be submitted separately. The separate `maple-quartz18/egui-mtl4` repository remains a publishing/synchronization mirror only. ## Validation - `cargo check --workspace` - `python3 scripts/check_metal_rust_pin.py` - `cargo test --locked -p egui-mtl4` (3 passed) - `cargo build --locked -p sixng-gui --features metal4-poc --example metal4_window` - `git diff --check`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 21:00:29 +00:00
Author
Owner

@⁠holdmysocks on GitHub · 2026-11-27 21:17 UTC · original

Thanks for this. The extraction itself looks good: the painter code matches what we had, and set_linear_texture_ids is a nice way to drop the SixNG-specific check.

One thing before we merge: the PR description and the THIRD_PARTY_NOTICES.md text say the painter becomes a workspace package under crates/egui-mtl4, but the diff instead removes metal4_egui.rs and pulls the crate from a separate repository by git revision. We'd like to keep it inside this repo, as the description says:

  • add the crate as crates/egui-mtl4 (its own Cargo.toml, src/lib.rs, README) and list it in the workspace members;
  • have sixng-gui depend on it with path = "../egui-mtl4" instead of the git source;
  • keep the notices paragraph as written, since it will then be accurate.

You're welcome to keep publishing it from your own repo as well; we'd just rather not have SixNG's own code come from outside the repo. Happy to merge once that's changed.

**@⁠holdmysocks** on GitHub · 2026-11-27 21:17 UTC · [original](https://github.com/holdmysocks/SixNG/pull/506#issuecomment-7228312432) Thanks for this. The extraction itself looks good: the painter code matches what we had, and `set_linear_texture_ids` is a nice way to drop the SixNG-specific check. One thing before we merge: the PR description and the `THIRD_PARTY_NOTICES.md` text say the painter becomes a workspace package under `crates/egui-mtl4`, but the diff instead removes `metal4_egui.rs` and pulls the crate from a separate repository by git revision. We'd like to keep it inside this repo, as the description says: - add the crate as `crates/egui-mtl4` (its own `Cargo.toml`, `src/lib.rs`, README) and list it in the workspace members; - have `sixng-gui` depend on it with `path = "../egui-mtl4"` instead of the git source; - keep the notices paragraph as written, since it will then be accurate. You're welcome to keep publishing it from your own repo as well; we'd just rather not have SixNG's own code come from outside the repo. Happy to merge once that's changed.
Author
Owner

@⁠maple-quartz18 on GitHub · 2026-11-27 21:52 UTC · original

Thanks for the clarification. I updated the branch accordingly:

  • crates/egui-mtl4 is now restored as a SixNG workspace member with its own Cargo.toml, README.md, LICENSE, and src/lib.rs.
  • sixng-gui now depends on it with path = "../egui-mtl4".
  • The THIRD_PARTY_NOTICES.md paragraph remains in place and is now accurate.
  • The separate maple-quartz18/egui-mtl4 repository remains available as a publishing/synchronization mirror.

For clarity, Metal-Rust is different: it remains an independent Git dependency from maple-quartz18/Metal-Rust; it is not copied into the SixNG workspace. SixNG's workspace crate is only egui-mtl4.

The fix is pushed in commit a5a450b, and the PR description has been updated to reflect this distinction. Local validation passes:

  • cargo check --locked --workspace
  • cargo test --locked -p egui-mtl4 (3 passed)
  • cargo build --locked -p sixng-gui --features metal4-poc --example metal4_window
**@⁠maple-quartz18** on GitHub · 2026-11-27 21:52 UTC · [original](https://github.com/holdmysocks/SixNG/pull/506#issuecomment-7228830439) Thanks for the clarification. I updated the branch accordingly: - `crates/egui-mtl4` is now restored as a SixNG workspace member with its own `Cargo.toml`, `README.md`, `LICENSE`, and `src/lib.rs`. - `sixng-gui` now depends on it with `path = "../egui-mtl4"`. - The `THIRD_PARTY_NOTICES.md` paragraph remains in place and is now accurate. - The separate `maple-quartz18/egui-mtl4` repository remains available as a publishing/synchronization mirror. For clarity, `Metal-Rust` is different: it remains an independent Git dependency from `maple-quartz18/Metal-Rust`; it is not copied into the SixNG workspace. SixNG's workspace crate is only `egui-mtl4`. The fix is pushed in commit `a5a450b`, and the PR description has been updated to reflect this distinction. Local validation passes: - `cargo check --locked --workspace` - `cargo test --locked -p egui-mtl4` (3 passed) - `cargo build --locked -p sixng-gui --features metal4-poc --example metal4_window`
Author
Owner

@⁠holdmysocks on GitHub · 2026-11-27 22:21 UTC · original

Thanks, the in-repo crates/egui-mtl4 with the path dependency is exactly what we wanted.

Two things before it can go in:

  • CI is red on all three platforms at the "Verify Metal-Rust dependency pin" step: Cargo.lock: package metal-rust has inconsistent source rev. The pin check wants the full 40-character revision in Cargo.toml (both [patch.crates-io] entries and crates/egui-mtl4/Cargo.toml), so please use 7f78fd2cc24f8dc4e3eec3178198a9b749df5dc8 instead of 7f78fd2, and the same full hash in THIRD_PARTY_NOTICES.md.
  • Please split the zlib model cache into its own PR. This update also bumps Metal-Rust by five commits (the Metal IO compressed cache) and adds --zlib, the GUI checkbox and the metal_io_models_zlib cache. That's a separate feature from the painter extraction, and we'd like to review it on its own. If this PR keeps only the crate move (on the current 0aa2a1f pin), we can merge it as soon as CI is green.

Master is now on 0.13.0, so a merge from master will also be needed.

**@⁠holdmysocks** on GitHub · 2026-11-27 22:21 UTC · [original](https://github.com/holdmysocks/SixNG/pull/506#issuecomment-7229260023) Thanks, the in-repo `crates/egui-mtl4` with the path dependency is exactly what we wanted. Two things before it can go in: - **CI is red on all three platforms** at the "Verify Metal-Rust dependency pin" step: `Cargo.lock: package metal-rust has inconsistent source rev`. The pin check wants the full 40-character revision in `Cargo.toml` (both `[patch.crates-io]` entries and `crates/egui-mtl4/Cargo.toml`), so please use `7f78fd2cc24f8dc4e3eec3178198a9b749df5dc8` instead of `7f78fd2`, and the same full hash in `THIRD_PARTY_NOTICES.md`. - **Please split the zlib model cache into its own PR.** This update also bumps Metal-Rust by five commits (the Metal IO compressed cache) and adds `--zlib`, the GUI checkbox and the `metal_io_models_zlib` cache. That's a separate feature from the painter extraction, and we'd like to review it on its own. If this PR keeps only the crate move (on the current `0aa2a1f` pin), we can merge it as soon as CI is green. Master is now on 0.13.0, so a merge from master will also be needed.
github-bot force-pushed github-bot/gh-506 from a5a450b0bb to da3e44b37e 2026-11-28 10:42:48 +00:00 Compare
Author
Owner

@⁠maple-quartz18 on GitHub · 2026-11-28 10:40 UTC · original

I rebuilt the PR from the current master (0bb6fa5, SixNG 0.14.0) and force-updated the branch to da3e44b.

This version:

  • keeps crates/egui-mtl4 inside the SixNG workspace;
  • uses path = "../egui-mtl4" from sixng-gui;
  • restores the full existing Metal-Rust pin 0aa2a1f694adf1a7e3ba877cc799e114d639df16 in the workspace and lockfile;
  • removes the zlib model-cache changes, including --zlib, the GUI checkbox, and metal_io_models_zlib;
  • includes the small gpu_draw module declaration needed by the Metal 4 example after rebasing onto current master.

Validation passed:

  • cargo check --workspace
  • python3 scripts/check_metal_rust_pin.py
  • cargo test --locked -p egui-mtl4 (3 passed)
  • cargo build --locked -p sixng-gui --features metal4-poc --example metal4_window
**@⁠maple-quartz18** on GitHub · 2026-11-28 10:40 UTC · [original](https://github.com/holdmysocks/SixNG/pull/506#issuecomment-7238046721) I rebuilt the PR from the current `master` (`0bb6fa5`, SixNG `0.14.0`) and force-updated the branch to `da3e44b`. This version: - keeps `crates/egui-mtl4` inside the SixNG workspace; - uses `path = "../egui-mtl4"` from `sixng-gui`; - restores the full existing Metal-Rust pin `0aa2a1f694adf1a7e3ba877cc799e114d639df16` in the workspace and lockfile; - removes the zlib model-cache changes, including `--zlib`, the GUI checkbox, and `metal_io_models_zlib`; - includes the small `gpu_draw` module declaration needed by the Metal 4 example after rebasing onto current master. Validation passed: - `cargo check --workspace` - `python3 scripts/check_metal_rust_pin.py` - `cargo test --locked -p egui-mtl4` (3 passed) - `cargo build --locked -p sixng-gui --features metal4-poc --example metal4_window`
github-bot changed target branch from master to gh-pr/506/base 2026-11-28 12:34:17 +00:00
github manually merged commit 7bc0cc8b94 into gh-pr/506/base 2026-11-28 12:34:18 +00:00
Author
Owner

@⁠holdmysocks on GitHub · 2026-11-28 12:29 UTC · original

Merged, thanks! The rebuilt branch was exactly right. One small addition before merging: CI builds the whole workspace on Windows and Linux too, where objc2 (through metal-rust) doesn't compile, so I pushed a commit that makes metal-rust a macOS-only dependency of egui-mtl4 and makes the crate empty on other platforms. I also pointed its repository field at this repo, since it lives here now. Feel free to send the zlib model cache as its own PR whenever you're ready.

**@⁠holdmysocks** on GitHub · 2026-11-28 12:29 UTC · [original](https://github.com/holdmysocks/SixNG/pull/506#issuecomment-7239258785) Merged, thanks! The rebuilt branch was exactly right. One small addition before merging: CI builds the whole workspace on Windows and Linux too, where `objc2` (through `metal-rust`) doesn't compile, so I pushed a commit that makes `metal-rust` a macOS-only dependency of `egui-mtl4` and makes the crate empty on other platforms. I also pointed its `repository` field at this repo, since it lives here now. Feel free to send the zlib model cache as its own PR whenever you're ready.
This discussion has been locked. Commenting is limited to contributors.
No description provided.