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

Manually merged
github merged 2 commits from gh-pr/1286/head into gh-pr/1286/base 2026-11-26 22:55:13 +00:00
Owner

@⁠R0Y00 on GitHub · 2026-11-24 06:47 UTC · original
R0Y00:codex/wide-srv-offsets-menu → main · +89 −5 · 8 files · 2 commits · merged 2026-11-24 06:54 UTC

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.

**@⁠R0Y00** on GitHub · 2026-11-24 06:47 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1286) `R0Y00:codex/wide-srv-offsets-menu` → `main` · +89 −5 · 8 files · 2 commits · merged 2026-11-24 06:54 UTC 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.
One s_load_dwordx16 from a descriptor table fetches two 8-dword image
descriptors. descriptor() returned the load's base offset for any register
in the load, so a sample naming the upper descriptor (s[N+8:N+15]) bound the
same SRV as the lower one. Add the register's dword index to the offset.

Measured on the executable's shaders: a pixel shader with two image_samples
from one wide load now declares separate SRVs at table offsets 0 and 32, and
a four-plane video shader declares SRVs at 64/32/96/128 instead of merging
two of them.

Test: tests/startup_translator_check.py (registered as startup_translator and
in the platform-independent Python job). It fails on the previous code
(both descriptors resolve to offset 0) and passes with this change.

AI-assisted (Claude Code).

(cherry picked from commit 16ac9a22bdc73dd57cd3496d2c92665e0bb4d606)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:55:11 +00:00
github manually merged commit a440dabb70 into gh-pr/1286/base 2026-11-26 22:55:13 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 06:54 UTC · original · reviewed

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.
**@⁠tedin7** on GitHub · 2026-11-24 06:54 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1286#pullrequestreview-6034917615) · **reviewed** 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.