Preserve placed texture bytes for CPU row reads #157

Manually merged
github merged 1 commit from github-bot/gh-157 into main 2026-12-05 20:45:47 +00:00 AGit
Owner

@⁠rtho782 on GitHub · 2026-12-05 19:54 UTC · original
rtho782:fix/preserve-placed-row-bytes → main · +104 −20 · 2 files · 1 commits · merged 2026-12-05 20:42 UTC

A Windows crash dump showed the title stopping at 0x14404D956 while reading one row of eight u32s from a 13-wide loaded texture. The reader consumes the original placed bytes, including padding and its row terminator. Reconstructing that prefix from a GPU image can fail after the placement memory has been released.

This change retains the prefix that the row reader can address while the placement is available. Its size is bounded by both the original allocation and four bytes per unit of texture width. A successful GPU resource-object creation invalidates the snapshot before publishing the object. Subsequent reads follow the existing reconstruction path.

Two synthetic regression tests exercise the production reader. One requests the 32-byte row after the original storage is overwritten and verifies that the bytes remain valid across handle release. The other requests a full row from a short placement containing an early terminator and verifies the returned length and contents. Both run without game assets or a GPU image.

Tested on Windows x64 with cargo test --release --locked --workspace. The exact gameplay route from the original report is unknown.

During a Series S gameplay replay, a locally instrumented build returned all 32 requested bytes from the retained placement and continued rendering. That request matches the width and row size from the original dump. The asset identity and exact route could not be verified.

**@⁠rtho782** on GitHub · 2026-12-05 19:54 UTC · [original](https://github.com/gamingwithhomie/larp/pull/157) `rtho782:fix/preserve-placed-row-bytes` → `main` · +104 −20 · 2 files · 1 commits · merged 2026-12-05 20:42 UTC A Windows crash dump showed the title stopping at `0x14404D956` while reading one row of eight `u32`s from a 13-wide loaded texture. The reader consumes the original placed bytes, including padding and its row terminator. Reconstructing that prefix from a GPU image can fail after the placement memory has been released. This change retains the prefix that the row reader can address while the placement is available. Its size is bounded by both the original allocation and four bytes per unit of texture width. A successful GPU resource-object creation invalidates the snapshot before publishing the object. Subsequent reads follow the existing reconstruction path. Two synthetic regression tests exercise the production reader. One requests the 32-byte row after the original storage is overwritten and verifies that the bytes remain valid across handle release. The other requests a full row from a short placement containing an early terminator and verifies the returned length and contents. Both run without game assets or a GPU image. Tested on Windows x64 with `cargo test --release --locked --workspace`. The exact gameplay route from the original report is unknown. During a Series S gameplay replay, a locally instrumented build returned all 32 requested bytes from the retained placement and continued rendering. That request matches the width and row size from the original dump. The asset identity and exact route could not be verified.
A 13-wide loaded texture requested one row of eight words at 0x14404D956. Reconstructing those bytes from the host image failed and stopped the process. The row reader consumes raw placement bytes, including padding, so retain only the prefix that its width can address. Drop the snapshot before exposing a GPU resource object and keep the existing readback path for those textures.

Cover the 32-byte case without a GPU image, source lifetime, and a short placement with an early row terminator.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 20:00:30 +00:00
github-bot referenced this pull request from a commit 2026-12-05 20:45:12 +00:00
github manually merged commit b4118ed65a into main 2026-12-05 20:45:47 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.