Commit Graph

736 Commits

Author SHA1 Message Date
cb32d2d942 Merge pull request #2876 from Ryderadzeee 2026-11-22 15:12:48 -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
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
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
5a41704181 Merge pull request #2167 from Alex Arenas 2026-11-22 15:10:18 -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
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
45ffc82680 Merge pull request #1161 from woreksami 2026-11-22 15:09:38 -05:00
6c92d8e998 Merge pull request #612 from ismailchaka1 2026-11-22 15:09:35 -05:00
5418decf08 Runtime: GPU address arena high-water mark (D3D-55)
The device tracks the arena's peak end offset, its peak live bytes overall
and per use (buffers, shader-visible descriptor heaps, shader code and
D3D12 heaps), and its allocations and refusals, and prints one line at
release. LEONIDA_ARENA_LOG=1 also logs every VA handed out, every refused
request, and upload/readback VAs outside the arena. This answers open
question 5 (how large the arena must be) once the game runs.

Rebased onto main now that #291 is in: arena_allocate/arena_release take
the use, and every call site passes it, including the heap ranges #291
added since.
2026-11-22 20:04:14 +00: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
81ec7f74c3 d3d12: link f16 halves between the VS and the PS, which is stages[2] since #2109
#2109 made the PSO stages {vs, gs, ps}; the --f16-interp-fallback link (SHADER-378, #2389) still read the PS from
stages[1], found the empty GS slot and never ran, so d3d12_f16_halves drew nothing. With a GS the PS reads the GS's
outputs, so the VS/PS link is skipped there (logged once). Also: xgameruntime_test re-reads the package id after
clearing the LEONIDA_PACKAGE_ID override.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:41:01 -05: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
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
4f4cc860ad Match DXGI on an out-of-range GetBuffer index 2026-11-22 22:34:58 +04:00
8d9a50759a fix(process): close g_done race, guard CreateEventW, and preserve ExitThread code in run_entry 2026-11-22 15:34:07 -03:00
663c4d9506 Cache host module names using growable heap buffers
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-22 18:24:37 +00:00
55a073183e d3d12: SetName is readable as WKPDID_D3DDebugObjectNameW, with the right GUID
@pwu2775-dev found on #2533 that the tests' WKPDID_D3DDebugObjectNameW was
mistyped ({4cca5fd8-921f-42c8-8599-d2866a3e5f7e}, the layer's old constant)
instead of d3dcommon.h's {4cca5fd8-921f-42c8-8566-70caf2a9b741}. Measured with
the right key, the host runtime does what D3D12 documents: SetName is
SetPrivateData with that key and the name with its terminator, GetPrivateData
reads it back (an empty name is a 2-byte entry), and the narrow key is not
touched. SetName(nullptr) faults in the host and leaves the name as it was.

So the name goes back into the private data, now under the right GUID, and the
separate name_ / debug_name() are gone. SetName(nullptr) answers E_INVALIDARG
and changes nothing. d3d12_private_data_test: 667 steps compared, 0 mismatches
(RTX 3060, driver 610.88); d3d12_debug_markers_test checks the name again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:24:07 +01:00
3a44e1926b Merge pull request #2736 from mrp1no 2026-11-22 13:17:27 -05:00
0963784063 PresentX planes: filter and blend in linear light, selectable SDR EOTF, Windows SDR white level, tone map
- Compose pass decodes every texel to linear (premultiplied) before filtering, converts the plane to the output's linear
  working space (Rec.2020 nits for HDR10, Rec.709 relative to SDR white for SDR), blends there and encodes once.
- SDR EOTF is piecewise sRGB by default (community-sourced Windows behaviour), gamma 2.2 by
  XboxPresentation::set_sdr_eotf or LEONIDA_SDR_EOTF=gamma22.
- SDR white: set_sdr_white_nits override, else DISPLAYCONFIG_SDR_WHITE_LEVEL of the window's output while HDR10 is
  active, else 203 nits (BT.2408).
- HDR10 on an SDR output: extended Reinhard on luminance (white point at the content peak, default 1000 nits) instead of a
  hard clip.
- HDR metadata stays unsent; docs section 4.5 documents the decisions and cites the sources.
- CPU reference model and xbox_present_test updated (linear model, EOTF option, 50% overlay, tone map, white level query).
- present_compose.inc rebuilt with glslc 2026.4 (byte-reproducible, spirv-val clean).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:17:24 +01:00
98d6888686 Merge pull request #2709 from totonii 2026-11-22 13:17:14 -05:00
a44df460f3 Merge pull request #2662 from admin 2026-11-22 13:16:54 -05:00
3dafb2335b Merge pull request #2630 from RaveN499 2026-11-22 13:16:40 -05:00
1c3360367f Merge pull request #2591 from 0xTehuti 2026-11-22 13:16:24 -05:00
8599c9e64c Merge pull request #2567 from marquezini
# Conflicts:
#	docs/gameinput.md
2026-11-22 13:16:16 -05:00
23f61f5724 Merge pull request #2563 from Ewann 2026-11-22 13:16:12 -05:00
c1543e3449 Merge pull request #2552 from Leonida local test 2026-11-22 13:16:07 -05:00
0d6dddc8c7 Merge pull request #2533 from mrp1no 2026-11-22 13:15:58 -05:00
00e53365b7 Merge pull request #2483 from Shadman PC 2026-11-22 13:15:38 -05:00
da3861dd86 Merge pull request #2462 from mrp1no 2026-11-22 13:15:29 -05:00
84df39f34f Merge pull request #2453 from Flyander 2026-11-22 13:15:26 -05:00
0dff1b420b Merge pull request #2416 from Ewann 2026-11-22 13:15:09 -05:00
09cf8b65e3 rdna2spirv: s_memtime / s_memrealtime via OpReadClockKHR, enable VK_KHR_shader_clock 2026-11-22 19:14:59 +01:00
78688eab40 Merge pull request #2389 from Julio Facal
# Conflicts:
#	docs/design.md
2026-11-22 13:14:35 -05:00
6579038528 Merge pull request #2383 from Sc4ros 2026-11-22 13:14:28 -05:00
e41720bac9 Merge pull request #2373 from Ewann 2026-11-22 13:14:21 -05:00
5864f1875c Merge pull request #2372 from Dominik 2026-11-22 13:14:20 -05:00
900473fcce Merge pull request #2343 from edupode 2026-11-22 13:14:02 -05:00
c5ab4bba97 Merge pull request #2327 from Dominik 2026-11-22 13:13:54 -05:00