Commit Graph

5744 Commits

Author SHA1 Message Date
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
93f81fd959 tools: spirv_metal_set0.py gives set 0 fixed Metal argument-buffer IDs (SHADER-161)
SPIRV-Cross 1.4.363.0 puts every runtime descriptor array of an argument
buffer at one ID and comments all but one out as "Overlapping binding", so a
native Metal shader can't reach set 0's images or samplers. The tool sizes the
runtime arrays from runtime/src/vulkan_bindless.h and moves each binding to
its own ID range, for spirv-cross --msl-decoration-binding. The Vulkan module
and layout are unchanged. All 17 set-0 test shaders convert with no overlap
and compile; cs_imgstore writes all 3x64 texels correctly in a native Metal
dispatch on an Apple A18 Pro.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:04:52 +03:00
d1474ee1d7 tools: spirv_gs_to_compute.py runs a translated GS as a compute capture pass (SHADER-159)
Apple GPUs have no geometry stage. The tool rewrites a translated geometry
module into a GLCompute module, one invocation per input primitive: the
per-vertex inputs are read from a buffer, every OpEmitVertex copies the
outputs to a record buffer, and a meta buffer holds each primitive's vertex
count and strip ends, for an ordinary draw afterwards. --layout writes the
slot order and sizes.

gs_tri lowered this way, converted with SPIRV-Cross and run natively on an
Apple A18 Pro: 195/195 records exact for 65 random triangles, and the
captured fullscreen triangle drawn from the records matches all 4096
gradient pixels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:04:42 +03:00
734bf2dafe docs: hardware oracle for the LDS programs, SHADER-105 answer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:04:27 +01: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
7f707a692b Docs: add French (fr) community quickstart
Stable onboarding text only, as docs/i18n/README.md asks: what the project is,
the own-copy and no-game-data rules, prerequisites, build commands, stage
order, common problems and how to contribute. Written from the English README,
CONTRIBUTING.md and docs/testing.md at e7584c52, which stay authoritative.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcPmkK8w6mToPwmoiLYPZt
2026-11-22 10:41:13 +01:00
075e4edf63 docs(zh-CN): sync the quickstart with main (Linux runtime stage)
The English README now says the runtime stage cross-builds the Windows
loader on Linux with clang-cl and lld-link against xwin's MSVC CRT and
Windows SDK, and that --runtime-build is the fallback for a build made
elsewhere. Update the zh-CN quickstart to match and bump the synced
commit to e7584c5.

Docs only: two Markdown files, no game data, no CI change.
2026-11-22 17:40:23 +08:00
865631448b Merge pull request #1279 from Vonsek 2026-11-22 04:38:00 -05:00
b583c89998 Merge pull request #1277 from 73N1X 2026-11-22 04:38:00 -05:00
e7854c92ed Merge pull request #1276 from Vonsek 2026-11-22 04:37:59 -05:00
8ed4dbc8e9 Merge pull request #1275 from Vonsek 2026-11-22 04:37:59 -05:00
31c84e7e77 Merge pull request #1274 from liang-kai-shui 2026-11-22 04:37:59 -05:00
8bf5db6fc8 Merge pull request #1263 from Lucy 2026-11-22 04:37:56 -05:00
88691074de Merge pull request #1262 from Lucy 2026-11-22 04:37:55 -05:00
7ac40c5b45 Merge pull request #1257 from cxchhh 2026-11-22 04:37:54 -05:00
297c9d7870 Merge pull request #1256 from abilliontokens
# Conflicts:
#	docs/design.md
2026-11-22 04:37:54 -05:00
1cfd6384a3 Merge pull request #1255 from Dominik 2026-11-22 04:37:53 -05:00
93dec1aa4d Merge pull request #1246 from kotorvr
# Conflicts:
#	docs/design.md
2026-11-22 04:37:51 -05:00
12f0c70d92 Merge pull request #1224 from abilliontokens 2026-11-22 04:37:50 -05:00
b4093239c5 Merge pull request #753 from Alex Collini
# Conflicts:
#	docs/design.md
2026-11-22 04:37:49 -05:00