Use both image descriptors from wide scalar loads and invalidate stale translations #1279

Merged
R0Y00 merged 2 commits from upstream-pr/1286 into main 2026-11-24 06:54:38 +00:00
R0Y00 commented 2026-11-24 06:47:45 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T06:47:45Z.


Refs #1150 and #1216.

This applies @denn0x's original wide-load fix and its three synthetic controls (16ac9a22bdc73dd57cd3496d2c92665e0bb4d606), preserving authorship. An image naming the ninth word of a sixteen-dword load now binds 32 bytes after the first image. Both the runtime and offline producer version the cache key, so a warm cache requests fresh bytecode without removing old files. A WARP fixture places a manifest under the old key and checks that the new request is issued.

Local English privacy and service bodies became readable including after scrolling and returning. The baseline compilation reproduced the two original VS, PS and binding manifests byte-for-byte. The corrected run changed only the two pixel shaders and their binding manifests. In a fixed 771×472 right-column region, bright text pixels rose from 9,639 to 24,366 for privacy and from 11,672 to 29,564 for service. This comparison used the local diagnostic startup build. A separate run selected Simplified Chinese (11/12), confirmed the localized navigation and copyright screens, and rendered both privacy and service body paragraphs in Simplified Chinese, including mixed Latin/Chinese text and punctuation. All committed tests use source-built inputs.

cmake --build --preset release --target d3d12_xs_shim startup_stream_consumer
ctest --preset release --no-tests=error --output-on-failure -R '^(startup_translator|startup_stream_request_warp|startup_stream_draw_(hardware|warp)|startup_sampler_heap_controls|startup_image_sample_l|startup_image_3d_controls)$'

Windows 11 26200.9974, NVIDIA RTX 4060 Laptop 32.0.16.1656, WARP 10.0.26100.9818, debug layer off. All seven tests passed with zero skips in 7.19 s on a440dabb. For a preexisting cache, run the updated recording build once, run python tools/startup/gfx2hlsl.py --pending <cache-directory>, then start the build again.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6576292996 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1286). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T06:47:45Z. --- Refs #1150 and #1216. This applies @denn0x's original wide-load fix and its three synthetic controls (16ac9a22bdc73dd57cd3496d2c92665e0bb4d606), preserving authorship. An image naming the ninth word of a sixteen-dword load now binds 32 bytes after the first image. Both the runtime and offline producer version the cache key, so a warm cache requests fresh bytecode without removing old files. A WARP fixture places a manifest under the old key and checks that the new request is issued. Local English privacy and service bodies became readable including after scrolling and returning. The baseline compilation reproduced the two original VS, PS and binding manifests byte-for-byte. The corrected run changed only the two pixel shaders and their binding manifests. In a fixed 771×472 right-column region, bright text pixels rose from 9,639 to 24,366 for privacy and from 11,672 to 29,564 for service. This comparison used the local diagnostic startup build. A separate run selected Simplified Chinese (11/12), confirmed the localized navigation and copyright screens, and rendered both privacy and service body paragraphs in Simplified Chinese, including mixed Latin/Chinese text and punctuation. All committed tests use source-built inputs. ```powershell cmake --build --preset release --target d3d12_xs_shim startup_stream_consumer ctest --preset release --no-tests=error --output-on-failure -R '^(startup_translator|startup_stream_request_warp|startup_stream_draw_(hardware|warp)|startup_sampler_heap_controls|startup_image_sample_l|startup_image_3d_controls)$' ``` Windows 11 26200.9974, NVIDIA RTX 4060 Laptop 32.0.16.1656, WARP 10.0.26100.9818, debug layer off. All seven tests passed with zero skips in 7.19 s on a440dabb. For a preexisting cache, run the updated recording build once, run `python tools/startup/gfx2hlsl.py --pending <cache-directory>`, then start the build again.
tedin7 commented 2026-11-24 06:54:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T06:54:28Z.

Review: COMMENTED


Reviewed at a440dabb703c8fd15cd4bc5970c51ecc922b6f2e.

Verification

