Commit Graph

4696 Commits

Author SHA1 Message Date
52a357c604 Merge pull request #341 from AlxcBTW 2026-11-21 22:37:36 -05:00
4428d939a6 fix(runtime): apply minimum LOD to sampled 2D views
The T# records an absolute mip clamp, but sampled views ignored it. Preserve the exposed mip range while applying the encoded clamp and use the descriptor fallback when a logical device cannot represent it.
2026-11-22 04:35:39 +01:00
3d21628d28 Convert every exposed integer RTV format in ClearRenderTargetView
R8G8, R16G16, R16G16B16A16, R32G32 (UINT/SINT), R32G32B32A32_SINT and R10G10B10A2_UINT fell into the float path and stored raw float bits. Clamp/truncate numerically like WARP; A2B10G10R10 alpha clamps to 3. Tests cover 19 formats on CPU and 15 against WARP.
2026-11-22 04:32:02 +01:00
d3949f7798 chore: merge upstream depth plane checks
Keep both the cross-family stencil negative and the live-slot shader-access regression on the shared integration base.
2026-11-22 04:30:50 +01:00
7079108182 Runtime: query heaps on Vulkan (D3D-15)
CreateQueryHeap makes one VkQueryPool per heap: occlusion (OCCLUSION and
BINARY_OCCLUSION queries), timestamp and copy-queue timestamp, and pipeline
statistics (all eleven Vulkan counters, whose order is the field order of
D3D12_QUERY_DATA_PIPELINE_STATISTICS). Other heap types are logged and
refused with E_NOTIMPL.

BeginQuery, EndQuery and ResolveQueryData are recorded in the command-list
IR with D3D12's rules for the calls, and replayed as vkCmdResetQueryPool +
vkCmdBeginQuery/vkCmdEndQuery, vkCmdWriteTimestamp at BOTTOM_OF_PIPE and
vkCmdCopyQueryPoolResults (64-bit, WAIT). Heap types, index ranges and the
destination buffer are checked before anything is written. A query that was
never ended resolves to zeros instead of stalling the GPU on WAIT_BIT.
GetTimestampFrequency is 1e9 / timestampPeriod. The devices enable
occlusionQueryPrecise and pipelineStatisticsQuery where the GPU has them.

Overlapping queries of one kind (valid D3D12, one active query per type in
Vulkan) are refused as unsupported, and binary occlusion is not clamped to
0/1 yet; both are written down in docs/d3d12_vulkan.md section 4.6.

Tested on an RTX 5070 (driver 621.01) under VK_LAYER_KHRONOS_validation.
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 21:30:47 -06:00
710c5e724b Merge remote-tracking branch 'origin/main' into shader-36-gather-wrap
# Conflicts:
#	scripts/run_gpu_tests.py
#	tests/test_shader_checks.py
2026-11-22 04:27:11 +01:00
370b042430 d3d12_vulkan_device_test: check requests the host runtime predates against the layer's clamp
Windows 10's d3d12.dll refuses shader models 6.7-6.9 and root signature 1.2 with E_INVALIDARG, where a newer runtime clamps them, so the SHADER_MODEL / ROOT_SIGNATURE comparison from #704 counted 4 mismatches on every Windows 10 machine. A request above the highest one the host answered is now checked against the layer's own clamp (S_OK, 6.0 / 1.1) instead, and the count is printed.
2026-11-21 22:27:04 -05:00
039df7d24f Runtime: upload heaps in Resizable BAR memory when the GPU has it (D3D-96)
Upload-heap buffers asked for HOST_VISIBLE | HOST_COHERENT memory only, so the GPU read every vertex, index and
constant buffer a game uploads over PCIe from system memory. They now prefer DEVICE_LOCAL | HOST_VISIBLE |
HOST_COHERENT when the device has Resizable BAR: such a type in a device-local heap larger than the 256 MiB BAR
window (leonida::resizable_bar, runtime/src/vulkan_memory.h). Without Resizable BAR that type is a window of
256 MiB or less that every upload buffer would share, so they stay in system memory there. A full VRAM heap falls
back to system memory through DeviceState::allocate's existing order.

