Commit Graph

1480 Commits

Author SHA1 Message Date
4c414d1216 tools: ps_oracle.py runs hand-written RDNA2 pixel-shader ISA on AMD GPUs
hw_oracle launches compute kernels only. vk_harness can now write a
pipeline's VK_KHR_pipeline_binary data and build a pipeline from it
(VKH_BINARY_OUT / VKH_BINARY_IN). ps_oracle.py puts assembled ISA in
place of _amdgpu_ps_main in the driver's PAL ELF, raises the pixel
stage's register counts in the msgpack metadata, optionally changes
other metadata entries, and draws with it, reading every pixel's mrt0
words back.

Checked on gfx1036 (driver 26.10.1): v_interp of a varying and the
parameter words P0 / P10 come back as expected. Tests in
tests/test_ps_oracle.py, docs in docs/shader_validation.md.

AI-assisted.
2026-11-22 20:15:34 +01:00
ae21dddaa6 Merge pull request #2290 from 1TrickOmen 2026-11-22 11:43:51 -05:00
07a6d1c5ae Merge pull request #2286 from Matheus Gomes 2026-11-22 11:43:48 -05:00
72758b9c5b Merge pull request #2270 from Tim Elery
# Conflicts:
#	docs/design.md
2026-11-22 11:43:39 -05:00
4c28f269ec Merge pull request #2264 from SirAmong 2026-11-22 11:43:34 -05:00
8f1370ce4a Merge pull request #2260 from Linnard Alex Brown Jr.
# Conflicts:
#	docs/design.md
2026-11-22 11:43:33 -05:00
873a952a37 Merge pull request #2239 from itsRevela 2026-11-22 11:43:15 -05:00
3fd09d4ecd Merge pull request #2232 from Jolymmiles 2026-11-22 11:43:11 -05:00
5fdb55613d Merge pull request #2226 from SirAmong 2026-11-22 11:43:06 -05:00
693b8c63af Merge pull request #2209 from Vonsek 2026-11-22 11:42:51 -05:00
b3a5411ce0 Merge pull request #2186 from fearkov
# Conflicts:
#	docs/design.md
2026-11-22 11:42:36 -05:00
2d848a33ee Merge pull request #2167 from Alex Arenas 2026-11-22 11:42:25 -05:00
d159969a1b Merge pull request #2162 from Cozma 2026-11-22 11:42:23 -05:00
430d046487 Merge pull request #2151 from Faterek
# Conflicts:
#	docs/design.md
2026-11-22 11:42:17 -05:00
e3c972d0d5 Merge pull request #2145 from KanameS 2026-11-22 11:42:13 -05:00
cdb907aa8f Merge pull request #2127 from AwkGrep256
# Conflicts:
#	docs/design.md
2026-11-22 11:42:03 -05:00
b903812991 Merge pull request #2126 from pwu2775-dev 2026-11-22 11:42:01 -05:00
7360583abd Merge pull request #2122 from jaybeebabageyus 2026-11-22 11:41:59 -05:00
ac7e1f9d0b Merge pull request #2116 from swam122yam-glitch 2026-11-22 11:41:55 -05:00
d3b2262635 Merge pull request #2114 from Vonsek 2026-11-22 11:41:55 -05:00
6f77e39793 Merge pull request #2112 from SirKingg 2026-11-22 11:41:54 -05:00
c97e961387 Merge pull request #2111 from Thatters 2026-11-22 11:41:53 -05:00
388a4723c2 Merge pull request #2103 from requiemsnkrp 2026-11-22 11:41:49 -05:00
95ac207b7b Merge pull request #2099 from Luis Baker 2026-11-22 11:41:47 -05:00
04a864baef Merge pull request #2085 from emirduran707 2026-11-22 11:41:37 -05:00
2fe08d7e18 Merge pull request #2084 from Luis Baker 2026-11-22 11:41:37 -05:00
61d5397910 Merge pull request #2070 from jaybeebabageyus 2026-11-22 11:41:29 -05:00
3d1a9889df Merge pull request #2049 from Shrey Ratna 2026-11-22 11:41:12 -05:00
817de3de95 Merge pull request #2041 from fearkov 2026-11-22 11:41:08 -05:00
1e24a98cce Merge pull request #2032 from Alex Arenas 2026-11-22 11:41:04 -05:00
68733d6606 Merge pull request #2021 from jaybeebabageyus 2026-11-22 11:41:02 -05:00
9b138453e8 Merge pull request #2001 from Rafael 2026-11-22 11:41:00 -05:00
1241d87e4f Merge pull request #1991 from TheHoracio 2026-11-22 11:40:59 -05:00
4b564a0943 Merge pull request #1937 from SHAURYASANYAL3 2026-11-22 11:40:49 -05:00
067e0240bd Merge pull request #1935 from Tao Battarel 2026-11-22 11:40:49 -05:00
72b6218983 Merge pull request #1916 from cobalt-pebble-804 2026-11-22 11:40:47 -05:00
5cf0a1743d Merge pull request #1880 from Vonsek 2026-11-22 11:40:43 -05:00
867be74659 Merge pull request #1742 from RaveN499 2026-11-22 11:40:38 -05:00
fc2ee62c98 Merge pull request #1683 from requiemsnkrp 2026-11-22 11:40:37 -05:00
ea00498d3f Merge pull request #664 from WHOISJARDAS 2026-11-22 11:40:30 -05:00
2a1bd0399d vk_pipeline_check: a module is in flight from vkCreateShaderModule on, tagged module or pipeline
Review of #2111 (@Pipodi): the in-flight table got its entry only just before vkCreateComputePipelines /
vkCreateGraphicsPipelines, so a thread busy in vkCreateShaderModule (or a large module there, alone behind
compile_gate) was invisible: the watchdog never named it, and --inflight-file couldn't name a module that died there.

