Commit Graph

5744 Commits

Author SHA1 Message Date
2aed56c6e5 RT-176: IGameInputDispatcher::Dispatch honours its quota
Dispatch ran the whole queue whatever quota it was given. It now runs
queued events oldest first, at least one per call (a quota of 0 runs
exactly one, as the GDK documents), takes no further event once the
quota has passed, and returns whether events remain. While events
remain the wait handle is signalled again, so a title that waits on it
before each call comes back for the rest.

The automatic path (no dispatcher, poll thread) still delivers the
whole queue. gameinput_test checks Dispatch(0), a 1 ms quota against a
5 ms callback, a large quota draining the queue, and an empty queue.
2026-11-22 14:31:09 -03:00
26aec3d46a Merge main into stale-unverified-rows (#2053)
Conflicts:
	docs/design.md

AI-assisted.
2026-11-22 18:30:40 +01:00
a3361d3735 fix(shader): use the texture format for 3D mip loads
Integer volume texels require matching sampled image types. Route the explicit mip through the shared typed fetch so sparse masks and D16 narrowing also preserve the intended channel values.
2026-11-22 18:29:12 +01:00
2651d688d1 Check unresolved archetype references across the other package archives 2026-11-22 18:28:19 +01:00
c15761b8cc SHADER-430: measure the v_interp ALU ops on gfx1036; p2_f16 keeps vdst's high half
tools/interp_hw_probe.py runs v_interp_* in a compute wave through tools/hw_oracle (the ops read the
attribute words from LDS at M0) and checks them against exact models: p1/p2_f32 and p1ll_f16 are single
fmas rounded to f32, p2_f16 rounds once straight to f16 (30 discriminating ties), and a 32-bit read of a
packed channel takes the raw words as f32. f32 denormal words follow MODE. All 292,474 checks match per
mode on a Radeon gfx1036 iGPU.

v_interp_p2_f16 keeps the high 16 bits of vdst on hardware; the translator zeroed them. It now writes
the low half only (write_lo16), with a semantic test that fails on the old code.

The SPI half (what a real draw writes into LDS for a packed channel) stays unverified; it needs a
pixel-shader harness.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:27:10 +01:00
a3b1719c61 gameinput: report and drive force-feedback and haptic motors through SDL3 haptics (RT-160)
IGameInputDevice answered the force-feedback and haptic half of the API with
nothing: no motors in GameInputDeviceInfo, E_INVALIDARG from
CreateForceFeedbackEffect, false from IsForceFeedbackMotorPoweredOn, a no-op
SetForceFeedbackMotorGain and E_INVALIDARG from SetHapticMotorState. A pad SDL
opens as a haptic device now reports one force-feedback motor with the effect
kinds SDL lists, and a pad with trigger motors reports two haptic motors.

Force feedback goes to SDL_CreateHapticEffect/RunHapticEffect on the poll
thread, so title calls still never touch SDL; the eleven GameInput effect kinds
are SDL's eleven force-feedback effects. The trigger haptic motors play their
one waveform as an intensity on the existing trigger output. A pad with neither
keeps the old answers, and LEONIDA_RUMBLE=0 silences both. gameinput_test drives
all of it through a fake haptic backend, because SDL's virtual joysticks report
no haptics.

AI-assisted.
2026-11-22 18:26:28 +01:00
c1d3363bae rdna2spirv: bitwise abs/neg in v_cmp(x)_class_f32 to preserve sNaNs 2026-11-22 18:25:19 +01:00
b0a9c16d21 d3d12: private data answers as the host runtime does
d3d12_private_data_test runs the same 672 GetPrivateData / SetPrivateData /
SetPrivateDataInterface / SetName steps on the device, a fence, a buffer, a
command allocator and a descriptor heap of the Vulkan-backed device and of the
host runtime, and compares every HRESULT, returned size, byte and reference
count. On main 130 of them differed (RTX 3060, driver 610.88), the same four
rules on every object:

- SetPrivateData with null data removes the entry whatever the size: S_OK
  when there was one, S_FALSE when there wasn't. The layer answered
  E_INVALIDARG for a nonzero size and kept the entry, and S_OK for a missing
  one.
- Zero bytes with data keep an empty entry (size 0); the layer removed it.
- SetPrivateDataInterface(null) releases the interface and keeps a
  pointer-sized entry that reads back as null; the layer removed it.
- SetName is not readable through GetPrivateData: the host sets neither
  WKPDID_D3DDebugObjectNameW nor the narrow key. The layer stored the name
  there; it now keeps it apart (debug_name()).

SetName(nullptr) faults in the host runtime; the layer still clears the name,
and the test reports those 5 steps as not compared.

d3d12_debug_markers_test's private-data checks expected the old answers and
now expect the host's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:24:14 +01:00
6bbc893ea2 Tests: GPU test for 16-bit float VOPC compares (all 16 f16 predicates, e32 and e64)
Two pixel tests, ps_vcmp_f16 (e32, VCC) and ps_vcmp_f16_e64 (SGPR destination,
swapped operands), with NaN, +-0, +-inf, f16 denormals and junk high halves.
Words derived by hand in the headers; semantic fixture and test added.

AI-assisted.
2026-11-22 18:24:00 +01:00
2de7683f43 progress_dashboard: read make_game.py's shaders folder; add a GPU-test panel
- corpus: make_game.py writes <work>/shaders/dxbc and <work>/shaders/spirv; the tool
  looked for <work>/dxbc and <work>/spirv and found nothing on a real work folder. The
  shaders folder itself is accepted too. The test now builds that layout.
- GPU tests: --gpu-log <file>[=<GPU, driver, OS>] reads the saved output of
  runtime/test/shaders/check.py, one group per GPU. ok is a pass, SKIP is not counted,
  anything else is a failure with its one-line detail; a log older than the last commit
  touching runtime/test/shaders or tools/rdna2spirv.py counts as needing a re-run.
  Result lines are told from the other lines check.py prints by its {name:20} column.

Checked on a real work folder: 26,501 of 26,503 carved shaders pass spirv-val, and none
of the 26,503 shader names appears in the page or the JSON.
2026-11-22 14:23:53 -03:00
542d028004 Merge remote-tracking branch 'origin/main' into perf/wave64-emulate-dead-scc-exec-fold
# Conflicts:
#	docs/design.md
#	tools/rdna2spirv.py
2026-11-22 13:23:16 -04:00
27546ddc2b story_index: validate the 0DRP auxiliary table before labelling it clip-stream
story_index gave any stream starting with a u32 of 2 or 3 and the bytes
01 01 00 00 the historical clip-stream signature, reported the count as a
version and called it a 24-byte header, even when only the eight-byte
prefix was present.

Reuse anim_index.aux_table from #2496 (u32 count 2 or 3, count
{u32 tag, u32 payloadBytes} pairs with first tag 0x101, every payload
inside the stream) and report the same record as anim_index: signature
clip-stream, count = entry count, no version, detail with the tags and
payload end. Streams that fail the check fall through to the generic
zero-prefix/text/raw handling. The tool still runs with python -I; the
other classes and the scan, directory and output paths are unchanged.

