Commit Graph

1718 Commits

Author SHA1 Message Date
cb32d2d942 Merge pull request #2876 from Ryderadzeee 2026-11-22 15:12:48 -05:00
a3c60bafb8 Merge pull request #2852 from Felix Croasdale 2026-11-22 15:12:36 -05:00
1c96d2785b Merge pull request #2839 from admin 2026-11-22 15:12:29 -05:00
32180661c1 Merge pull request #2823 from jsthope
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-22 15:12:22 -05:00
9a507b063d Merge pull request #2822 from bobcatchris 2026-11-22 15:12:19 -05:00
f5ec088201 Merge pull request #2817 from IAmNotSiob 2026-11-22 15:12:17 -05:00
0a23659605 Merge pull request #2806 from Alex Arenas 2026-11-22 15:12:11 -05:00
64272954c2 Merge pull request #2791 from bobcatchris 2026-11-22 15:12:01 -05:00
e138630254 Merge pull request #2772 from Nicolas Abosch 2026-11-22 15:11:49 -05:00
5a7507d508 Merge pull request #2750 from admin 2026-11-22 15:11:36 -05:00
18234e1fcc Merge pull request #2728 from Størm 2026-11-22 15:11:31 -05:00
2257d30b13 Merge pull request #2594 from totonii 2026-11-22 15:11:11 -05:00
cda0da18b8 Merge pull request #2567 from marquezini 2026-11-22 15:11:09 -05:00
2236919f71 Merge pull request #2533 from mrp1no 2026-11-22 15:11:02 -05:00
d65ef538b5 Merge pull request #2260 from Linnard Alex Brown Jr.
# Conflicts:
#	docs/design.md
2026-11-22 15:10:26 -05:00
5a41704181 Merge pull request #2167 from Alex Arenas 2026-11-22 15:10:18 -05:00
41cdb55803 Merge pull request #2123 from traeb0n 2026-11-22 15:10:14 -05:00
00f9ebd672 Merge pull request #2070 from jaybeebabageyus 2026-11-22 15:10:09 -05:00
5063e9cd80 Merge pull request #2069 from AlxcBTW
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-22 15:10:09 -05:00
5abbc6031a Merge pull request #2042 from Vonsek 2026-11-22 15:10:04 -05:00
66ff7cb82a Merge pull request #2039 from Vonsek 2026-11-22 15:10:04 -05:00
7fded18980 Merge pull request #1773 from Vonsek 2026-11-22 15:09:47 -05:00
803abc9176 Merge pull request #1611 from Vonsek 2026-11-22 15:09:45 -05:00
c4eaab94c9 Merge pull request #1518 from Henrique Vinagre 2026-11-22 15:09:42 -05:00
94a6cba5e7 Merge pull request #1299 from Vonsek 2026-11-22 15:09:39 -05:00
45ffc82680 Merge pull request #1161 from woreksami 2026-11-22 15:09:38 -05:00
58024a3a6f Merge pull request #896 from DiazE117 2026-11-22 15:09:38 -05:00
7e1aecf0cb first_light: fix VKH_TSHARP_VA overflow guard, subgroup size, preview env, and test docs
Addresses @Kam471's review on #2806:
- Fix uint32 wraparound in VKH_TSHARP_VA bounds check (tsharp_va > heap_bytes - 32) so 0xFFFFFFE0 is rejected with exit 2 instead of writing OOB; add regression test in tests/test_first_light.py.
- Clarify exact test counts in docs/first_light.md (14 tests: 11 pass, 3 skip without LEONIDA_FIRST_LIGHT_DIR; 14/14 pass with LEONIDA_FIRST_LIGHT_DIR).
- Require --obj when --dds is passed so textured probes are always populated, include all texture env vars in the non---run preview command, and pass VKH_SUBGROUP_SIZE from manifest['ps']['subgroup_size'].
2026-11-22 21:06:15 +01:00
faf8268e3f vk_harness: enable shaderSampledImageArrayDynamicIndexing for VKH_TEX_RGBA 2026-11-22 21:06:15 +01:00
3763517741 First light: add textured draw path with T#/S# bindless set and CPU oracle (TEST-524)
Implements TEST-524:
- runtime/test/vk_harness.cpp: adds optional VKH_TEX_RGBA, VKH_TSHARP_VA, and VKH_SSHARP (inert when unset) to upload an RGBA8 texture to set 0 image index 1 (with 1x1 magenta fallback at index 0), write the 8-dword T# at VKH_TSHARP_VA in the 64 KiB heap, decode S# via gfx10_descriptors.h into sampler index 1, and bind DescriptorTable at binding 2.
- tools/first_light.py: adds --dds <path.dds> (decoding via tools/dds_png.py to texture.rgba), defaults --ps to PS_Copy_3ea4b38a_Wrapped (wave32, single image_sample_lz, compatible with DEFAULT_VS), reads ptr32_lo SGPR and literal_samplers from index.json, and adds a bilinear clamp-to-edge CPU texture oracle (centre_rgba + rgba_probes) in check_image.
- tests/test_first_light.py: shares fl.harness_env() so package-gated tests cover both untextured and textured runs, and adds 6 synthetic TexturedOracleTests (no GPU or game files).
- docs/first_light.md: documents the textured path and RTX 3060 verification (counts and hashes only; no game data).
2026-11-22 21:06:14 +01:00
4edfb2418d runtime: make the purge-ownership test deterministic
The dead-owner case relied on the spawned child's PID staying free until the
sweep ran, which is not guaranteed on a busy machine; a reused PID turned the
check into a SKIP. The deletable stand-in now uses this process's own PID
instead: the sweep runs before this process has created any clone, so a file
named with the current PID is always a leftover of a dead run there, and the
live-PID and handle-held skip cases keep their own deterministic stand-ins.
2026-11-22 21:02:58 +01:00
50e9dd32fa Merge remote-tracking branch 'upstream/main' into 2070-lifecycle-fix
# Conflicts:
#	runtime/src/pe_loader.cpp
#	runtime/src/pe_loader.h
#	runtime/test/loader_tls_test.cpp
2026-11-22 20:57:07 +01:00
1188e6406e runtime: scope the TLS clone purge to ownerless files, clean clones before ExitProcess, per-slot thread-event errors
The startup purge deleted every leonida_tls_host_*.dll in the temp directory, so it could remove the
clone of a concurrent process that had copied its helper but not reached LoadLibraryExW yet. Clones
are now copied to a staging name and renamed into place while the copy step's guard handle is open, so
a final-name clone never exists without a handle, and the purge skips files that fail an exclusive
open or whose owner process (from the file name) is still alive.

