Commit Graph

18350 Commits

Author SHA1 Message Date
421207afdc Runtime: clear the Xbox flag high byte in the d3d12_xs deserializer
The d3d12_xs shim masked 0x03000000 on a copy before the host serializer but
forwarded D3D12CreateRootSignatureDeserializer blobs unchanged. The host
deserializer rejects a blob whose RTS0 flags carry that high byte (measured
E_INVALIDARG), and docs/d3d12_vulkan.md says the flags "must be masked on a
copy before the host serializer/deserializer".

copy_rts0_blob_clear_xbox_flags walks the DXBC chunk table to the RTS0 chunk,
clears bits 24-31 of its flags on a copy, and the deserializer forwards that
copy when a rewrite is needed. root_sig_test adds test_deserializer: it
tampers a serialized blob with 0x03000000, checks the host rejects it, and
checks the registered shim deserializer clears it and returns flags 0.

AI-assisted (Cline).
2026-11-22 00:36:18 +01:00
e87d82d7c0 Test viewer chunk scheduling work and order 2026-11-22 00:36:00 +01:00
a42b5e2c75 Skip unnecessary viewer chunk candidate scans 2026-11-22 00:35:52 +01:00
714531412f check.py: find the Visual Studio build folders too; say which one was used (TEST-38 follow-up)
Follow-up to #337, from the review points there:

- resolve_build_dir, CONFIG_DIRS and the "not found" message move from
  scripts/run_gpu_tests.py into runtime/test/shaders/check.py, which
  run_gpu_tests.py already imports from. check.py main() now finds the
  programs in build/RelWithDebInfo, Release, Debug or MinSizeRel as well,
  so `check.py <out>` (docs/design.md, "Reproduce the shader tests") works
  with the Visual Studio generator.
- When the programs come from a configuration subfolder, one line says
  which: `test programs: <folder> (newest of A, B)`, so a #166 report can
  name the build it ran and a stale pick is visible.
- The "Test programs not found" message says the configuration subfolders
  were searched too (and gets a space after the colon in run_gpu_tests.py).
- tests/test_gpu_build_dir.py: the printed line, the message, and two
  main()-level tests (run_gpu_tests.main hands the resolved folder to
  run_suite, check.main hands it to the first test) with the programs faked.

No GPU used. AI-assisted.
2026-11-22 00:35:00 +01:00
cdaaebcac0 Tools: report a short OSG1 signature instead of aborting feature_scan
streams() read `count` 32-byte elements at `first` without checking the part
length, so a truncated OSG1 raised struct.error out of scan_dxbc and killed the
whole count-only scan. Treat a signature whose element table does not fit (or
whose first element overlaps the 8-byte count/offset header) as carrying no
stream information, matching the existing len(sig) < 8 case. Well-formed
signatures are read exactly as before.

Synthetic regression test in tests/test_feature_scan.py: it fails on
unmodified main with struct.error and passes with the fix; a work folder with
one truncated OSG1 still prints the summary and keeps the real stream-1 count.
No game data, no GPU. Full CPU suite: 1559 passed, 150 skipped, 1 xfailed;
semantic suite: 423 passed; compileall and --help clean.

New BUILD item claimed in #374. AI-assisted (OpenCode).
2026-11-21 17:34:45 -06:00
ea1d34dc61 Docs: the images row covers d16 compare results 2026-11-21 19:33:39 -04:00
8b884e475b Cover padded DDS rows with custom masks 2026-11-22 00:33:31 +01:00
f2ec9e5e17 Size DDS mask output from packed pixels 2026-11-22 00:33:23 +01:00
6ae02af006 Merge main into d3d-25-uav-clears
Conflicts: main moved texture create info into texture_create_info (the UAV
attachment usage now goes there, so placed-resource sizing agrees) and edited
the same docs paragraphs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:33:19 +00:00
0d31245e86 Tests: the depth compare sample result is an f16 under d16 2026-11-21 19:33:13 -04:00
d701d73f15 Translator: image_sample_c_lz returns an f16 under d16 2026-11-21 19:32:36 -04:00
ad0e4d143b Build: require Python 3.12+ to match CI 2026-11-21 20:32:33 -03:00
2e23b7e73b CI: lint GitHub Actions workflows with jactionlint 2026-11-21 20:32:33 -03:00
fe12da7edd D3D-35: implement ExecuteBundle IR inlining and validation 2026-11-22 00:32:28 +01:00
e166d2eb34 fix(fuzz): v_perm_b32 selectors 9/11 read bit 31, not bit 23
The oracle took bit 23 as the sign bit for selector bytes 9 and 11.
The ISA takes bit 7 of bytes 1/3 of each source: bits 15/31 of src1 and
47/63 of src0, so the second sign bit of each source is bit 31. The
translated SPIR-V was already right; this was a false mismatch in the
oracle, found by @kotorvr reviewing #325.