Synthetic tests cover the record, parity with anim_index, exact fit,
trailing bytes, payload overrun and oversized sizes, the bare and
truncated old prefix, wrong counts or first tags, and an archive scan.

Claim: https://github.com/ItsNotRexed/Leonida/issues/2300#issuecomment-7082717677
Depends on: #2496

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:22:41 +01:00
2770653f4e v_div_fmas: pre-scale operands before Fma when safe to preserve tiny intermediates 2026-11-22 18:22:22 +01:00
1ace3ac642 Merge remote-tracking branch 'origin/main' into d3d12-queues-v2
# Conflicts:
#	runtime/src/vulkan_backend.h
2026-11-22 18:21:38 +01:00
0a8c08a564 audio_config, world_names: hash a name as the pinned latin-1 joaat does
audio_config hashed the lowercased UTF-8 bytes, and world_names encoded to UTF-8
before lower-casing the bytes, so both gave a different 32-bit hash for any
non-ASCII name than hashdict.py and awc_names.py, which hash the lowercased
latin-1 bytes that tests/test_hashdict.py pins. A title with an accent then
produced a stream id no AWC bank stores. Both copies now use the dictionary
form, and a cross-tool test holds every joaat copy in tools/ to it.
2026-11-22 17:21:26 +00:00
935bc8e4ac cvt_norm_f16: record RDNA2 gfx1036 hw verification and add SDWA WORD_1 test 2026-11-22 18:20:21 +01:00
524d1e92bd feat(shader): translate signed and unsigned 32-bit integers to binary64
RDNA2 lighting and geometry programs can convert an integer to a double without losing low bits. Emit the conversion at binary64 precision and use the same scaled, masked VGPR-pair writes as double addition.
2026-11-22 18:19:35 +01:00
94955e12c3 tools: fmisc_diff.py, a differential fuzzer for f32 misc ops and float compares
A separate exact-rational ISA model for v_fract_f32, v_frexp_mant/exp_f32, v_ldexp_f32, v_cvt_u32/i32_f32, v_cvt_off_f32_i4, v_fmamk_f32, the 16 v_cmp_*_f32 conditions and v_cmp_class_f32, with neg/abs, omod and clamp and every source kind within the constant-bus rules, compared one lane at a time with rdna2spirv run in tests/semantic/spirv_mini_interp.py, optionally with the hardware through tools/hw_oracle (run under IEEE off, f32 denormals flushed). Denormals, NaN payloads read as integers, clamp of a NaN and omod giving a zero are counted skips. v_cmp_class_f32 with neg/abs on a signalling NaN only with --known.

