[PR #3] fix(core): stabilize Glide2 rendering for Metal Fatigue #3

Open
opened 2026-10-31 13:06:11 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/lutris/GlideVK/pull/3
Author: @adrianlungu
Created: 10/27/2026
Status: 🔄 Open

Base: main ← Head: metal-fatigue-glide-rendering


📝 Commits (6)

  • 032d1f5 fix(core): stabilize Glide2 rendering for Metal Fatigue
  • 4493e17 fix(glide2x): cover the monitor when Wine rejects a Glide mode
  • 217d554 ci: build and publish i686 release DLLs
  • 7db0e81 chore: commit the release dependency lockfile
  • d98b21a fix(core): satisfy current Clippy slice chunk lint
  • 9eaa019 chore: satisfy current Clippy array chunk lints

📊 Changes

14 files changed (+3211 additions, -506 deletions)

View changed files

➕ .cargo/config.toml (+2 -0)
➕ .github/workflows/windows-dlls.yml (+111 -0)
📝 .gitignore (+0 -1)
➕ Cargo.lock (+55 -0)
📝 README.md (+44 -0)
📝 crates/glide2x/glide2x.def (+1 -0)
📝 crates/glide2x/src/lib.rs (+769 -148)
📝 crates/glide3x/src/lib.rs (+32 -7)
📝 crates/glidevk-core/src/lib.rs (+25 -7)
📝 crates/glidevk-core/src/texture.rs (+54 -16)
➕ crates/glidevk-core/src/vk/frame_pacer.rs (+95 -0)
📝 crates/glidevk-core/src/vk/mod.rs (+1504 -313)
📝 crates/glidevk-core/src/win32.rs (+487 -6)
📝 docs/game-compatibility.md (+32 -8)

📄 Description

Summary

  • Preserve the Vulkan backend across Glide renderer reopens and rebind it to a real Win32 surface when Glide supplies a NULL HWND.
  • Follow surface/window resizing, batch texture uploads, retain upload resources until queued work completes, and keep persistent texture bindings live.
  • Add configurable frame pacing (GLIDEVK_FPS) and lightweight profiling output for real-game stalls.
  • Implement Glide 2 grTexCalcMemRequired using the original SST-1 mip-size accounting: every LOD in the inclusive chain, narrow-level TMU granularity, and final 8-byte alignment.
  • Cover the current monitor with a borderless window when Wine rejects a legacy Glide mode, keeping the requested mode as Vulkan's logical coordinate space.
  • Honor GLIDEVK_WINDOWED=0 as explicitly disabled rather than treating any presence of the variable as windowed.
  • Document Metal Fatigue findings, the fullscreen fallback, and the current macOS i686 MinGW/Rust build-std workaround.

Motivation

Metal Fatigue reached roughly 53 FPS at 1600x1200 with no Vulkan present failures or texture misses, then crashed abruptly in GlideRendEng.dll. GlideVK previously reported only the base mip size. Metal Fatigue uses grTexMinAddress, grTexMaxAddress, and grTexCalcMemRequired to lay out its own TMU heap, so base-only accounting can make consecutive textures overlap.

The mip-size table and alignment behavior match the original 3Dfx SST-1 Glide source (glide2x/sst1/glide/src/ditex.c).

The same game also exposes a fullscreen fallback bug: it requests 1600x1200 with a NULL HWND, Wine/macOS returns DISP_CHANGE_BADMODE (-2), and GlideVK previously left the game's initial 640x480 window untouched. That appears as a black square in the upper-left. The display-mode fallback now covers the game's monitor while retaining 1600x1200 as the logical Glide coordinate space.

Validation

  • cargo fmt --all
  • cargo test --workspace (run repeatedly; also verifies the context tests are no longer racy)
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo +nightly build -Z build-std=std,panic_abort --release --target i686-pc-windows-gnu

Tests cover the monitor-preference bounds for the borderless fallback, including malformed monitor rectangles. The rebuilt PE32 glide2x.dll and glide3x.dll both link successfully. Metal Fatigue still needs repeat runs to verify the corrected TMU layout and visual fullscreen behavior in the bottle.

Release artifacts

The added Windows DLL workflow runs tests and Clippy, cross-builds glide2x.dll and glide3x.dll for i686 Windows, validates their PE architecture and key exports, publishes a glidevk-i686-windows workflow artifact on pushes/PRs, and attaches the DLLs plus SHA256SUMS to GitHub Releases for v* tags.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/lutris/GlideVK/pull/3 **Author:** [@adrianlungu](https://github.com/adrianlungu) **Created:** 10/27/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `metal-fatigue-glide-rendering` --- ### 📝 Commits (6) - [`032d1f5`](https://github.com/lutris/GlideVK/commit/032d1f53d4347049e2699d1bd364c640a46ef465) fix(core): stabilize Glide2 rendering for Metal Fatigue - [`4493e17`](https://github.com/lutris/GlideVK/commit/4493e17e0fb4e6a7f0be2ebce5e44017feb10d93) fix(glide2x): cover the monitor when Wine rejects a Glide mode - [`217d554`](https://github.com/lutris/GlideVK/commit/217d5544cbf866ec2d48bb047056ac4fab99858a) ci: build and publish i686 release DLLs - [`7db0e81`](https://github.com/lutris/GlideVK/commit/7db0e814a92a11bed369522d10b86d6b22f40a77) chore: commit the release dependency lockfile - [`d98b21a`](https://github.com/lutris/GlideVK/commit/d98b21a09e88affcd8f02978b1aef62605322dcd) fix(core): satisfy current Clippy slice chunk lint - [`9eaa019`](https://github.com/lutris/GlideVK/commit/9eaa019a0885fc329184c8f4e9f18a0a8ed562a6) chore: satisfy current Clippy array chunk lints ### 📊 Changes **14 files changed** (+3211 additions, -506 deletions) <details> <summary>View changed files</summary> ➕ `.cargo/config.toml` (+2 -0) ➕ `.github/workflows/windows-dlls.yml` (+111 -0) 📝 `.gitignore` (+0 -1) ➕ `Cargo.lock` (+55 -0) 📝 `README.md` (+44 -0) 📝 `crates/glide2x/glide2x.def` (+1 -0) 📝 `crates/glide2x/src/lib.rs` (+769 -148) 📝 `crates/glide3x/src/lib.rs` (+32 -7) 📝 `crates/glidevk-core/src/lib.rs` (+25 -7) 📝 `crates/glidevk-core/src/texture.rs` (+54 -16) ➕ `crates/glidevk-core/src/vk/frame_pacer.rs` (+95 -0) 📝 `crates/glidevk-core/src/vk/mod.rs` (+1504 -313) 📝 `crates/glidevk-core/src/win32.rs` (+487 -6) 📝 `docs/game-compatibility.md` (+32 -8) </details> ### 📄 Description ## Summary - Preserve the Vulkan backend across Glide renderer reopens and rebind it to a real Win32 surface when Glide supplies a NULL HWND. - Follow surface/window resizing, batch texture uploads, retain upload resources until queued work completes, and keep persistent texture bindings live. - Add configurable frame pacing (`GLIDEVK_FPS`) and lightweight profiling output for real-game stalls. - Implement Glide 2 `grTexCalcMemRequired` using the original SST-1 mip-size accounting: every LOD in the inclusive chain, narrow-level TMU granularity, and final 8-byte alignment. - Cover the current monitor with a borderless window when Wine rejects a legacy Glide mode, keeping the requested mode as Vulkan's logical coordinate space. - Honor `GLIDEVK_WINDOWED=0` as explicitly disabled rather than treating any presence of the variable as windowed. - Document Metal Fatigue findings, the fullscreen fallback, and the current macOS i686 MinGW/Rust build-std workaround. ## Motivation Metal Fatigue reached roughly 53 FPS at 1600x1200 with no Vulkan present failures or texture misses, then crashed abruptly in `GlideRendEng.dll`. GlideVK previously reported only the base mip size. Metal Fatigue uses `grTexMinAddress`, `grTexMaxAddress`, and `grTexCalcMemRequired` to lay out its own TMU heap, so base-only accounting can make consecutive textures overlap. The mip-size table and alignment behavior match the original 3Dfx SST-1 Glide source (`glide2x/sst1/glide/src/ditex.c`). The same game also exposes a fullscreen fallback bug: it requests 1600x1200 with a NULL HWND, Wine/macOS returns `DISP_CHANGE_BADMODE` (-2), and GlideVK previously left the game's initial 640x480 window untouched. That appears as a black square in the upper-left. The display-mode fallback now covers the game's monitor while retaining 1600x1200 as the logical Glide coordinate space. ## Validation - `cargo fmt --all` - `cargo test --workspace` (run repeatedly; also verifies the context tests are no longer racy) - `cargo clippy --workspace --all-targets -- -D warnings` - `cargo +nightly build -Z build-std=std,panic_abort --release --target i686-pc-windows-gnu` Tests cover the monitor-preference bounds for the borderless fallback, including malformed monitor rectangles. The rebuilt PE32 `glide2x.dll` and `glide3x.dll` both link successfully. Metal Fatigue still needs repeat runs to verify the corrected TMU layout and visual fullscreen behavior in the bottle. ## Release artifacts The added Windows DLL workflow runs tests and Clippy, cross-builds `glide2x.dll` and `glide3x.dll` for i686 Windows, validates their PE architecture and key exports, publishes a `glidevk-i686-windows` workflow artifact on pushes/PRs, and attaches the DLLs plus `SHA256SUMS` to GitHub Releases for `v*` tags. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lutris/GlideVK#3
No description provided.