Commit Graph

1134 Commits

Author SHA1 Message Date
e3c9fbd2f2 Merge pull request #1329 from undeadhuman37 2026-11-22 05:37:43 -05:00
2837c2fdac Merge pull request #1328 from Ewann 2026-11-22 05:37:43 -05:00
a292b93a63 Merge pull request #1313 from SombraSoft 2026-11-22 05:37:40 -05:00
d01d1df494 Merge pull request #1306 from zneel 2026-11-22 05:37:40 -05:00
3d4bd43117 Merge pull request #1302 from Vonsek 2026-11-22 05:37:40 -05:00
53300de17f Merge pull request #1270 from AimLogin 2026-11-22 05:37:39 -05:00
6314d00c16 Merge pull request #1256 from abilliontokens 2026-11-22 05:37:39 -05:00
2f6881a065 Merge pull request #908 from AlxcBTW 2026-11-22 05:37:39 -05:00
e6f8478e9b D3D-62: create the converter on every GPU; merge with the concurrent-queue test
The converter was made only where the GPU lacks D24_UNORM_S8_UINT (1c5463b4). 96-bit textures need it on every
GPU, so it is always created; it costs nothing until a copy uses it (lazy pipeline, lazy tracker lock).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 11:26:48 +01:00
983862e2a8 Runtime: 96-bit R32G32B32 textures on the Vulkan layer (D3D-62)
R32G32B32_FLOAT/UINT/SINT/TYPELESS textures were refused ("texture format not
supported yet"). They are now R32G32B32A32 images on every GPU: most have no
optimal-tiling RGB32 image, and one that has would not avoid the repack, since
D3D12 places subresources at multiples of 512 bytes and Vulkan wants a copy's
buffer offset to be a multiple of the texel size
(VUID-vkCmdCopyBufferToImage-dstImage-07975).

- Footprints keep D3D12's 12-byte texels (compared with WARP).
- CopyTextureRegion between a texture and a buffer is repacked by the D24
  compute pass (depth24_convert.comp modes 2 and 3, Depth24Job::rgb96): the
  same scratch, parts and lifetime, texels of three words in the footprint and
  four in the scratch, copied uninterpreted. depth24_convert.inc is
  regenerated with the documented glslc command; the same glslc reproduces the
  previous blob byte for byte from the previous source.
- WriteToSubresource/ReadFromSubresource take the staged copy, as D24-as-D32.
- A view's T# names GFX10_FORMAT_32_32_32_*, so alpha reads as one.
- Refused: unordered access and depth (as WARP), render targets (WARP has
  them; not done, and FORMAT_SUPPORT and GetResourceAllocationInfo agree),
  copies between a 96-bit and a four-channel texture, views of another
  format family.

Tested on an RX 9070 XT (AMD 26.11.2), Windows 11: d3d12_rgb96_test matches
WARP and the expected texels bit for bit for 4 formats as 2D arrays with mips
and as volumes; d3d12_descriptor_test samples FLOAT, UINT and TYPELESS views.
Clean under the validation layer with sync validation; depth24_convert_test
and ctest (62) pass.

AI-assisted (Claude Code).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 11:26:48 +01:00
51c402027c Docs: note e293917 pin and v1.2 model-count re-measure caveat 2026-11-22 07:22:52 -03:00
53ebea28f1 Merge origin/main (#1301 merged): read-method accessors, one translator row
#1301 landed on main: check_read_methods, fssm_header.read_methods,
ps_interp_census.py removed. Resolution: our corrected SHADER-181 mode row
references check_read_methods and the surviving census tool; kotorvr's
translator-side row kept verbatim; the two stale copies of the old
bits-are-the-mode row, the extra interpolants duplicates and the old
fssm_header paragraph dropped.
2026-11-22 02:22:27 -08:00
40984f1693 Merge remote-tracking branch 'upstream/main' into codex/mtbuf-packed-loads 2026-11-22 11:20:12 +01:00
1ea8ac875d Merge remote-tracking branch 'origin/main' into presentx-core-v2-local
# Conflicts:
#	README.md
#	docs/d3d12_vulkan.md
#	runtime/CMakeLists.txt
#	runtime/shims/d3d12_com.h
#	runtime/shims/d3d12_vulkan_device.cpp
#	runtime/test/vk_test_device.h
2026-11-22 11:15:14 +01:00
7adce0dcbf fix(shader): use instruction identity selectors for MTBUF loads
Native RDNA2 ignores descriptor selectors for MTBUF and supplies zero for absent components. Preserve runtime descriptor swizzles for MUBUF and cover both paths with the same conflicting selectors.
2026-11-22 11:13:51 +01:00
eb8898d342 Merge origin/main: one PS interpolation modes row, read-method semantics
main hand-merged both PRs' rows (1246 twice, then 1256), leaving kotorvr's
bits-0-1-are-the-mode row beside ours and a duplicated Pixel-shader
interpolants row. Resolution keeps one interpolants row and one SHADER-181
row stating the measured truth: FSSM flags bits 0-1 are the read method
(55,791-record validation, 0 contradictions), the mode is PSV0's
(tools/ps_interp_modes.py), and the two disagree in 2,190 Constant-via-
p1/p2/f16 and 3,197 Linear-mov-only rows. The fssm_header section says the
same. #1301 (kotorvr) renames the accessors to read_methods and keeps the
translator side; kotorvr's code is untouched here.
2026-11-22 02:12:43 -08:00
c9fd097b34 Translator: v_frexp_mant_f32, v_frexp_exp_i32_f32, v_ldexp_f32 (SHADER-89) 2026-11-22 10:10:43 +00:00
62593f47ca Runtime: Xbox-ABI proxies for the command queue and the fence (BUILD-231)
Device slots 8 (CreateCommandQueue), 75 (CreateCommandQueue1), 36
(CreateFence) and 32 (OpenSharedHandle of a fence) now return queue and
fence proxies. They forward the public chain in PC order (19 queue slots,
11 or 12 fence slots), refuse and log a slot past it up to the end of the
proxy's table, and name a read past the table through a guard region and
a vectored handler.

Heap, queue and fence proxies are unwrapped wherever a device or queue
method hands them to the real runtime: queue Signal/Wait, device slots
31/34/35/45/46/50. Arrays are copied without exceptions. QueryInterface
answers only the modelled interfaces, and logs one the real object has
but the proxy does not model. Outputs are cleared on failure as for
slots 14/62/76. --trace-d3d12 records proxy calls in the README grammar.
Every function a thunk hands its words to keeps them in the same
positions, because a title passes only as many as the method takes.

Tests: queue_proxy_test (host WARP, host hardware, Vulkan device;
differential per-process error cases, guard faults, identity, threads,
raw-slot client, child-runner self-test), xs_proxy_mock_test (older
devices, fences without Fence1, OpenSharedHandle branches, allocation
failures; three guard-setup fault modes), and device_proxy_test through
the D3D12XboxCreateDevice shim. No game files.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:08:53 +01:00
64b89ac4a5 Merge pull request #1316 from cxchhh 2026-11-22 05:08:05 -05:00
3277d0dd83 Merge pull request #1315 from Vonsek 2026-11-22 05:08:05 -05:00
3228b99dc2 Merge pull request #1313 from SombraSoft 2026-11-22 05:08:04 -05:00
71c731e394 Merge pull request #1310 from crastinator 2026-11-22 05:08:04 -05:00
133e3d6710 Merge pull request #1309 from Alex Collini 2026-11-22 05:08:03 -05:00
baafd44149 Merge pull request #1308 from Vonsek
# Conflicts:
#	docs/design.md
2026-11-22 05:08:02 -05:00
5ba5db325f Merge pull request #1305 from Dominik
# Conflicts:
#	docs/README.md
#	docs/i18n/README.md
2026-11-22 05:08:00 -05:00
b9f98f2517 Merge pull request #1302 from Vonsek 2026-11-22 05:07:58 -05:00
1d84168179 Merge pull request #1301 from kotorvr
# Conflicts:
#	docs/design.md
2026-11-22 05:07:58 -05:00
f0aa5c9693 Merge pull request #1293 from cxchhh 2026-11-22 05:07:54 -05:00
4c13783cf9 Merge pull request #1292 from Urban225 2026-11-22 05:07:54 -05:00
0eac7a7719 Merge pull request #1291 from Vonsek 2026-11-22 05:07:54 -05:00
3ea9ca3b0c Merge pull request #1287 from LocranKing 2026-11-22 05:07:53 -05:00
98362d0748 Merge pull request #1286 from liang-kai-shui 2026-11-22 05:07:53 -05:00
10b5c2bcb3 Merge pull request #1285 from Emre Demir 2026-11-22 05:07:53 -05:00
b0416b3552 Merge pull request #1265 from Jan Trencansky 2026-11-22 05:07:51 -05:00
470f562318 Merge pull request #1256 from abilliontokens
# Conflicts:
#	docs/design.md
2026-11-22 05:07:51 -05:00
471d1d48bb Translator: copy mesh clip/cull distances one float at a time (SHADER-155)
SPIRV-Cross 1.4.363.0 turns the whole-array OpStore of ClipDistance into the
mesh per-vertex output into a C array assignment, which Metal rejects
("array type 'threadgroup float[1]' is not assignable"). Copying each element
gives the same result on Vulkan and compiles on Metal: ms_clip draws its
expected 2048/4096 pixels in a native Metal mesh draw on an Apple A18 Pro.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:07:16 +03:00
b9893db9fc fix(shader): store NaN as zero in normalized buffer formats
The buffer unit encodes every half NaN as zero. Passing NaN to FClamp instead produced the negative signed-normalized endpoint on both translated backends.
2026-11-22 11:04:10 +01:00
ace75cfb58 docs/world.md: building the whole city with instancing and LOD sets
Measured on levels.rpf: 1,549,343 HD/ORPHAN_HD placements in 2,940 chunks
(21 min) and all 1,669,771 placements in 12,340 tiered chunks (33 min), every
chunk checked structurally and samples parsed by three r160's GLTFLoader; the
LOD-tier medians and bands; what the viewer loads with and without bands; the
pin vs #8/#10 model coverage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:02:54 +00:00
c833ae6d48 ASSET-44: Bump rpf9-explorer for C# BCPack BC1/BC3/BC4/BC5 decode 2026-11-22 06:57:22 -03:00
d3ca882585 Tools: a Linux backend for the hardware oracle through libdrm_amdgpu, and its first runs on RDNA2
tools/hw_oracle ran only on Windows, through the HIP runtime in the AMD
driver, and so far only on gfx1150. On Linux the same kernels now run as
raw compute dispatches through the kernel driver: no ROCm, only clang
with the amdgcn target, gcc and the libdrm headers.

- hw_oracle_drm.c is the launcher. Its command stream is libdrm's own
  compute dispatch test for GFX10 (amdgpu_test_dispatch_memset), with
  what belongs to the kernel put in: the entry point, the group size,
  the kernarg pointer in two user SGPRs, and COMPUTE_PGM_RSRC1,
  COMPUTE_PGM_RSRC2 and the wave size as the kernel's descriptor has
  them. So the .amdhsa_* directives (register counts, float rounding
  and denormal modes, IEEE, DX10 clamp) take effect as under the HIP
  runtime. It prints the same lines as hw_oracle.c. Compute engine
  version 10 only (RDNA1 and RDNA2).
- drm.py is the backend: it assembles with clang, takes .text, the
  kernel offsets and the kernel descriptors out of the object, and runs
  the launcher. A descriptor that asks for what the launcher does not
  provide (LDS, scratch, more user SGPRs) is refused. The render node
  must be named in LEONIDA_HW_DRM_NODE, and a node with a display
  connected is refused unless LEONIDA_HW_DRM_ALLOW_DISPLAY=1.
- runner.open_oracle() picks the backend for the platform. The Windows
  path is unchanged.
- asm.raw_kernel_text puts the GFX10 names of the global memory
  instructions back for gfx10xx. crosslane_fuzz stores with
  global_store_b32, which a GFX10 assembler does not have, so on RDNA2
  every one of its programs was rejected.

One thing the launcher had to learn: while it rewrote one command buffer
in place, the second kernel of every process ran the first kernel's
commands (200 of 200 runs). Every submission now gets command memory of
its own; 24,500 distinct kernels in both wave sizes then each returned
their own words, and a test runs 300 of them.

Results on the integrated GPU of a Ryzen 9 7950X3D (Raphael, gfx1036),
Linux 7.3.5, libdrm 2.4.134, clang 23.1.5:

- salu_diff --oracle hw: 70,000 programs, 69,021 run, 0 mismatches
  (seeds 1-8; seeds 1-4 with --bfe-any; seeds 1-2 with --inline64). The
  s_bfe_i32 rule measured on gfx1150 holds on RDNA2, and s_ff0_i32_b32
  and s_ff0_i32_b64, which gfx1150 lacks, match (2,000 programs).
  --oracle translator,hw: 3,000 programs pass.
- crosslane_fuzz --oracle hw: 32,000 programs, 0 mismatches: seeds 1-6
  (12,000 wave32, 12,000 wave64, 6,586 with the permlane hypothesis)
  and seeds 1-2 with --dpp (8,000, 972 with the DPP hypothesis).
- f32_fuzz --oracle hw, seeds 1-6: 38,858 programs, 28,671 match, 0
  mismatches, 56 known deviations (an output modifier turns -0 into +0,
  as on gfx1150), the rest skipped or not judged. The four MODE settings
  read back as the descriptors set them.
- Controls: a reference with s_min_i32's SCC changed from < to <= gives
  2 mismatches in 5,000 programs, minimized to that instruction;
  crosslane_fuzz --permlane-fetch-inactive mismatches in 239 of 1,000;
  f32_fuzz --negative-control catches all six wrong models.
- No GPU fault, timeout or reset in the kernel log.

Tests: tests/test_hw_oracle.py gains tests of the backend that need no
GPU (reading the object and its descriptors, tokens, the display check,
the platform choice, the GFX10 mnemonics) and two on hardware: 300
distinct kernels, and an f32 rounding mode set in the descriptor that
must change a sum. The HIP-only test skips on Linux.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 04:57:17 -05:00
78b111992b feat(translator): pack explicit 2D mip loads into D16 registers
The explicit-mip fetch already selects the sampled view by numeric type. Pass its D16 modifier to the same result writer as image_load so integer components and floating halves retain their representation.
2026-11-22 10:57:08 +01:00
7c0bb5e17b Tools: every f16 input through the f16 transcendentals on the hardware oracle (FUZZ-29)
tools/f16_trans_sweep.py runs all 65,536 f16 bit patterns through v_exp/log/rcp/rsq/sqrt/sin/cos_f16 natively
(8 raw kernels of 1,024 threads per op), in wave32 and wave64 and five MODEs (IEEE, f16 denormal mode, f16
round toward zero), reads MODE back first, and compares each word with the exact result correctly rounded to
f16 (decimal, 60 digits; sin/cos reduced in turns). It counts bit-exact, 1 ulp, >1 ulp, denormals read or
written as zero, signalling NaNs kept or quieted, and the inputs where SPIR-V is undefined, and lists the words
of 23 special inputs.

On an RX 6700 XT (gfx1031): the five non-trigonometric ops are correctly rounded on every non-NaN input; sin/cos
are exact in turns over the whole f16 range (14 and 4 results 1 ulp off, all at |x| <= 1), while the f32
product 6.2831855 * x is >1 ulp off on 16,366 sin and 2,036 cos inputs (#594). denorm_mode_16_64 = 0 flushes
denormal operands and results, FP_ROUND's f16 field is ignored, IEEE only quiets signalling NaNs. The results
go into docs/design.md (a new f16 transcendentals row) and docs/shader_validation.md.
2026-11-22 11:57:04 +02:00
a38bf01159 Merge upstream/main to retain typed explicit mip loads
# Conflicts:
#	docs/design.md
#	tools/rdna2spirv.py
2026-11-22 10:55:43 +01:00
9395ea9f8b docs: add Polish (pl-PL) community quickstart
Translates the stable onboarding text (what the project is, the own-copy and no-game-data rules, prerequisites,
build commands, stage order, troubleshooting, and how to contribute) synced to c0ac5fd6, and lists pl-PL in
docs/i18n/README.md and docs/README.md.
2026-11-22 09:55:11 +00:00
5be53a713c shader: SHADER-181 translator half; FSSM flags bits are the read method (reconcile with #1256)
Per the split in #1218, #1256 owns the PS interpolation-mode decoder and
census; this keeps the translator side of what #1246 put on main.

- fssm_header: read_methods()/READ_MOV/READ_INTERP/read_name() replace
  interpolation_modes()/MODE_*/mode_name(); the bits say how the code reads
  each input (0x01 v_interp_mov, 0x02 v_interp_p1/p2), as #1256 names them.
- rdna2spirv: check_read_methods() (same rule, refuses 0 of 12,101 PS);
  index.json records ps_flat_interpolants.
- Remove tools/ps_interp_census.py and its test (#1256's ps_interp_modes.py
  covers it).
- docs/design.md: the row becomes the translator-side "PS v_interp read
  methods" row; the "PS interpolation modes" row is #1256's.

Depends on: #1256

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:53:08 +00:00
a9ab50e522 docs/design.md: drop the stale Known approximations row the #753 merge kept
The conflict resolution in b4093239c kept both versions of the row: the one from #753 and main's older one,
which still says the MODE register is ignored. The old row's other content (pkrtz, v_mul_legacy_f32) is in
the #753 row word for word, so only the contradiction goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:52:30 +01:00
761c532c7c feat(shader): translate packed fixed-format buffer loads
MTBUF encodes a format independently of the vertex buffer descriptor. Route its D16 loads through the existing fixed-format decode and packed destination writer so a valid vertex fetch can reach a draw.
2026-11-22 10:51:31 +01:00
8c4e3832d9 GPU fixtures for the CPU-only nlg, cvt_off, output-modifier and constant-modifier rules (TEST-175)
docs/design.md marked four translator rules "not GPU-verified": v_cmp(x)_nlg,
v_cvt_off_f32_i4, the VOP3 output modifiers on v_fmac_f16 and
v_interp_p2/mov_f32, and VOP3 FP modifiers on constants. This adds one pixel
fixture per rule group, each writing four constant mrt0 words derived in its
header: ps_cmp_nlg, ps_cvt_off, ps_fmac_f16_mods, ps_vop3_const_mods,
ps_interp_f32_mods and ps_interp_mov_mods. The two interp fixtures are drawn
with a new vertex shader, vs_interp_consts, whose params are constant over the
triangle.

Every word is a normal float or zero, so the R32G32B32A32_SFLOAT target can't
change it. All six are wired into check.py and run_gpu_tests.py.
tests/semantic/test_rule_gpu_fixtures.py checks that the interpreter, both
runners and the headers agree. run_gpu_tests.py now skips only
ps_interp_f16_high under --bary-fallback, as check.py does, rather than every
PIXEL_VERTEX fixture.

On a Tesla V100 (NVIDIA 580.95.05, Linux), all six write their words on 4096
of 4096 pixels, natively and with LEONIDA_W64_EMULATE=1
LEONIDA_BARY_FALLBACK=1. docs/design.md now cites them. The integer clamp row
stays with quackottu's part of TEST-175, and the denormal-flush row still
needs an RDNA1/2 part.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:41:50 +00:00
5b67ae0815 Tools+docs: decode PS interpolation modes from PSV0 and census the corpus (SHADER-181)
No FSSM word stores SPI_PS_INPUT_ENA/ADDR (u16 scan of 0x00-0x138 over all
12,101 PS against the signature-reconstructed value). tools/ps_interp_modes.py
decodes the mode from the DXBC PSV0 input elements (DXIL::InterpolationMode,
mapped to the SPI_PS_INPUT_ENA pair bits per Mesa gfx103.json), cross-checks
the FSSM table flags (read-method bits 0/1/3/4) and the disassembly I/J
operands, and runs a census: all generic inputs are Constant or
perspective-centre Linear (zero centroid/sample/noperspective); SV_Position is
noperspective by D3D rule, interpolated through the parameter cache in only 4
PS; every shader reads a single barycentric pair (v0/v1, one v14 copy). 23
synthetic tests; decoder+census only, no translator change.
2026-11-22 01:41:37 -08:00
4155021ba9 fix(translator): preserve integer taps in typed 2D gathers
Packing integer gather results as half floats discarded the texture values in both signed and unsigned views. Use the descriptor format for the Vulkan image type and pack each integer pair into its destination register.
2026-11-22 10:41:19 +01:00