Adds a pinned test with both sign-bit patterns, and makes half of the
generated v_perm cases use a pinned selector built from bytes 0..15 so
the sign-bit, 0x00 and 0xff ranges are exercised instead of depending
on the seeded scratch values.

Verified: 29 cpu_ref tests, 6 shader_diff tests, 440 semantic tests,
and 3000 seeded programs with 0 mismatches and 0 skips.
2026-11-22 00:31:28 +01:00
25ca1d63f2 Merge upstream main into SHADER-7 and retain filtered clip dependencies 2026-11-21 15:31:09 -08:00
8af93abab3 tests/semantic: run Floor/Ceil/Trunc in the interpreter, and test v_floor/ceil/trunc/rndne
spirv_mini_interp.py had no GLSL.std.450 Floor, Ceil or Trunc, so v_floor,
v_ceil and v_trunc (f32 and f16) stopped with UnsupportedConstruct. Add them
next to RoundEven. An integral result now keeps the operand's sign (IEEE 754
roundToIntegral): RoundEven(-0.4) used to give +0.0.

tests/semantic/test_alu_rounding.py checks the four ops in f32 and f16
against a plain-Python reference (edge values, seeded values, the kept f16
high half, op_sel). test_interp.py tests the ExtInsts directly.
2026-11-21 20:30:29 -03:00
9500680a34 Treat non-mask b32 sources for s_ff* as scalars 2026-11-21 23:30:24 +00:00
5df3d01a5a Merge commit 'd937b7f092dbc188b59754e5c73c1a9dac553cf9' into codex/med3-result-modifiers
# Conflicts:
#	runtime/test/shaders/check.py
#	scripts/run_gpu_tests.py
2026-11-21 16:29:40 -07:00
467b1d1ff9 runtime: ClearUnorderedAccessViewUint/Float on the Vulkan device (D3D-25)
The CPU handle's slot is read while recording as the GFX10 T#/V# a shader
would load (docs section 3.4), so the clear works with whichever view
creation lands (#157, #328, #334) and with game-built descriptors.

- Buffers: vkCmdFillBuffer for elements up to 4 bytes, with the unaligned
  ends copied from the filled middle; 8/16-byte elements are written with
  vkCmdUpdateBuffer and doubled with copies. Rects are element ranges.
- Textures: vkCmdClearColorImage for whole views, vkCmdClearAttachments
  for rects (UAV textures also get COLOR_ATTACHMENT usage when the format
  supports it), in place in GENERAL; mip and layer range from the T#.
- Values follow D3D's Uint (raw low bits) and Float (converting) rules,
  encoded in the view's format and cleared into the image as the value
  that decodes those bytes in the image's own format (typeless resources).
- d3d12_uav_clear_test: hand-computed conversion checks, then raw,
  structured and typed buffers and 2D, array and volume textures cleared
  and read back through D3D12; refusals at record and replay.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:29:32 +00:00
993a2cbf72 Runtime: install static TLS for mapped images 2026-11-21 23:29:24 +00:00
8550970f10 Merge upstream GPU fixture dependencies into the two-mip test
Preserve the cube test's isolated vertex shader and count the new upstream compute checks alongside the two-mip draw.
2026-11-22 00:28:50 +01:00
85a4e7b2a7 Translator: v_subrev_f16 (S1 - S0 on the selected halves)
v_subrev_f16 (VOP2 0x34 on GFX10) raised Unsupported. Translate it with the
other f16 VOP2/VOP3 ops, swapping the two operands of the subtraction: op_sel
still names src0/src1 and the destination half, neg/abs/clamp apply as for
v_sub_f16, and the half that is not written is kept.

Tests: tests/semantic/test_alu_subrev_f16.py (VOP2 and VOP3 forms, every
op_sel combination, neg and clamp, and a seeded comparison with v_sub_f16 on
swapped operands), plus v_subrev_f16 rows in the f16 op_sel tables.
2026-11-21 20:28:24 -03:00
438e144270 Runtime: build with MSVC; the descriptor test shows a missed sampler lookup
Two findings from the review of #328, on MSVC 19.44 and an RTX 5080.

- bind_image did not compile with MSVC (C2397): the view's aspect, picked
  between two VkImageAspectFlagBits values, went into a VkImageAspectFlags
  field in braces. MSVC's enums are ints, so that is a narrowing
  conversion there; GCC and clang give the enum an unsigned type and accept
  it. The value is cast now.
- d3d12_descriptor_test passed with the sampler index forced to 0, because
  its point, clamping sampler and the fallback sampler read the same
  texels. The test's sampler now wraps in U and the shader samples one
  tile to the right: the right sampler gives the texture, the fallback its
  right edge. With the index forced to 0 the test fails (texel 0 reads
  224, 0, 135, 255 instead of 0, 0, 128, 255).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 18:28:13 -05:00
bc14565c45 Runtime: texture views and samplers go into the bindless set (M2, the device's part)
The device now keeps set 0 of the translated shaders and puts into it what
views and samplers name. No pipeline binds the set yet: that comes with
the compute path. Until then rt::d3d12::bindless_set / bindless_set_layout
hand it out.

- Device: CreateShaderResourceView and CreateUnorderedAccessView of
  textures write a T# into the slot, CreateSampler an S#
  (gfx10_descriptors.h); each makes sure set 0 has the view or sampler and
  the hash table has the key. The key is the descriptor's bytes, so a
  copied descriptor needs nothing more. A view that cannot be shown (a
  volume, a multisampled texture, the stencil plane, a range past the
  texture) leaves a null descriptor, which finds the fallback. A texture
  is named by an address of its own above 4 GiB that nothing dereferences;
  its keys are erased and its indices freed when it is destroyed.
- VulkanDeviceInfo::bindless says the Vulkan device has the features; the
  standalone device and the test helper enable them where the GPU has
  them, with samplerAnisotropy and samplerMirrorClampToEdge.
- Every ExecuteCommandLists flushes the set before its commands are
  written (VulkanContext::set_bindless_prepare).
- Layouts: a bindless descriptor has one image layout, but D3D12 samples a
  texture both in a shader-resource state and while promoted from COMMON
  (GENERAL here). With the set, a texture's shader-resource states use
  GENERAL too (ResourceBinding::sampled_in_general). This follows from the
  Vulkan rule for descriptor layouts; no test can see it broken, since the
  validation layer does not follow dynamic indices into runtime arrays.

Not done, and listed in docs/d3d12_vulkan.md: buffer and constant-buffer
views, 1D/3D/multisampled and stencil views, descriptors the game writes
itself, static samplers and shaders' literal S#s, and holding back a flush
that moves table entries while earlier command lists still run.

Test: d3d12_descriptor_test, through the Xbox-ABI proxy. It decodes what
the slots hold (a view of an uploaded 8x8 texture, a sampler, a BGRA cube
view with a component mapping, an unordered-access view, null
descriptors). Then a compute shader (test/glsl/cs_sample.comp, compiled
with glslangValidator where it is found) is handed a slot's T# and the
sampler's S#, looks them up in the hash table as a translated shader does
and samples; the test creates that pipeline in Vulkan and binds the
device's set. It reads the texture through the view's own slot and
through a copy of it, and gets the fallback from a slot of bytes no view
was made for and, once the texture is destroyed, from the view's own
bytes. Without the table insert, or without the removal at destruction,
the test fails. The test no longer compiles d3d12_xs_device.cpp itself:
the COM library has it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 18:28:13 -05:00
e0e9b901ff Runtime: test the 1.2 root-signature Xbox flag high byte clearing
root_sig_test only exercised the high byte clearing for 1.0 and 1.1. Add the
1.2 case (Desc_1_2 is D3D12_ROOT_SIGNATURE_DESC2, whose static samplers are
D3D12_STATIC_SAMPLER_DESC1) so the shim's 1.2 path is covered, and extend
test_registered_shim to prove the registered d3d12_xs serializer clears the
byte for 1.2 end-to-end.

AI-assisted (Cline).
2026-11-22 00:26:50 +01:00
ed6da6b699 FUZZ-3: float VALU differential fuzzer; v_mac_f32 unfused, conversion output modifiers
tools/f32_fuzz.py runs seeded VOP1/VOP2/VOP3 float programs (neg/abs, clamp,
omod) through an exact-arithmetic RDNA2 model and through the translated
SPIR-V in tests/semantic's interpreter, and compares them bit-exact.
Denormals, and inputs the emitted SPIR-V leaves undefined, are counted
separately instead of being compared.

Translator fixes it found:
- v_mac_f32 is the VOP2 form of v_mad_f32 (product rounded before the add),
  not of v_fma_f32 (LLVM getNewFMAInst: V_MAC_F32 -> V_MAD_F32_e64). It
  emitted Fma.
- VOP3 clamp and mul:2/mul:4/div:2 were dropped on v_cvt_f32_i32/u32,
  v_cvt_f32_ubyte0..3, v_cvt_f32_f16 and v_rcp_iflag_f32 (LLVM
  VOPProfileI2F: $src0, $clamp, $omod).

Interpreter: RoundEven keeps the sign of a zero result; Fma rounds once
(it double-rounded through a double); adds OpFDiv, OpIsNan, OpIsInf,
Floor/Ceil/Trunc/Exp2/Log2/Sqrt/InverseSqrt, raising where SPIR-V or
GLSL.std.450 leave the result undefined.

Pinned by runtime/test/shaders/ps_f32_mods.asm (check.py, run_gpu_tests.py,
tests/semantic/test_f32_valu.py) and tests/test_f32_fuzz.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:26:30 +01:00
fbffbce383 Runtime: preserve explicit RGBA8 typeless RTV formats for clears 2026-11-21 19:26:08 -04:00
d937b7f092 vk_pipeline_check: read subgroup_size null (--wave64-emulate: any size) as no required size
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 18:26:07 -05:00
514e11d848 Isolate concurrent manifest writes before atomic replacement 2026-11-21 20:26:04 -03:00
682ba4aa32 Merge branch 'main' into fix/f64-conversion-output-modifiers 2026-11-22 00:25:53 +01:00
e1e5be639b rpf_probe.py: print filesystem paths without escaping separators 2026-11-22 00:24:52 +01:00
49cd093d84 Docs: record the multiply-add literal rule in the contract table 2026-11-21 19:24:48 -04:00
3c2f2455d3 Merge origin/main into interp-float-compares 2026-11-21 20:24:44 -03:00
03bd5a0b20 Tests: ps_fma_literal checks which operand the literal multiplies 2026-11-21 19:24:37 -04:00
c334b56977 Translator: v_fmamk_f32 and v_madmk_f32 multiply S0 by the literal 2026-11-21 19:24:19 -04:00
5800d0ec69 rbf0_tree.py: validate requested limits and offsets before decoding 2026-11-22 00:23:40 +01:00
73e1bf79bb swizzle_search.py: explain why an empty search cannot produce a preview 2026-11-22 00:23:40 +01:00
803b57d651 hashdict.py: require inputs for build and lookup 2026-11-22 00:23:40 +01:00
31925ff0c6 classify_carve.py: preserve reports when a write fails 2026-11-22 00:23:40 +01:00
7b2bf8cf61 audio_config.py: stream input files when scanning without --join 2026-11-22 00:23:40 +01:00
3a9e32ee1c Address packed buffer-store atomics through a dword array element 2026-11-21 16:23:36 -07:00
11c13f552e Isolate Git environment in Windows submodule tests
Pass a fixture-specific environment to Git subprocesses so test cleanup
preserves inherited empty Git config values on Windows.
2026-11-22 00:22:59 +01:00
d7cbc3e7cb Translator: split a dispatch OpSwitch past SPIR-V's limits into two levels
With --wave64-emulate the two ScreenProbes compute shaders reach ~37k dispatch blocks: one OpSwitch of 74k
words, past the 65,535-word instruction limit (and spirv-val's 16,383-case cap). An outer switch on
pc / 16000 now picks a chunk; each chunk is its own selection construct whose blocks exit to its merge. All
26,503 shaders translate and validate with --wave64-emulate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 18:22:19 -05:00
bb65ea6c35 runtime: require idle for bindless key replacements 2026-11-22 00:21:48 +01:00
2a122c7cbc Cite BVH4 header source and report version field 2026-11-21 23:21:07 +00:00
fc7a3d9ca7 FUZZ-4: scalar ALU differential fuzzer; s_ff0_i32_b32 on a constant
tools/salu_diff.py runs seeded SOP1/SOP2/SOPC/SOPK programs through its
own reference and through the translator plus spirv_mini_interp, and
compares three SGPRs and SCC. It found that s_ff0_i32_b32 read a 32-bit
constant source as a lane mask; constants are now values, as for
s_bcnt*_b32. GPU-checked with ps_salu_ff.asm.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:21:00 +01:00
2003018967 Add synthetic f64 conversion fixture 2026-11-22 00:20:56 +01:00
4c7652f17c fssm_header.py: search both locations for shader stages 2026-11-22 00:20:29 +01:00
286f365cc3 tex_mode_probe.py: reject formats without a supported color scorer 2026-11-22 00:20:29 +01:00