The device logs where upload heaps live, LEONIDA_UPLOAD_SYSMEM=1 keeps them in system memory for comparison, and
vulkan_memory_flags / device_upload_in_vram report the choice to tests. d3d12_state_map_test checks the detection
on the heap layouts of an RTX 5060 Ti with Resizable BAR, an RTX 3090 without it, a 256 MiB window and an
integrated GPU; d3d12_vulkan_device_test checks that its upload buffer is placed accordingly, and its GPU copies
then read that buffer in both placements.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 21:26:20 -06:00
b74c7f2946 Merge remote-tracking branch 'origin/main' into claude/d3d-30-fences-timing-7ce86f
# Conflicts:
#	runtime/shims/d3d12_com.cpp
#	runtime/shims/d3d12_vulkan_device.cpp
2026-11-22 03:24:05 +00:00
ebbce72855 Merge remote-tracking branch 'origin/main' into bpw32-main
# Conflicts:
#	docs/design.md
#	runtime/test/shaders/check.py
#	scripts/run_gpu_tests.py
2026-11-22 04:22:25 +01:00
f282a0dd97 Fix descriptor benchmark device index selection 2026-11-22 00:16:07 -03:00
0251789a8b Merge remote-tracking branch 'origin/main' into d24-on-d32
# Conflicts:
#	runtime/src/vulkan_backend.h
2026-11-22 04:10:13 +01:00
507b72e35a Merge pull request #785 from 73N1X 2026-11-21 22:09:22 -05:00
9518341508 Merge pull request #783 from mohamedsaad.lahlou 2026-11-21 22:09:19 -05:00
6badcb87a3 Merge pull request #782 from ismailchaka1 2026-11-21 22:09:18 -05:00
9474059934 Merge pull request #781 from rasptum 2026-11-21 22:09:17 -05:00
56985b2ea6 Merge pull request #778 from ismailchaka1 2026-11-21 22:09:11 -05:00
a297365e38 Merge pull request #775 from JavierBlanco23
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-21 22:09:05 -05:00
cc772d6ce8 Merge pull request #771 from bennymxckz 2026-11-21 22:08:51 -05:00
87daf46e46 Merge pull request #767 from Derpbeat 2026-11-21 22:08:43 -05:00
859c97f9d2 Merge pull request #761 from ismailchaka1 2026-11-21 22:08:32 -05:00
316e2773f7 Merge pull request #715 from Vonsek 2026-11-21 22:08:19 -05:00
b288ad9638 Merge pull request #680 from kotorvr 2026-11-21 22:08:12 -05:00
672721b3a1 Merge pull request #617 from VictorJulianiR 2026-11-21 22:08:01 -05:00
dee21a01ac Merge pull request #592 from SirAmong 2026-11-21 22:08:00 -05:00
d549d2d117 Merge pull request #417 from kotorvr 2026-11-21 22:07:52 -05:00
10f5b63a26 Merge updated GPU runner checks while preserving packed-format coverage 2026-11-21 20:07:25 -07:00
6398d46f48 chore: merge upstream volume SRV support
The texture-wide deny check now subsumes the volume-specific check. Keep the independent volume LOD restriction and its pixel coverage.
2026-11-22 04:07:10 +01:00
aa73dd7df1 Merge current runtime targets into the standalone Vulkan build option 2026-11-22 00:07:04 -03:00
4859a809b3 chore(merge): integrate current Vulkan descriptor tests
Keep the upstream 3D texture uploads alongside the unaligned BC sample and preserve the expanded feature-query documentation.
2026-11-22 04:06:58 +01:00
f577bf0318 vk_pipeline_check --stats: the driver's statistics for each translated shader
vk_pipeline_check <spirv dir> --stats FILE enables VK_KHR_pipeline_executable_properties, creates the
pipelines with CAPTURE_STATISTICS and writes, for the executable that runs each translated shader (not
the partner stub's), every statistic the driver reports as CSV rows name,stage,statistic,value. On RADV:
instructions, VGPRs, SGPRs, spills, scratch size, waves per SIMD, and more.

scripts/shader_stats.py <stats.csv> <disasm dir> [--details] compares them with the original RDNA
listings: code growth, VGPRs against the highest VGPR the original uses, and which shaders use scratch or
spill (a register file that went to memory, e.g. through v_movrels with an unbounded index). Over the
corpus it says how many shaders compile badly.

RX 5700 XT (RADV), the repository's test shaders: 47 pipelines, no scratch or spills in any.
New tests/test_shader_stats.py (standard library only).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 21:06:49 -06:00
e9a8203d45 Merge main and preserve volume views and HRESULT tracing in A8 coverage 2026-11-22 00:06:32 -03:00
6998954a15 Tests: cover RGBA8 RTV automatic mips, predicates and range bounds (D3D-70) 2026-11-21 23:03:25 -04:00
066df86857 Vulkan: clamp pipeline check slice before adding count 2026-11-22 04:03:08 +01:00
1b6cc3f2c2 Translator: ds_read_u8/i8_d16[_hi] 8-bit LDS reads into a 16-bit half (SHADER-85)
ds_read_u8_d16, ds_read_u8_d16_hi, ds_read_i8_d16 and ds_read_i8_d16_hi
(RDNA2 DS opcodes 162-165) were rejected. They reuse the u8/i8/u16_d16
path: the byte is zero- or sign-extended 8->16 into one half of the
destination and the other half is kept.

Tests: CPU value test on the new cs_w32_lds_u8_d16 fixture (mini
interpreter now accepts Workgroup variables for one invocation), GPU
dump cs_w32_lds_u8_d16.asm registered in check.py and run_gpu_tests.py,
lds_fuzz generates the four reads. Contract row in docs/design.md and
shader_validation.md updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:02:47 -05:00
5ec780c3e7 Runtime: order back-to-back copies into an image already in the transfer layout
D3D12 orders consecutive copies and resolves on a resource that stays in
COPY_DEST or COPY_SOURCE without a barrier from the application; Vulkan
needs one. detail::copy_layout emitted a barrier only when the layout
changed, so a second copy into an image the first had already left in
TRANSFER_DST_OPTIMAL was unordered with it: synchronization validation
reported 10 WRITE_AFTER_WRITE hazards in d3d12_vulkan_device_test
(@guimsolutions's finding in #634).

When a piece needs no transition, copy_layout now adds a memory barrier
from earlier transfer writes to the new transfer access (transfer stage
only). Copies and resolves both go through it.

With VK_LAYER_VALIDATE_SYNC=1: d3d12_vulkan_device_test goes from 10
hazards (exit 1) to 0; the descriptor, method-variants, sampler2 and
replay tests report none either.
2026-11-22 03:02:26 +00:00
d5e00415f6 D3D-86: answer CheckFeatureSupport OPTIONS2-5, 7, 9, 11, 13-16, 18-21 2026-11-22 04:00:58 +01:00
f9addf5739 Depth-plane T# of a D24 texture is 8_24_UNORM even when stored as D32
image_descriptor named the depth-plane SRV's format from the stored Vulkan
format, so a D24 texture the layer keeps as D32_SFLOAT_S8_UINT (no D24 on the
GPU, the Radeon 880M) got the X24_8_32_FLOAT code instead of the 8_24_UNORM the
console's own descriptor has, and d3d12_descriptor_test failed there. The T#
now carries the format of the texture as created; bind_image views the image
as stored (its own format, depth aspect), since a D24 view of a D32 image is
not valid. A depth-plane view of a texture of the other depth family is
refused.

The D24 comparison test checks the T# codes of the depth and stencil plane
SRVs instead of printing a known gap (depth-plane and stencil-plane views
exist on main now); the docs say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 03:59:18 +01:00
71812aac05 GameInput shim: download SDL3 only when asked (LEONIDA_SDL3_FETCH)
The shim is built with an installed SDL3 (find_package) or with
-DLEONIDA_SDL3_FETCH=ON / FETCHCONTENT_SOURCE_DIR_SDL3; otherwise configure
prints a message, gta6rt builds without it, and CTest lists gameinput as
disabled. build_runtime.ps1 gains -FetchSdl3 and warns that its cl.exe
fallback never builds the shim. Review nits: delivering_thread is atomic,
and SDL's own GameInput joystick driver is pinned off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:58:46 +00:00
96404ac97a Merge main into D3D-26: unordered-access clears on main
Keeps both sides; the discard emit now passes the binding to image_barrier
as main's version takes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:58:23 +00:00
ca9a76b63b Runtime: include <initializer_list> in d3d12_fence_waiter_test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:58:09 +00:00
4fa0fb7dee Runtime: ID3D12Resource::GetDesc fills in a defaulted Alignment, as the host does
A resource created with Alignment 0 read back Alignment 0 from the Vulkan-backed
device. The PC runtime and WARP report the placement alignment instead: 64 KiB,
or 4 MiB for a multisampled texture, and keep one the description asked for.

d3d12_resource_desc_test compares every GetDesc field of 26 committed and
reserved descriptions with the default adapter and WARP.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 21:56:53 -05:00
6617139da8 Runtime test: name the short buffer too_small (small is a Windows macro)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:56:52 +00:00
deae7cc736 Merge remote-tracking branch 'origin/main' into claude/d3d-24-debug-markers-457bab
# Conflicts:
#	runtime/shims/d3d12_com.cpp
#	runtime/src/command_list.h
2026-11-22 02:56:52 +00:00
123ace7c11 Runtime: stencil-plane SRVs only on their own depth-stencil family
The stencil side of #767. image_descriptor accepted X24_TYPELESS_G8_UINT
and X32_TYPELESS_G8X24_UINT plane-1 views on either family, so an
R32G8X24_TYPELESS texture with an X24_TYPELESS_G8_UINT view (or the
other way round) got a live 8_UINT T# where D3D12 refuses the view.
Each stencil view format is now accepted on its own DXGI family only:
X24_TYPELESS_G8_UINT on R24G8_TYPELESS / D24_UNORM_S8_UINT,
X32_TYPELESS_G8X24_UINT on R32G8X24_TYPELESS / D32_FLOAT_S8X24_UINT. The
family is the DXGI format, not the Vulkan one behind it.

d3d12_descriptor_test checks that the other family's stencil view
format leaves the slot null on both textures; on main that check fails.
2026-11-22 02:56:29 +00:00
0c46a83525 Merge remote-tracking branch 'origin/main' into claude/d3d-30-fences-timing-7ce86f
# Conflicts:
#	runtime/shims/d3d12_com.cpp
2026-11-22 02:55:57 +00:00
c7e450fc69 D3D-26: keep a null discard region apart from an explicit UINT_MAX count
A region with NumSubresources = UINT_MAX was recorded like a null region and
skipped the FirstSubresource check. DiscardResource now has a whole flag;
explicit ranges are checked in 64-bit at recording and replay. Tests at the
UINT_MAX boundary in command_list_test, part F and the COM device test.
Found by matheuskshn in review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:55:44 +00:00
d8397aa3ee Runtime: keep the multiple-fence countdown unsigned (D3D-30 review)
SetEventOnMultipleFenceCompletion narrowed its UINT count to int for the
ALL countdown, so a count past INT_MAX started negative, looked done and
never set the event. The waiter now counts down a std::atomic<UINT> that
stops at zero, so later ANY hits do not wrap. It moves to
shims/d3d12_fence_waiter.h, and the new ctest d3d12_fence_waiter checks
counts past INT_MAX, ALL, and hits past zero without a GPU.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:55:30 +00:00
8b23fa2732 Runtime: GetPrivateData returns the needed size with DXGI_ERROR_MORE_DATA
A buffer too small for an entry now gets the size to retry with, for byte
and interface entries alike, as vkd3d-proton's private store does. The
test retries with the returned size for both kinds. Review on #419.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:55:00 +00:00
0e59c75b7b Runtime: GameInput shim on SDL3 (any controller; DualSense trigger effects, lightbar)
GameInputCreate and the v0 IGameInput/IGameInputDevice/IGameInputReading/IGameInputDispatcher surface a title uses
for gamepads, served from SDL3 gamepads so DualSense, DualShock 4, Switch Pro and Xbox pads all work. Rumble goes to
SDL_RumbleGamepad, impulse-trigger rumble to SDL_RumbleGamepadTriggers, and on a DualSense to adaptive-trigger effects
through SDL_SendGamepadEffect (LEONIDA_DS_TRIGGERS=off|rumble|resistance). Lightbar via LEONIDA_DS_LIGHTBAR.

SDL3 (zlib) comes from an installed package or a pinned, hash-checked release tarball via FetchContent;
-DLEONIDA_SDL3=OFF skips the shim. gameinput_test covers the shim on SDL virtual joysticks; gameinput_probe is the
manual check on a real pad. docs/gameinput.md has the mapping, settings and VERIFY list.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:54:55 +00:00