std::atexit cleanup never ran on the --run path because main ends with ExitProcess; the loader now
exposes cleanup_tls_clones() and main calls it before ExitProcess (atexit still covers normal exits).

on_host_thread_event wrapped the whole slot loop in one try/catch, so one throwing slot killed the
events for every other module. The catch is now per slot, and the detach path releases the slot even
when the callbacks threw, instead of leaking the block to the OS loader.

README and the initialize_tls comment no longer claim only one mapped TLS module can be live; the
loader_tls_test gained purge-ownership and explicit-cleanup checks.
2026-11-22 20:54:47 +01:00
09c6cbe045 fix(runtime): support InstanceDataStepRate > 1 via vertex attribute divisor
CreateGraphicsPipelineState previously logged that instance step rates above 1 were not modelled and left per-instance slots stepping every instance.

Query and enable vertexAttributeInstanceRateDivisor via VK_KHR_vertex_attribute_divisor (falling back to VK_EXT_vertex_attribute_divisor) in create_vulkan_device() and vk_test_device.h, chain VkPipelineVertexInputDivisorStateCreateInfoEXT onto VkPipelineVertexInputStateCreateInfo::pNext when a per-instance slot has InstanceDataStepRate > 1 (refusing with E_NOTIMPL when the feature is unavailable), and add a synthetic GPU instanced draw test in d3d12_draw_test for step rate 2 with a step-rate 1 negative control.

Rebased onto upstream/main (16282101), chaining divisor feature structs via v13.next()/v13_.next() and moving step_fence to 60 after x8_fence.

AI-assisted.
2026-11-22 20:50:50 +01:00
32fc04a14e dxgi: MakeWindowAssociation refuses unknown flag bits
The factory answered S_OK for every flags value, while the host rejects anything
outside DXGI_MWA_NO_WINDOW_CHANGES, DXGI_MWA_NO_ALT_ENTER and
DXGI_MWA_NO_PRINT_SCREEN with DXGI_ERROR_INVALID_CALL (measured on Windows 11
with the system DXGI), so an invalid call looked accepted. Reject unknown bits
before recording the window, and cover the accepted combinations and two unknown
bits in the swapchain test.
2026-11-22 13:40:33 -06:00
7b8eed6f21 dxgi: ResizeTarget resizes a windowed swapchain's client area
ResizeTarget answered S_OK and ignored its argument, so a windowed game that
switches resolution through the DXGI 1.0 path kept the old window: the host
moves the target's client area to the mode's Width x Height and leaves the back
buffers alone until ResizeBuffers (where 0 means the new client area).

