Commit Graph

5744 Commits

Author SHA1 Message Date
2933767eac Merge origin/main into d3d90-castable-placed (resolve #1083 conflicts)
Keep-both resolutions per #313's conflict analysis: main's ExecuteIndirect /
acceleration-structure / debug-marker / depth24 / node-mask features alongside
the stack's arena, compute and draw paths. Main's indirect and AS offsets gain
the arena's buffer_offset / heap_base compensation; AS resources on default
heaps get their GENERIC structure over the arena range. Reset clears
stencil_ref_set_ next to reset_state, and OMSetStencilRef sets it. README takes
main's (the crypto-token lines stay deleted).
2026-11-21 23:23:18 -08:00
851eb563b6 gameinput: keyboard pad moves and aims: WASD left stick, mouse right stick, mouse buttons LT/RT
The keyboard pad only pressed buttons, enough for menus. WASD now drives
the left stick (opposite keys cancel, diagonals on the round gate), cursor
movement the right stick (decaying back to center), and the right/left
mouse buttons the left/right triggers. Everything is released on focus
loss. A set_cursor_source seam sits beside set_keyboard_source for tests.
2026-11-22 12:49:29 +05:30
a0a6d2f07c Translator: --texel-offset-fallback for image_sample*_o without VK_KHR_maintenance8
A run-time texel Offset outside gather needs VK_KHR_maintenance8, which NVIDIA
Pascal lacks, so ps_texoff skips there and 4 PS (31 image_sample_o) can't run.
With --texel-offset-fallback the offset is folded into the coordinate:
coordinate + offset / size of the sampled level (0 for _lz/_c_lz, the LOD for
_l, OpImageQueryLod's for implicit samples, plus the bias for _b; floored and
clamped). An integer offset commutes with wrapping and clamping, so this is
exact at that level for every address mode; only a trilinear blend differs
(the coarser level moves by offset / 2). Implicit samples become Grad samples
with the unshifted coordinate's derivatives, so the LOD doesn't change with a
per-pixel offset. Gathers keep their Offset (shaderImageGatherExtended).

- LEONIDA_TEXOFF_FALLBACK=1 for build.py, check.py and run_gpu_tests.py;
  vk_texture_test then isn't asked for maintenance8, and texoff_problem also
  judges the +16/-32 sample.
- runtime/test/shaders/ps_texoff_implicit.asm: ps_texoff's per-pixel sample
  as image_sample_o, the corpus form.
- tests/test_texel_offsets.py: the fallback for every sample form, including
  spirv-val without --allow-offset-texture-operand.
- docs/design.md "Texel offsets", docs/testing.md.

GTX 1060: ps_texoff and ps_texoff_implicit 4096/4096 exact (SKIP before).
Corpus: the 4 PS translate and validate; needs_maintenance8 4 -> 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSJXX67xeoorUsLJ2f9zms
2026-11-21 23:18:38 -08:00
f4dbf5ac7a Translator: a wave64 write to vcc_lo or vcc_hi sets only that half of the VCC mask
In wave64 a 32-bit write to vcc_lo stored all 64 lanes of the VCC lane mask,
and one to vcc_hi only reached the %vcc_hi data word that no VCC reader
looks at. Write the named half of the mask, as exec_lo/exec_hi do; VCC as
data is unchanged.
2026-11-22 12:48:29 +05:30
2b7621997a Merge remote-tracking branch 'origin/main' into oob-select-v2
# Conflicts:
#	tests/semantic/regen_fixtures.py
2026-11-22 08:11:31 +01:00
c774f25f09 rdna2spirv: barrier rounds for wave32 compute shaders whose s_barrier isn't in uniform control flow (SHADER-91)
On RDNA every s_barrier counts against the same workgroup barrier and a wave that has ended no longer counts;
SPIR-V needs every OpControlBarrier reached by the whole workgroup in uniform control flow. A native wave32
compute shader whose s_barrier sits anywhere but a top-level block of the structured tree now runs in rounds,
the emulated wave64 loop without its cross-lane part: s_barrier ends a segment, each invocation runs until its
next s_barrier or the end, and the workgroup meets at one OpControlBarrier at the end of the round. A per-round
count of the invocations not done (three Workgroup words) ends the loop. Native wave64 cs and ms are unchanged.

Intel Arrow Lake Xe-LPG iGPU (32.0.101.8132): cs_barrier_divergent and the new cs_barrier_early_end and
cs_barrier_loop lose the device with the plain translation and pass with barrier rounds; all three pass on an
RTX 5070 Ti (617.42) either way. docs/design.md's Workgroup barriers row describes it.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:09:17 -06:00
4da180733e Merge pull request #1109 from pasindunaduninduwara
# Conflicts:
#	docs/design.md
2026-11-22 02:09:12 -05:00
304a101352 Merge pull request #1108 from ken00H 2026-11-22 02:09:10 -05:00
ffab01d843 Merge pull request #1106 from cxchhh 2026-11-22 02:09:10 -05:00
974ff31732 Merge pull request #1103 from quackottu
# Conflicts:
#	docs/design.md
2026-11-22 02:09:09 -05:00
6fc7d49294 Merge pull request #1089 from kotorvr 2026-11-22 02:09:03 -05:00
c22afe3a63 Merge pull request #1087 from caua-an 2026-11-22 02:09:02 -05:00
aa3d5854dd Merge pull request #1077 from cxchhh 2026-11-22 02:08:59 -05:00
dfad4c3d1a Merge pull request #1074 from 465d6a0eac
# Conflicts:
#	docs/design.md
2026-11-22 02:08:59 -05:00
21bf8c3d79 Merge binary occlusion and share queue resolve resources 2026-11-22 04:05:44 -03:00
e98250411e rdna2spirv: mask carry/sign-out lane masks by EXEC 2026-11-22 12:35:13 +05:30
1465675b16 AGENTS.md: name the numpy/Pillow exceptions, add the omitted smoke tests; design.md: drop duplicated contract rows 2026-11-22 10:03:51 +03:00
b1388b6992 Docs: reconcile the census map count with SixNG's 30,785, map by map
SixNG's 7,257 extra resources have CEntityDef objects but no CMapData struct:
961 interior archetype resources (CMloArchetypeDef, 540,665 entities in interior
space) and 6,296 35abc248 entity groups (39,622 entities in group-local space).
The census has 7 maps (1,239 entities) that SixNG misses, whose entity data is in
a continuation page. Net 7,250 maps / 579,048 entities, the whole published gap.
The 23,528 maps both count agree on every entity count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:57:51 +00:00
67f8a5338d psin_data: reject block tables that run past the region; read 0x62 enums both ways
Review on #1077 (@kapitche): block sizes came straight from the table, so a
damaged size made the walker allocate gigabytes. block_table now rejects
blocks that end past the first section. Every real container fills the region
exactly, so no counts change.

The same review asked why 0x62 was read as s32. LENM lists values on both
sides of the sign bit for 0x62 enums, so a value now counts as listed under
either reading. Unlisted enum values drop from 31,624 to 827; the 30,577
'hash-like' values in story000_script were this.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:57:44 +00:00
4213226698 Translator: clamp saturates the 16-bit unsigned add/sub instead of being dropped
v_add_nc_u16 / v_sub_nc_u16 (and the v_add/sub/subrev_u16 e64 names) with
the VOP3 clamp bit wrapped at 16 bits; they saturate to [0, 0xFFFF], as the
32-bit v_add/sub_nc_u32 clamp already does. Clamp on any other 16-bit
integer op is now Unsupported rather than ignored.
2026-11-22 12:27:08 +05:30
39d5d0e60d RT-54: bvh_builder_test uses WARP on NVIDIA; record the builder's shader shapes
The package's 53 compute shaders are Xbox DXIL (target triple dxil-ms-xb2,
xbox.compiler.options metadata; dxil.dll rejects all 53). NVIDIA's DXIL reader
rejects the 49th, the only one with a resource in a function signature, and
either returns E_OUTOFMEMORY or aborts the process inside nvwgf2umx.dll.
The proxy forwards the bytecode unchanged, so the fix is in the test: an NVIDIA
adapter switches to WARP unless LEONIDA_BVH_HARDWARE=1. LEONIDA_BVH_RECORD62
now prints each container's shape before the call, and LEONIDA_BVH_DXIL=1 adds
dx.op counts and masked validator error kinds (names and counts only).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:48:55 +00:00
dd380ef2fb Tests: fuzz integer image loads 2026-11-22 03:46:54 -03:00
14887e6828 Translator: honour V# OOB_SELECT in MUBUF/MTBUF bounds checks
buffer_address() picked the bounds check from the stride alone and never read
word3. It now reads OOB_SELECT (bits 29:28) and applies the rule measured
natively on RDNA2 (gfx1036, docs/buffer_bounds.md; Mesa's GFX11 column): a
dword is out of range in mode 0 at idx >= NR or off + 4 > stride, mode 1 at
idx >= NR, mode 2 at NR == 0, mode 3 (RAW) at offs + 4 > NR, where off is
inst_offset + vaddr and offs adds soffset. A literal word3 folds the mode, a
run-time one selects with OpSelect.

Builds on the raw tail rule of #443 (per-dword loads): x2..x4 loads AND stores
are per dword in modes 0 and 3 (a store that straddled the edge used to write
past it), modes 1 and 2 take the whole access, a typed element
(buffer_load/store_format) is all or nothing at its format's size, an atomic
checks its dword's end. Measured on a Radeon 880M (gfx1150), a valid proxy for
RDNA2: 504 buffer_load_dword cases over idxen/offen/inst_offset/soffset at the
stride and record edges agree with the rules, plus the x2/x4, typed and atomic
edges.

Swizzle (V# word1 bit 31 SWIZZLE_ENABLE, word3 bit 23 ADD_TID_ENABLE; Mesa
gfx10-rsrc.json lines 326 and 337): a literal V# with either is Unsupported in
every mode; a run-time one is translated unswizzled (documented known gap).

A V# with word3 = 0 is mode 0 / stride 0 and so always out of range, as on
hardware: the harness output V# (vk_compute_test, interpreter push constants),
cs_bounds, cs_fmt_1010102, cs_store, mem_diff and the format tests now say
OOB_SELECT 3 (or 1 with a stride) explicitly.

Tests: tests/semantic/test_buffer_oob_select.py (33 hand-tabulated cases plus
multi-dword stores, typed elements and the swizzle gate, literal and run-time
V#), GPU tests cs_oob_select.asm and cs_oob_tail.asm (the second tells the end
check from Mesa's GFX10 start check). docs/design.md, Buffer bounds checking,
has the per-mode rule; docs/buffer_bounds.md notes the translator reads it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 07:40:20 +01:00
9c7e223a3c D3D-90: castable formats on placed resources (CreatePlacedResource2)
The placed half of D3D-85: CreatePlacedResource1/2 wrap the placed path, and 2 carries NumCastableFormats/pCastableFormats exactly as CreateCommittedResource3 does. The castable list is mapped by a shared helper (also used by the committed path) that refuses unmapped formats and casts whose texel size differs from the resource's, matching the host's E_INVALIDARG and avoiding a size-mismatched VkImageFormatListCreateInfo. A typed UNORM texture with a castable list also accepts an RTV in a listed RGBA8 family format, cleared through the same reinterpretation a typeless RTV uses.
2026-11-21 22:40:16 -08:00
7ec7fbf391 Merge pull request #1074 from 465d6a0eac
# Conflicts:
#	docs/design.md
2026-11-22 01:38:18 -05:00
97cbbcf94a Merge pull request #1072 from Lucy 2026-11-22 01:38:15 -05:00
0e996c35fc Merge pull request #1071 from Lucy 2026-11-22 01:38:15 -05:00
94959628bb Merge pull request #1058 from Lucy 2026-11-22 01:38:09 -05:00
a4cae04e89 Merge pull request #1057 from cxchhh 2026-11-22 01:38:08 -05:00
78f80b74e9 Merge pull request #1054 from nicolas 2026-11-22 01:38:07 -05:00
b91eb99cbe Merge pull request #1051 from 1TrickOmen 2026-11-22 01:38:05 -05:00
956eaa6122 Merge pull request #1033 from undeadhuman37 2026-11-22 01:37:59 -05:00
d494e10ef5 Merge pull request #1015 from Vonsek 2026-11-22 01:37:57 -05:00
2d93239c82 Merge pull request #912 from nicolas 2026-11-22 01:37:55 -05:00
6d25ad0972 Merge pull request #889 from gabrielsteglich 2026-11-22 01:37:54 -05:00
d1d23d842d Merge pull request #804 from Jess-Doit 2026-11-22 01:37:54 -05:00
c22798eed5 Translator: gather LOD ties select the upper mip (SHADER-152)
native OpImageGather Lod (VK_AMD_texture_gather_bias_lod) selected mip 1 on Radeon Graphics 26.10.1 while
the emulation's RoundEven selected mip 0. image_gather4_l(_o) now picks the mip as Floor(clamp(LOD) + 0.5):
ties go up like the native draw, and every non-tie LOD selects the same mip as before. The [0, levels-1]
clamp is unchanged.

Tests: 232 gather sites in the 16 corpus shaders that use image_gather4_l/_o now emit FAdd+Floor instead of
RoundEven and still assemble and pass spirv-val (16/16 translated, 16/16 valid, 946 fetches unchanged); a
200-shader corpus slice is 200/200 translated and valid before and after; the full suite passes (3498 passed,
61 skipped). The 0.5 rule is the Radeon measurement; the guest's own gfx1013 tie behaviour is still not
hardware-verified.
2026-11-22 03:37:17 -03:00
4fa8336202 Translator: gather LOD ties select the upper mip (SHADER-152)
#973 clamps the explicit-gather LOD to the S# bounds and records that, at exactly 0.5 with bounds [0,1],
native OpImageGather Lod (VK_AMD_texture_gather_bias_lod) selected mip 1 on Radeon Graphics 26.10.1 while
the emulation's RoundEven selected mip 0. image_gather4_l(_o) now picks the mip as Floor(clamp(LOD) + 0.5):
ties go up like the native draw, and every non-tie LOD selects the same mip as before. The [0, levels-1]
clamp is unchanged.

Tests: 232 gather sites in the 16 corpus shaders that use image_gather4_l/_o now emit FAdd+Floor instead of
RoundEven and still assemble and pass spirv-val (16/16 translated, 16/16 valid, 946 fetches unchanged); a
200-shader corpus slice is 200/200 translated and valid before and after; the full suite passes (3498 passed,
61 skipped). The 0.5 rule is the Radeon measurement; the guest's own gfx1013 tie behaviour is still not
hardware-verified.
2026-11-22 03:35:24 -03:00
eabcb993a7 psin_data: decode PSIN instance data through the LSCH schema (PROC-46)
The region between the PSIN header and LSCH is a block table plus its data
blocks: 16-byte rows {u32 type, u32 size, 0xaa x 8}, 8 bytes of 0x70 padding,
then the blocks, each 16-byte aligned, ending exactly at the first section.
LRSC's 0DRP header names the root block at +0x10. Pointers are u64 with the
block number in the low 20 bits and the byte offset above.

tools/psin_data.py walks every value reachable from the root (embedded
structs, struct and string pointers, the 0x5c/0x52/0x54/0x50 arrays, the 0x71
binary map, the 0x75 SwissTable and the 0x73 open-addressed table, the 16-byte
0x44 string with its in-place form) and reports counts and checks only.
Unknown member types are counted and skipped.

Over the 17,507 complete containers with LSCH and LRSC in package 1.0.2.1 the
block tables fill the region 17,507 times and the walk reaches 129,100,004 of
129,117,812 block bytes (99.986%). The rest is behind the three member types
it does not decode (0x5a, 0x76, 0x77).

docs/psin.md gets an "Instance data" section. The header's +8 "version" and
+12 "hash table bytes" are the first block-table row: 22 is a 0x16 block,
found on 1,010 of 18,640 streams. The type-code readings the instance data
confirms are updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:34:55 +00:00
7e990164a6 Docs: name two more grass-list members (slodID, SLODArchetypeList)
Found by joaat over common engine words; the member table gives offsets 0xB0
and 0x158.

AI-assisted (Claude).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:34:12 +00:00
558fd50776 Docs: OceanSimPresets layout and the Beaufort sea-state variable
gamedata_xml.py lists the OceanSimPresets root without describing it. Adds
its element tree with counts (10 regional presets with Location/Direction and
3 four-point octave curves each, four WavefrontShape curves) and the link to
the timecycle's water_ocean_beaufort_scale (26 documents, 676 values, 0-10).
What is measured and what is a hypothesis are kept apart. Structure and
counts only.

AI-assisted (Claude). Measured on my own copy (1.0.2.1); docs only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:32:59 +00:00
8e6afb23fd Merge runtime indirect and ray-tracing changes into the occlusion branch 2026-11-22 03:32:16 -03:00
532f854184 Merge main indirect and ray tracing changes into binary occlusion fix 2026-11-22 03:31:47 -03:00
9a87c348bb Docs: meaning of the shader RenderBucket and RenderBucketMask fields
rpf9dump exports both raw. On a 3,000-model sample (27,435 shaders) the mask
is 0xFF00 | 1 << (bucket & 0x7F) in every shader, bit 7 of the bucket is a
separate flag, and the bucket values 0-6 follow GTA V's drawable bucket list
(opaque, alpha, decal, cutout, no splash, no water, water), checked against
model-name tokens. Counts only.

AI-assisted (Claude). Measured on my own copy (1.0.2.1); docs only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:31:11 +00:00
f040a941f7 Translator: --bary-fallback takes the lowest free location, not one past the highest
A PS whose only attribute is attr30 put %bary at Location 31, which Khronos
validation rejects on drivers with 128 fragment input components (found by
@Vonsek on #804). The lowest location no attribute uses is always available
and is 0 there. The corpus is unchanged: the 321 fallback shaders keep
locations 1-5, since their attributes are dense. New semantic test for the
sparse case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSJXX67xeoorUsLJ2f9zms
2026-11-21 22:28:26 -08:00
4030a386fb Translator: --bary-fallback for raw barycentrics without VK_KHR_fragment_shader_barycentric (SHADER-98)
The 321 pixel shaders that read the raw barycentric pair are translated to
BuiltIn BaryCoordKHR, so they can't run on a device without the extension
(NVIDIA Pascal, for one). With --bary-fallback the pair comes from an
ordinary vec3 input one location past the shader's attributes; the module
needs neither the capability nor the extension, and the index records the
location as bary_fallback_input. tools/bary_fallback_gs.py writes the
pass-through geometry shader that fills it: Position and the PS's inputs
copied unchanged, plus (1,0,0), (0,1,0), (0,0,1) at the three vertices,
whose perspective interpolation is the BaryCoordKHR value.

- LEONIDA_BARY_FALLBACK=1 for build.py, check.py and run_gpu_tests.py
  (like LEONIDA_W64_EMULATE): translate with the flag, build
  <name>.bary_gs.spv, draw those shaders through it.
- vk_harness: VKH_GS_HELPER=1 keeps VKH_SUBGROUP_SIZE on the fragment
  stage when the GS only feeds the pixel shader under test.
- tests/semantic/test_bary_fallback.py and the ps_bary fixture.
- docs/design.md contract row and index key, docs/testing.md section.

GTX 1060 (Pascal): ps_bary 4096/4096 exact, ps_uniform_branch and
ps_scc_mask32 pass with the fallback (SKIP without it). Pixel-shader corpus:
12,101/12,101 translate and pass spirv-val with and without the flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSJXX67xeoorUsLJ2f9zms
2026-11-21 22:28:25 -08:00
3d62823f63 Docs: instanced props and grass in map resources (full corpus)
Follow-up to #936 (merged as b0f891c): documents the four instance-list
structs with their schema-named members, the InstanceList array format, and
the full run of tools/instance_lists.py over levels.rpf, story000.rpf and
shared_minigame000.rpf (237,318 map resources, 26.5 million prop and 225.5
million grass instances). Counts only.

AI-assisted (Claude). Measured on my own copy (1.0.2.1); docs only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:22:58 +00:00
d2b9d9da3d Merge main into binary occlusion fix 2026-11-22 03:21:07 -03:00
3ec79019ac Merge main into the overlapping occlusion branch 2026-11-22 03:20:06 -03:00
09d3841df8 anim_clips: decode the clip dictionaries in anim.rpf to keyframes
tools/anim_clips.py groups the stream walk of anim_index.py into RAGE
resources via the page map at the +0x08 pointer, finds the clip
dictionaries (system-only, 1 or 2 pages) and decodes dictionary -> clips
-> packs -> animations -> sequences -> channels. Channel types 0-5, 7, 8
and the GTA VI type 10 (second-order delta coding) are decoded. Output is
counts and per-dictionary rows only; --decode prints one dictionary's
values to stdout for local use.

docs/animation.md gets a "Keyframe decoding" section with the layouts and
the measured full-archive counts, and the statements it makes stale are
updated: 0x98e1750c is joaat32("bonerotation"), the 2/3 packed streams
are second system pages of 0DRP resources, and keyframes are decoded for
the clip dictionaries. tests/test_anim_clips.py builds synthetic
resources, including a type-10 encoder for a round trip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:17:56 +00:00