AI-assisted.
2026-11-22 18:19:02 +01:00
5402335df2 Add additional commands to quickstart guide
Adds `--pick` and `--check --full-check` examples to the French quickstart.
2026-11-22 18:18:08 +01:00
7834593b51 docs: update embedded shader translation count to 51/52 (PROC-120)
Update docs/embedded_shaders.md §4 and §5 and related references in
docs/d3d12_vulkan.md to reflect current main: 51 of 52 XboxBvhBuilder.dll
compute shaders now translate and pass spirv-val since #1871
(GFX10_FORMAT_8_UINT) and #1968 (427c1376: global_atomic_fmax/fmin and
buffer_load_ushort) landed.

Only Box16Rehydration remains blocked, awaiting buffer_store_short (#1864).

Claim: https://github.com/ItsNotRexed/Leonida/issues/2300#issuecomment-7082579530
2026-11-22 18:16:21 +01:00
56a51c405d rdna2spirv: implement 10 32-bit LDS CAS atomics (SHADER-448) 2026-11-22 14:15:20 -03:00
c921b244ab rdna2spirv: v_mad_u32_u16 / v_mad_i32_i16 op_sel on S2 and D, and clamp
These forms were refused. Measured on RDNA2 (gfx1036, raw kernels through
tools/hw_oracle, wave32 and wave64): op_sel bit 2 adds S2[31:16]
zero-extended (in the i16 op too), op_sel bit 3 writes the result shifted
left by 16, and clamp saturates the sum to u32 / i32 before that shift.

GPU test ps_valu16_mad_sel (4096/4096 on RTX 5080 and the gfx1036 iGPU), the
same shader as a semantic fixture, test_alu_mad_32_16 checks the measured
rule instead of the refusal, and a docs/design.md row (EGEN-HW-MAD-U32-U16).

AI-assisted.
2026-11-22 18:15:11 +01:00
289f2e948a Translator: v_readfirstlane_b32 in a vertex shader without BallotFindLSB (SHADER-413)
A native readfirstlane is a ballot of the EXEC lanes, its lowest set bit
and a shuffle from that lane. MoltenVK lowers OpGroupNonUniformBallotFindLSB,
like the SubgroupSize built-in, to Metal's threads_per_simdgroup input,
which a vertex function can't declare, so every VS with a readfirstlane
failed to compile on Apple GPUs.

In a vertex shader the lowest bit is now taken with FindILsb over the
ballot's four words, the form the --wave64-emulate path already uses on
its mask words. It gives the same lane, since a ballot has no bit at or
above the subgroup size. Other stages keep BallotFindLSB.

On an Apple M4 (MoltenVK 1.4.2), with the 1.0.2.1 corpus translated from
4eb6155d: exactly the 572 VS that contain v_readfirstlane_b32 change, and
all 2,236 stay spirv-val-valid. VS pipelines go from 667 to 672 on main,
and from 1,662 to 2,233 of 2,236 with #1784's --no-vertex-subgroups.

tests/semantic/test_vs_readfirstlane.py runs it on the wave interpreter,
with the first EXEC lane in word 0 and word 1 of the ballot.

AI-assisted.
2026-11-22 18:14:30 +01:00
d6e1ad09c4 design.md: one row each for the topics main repeated after 4eb6155d (PROC-106)
Merges after 4eb6155d repeated 16 more topics in design.md (DPP, EXEC,
Control flow, 32-bit global atomics, 2D array resource dimensions,
v_pack_b32_f16, Multiply-add and output modifiers, Float min/max/med3,
Wave64 handling, ds_cmpst_b32, the 16-bit frexp/ldexp and min3/max3/med3
rows, v_cvt_flr/rpi, buffer_atomic_*_x2, wave64 partition invariance and
Buffer bounds checking). Each is one row again at the first copy's place.

Copies that were an older version of the row brought back by a merge
(EXEC, global atomics, ds_cmpst_b32, v_cvt_flr/rpi, partition invariance,
buffer bounds) give way to the current row. Where two copies each added
something (control flow, global atomics, multiply-add, 16-bit min3/max3/
med3), the row keeps both.

AI-assisted.
2026-11-22 18:14:13 +01:00
90a046eaa4 perf(runtime): inline draw views and move into CommandList to eliminate allocations (D3D-289)
In `replay_cpu_bench` and real game execution, recording draws was the largest
remaining per-draw overhead (~155-160 ns and 4 heap allocations per draw call,
measured by @traeb0n in #2123 follow-up finding D3D-289).

Previously:
- `d3d12_com.cpp` heap-allocated a dynamic `std::vector<TargetView>`
  for render targets and another `std::vector<VertexBufferView>` for vertex buffers
  (copying from the list's 32-element array).
- `CommandList::draw(const Draw&)` then copied both vectors again into the `Command`
  variant inside `commands_`, resulting in 4 heap allocations per draw.

This change:
- In `runtime/src/command_list.h` (`leonida::Draw`):
  - Replaces `std::vector<TargetView>` with fixed inline `std::array<TargetView, 8> render_targets`
    (matching `D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT` = 8) and tracks `render_target_count`.
  - Replaces `std::vector<VertexBufferView>` with fixed inline `std::array<VertexBufferView, 32> vertex_buffers`
    (matching `D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT` = 32).
  - Adds rvalue `bool draw(Draw&&)` overload that moves the command into `append(std::move(draw))`.
- In `runtime/shims/d3d12_com.cpp`:
  - Stores `render_targets_` as an inline `std::array<leonida::TargetView, D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT>`,
    eliminating heap reallocations on `OMSetRenderTargets`.
  - Directly passes `vertex_buffers_` without copying into a temporary vector.
  - Moves `draw` with `check(list_.draw(std::move(draw)))`.
- In `runtime/src/vulkan_replay.h`:
  - Iterates over bound render targets using `slot < draw.render_target_count && slot < draw.render_targets.size()`.
- In `runtime/test/d3d12_com_test.cpp`:
  - Adds static assertions verifying `Draw` move constructibility, move assignability,
    and fixed inline array sizes.
- Updated `docs/d3d12_vulkan.md` with the contract details.

Result: 0 heap allocations per draw call (down from 4), eliminating ~155-160 ns
recording overhead per draw call.

Tested:
- `python -m compileall -q make_game.py tools tests`: OK
- `python -I make_game.py --help`: OK
- `static_assert` checks in `d3d12_com_test.cpp`: verified
Hardware: Tested on AMD Radeon RX 7800 XT (driver 24.20.19.05 / Vulkan 1.4.359 / Windows 11).
AI-assisted. Standard library / C++ only; no game content or carved assets.

Item: D3D-289
Depends on: #2123
2026-11-22 23:11:32 +06:00
9b17404e15 Runtime: replay overlapping statistics and binary occlusion queries (D3D-252)
D3D12 only forbids beginning the same query element twice while it runs, so a
command list may overlap two pipeline-statistics queries, or an ordinary
occlusion query and a binary one, on different slots of one heap. The replay
refused all of those with ReplayResult::unsupported. The overlapping-ordinary
occlusion machinery already virtualizes concurrent queries as non-overlapping
physical segments whose results are summed; this extends it to the remaining
cases:

- Binary occlusion joins the ordinary kind in the same physical pool (both are
  VK_QUERY_TYPE_OCCLUSION, so one physical query is open at a time and the
  shared intersection interval is counted by both logical queries). A binary
  resolve of a multi-segment query sums its segments and normalizes the total
  to 0/1 (OcclusionResolve::sum_binary; run flag needs_sum_binary).
- Overlapping pipeline-statistics queries split into the statistics pool with
  the same one-slot-per-event layout (plan_overlapping_statistics_segments);
  every non-timestamp resolve while a query runs closes and reopens the open
  segment for D3D-162's helper-dispatch exclusion. The single-list replay()
  helper still has no segment pool and refuses such lists outright instead of
  running two Vulkan queries of one type whole.

The device test's old pin of the occlusion+binary refusal now expects a
replay; vk_overlapping_occlusion adds crossing statistics queries checked
word-by-word against three unsplit references and an ordinary query around a
binary one; replay_query_predication pins the segment layouts, the composite
binary resolve and the helper's refusal without a GPU. docs/d3d12_vulkan.md
4.6 moves the case out of "Not implemented yet".

AI-assisted: yes
2026-11-22 18:10:42 +01:00
9db2fffc6c design.md: Buffer format stores list sint 8/16 as well
The FORMATS table encodes the sint 8/16 formats (6, 12, 19, 28, 61, 70 in
tools/rdna2spirv.py) next to uint 8/16. Noted by HQasper on #2063.

AI-assisted.
2026-11-22 18:10:11 +01:00
1a22106ac6 Docs: 51 of the BVH builder's 52 FSSM programs translate on main; one rule (buffer_store_short) left (PROC-120)
Recounted with main 49475796 on the 1.0.2.1 package (counts only): 52/52 unpack,
42 clean and 10 with invalid words in the disassembly, 51 translate and pass
spirv-val. The four rules embedded_shaders.md listed are three since 427c1376
(#1968); Box16Rehydration stops at buffer_store_short (#1864). d3d12_vulkan.md
and the docs index quoted 41/42 and four rules in seven places.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:10:07 +01:00
21a1ecf897 rdna2spirv: implement v_div_fixup_f16 and v_div_fixup_f64 2026-11-22 18:09:58 +01:00
984dcc3c3c docs: one row per topic again in design.md, README.md and testing.md (PROC-106)
tests/test_docs_design_rows.py failed on main again: merges after
64ece042 and abbb3dce kept both sides of rows two branches had edited.
design.md had 24 topics repeated (two to five rows each), README.md one
and testing.md two.

Each group is now one row at the first copy's place, keeping every fact
any copy stated. Where copies disagreed, the newer wording (by git blame
and the commit that wrote it) wins: for example, the --f16-interp-fallback
row no longer also gives the pre-SHADER-291 locations 29 - 2N / 30 - 2N,
the "Not GPU-verified" notes give way to the SHADER-137 hardware results
added to the same rows, and "tbuffer_store_format_* is not translated"
gives way to the paragraph describing how it is translated.

A sentence-by-sentence check of every copy against the merged row finds
only those deliberately replaced. The four docs tests pass.

AI-assisted.
2026-11-22 18:09:57 +01:00
ca540fb35a Resolve archetype clip references and frame the 0DRP auxiliary payloads 2026-11-22 18:09:01 +01:00
06451e4819 docs/design.md: drop the duplicated Models row (keep the one with the levels.rpf footnote marker)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:08:00 -05:00
49b8901e34 rdna2spirv: return +0.0 from v_cubema_f32 when major axis is -0.0 2026-11-22 09:07:49 -08:00
9a82abceb3 tools/progress_dashboard: local page of what works, what changed and what blocks next
progress_dashboard.py (standard library, python -I) collects outcomes the project already
produces and writes a self-contained progress.html, JSON snapshots and a history into a
folder outside the repository (a folder inside it is refused):

- unit tests: --run-tests runs tests/test_*.py with ci.yml's selection, one process each;
  a test counts as current only if neither it nor tools/, scripts/, make_game.py changed
  since it passed (content digests, so uncommitted edits are handled too)
- runtime tests: runtime/build LastTest.log and --junit files (CTest or pytest)
- the translator contract table in docs/design.md, each row classified by how it says it
  was confirmed, with the matched words shown
- the measured tables in docs/runtime_imports.md
- --work: per-stage counts from the user's own carve and translation (numbers only)
- --github (read-only gh): latest completed CI run per workflow on main, the D3D- table
  of #313, the coordination issue's section sizes and, with --login, claims and PRs

No game data: counts, pass/fail and error classes only; no shader names or paths into the
game copy. The page has no packages and no network access. tests/test_progress_dashboard.py
covers the parsers, the classification, freshness, the no-names rule and the output folder.
2026-11-22 14:07:29 -03:00
ede5918824 fix(shader): match explicit 2D LOD samples to the texture format
Integer images need an integer sampled type for defined Vulkan texels. Use the descriptor format to select it while carrying the supplied mip level into every branch.
2026-11-22 18:06:36 +01:00
97afefdebc Merge remote-tracking branch 'origin/main' into shader-33-vs-inputs
# Conflicts:
#	tests/test_shader_checks.py
2026-11-22 18:06:20 +01:00
2a015677b3 Runtime: geometry shaders in graphics PSOs (VS + GS + PS)
CreateGraphicsPipelineState refused any desc.GS, although all 195 geometry
shaders translate (triangles in, a triangle strip out; docs/design.md
"Geometry shaders"). The stage table now holds VS, GS and PS; a GS needs the
geometryShader feature (enabled on the standalone and test devices where
the GPU has it, E_NOTIMPL otherwise), and the PSO's topology type must be
TRIANGLE, the GS's input (E_INVALIDARG otherwise). The push-constant range
names the geometry stage only where the device has it. Hull, domain and
stream output stay refused.

d3d12_geometry_test (in ctest): a GS that emits each triangle twice, against
a pipeline without one, and a line topology refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:05:49 +01:00
70232f1589 rdna2spirv: single-rounded UNORM/SNORM stores and 2-comp DST_SEL swizzle (SHADER-364) 2026-11-22 18:05:15 +01:00
506379fcb2 docs: rebuild the contract-row dedupe on current main
Merge every repeated topic in docs/design.md, docs/README.md and docs/testing.md into one row, keeping the current measured numbers (382,781 models; 4,686 fragments / 30,343 bone-bound / 126,301,454 triangles excluding levels.rpf) and folding in the unique verified facts from the shorter duplicates.
2026-11-22 17:05:09 +00:00
e7b3ab29c5 rdna2spirv: implement 32-bit global_atomic_{inc,dec} and buffer_atomic_{inc,dec} 2026-11-22 14:05:00 -03:00
dd0ac1f704 docs/design: mark the EXEC and 64-bit scalar bitwise rows hardware-verified 2026-11-22 20:04:45 +03:00
ebae4f54c3 hw_oracle: native RDNA2 measurement of MODE.FP_ROUND f16/f64 (SHADER-132) 2026-11-22 18:03:54 +01:00
f499cdbd7e rdna2spirv: implement v_div_fmas_f32 and v_div_fmas_f64 2026-11-22 18:03:37 +01:00
076149b744 d3d12: placed and reserved resources answer their arguments as the host does
compare_placed_reserved (d3d12_vulkan_device_test) runs 76 CreatePlacedResource
and CreateReservedResource cases against the host runtime on the standalone
device. On main 31 of them differed (RTX 3060, driver 610.88):

- CreatePlacedResource checked none of the description, initial-state and
  clear-value rules CreateCommittedResource has, and checked a plain texture's
  size against nothing: a texture larger than its heap, or past its end, was
  accepted. A small texture (4 KiB alignment) at a 4 KiB offset was refused.
- CreateReservedResource checked those rules only for textures (through the
  committed backing) and never the initial state or clear value.
- Both answered a null output with S_FALSE; the host checks the arguments,
  then answers E_UNEXPECTED.

The initial state was not checked for committed resources either. The host
takes exactly GENERIC_READ, one write state alone (RENDER_TARGET,
UNORDERED_ACCESS and DEPTH_WRITE with their flag), or a mix of read states on a
texture; any bits on a buffer except the acceleration-structure state without
UAV access. initial_state_refusal holds that rule, in committed_resource_refusal,
so committed, placed and reserved resources share it; 23 "committed: ... state"
cases pin it in compare_invalid_arguments.

A placed buffer in an upload or readback heap takes any initial state on the
host (a committed one must start in GENERIC_READ or COPY_DEST); UAV access is
refused there as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:02:11 +01:00
3d7013b707 GPU test cs_fmt_int_narrow: 8/16-bit UINT/SINT typed buffers, words from gfx1036
A compute fixture loads through the nine narrow integer formats (DST_SEL
XYZW, X011 and d16) and stores edge values through each with the
runtime's selectors. check.py's 136 expected words are the same program's
output run natively on gfx1036 (tools/hw_oracle, wave32 and wave64), and
the interpreter test runs the fixture against them too.

Depends on #1871.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:02:10 +01:00
91fb9d601a tools: pk16_diff.py, a differential fuzzer for packed and 16-bit integer VALU
A separate ISA model for the v_pk_* integer ops (op_sel, op_sel_hi, clamp) and the 16-bit VOP3 integer ops (op_sel on sources and the destination half, the kept other half, clamp), with VGPR, SGPR, inline-constant and literal sources within the constant-bus rules, compared one lane at a time with rdna2spirv run in tests/semantic/spirv_mini_interp.py, optionally with the hardware through tools/hw_oracle. A constant whose high half a packed op reads (#2224) only with --known.

AI-assisted.
2026-11-22 18:01:58 +01:00
ee556a83d7 rdna2spirv: v_sin/v_cos give +0 at odd half/quarter turns, as RDNA2 does (SHADER-134)
Measured natively on gfx1036 (f32 and f16, every quarter turn from 0.25 to
2^24 of either sign, around +-256, specials): sin at an odd half turn and
cos at an odd quarter turn are exactly +0, where Sin/Cos of the rounded
2*pi gave about -+8.7e-8 (or a 1-ulp f16 denormal). The test holds 500
measured words (whole, half and quarter turns, infinities, NaN).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:01:14 +01:00
3b0348e3ea rdna2spirv: v_cvt_flr_i32_f32 of a negative denormal is 0, as on RDNA2 with f32 denormals flushed
Floor of the kept denormal gave -1. 44 more measured words (gfx1036) for
v_cvt_flr_i32_f32 and v_cvt_rpi_i32_f32 (the control) in the test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:01:12 +01:00
563cd2b7bd rdna2spirv: v_floor/ceil/fract_f32 read a denormal as zero, as RDNA2 does in the game's MODE
Measured natively on gfx1036 (IEEE 0, f32 denormals flushed): floor(-1e-45)
is -0, ceil(+1e-45) +0 and fract of either 0, where a translation that keeps
the denormal (any driver that keeps f32 denormals) gives -1.0, +1.0 and
0x3f7fffff. fract(+-inf) is exactly 0xffc00000 and a NaN operand passes
through unchanged. The new test holds 75 measured words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:01:10 +01:00
0143a14b52 design.md: 16-bit min3/max3/med3 measured on RDNA2; test with the measured words
v_min3/v_max3/v_med3 on f16, i16 and u16 were 'Not GPU-verified'. 6,092
cases run natively on gfx1036 (tools/hw_oracle, IEEE 0, f16 denormals
kept) give the translator's word except src0's NaN payload when all three
operands are NaN, which the row already lists as not modelled for the
32-bit ops. The new test holds 540 of the measured words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:01:08 +01:00