Measured on Windows 11 with the system DXGI (RX 7900 XTX): ResizeTarget(nullptr)
is DXGI_ERROR_INVALID_CALL, ResizeTarget(0x0) is accepted and the window's
minimum tracking size decides the result, ResizeTarget(234x156) gives a 234x156
client area with the buffers at 128x128, and ResizeBuffers(0, 0, 0) then takes
234x156. The swapchain test now covers the same sequence on the shim.
2026-11-22 13:40:31 -06:00
07e2293ec0 feat(runtime): implement buffer CreateShaderResourceView (raw, structured, typed GFX10 V#)
Implement D3D12_SRV_DIMENSION_BUFFER in ID3D12Device::CreateShaderResourceView,
writing a 16-byte GFX10 V# descriptor into the 32-byte CBV_SRV_UAV slot:
- Raw (D3D12_BUFFER_SRV_FLAG_RAW, R32_TYPELESS, stride 0): OobSelect::raw,
  num_records = NumElements * 4, GFX10_FORMAT_32_UINT.
- Structured (StructureByteStride > 0, DXGI_FORMAT_UNKNOWN): OobSelect::structured,
  stride = StructureByteStride, num_records = NumElements, GFX10_FORMAT_32_UINT.
- Typed (stride 0, uncompressed color format incl. RGB96): OobSelect::structured,
  stride = element bytes, num_records = NumElements, format_from_vulkan(named),
  Shader4ComponentMapping applied to format_swizzle(named).
- Rejects DENY_SHADER_RESOURCE, null desc on buffer, invalid format/stride/flag
  combinations, and out-of-bounds ranges (leaving the 32-byte slot zeroed).

AI-assisted.
2026-11-22 20:37:10 +01:00
f5907ef65a Merge main (873a952a) into the RT-176 branch 2026-11-22 16:32:48 -03:00
e7c83353c7 RT-176: Dispatch runs only the batch queued when it starts
Review follow-up. Dispatch took events one at a time from the live
queue, so readings queued during the call (by the poll thread, or by a
callback) were delivered in the same call: with an unlimited quota a busy
queue could keep the title inside Dispatch, and each erase at the front
made a drain O(n^2) under deliver_mu.

Dispatch now swaps out the batch present at entry and walks it in order;
events it leaves (quota spent) go back to the front of the queue, ahead of
newer ones. gameinput_test adds a callback that queues a reading from
inside the call: each Dispatch(UINT64_MAX) runs exactly its starting batch
and returns true (the previous version never returned). The docs say so,
and the dispatcher row's open column reads a dash instead of a blank.
2026-11-22 16:32:10 -03:00
15f5b2fbc0 Fix what the round-41 merges broke
- tests/semantic: BaseVertex/BaseInstance read 0 in the wave interpreter; the LDS MockGens follow
  SHADER-309 (lds_bound, lds_access, lds_atomic); abs emission tests load their operand, since
  SHADER-315 folds scalar ALU on constants.
- test_translate: the dynamic gather sampler is a loaded word, not s16 + 0 (SHADER-315 folds it).
- test_world_build: DDS downscale weights colours by alpha (62804d0d).
- test_fspx_shaders_stage: the fake disassembler writes the listing make_game now checks.
- xgameruntime_test: re-read the package id after clearing the LEONIDA_PACKAGE_ID override.
- docs: one row per topic again in design.md (72 topics) and README.md; one Other languages line;
  embedded_shaders.md keeps one copy of each bullet; animation.md links the heading anchor.
- tools/scripts: character_textures uses report_paths.same_report_path; stdout guard on six programs;
  LF write in vs_input_survey; the cl.exe fallback compiles winhttp_offline.cpp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:30:33 -05:00
3eb80d77e3 Merge main into cov-d16fmt (#2039)
Conflicts:
	scripts/run_gpu_tests.py
	tests/semantic/regen_fixtures.py
	tests/test_shader_checks.py

AI-assisted.
2026-11-22 20:27:12 +01:00
a922e9edd4 tests: CPU value tests for 8/16-bit and 64/96/128-bit LDS accesses
Two wave32 GPU tests, cs_w32_lds_subdword (ds_write_b8/_b16 and their
_d16_hi forms, ds_read_u8/_i8/_u16/_i16) and cs_w32_lds_wide
(ds_write/ds_read _b64/_b96/_b128, ds_read2st64_b32), and a semantic
test that runs them in the SPIR-V interpreter against a byte-level LDS
model of the ISA rules, with three SPIR-V sabotages as negative
controls. These ops were checked only by lds_fuzz.py, which needs a GPU.

No translator change. RTX 4070 SUPER, driver 610.88: both dumps match.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:17:14 -06:00
111b634c21 runtime: BufferVaIndex's longest-range bound follows the live ranges
The bound that stops a lookup's walk only grew: once a large buffer was
freed, every later miss still walked back as far as that buffer had
reached. With 20 000 buffers of 256 bytes, a 1 GiB range added then
removed left a miss past the last buffer at 250-600 us instead of ~50 ns
(found by @padhossein in review of #2823).

A multiset of the indexed sizes keeps the bound at the longest range
indexed now; insert and erase stay O(log n), find is unchanged. Inserting
the same (va, id) again replaces its size instead of leaving the old one
in the bound.

buffer_va_index_test checks the bound after erases (same sizes and a
smaller re-registration included), against the longest live range in all
200 random tables, and times the review's miss-after-free case.
2026-11-22 20:09:00 +01:00
10b88e8580 TEST-433: the skip message states the measured cause (16 live lanes behind a reported 32)
Measured by kapitche: Intel UHD 770 reports gl_SubgroupSize 32 in the fragment stage but runs 16 live invocations, so tiers A and B (32 or 64 live lanes) cannot hold. The skip keeps its condition (minimum subgroup below 32); deriving it from a measured live width is a follow-up.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:01:33 -05:00
654c5360af Revert "TEST-433: skip only devices whose subgroups are all narrower than 32 (the Intel 16-wide premise was wrong)"
This reverts commit e215380e1e.
2026-11-22 14:01:12 -05:00
e215380e1e TEST-433: skip only devices whose subgroups are all narrower than 32 (the Intel 16-wide premise was wrong)
The reporter corrected the probe: Intel UHD 770 reports a subgroup size of 32, so its tier A failures have an unknown cause and must not be skipped; only a device whose largest subgroup is below 32 (llvmpipe) is.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:00:50 -05:00
093b6c622a TEST-433: skip the tier A/B pixel fixtures where the fragment subgroup is narrower than 32 and cannot be required
Intel UHD 770 reports fragment subgroup 8..32 but runs pixel shaders 16 wide and cannot be held to 32, so reads
across 16 lanes (permlane, swizzle, bpermute) fail there. Tiers A and B mean exact on 32- or 64-lane subgroups.

The SHADER-10 row also loses the stale text the merge of #2260 left in it: the pre-TEST-319 A list (bpermute and
permlane "not GPU-tested here"), "Corpus coverage is not measured here", "the corpus ones are wave32", "geometry
shaders are not tested" and a repeated sentence, which the census and the GS fixtures (TEST-251) now contradict.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:59:11 -05:00
59bb784066 d3d12_shader_cache_test: avoid passing nullptr to SAL _In_ params on host D3D12 runtime
Windows 11 23H2 in-box d3d12.dll (10.0.22621.5415) AVs with 0xC0000005 when passed nullptr for SAL _In_/_Inout_ parameters (pDesc, pKey, pValue, pValueSize) without the debug layer (reported by @CharlyRien on #2167). Keep all null-pointer checks on the Vulkan layer, skip only raw nullptr _In_/_Inout_ calls on the host comparison, and disable stdout buffering so progress lines flush immediately.
2026-11-22 19:57:44 +01:00
676c6abae3 Merge main into coverage-gaps (#1299)
runtime/test/shaders/check.py
scripts/run_gpu_tests.py
tests/semantic/test_value_semantics.py

AI-assisted.
2026-11-22 19:52:12 +01:00
d3b774eed5 PresentX planes: tone map shoulder, SDR white query off the present path, review fixes
- Tone map: identity up to 0.8 of SDR white, extended Reinhard shoulder above it, continuous in value and slope, content
  peak maps to 1.0 (SDR-range content is no longer darkened).
- The Windows SDR white level is read by a background thread (about once a second, only while HDR10 is in use);
  PresentX reads an atomic. A failed query keeps the last good value; QueryDisplayConfig retries on
  ERROR_INSUFFICIENT_BUFFER.
- LEONIDA_SDR_EOTF is case-insensitive, unknown or too long values are logged; setters are atomics; <cwchar> for wcscmp.
- Tests: eight-step HDR10 ramp with hand-calculated bytes, curve properties (monotonic, identity below the knee, peak 1,
  slope continuity), HDR10 plane 1 over SDR plane 0 on HDR10 and SDR outputs, hand-calculated 50% overlay bytes, query cost.
- Docs 4.5: shoulder description, query cost, sources marked (KWin claim unverified, vkd3d-proton file partly read, the
  measured 80 nits only covers the SDR fallback path).
- present_compose.inc rebuilt with glslc 2026.4 (reproducible, spirv-val clean).

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