Linux (worktree from origin/main):

  • git diff --check origin/main...HEAD — clean
  • python -B tests/docs_links_check.py — passed (16 Markdown files, 286 links)
  • python -B tests/bidi_controls_check.py — passed (1077 tracked files)
  • python -B tests/startup_translator_check.py — startup translator checks: 0 failed
  • python -B tests/startup_sampler_heap_check.py — passed
  • python -B tests/startup_image_sample_l_check.py — passed
  • python -B tests/startup_image_3d_check.py — passed

Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at a440dabb703c8fd15cd4bc5970c51ecc922b6f2e:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target startup_stub_consumer -- -j 6): 23.42s (configure 1.52s)
    • Test (ctest --preset dev -R 'startup_translator|startup_stream_request_warp' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (1.18s: startup_translator 0.13s, startup_stream_request_warp 1.12s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target startup_stub_consumer -- -j 6): 35.16s (configure 1.46s)
    • Test (ctest --preset release -R 'startup_translator|startup_stream_request_warp' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (1.28s: startup_translator 0.15s, startup_stream_request_warp 1.22s)

Findings

  • Stage.descriptor in tools/startup/gfx2hlsl.py adds 4 * s[3] to the base byte offset when s[2] is not None, resolving upper descriptors inside wide scalar loads (s_load_dwordx16, s_load_dwordx8) to their true table offsets (+32, +0x50) instead of aliasing the load base.
  • pipeline_key in tools/startup/gfx2hlsl.py and cached_translation in src/startup_stubs/d3d12_draw.inl both seed FNV-1a with the exact 17-byte "x2w-startup-srv-2" revision string (no trailing NUL), invalidating stale translations without modifying legacy cache files.
  • tests/startup_translator_check.py (including its negative control) and tests/startup_stream_check.py cover both behaviors cleanly. No issues found.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6034917615 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1286#pullrequestreview-6034917615). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T06:54:28Z. **Review:** COMMENTED --- Reviewed at `a440dabb703c8fd15cd4bc5970c51ecc922b6f2e`. ### Verification **Linux** (worktree from `origin/main`): - `git diff --check origin/main...HEAD` — clean - `python -B tests/docs_links_check.py` — passed (16 Markdown files, 286 links) - `python -B tests/bidi_controls_check.py` — passed (1077 tracked files) - `python -B tests/startup_translator_check.py` — `startup translator checks: 0 failed` - `python -B tests/startup_sampler_heap_check.py` — passed - `python -B tests/startup_image_sample_l_check.py` — passed - `python -B tests/startup_image_3d_check.py` — passed **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)** at `a440dabb703c8fd15cd4bc5970c51ecc922b6f2e`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target startup_stub_consumer -- -j 6`): `23.42s` (configure `1.52s`) - Test (`ctest --preset dev -R 'startup_translator|startup_stream_request_warp' --parallel 4 --no-tests=error --output-on-failure`): **2/2 passed** (`1.18s`: `startup_translator` `0.13s`, `startup_stream_request_warp` `1.12s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target startup_stub_consumer -- -j 6`): `35.16s` (configure `1.46s`) - Test (`ctest --preset release -R 'startup_translator|startup_stream_request_warp' --parallel 4 --no-tests=error --output-on-failure`): **2/2 passed** (`1.28s`: `startup_translator` `0.15s`, `startup_stream_request_warp` `1.22s`) ### Findings - `Stage.descriptor` in `tools/startup/gfx2hlsl.py` adds `4 * s[3]` to the base byte offset when `s[2] is not None`, resolving upper descriptors inside wide scalar loads (`s_load_dwordx16`, `s_load_dwordx8`) to their true table offsets (`+32`, `+0x50`) instead of aliasing the load base. - `pipeline_key` in `tools/startup/gfx2hlsl.py` and `cached_translation` in `src/startup_stubs/d3d12_draw.inl` both seed FNV-1a with the exact 17-byte `"x2w-startup-srv-2"` revision string (no trailing NUL), invalidating stale translations without modifying legacy cache files. - `tests/startup_translator_check.py` (including its negative control) and `tests/startup_stream_check.py` cover both behaviors cleanly. No issues found.
upstream-sync closed this pull request 2026-11-24 07:00:43 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
R0Y00/Xbox2Windows!1279
No description provided.