[removed by author] #284

Manually merged
github merged 8 commits from gh-pr/284/head into gh-pr/284/base 2026-11-26 21:40:02 +00:00
Owner

@⁠thegl0w on GitHub · 2026-11-21 20:34 UTC · original
gpu-alias/shader-lookup → main · +630 −4 · 11 files · 8 commits · merged 2026-11-21 21:26 UTC

[removed by author]

**@⁠thegl0w** on GitHub · 2026-11-21 20:34 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/284) `gpu-alias/shader-lookup` → `main` · +630 −4 · 11 files · 8 commits · merged 2026-11-21 21:26 UTC [removed by author]
On the console a shader can load through a 64-bit address read from
memory, because a graphics allocation's CPU pointer is also its GPU
address. On desktop each aliased allocation is a separate buffer.

src/title_va_lookup.hlsli binary-searches ranges sorted by title
address (64-bit compares on uint2) and returns the range's descriptor
slot and the byte offset. era_title_va::shader_ranges packs a table's
ranges in that layout and rejects unsorted, overlapping, empty or 4 GiB
ranges, which a raw view cannot cover.

gpu_alias_lookup_{warp,hardware} open three era_heap graphics
allocations plus one placed across a 4 GiB line, and load one word
through each of 122 title addresses read from an input buffer. The
addresses cover range starts, ends, middles, the words just outside
each range, the null page, an address above user space, and the same
low words 4 GiB above and below the placed range. Results must match
the CPU reading through the title pointers. era_title_va_shader covers
the packing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Shaders that read addresses from their inputs also store and use
atomics through them (global_store, global_atomic_add and _sub, float
min and max). gpu_alias_writes.hlsl does each through TitleLookup on
the aliased title allocations; float min and max use a
compare-exchange loop on the word's bits.

gpu_alias_lookup_writes_{warp,hardware} reuse the lookup fixture (now
shared with gpu_alias_lookup) and run 1,041 records:
- 14 stores at range starts, middles and ends and on both sides of the
  4 GiB line;
- 256 contending threads each for add, sub, float min and float max on
  one word per operation;
- three stores to unmapped addresses, which must report 0 and change
  nothing.
Afterwards every word of all four allocations is compared with the
CPU's expectation through the title pointers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The placed allocation's middle word is the 4 GiB line, which the store
list also named separately, so two threads stored different values to
one word. WARP happened to keep the expected order; the RTX 3070 did
not. Store to the words on either side of the line instead and assert
that every store address is distinct.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
TitleLookup checked only the first byte, but both shaders use the
result for a four-byte raw UAV operation. A start inside a range's last
three bytes reported success, and an unaligned offset could reach a raw
load, store or atomic.

TitleLookup now takes the access size and succeeds only for a 4-byte
aligned address whose whole access lies inside one range.
shader_ranges also rejects ranges that do not start on a 4-byte
boundary, which would misalign raw offsets.

New controls:
- The placed allocation's range now ends two bytes short of the
  allocation, so its last aligned word crosses the range end with two
  bytes inside.
- gpu_alias_lookup reads each range's last valid word, the aligned word
  after it, and misaligned starts at both ends.
- gpu_alias_lookup_writes adds a rejected store and float min on the
  tail-crossing word and misaligned store, add and sub inside ranges.
  All of them must report 0, and the full-allocation comparison checks
  that every backing word, including the in-range bytes of the
  tail-crossing word, is unchanged.
- era_title_va_shader covers the alignment rejection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:40:01 +00:00
github manually merged commit 4dc8730998 into gh-pr/284/base 2026-11-26 21:40:02 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-21 20:55 UTC · original

TitleLookup checks only the first byte, but both shaders use the result for a four-byte raw UAV operation. A start inside the last three bytes currently reports success, and an unaligned offset can reach a raw load/store or atomic. Please validate the entire aligned DWORD access before issuing it (or keep the helper byte-oriented and check at its callers). Add last-valid-word, tail-crossing and misaligned controls, with unchanged backing words for rejected writes.

**@⁠R0Y00** on GitHub · 2026-11-21 20:55 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/284#issuecomment-7069110736) `TitleLookup` checks only the first byte, but both shaders use the result for a four-byte raw UAV operation. A start inside the last three bytes currently reports success, and an unaligned offset can reach a raw load/store or atomic. Please validate the entire aligned DWORD access before issuing it (or keep the helper byte-oriented and check at its callers). Add last-valid-word, tail-crossing and misaligned controls, with unchanged backing words for rejected writes.
github-bot changed title from shader: load, store and use atomics through 64-bit title addresses to [removed by author] 2026-12-02 09:38:34 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.