- The entry is made once the worker holds compile_gate, before vkCreateShaderModule, with phase "module"; it becomes
  "pipeline" when the pipeline is created, and is removed on every path out of the loop (a pipeline, a skip, a failed
  module). A module over --large-module-bytes writes the file when it enters the driver, not only at its pipeline.
- --inflight-file lines are "name<TAB>phase"; make_game.py reads the name.
- The watchdog says "still creating the shader module of X" or "still compiling X".

Waiting on compile_gate is not in the table: that thread isn't in the driver.

Tested on Windows 11 Pro 25H2, MSVC 14.51 + Ninja, RTX 5070 Ti / 621.24: the crash end-to-end through
make_game.pipelines on 62 real compute modules (skipped, the other 61 checked); the in-flight file at a simulated
crash reads "<module>\tpipeline" and is empty after a clean pass (62/62). tests/test_make_game_pipelines.py writes the
tab format; all 14 test_make_game*.py files pass. No new warnings. No game data. AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:34:50 -05:00
a28493ba8f runtime: support multiple simultaneous manually mapped static-TLS modules 2026-11-22 17:34:35 +01:00
72d7e52dfa Translator: a mask copied to a VGPR respects EXEC (SHADER-21 part 2, #210) 2026-11-22 16:33:52 +00:00
989877d1e0 fix(vulkan): fail capture readback when the fence wait fails
Only copy the mapped capture buffer after a successful fence wait. Inject a failure in the synchronization test and verify that the caller's pixel and metadata outputs are unmodified.
2026-11-22 13:33:33 -03:00
fbe50b23fd rdna2spirv: align swizzled buffer addressing with native RDNA2 hardware (SHADER-343)
Measure MUBUF/MTBUF swizzled buffer addressing (V# SWIZZLE_ENABLE,
ADD_TID_ENABLE, INDEX_STRIDE, OOB_SELECT, multi-dword and typed
accesses, atomics, 32-bit offset wrap) natively on RDNA2 (gfx1036,
wave32 and wave64) via tools/buffer_swizzle_probe.py, and fix all six
observed silicon divergences in tools/rdna2spirv.py:

- idxen=1 ignores ADD_TID_ENABLE (both address and bounds).
- SWIZZLE_ENABLE=1 with idxen=0 and ADD_TID_ENABLE=0 stays linear and
  OOB_SELECT 3 remains RAW.
- Multi-dword raw accesses step by +4*IS only in scratch-swizzle mode
  (SWIZZLE_ENABLE=1, idxen=0, ADD_TID_ENABLE=1); indexed swizzle
  (idxen=1) steps linearly by +4 bytes even across IS boundaries.
- Scratch-swizzle mode suppresses typed formats > 4 bytes (MUBUF/MTBUF)
  and 8-byte buffer_atomic_*_x2 even under OOB_SELECT 2 (formats <= 4B
  execute normally); indexed swizzle executes them linearly.
- OOB_SELECT 3 with active swizzle and stride != 0 checks
  (index + soffset) >= num_records or off + payload > stride.
- off = uint32(voff + inst_offset) wraps at 32 bits before bounds
  checking, while RAW mode 3 uint64(off) + uint64(soffset) does not.

Update semantic tests, cs_buf_swizzle fixture expectation (word 4:
0x5eed0028 -> 0x5eed000c), unit tests, and docs/design.md /
docs/shader_validation.md.
2026-11-22 08:32:34 -08:00
fac5a5af7d Runtime: MULTISAMPLE_QUALITY_LEVELS answers TILED_RESOURCE
CheckFeatureSupport(MULTISAMPLE_QUALITY_LEVELS) refused the TILED_RESOURCE
flag with E_INVALIDARG. Native D3D12 (RX 7800 XT, a Radeon iGPU and WARP)
answers S_OK: 1x and 4x keep the plain answer, every other count has none,
and a format without a tile shape (96-bit) has none at any count, which is
GetResourceAllocationInfo's tiled rule here (tiled MSAA is 4x only).
128-bit formats tiled at 4x are a driver difference: the AMD drivers answer
0, WARP and NVIDIA allocate them; the layer follows the latter.

d3d12_vulkan_device_test compares the TILED_RESOURCE quality levels of six
formats at five counts with the host's (allowing that one difference). The
allocation side of the AMD failure is c97ae261's host-quality gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:32:12 +01:00
8ab01bbe3b XDXR: totalSizeIn64BNodes does not count the header, a structure is 64 * (field + 1) bytes (RT-151)
docs/bvh.md 3.1: u32@0x20 = 0x140 + 64 * totalSizeIn64BNodes, 271,627 of
271,627 streams. xdxr_build.comp wrote total_size / 64; the copy and
postbuild paths read the field as the whole size, and tools/xdxr_bvh.py
wrote and validated it the same way. Now the header writes total / 64 - 1,
MODE_COPY_AS and MODE_POSTBUILD use (field + 1) * 64, validate() and the
reference builder agree, xdxr_build.inc is regenerated (glslc 2026.4) and
d3d12_xdxr_rt_test reads the size the same way.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 11:30:53 -05:00
b9a3cbcfc0 gameinput: GetTemporalReading stays E_NOTIMPL, as in GameInput v0 (RT-147)
Microsoft's reference page says IGameInput::GetTemporalReading "was never
implemented in v0" and returns E_NOTIMPL, and v1 removed it, so the shim's
E_NOTIMPL already matches the API the title was built against. A history
lookup would answer what no GameInput runtime does. The v0 header (NuGet
Microsoft.GameInput 0.2303.22621.3038) declares (timestamp, device,
reading), the shim's layout; the page's five-parameter form doesn't match it.

Pin the behaviour in gameinput_test (E_NOTIMPL with the reading cleared, for
past, present and current timestamps, with and without a device filter;
E_POINTER for a null output) and say so in docs/gameinput.md instead of
listing the method as a gap.
2026-11-22 10:26:34 -06:00
0c45e9a569 Pipelines stage: use the new checker options only when the build has them; the checker rejects unknown options
Review of #2111 (@matheuskshn): a vk_pipeline_check built before this PR takes any argument it doesn't know as the
cache path. Run with --inflight-file F, it would write the Vulkan pipeline cache into F and exit 0; make_game.py would
then delete F and report success, with no pipeline_cache.bin. That happens with a reused runtime build or a supplied
Windows build (#2194).

- make_game.py asks the checker first: run without arguments it prints its usage before touching Vulkan, and only a
  build that lists --inflight-file and --skip-file gets them and the crash retry. An older build runs exactly as before
  (one call, a crash stops the stage), with a log line saying to rebuild the runtime stage for crash recovery.
- vk_pipeline_check: an unknown --option or a second positional argument is now a usage error (exit 2) instead of
  silently becoming the cache path, so the next new option can't be swallowed the same way.

Tested on Windows 11 Pro 25H2, MSVC 14.51 + Ninja, RTX 5070 Ti / 621.24:
- checker_supports: True for this build, False for a 6a6704df build (before this PR).
- the new checker: --no-such-option and a second cache path exit 2 with a message.
- make_game.pipelines on 62 real compute modules: with this build and a simulated crash, the module is skipped and
  the other 61 checked, as before; with the 6a6704df build, one call without the new flags, exit 0, and the cache in
  pipeline_cache.bin (6.7 MB), nothing written to pipeline_inflight.txt.
- tests/test_make_game_pipelines.py: 11 tests, 2 new (an older checker gets the old invocation and isn't retried;
  support is read from the usage line). All 14 test_make_game*.py files pass.
No game data. AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:25:07 -05:00
cfcc6c54a3 runtime: implement ID3D12Device9::CreateShaderCacheSession and ShaderCacheControl (D3D-34)
Add in-memory ID3D12ShaderCacheSession support (FindValue, StoreValue, SetDeleteOnDestroy, GetDesc) and ID3D12Device9::ShaderCacheControl on the Vulkan-backed D3D12 device, matching the Windows D3D12 host runtime's validation, size queries, duplicate rejection, cross-session sharing, and delete-on-destroy lifecycle.

Verified with synthetic test d3d12_shader_cache_test comparing the Vulkan layer against the host Windows D3D12 runtime under LEONIDA_VK_VALIDATION=1.
2026-11-22 17:24:30 +01:00