Commit Graph

4163 Commits

Author SHA1 Message Date
7f97fb7b8f Merge fork/m15-translated-draw-v2 (M1.5, #907) into pr291-on-main 2026-11-22 12:19:59 +01:00
1e5d0dbeb9 fix(dxgi): probe VK_PRESENT_MODE_IMMEDIATE_KHR for DXGI_FEATURE_PRESENT_ALLOW_TEARING 2026-11-22 08:18:25 -03:00
09b08df5d1 Support SINT and SNORM RTVs for typeless RGBA8 textures 2026-11-22 15:17:12 +04:00
a6daa4cfff fix(dxgi): reject Get/SetMaximumFrameLatency on non-waitable swapchains with DXGI_ERROR_INVALID_CALL 2026-11-22 08:15:47 -03:00
69b21a9427 Merge origin/main (c2967a5e) into d3d90-castable-placed
Second merge round: main added rgb96 views, the device filter, the
present source-rect path and its own ctest registration of
d3d12_present_test. bind_image keeps both defaulted parameters and the
rgb96 view fallback; image_descriptor runs main's 96-bit family check
before the castable-list check; Resource keeps main's rgb96_ member;
register_samplers and the presentation plumbing follow main's positions,
and the duplicated d3d12_present_test block and stale 'surfaces' local
are dropped in favour of main's.
2026-11-22 03:15:32 -08:00
cee1ba5ac4 tests: accept a host that wraps GetResourceAllocationInfo totals past 2^64; ours stays saturated
compare_allocation_info required the host's answer for two totals that
overflow 2^64 (two 2^63 buffers; the largest buffer plus one). WARP and
the hosts of #1204 saturate at 0xFFFFFFFFFFFF0000, but the Intel Raptor
Lake-S (101.7092) and RTX 5060 Laptop (621.24) hosts on Windows
26300.9974 (D3D12Core 10.0.26100.9818) wrap, to 0 and 65536, while WARP
on the same PC saturates. d3d12_vulkan_device_test failed there on both
GPUs.

Ours is now pinned to the saturated answer, which can't make a caller
allocate less than one of its resources. A host whose total is below its
largest resource has wrapped and is reported, not compared. Any other
host answer is still a mismatch.
2026-11-22 14:14:21 +03:00
35804cf199 Merge pull request #1404 from kovaaper 2026-11-22 06:08:14 -05:00
4d75d961af Merge pull request #1394 from Vonsek 2026-11-22 06:08:11 -05:00
5e9a2dc58d Merge pull request #1393 from DomasUrbonas 2026-11-22 06:08:10 -05:00
fa7626dbb3 Merge pull request #1384 from Dominik 2026-11-22 06:08:08 -05:00
ce29a787c2 Merge pull request #1378 from Emirhan Karaca 2026-11-22 06:08:07 -05:00
6f0b78805b Merge pull request #1375 from Vonsek 2026-11-22 06:08:05 -05:00
a45d7bf397 Merge pull request #1374 from zneel 2026-11-22 06:08:05 -05:00
d7f4df8b7a Merge pull request #1368 from Felix Croasdale 2026-11-22 06:08:03 -05:00
53f9e87620 Merge pull request #1367 from Vonsek 2026-11-22 06:08:03 -05:00
286f5e1bbe Merge pull request #1364 from AlxcBTW 2026-11-22 06:08:02 -05:00
0edade25ff Merge pull request #1363 from Vonsek
# Conflicts:
#	docs/design.md
2026-11-22 06:08:02 -05:00
ccfc8cac1a Merge pull request #1357 from totonii 2026-11-22 06:08:00 -05:00
0a7f9987a7 Merge pull request #1340 from Vonsek 2026-11-22 06:08:00 -05:00
0648aae33f Merge pull request #1339 from mrb-eel 2026-11-22 06:08:00 -05:00
05922b71ff merge: retain the high half when saturating odd D16 image loads
Current main now preserves an odd load's leftover VGPR half. Apply the signed or unsigned range conversion before that shared half-word write so both behaviors survive the integration.
2026-11-22 12:06:27 +01:00
6e2db3d273 Merge main (c2967a5) into runtime/compute-path
main gained 117 commits since f85582e, among them #119 itself (through #908,
which is built on its head and adds PresentX on top), so both sides now
carry the presentation path: this branch as #119's own commits merged with
main at 426023a, main as #908's integration of them. Eleven hunks in six
files conflicted.

runtime/src/vulkan_present.h (2 hunks):
- present's blit: main's structure (a blank present, the source rectangle)
  with both locks of the branch. record() reads and updates the context's
  layout tracker, which ExecuteCommandLists guards with tracker_mutex_ (it
  copies the tracker, emits, and commits the copy after the submit); under
  the resource lock alone a present between that copy and that commit would
  lose its update. Order as in the context: resource -> tracker -> submit.
- presentable(): identical code, main's comment.

runtime/shims/d3d12_vulkan_device.cpp (3 hunks):
- includes: shader_library.h stays (pipelines read the translator's index);
- Resource's fields: the branch's arena fields and main's rgb96_ (D3D-62);
- standalone device: info.presentation is set once, where the swapchain
  extension is pushed (the branch's order); main set the same value later.

runtime/shims/d3d12_com.h (2 hunks): the union of the includes; the
branch's VulkanDeviceInfo::features and shader_dir stay.

runtime/CMakeLists.txt: main now builds and registers d3d12_present_test
next to xbox_present_test, so the branch's copy of that block goes; the
compute and draw tests keep theirs. d3d12_present_test keeps returning 77
without a Vulkan device, which main's registration (c2967a5) relies on but
main's test does not do yet.

README.md, docs/d3d12_vulkan.md (3 hunks): the branch's text. main's side
is what the branch had already merged at f85582e, unchanged since.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 06:03:39 -05:00
35506a08d0 test(vulkan): encode the sampled view format in the synthetic T#
The arbitrary texture key named an unsigned format for an RGBA8_UNORM view, sending explicit gathers down the wrong branch. Derive the T# format from the same Vulkan format used to create the view.
2026-11-22 12:02:23 +01:00
a180cf3a10 fix(translator): read 2D level-zero samples through typed views
Nearest sampling an integer image through a float view violates Vulkan's numeric-type rule. For D16 the subsequent float-to-half conversion also destroys the sampled integers, including every texel in the synthetic signed/unsigned sum.
2026-11-22 12:00:59 +01:00
174cad2f04 Merge main into test-184-image-ops
main is at c2967a5e, 120 commits past the branch's base. Two conflicts, both
sides kept:

- docs/design.md: main added a third "Typed image loads" row at the place
  where this branch adds its "Image atomics, size and LOD queries" row. Main's
  row first, then this branch's.
- tests/test_shader_checks.py: main counts one more check (cs_fmt_xy_xyz,
  TEST-185: 2 -> 3) on the line next to this branch's comment change. Main's
  count with this branch's comment; the STORE_WORDS and GET_LOD_TESTS terms
  stay.

Nothing from main overlaps the new fixtures: TEST-185 and cs_w64x_andn2_exec
run through vk_compute_test's dump mode, and vk_store_test, vk_texture_test
and vk_compute_test are unchanged on main.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 06:00:33 -05:00
d7e1857c5d Merge origin/main into d3d90-castable-placed (resolve #1083 conflicts)
Both sides extended the same spots: the PR's castable-format flag and main's
R9G9B9E5-as-R32_UINT view emulation meet in bind_image (two extra defaulted
parameters), image_descriptor's view format (resource_format + castable list),
create_texture (TextureCreateInfo carries the VkImageFormatListCreateInfo the
castable list fills) and the device init (arena creation plus main's predication
configuration). Main's hardened CopyBuffer preparation and predicate capture
keep the PR's arena-buffer offsets; the PR's old emit-side offset math is
superseded by main's prepare-side buffer_offset handling.
2026-11-22 03:00:14 -08:00
07bd05fa95 Translator: zero-based VS v0/v3 (VertexIndex - BaseVertex, InstanceIndex - BaseInstance); VS is legacy, not NGG (SHADER-33)
Corpus (scripts/vs_input_survey.py, all 2,236 VS): no exp prim, no s_sendmsg, no v_mbcnt, every
VS exports pos0/param, so the console runs them as legacy hardware VS. Their input VGPRs are
Mesa's GFX10 legacy layout (radv_shader_args.c, declare_vs_input_vgprs, not is_ngg): v0 vertex
id, v1 unused, v2 primitive id, v3 instance id; no VS reads v1/v2 on entry, 788 start with the
fetch call and read attributes from v4.

Those ids are zero-based on the hardware (ac_nir_lower_intrinsics_to_args.c: vertex_id is
load_vertex_id_zero_base, instance_id is load_instance_id; the bases come in SGPRs), while
Vulkan's VertexIndex/InstanceIndex include firstVertex|vertexOffset/firstInstance. The
translator now seeds v0 = VertexIndex - BaseVertex and v3 = InstanceIndex - BaseInstance
(DrawParameters; feature shaderDrawParameters in every VS's metadata).

GPU test vs_base_ids.asm, drawn with VKH_DRAW=16,7 (new vk_harness option): 0x101 on every
pixel, where before it was 0x7111. Run by check.py and run_gpu_tests.py. vk_harness,
vk_pipeline_check, vk_bindless_test, vk_texture_test and the runtime's Vulkan device enable
shaderDrawParameters. design.md's "Inputs and outputs" row replaces the "unverified" note.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:59:04 +01:00
53e08a76b4 Merge remote-tracking branch 'origin/main' into fma-khr
# Conflicts:
#	runtime/test/vk_test_device.h
2026-11-22 11:58:52 +01:00
17ef3d0cfb chore: integrate upstream after the explicit-gather revert
Keep the corrected texture descriptor while bringing the branch onto the maintainer's post-revert tree.
2026-11-22 11:58:17 +01:00
6f5b59ea81 runtime: serve LoadLibrary/GetProcAddress of shim-owned modules; xgameruntime.lib's run-time entry points
The package's GDK modules don't import xgameruntime.dll. libHttpClient.GDK.dll and XCurl.dll have no import
entry for it, but both carry the wide string "xgameruntime.dll" and the names InitializeApiImpl[Ex|Ex2],
QueryApiImpl and UninitializeApiImpl next to a statically linked XGameRuntimeInitialize: xgameruntime.lib's
thunks LoadLibraryW the runtime and GetProcAddress those names. Bound to the host, that bypasses the offline
shim. The executable is very likely built the same way.

- library_loader.cpp: LoadLibrary*/GetModuleHandle*/GetProcAddress/FreeLibrary for kernel32, kernelbase and the
  api-ms-win-core-libraryloader sets. A module the registry owns (rt::shims::owns_dll) gets a pseudo-handle and
  GetProcAddress resolves through the registry; an unserved name is NULL with ERROR_PROC_NOT_FOUND. Every other
  module goes to the host.
- xgameruntime.cpp: the five entry points, with the signatures and the unknown-class error documented by
  xodus-gaming/xgameruntime-docs (GPL-3.0, facts only). QueryApiImpl logs the class and interface ids and refuses
  them, so the first boot with the executable names the COM interfaces to implement.
- xgameruntime_test drives the path through XCurl.dll's api-set binding; docs/runtime_imports.md records the
  measurement and the new dry-run counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:58:12 +00:00
554b1d165d test(shader): exercise BGRA stores through the GPU runner
Use the final two readback words to make both packed view formats reproducible through the existing filtered test. Give the paired RGBA cases real identity selectors.
2026-11-22 11:58:01 +01:00
5db6905711 Merge remote-tracking branch 'origin/main' into presentx-core-v2-local
# Conflicts:
#	runtime/CMakeLists.txt
2026-11-22 11:57:47 +01:00
3e5046c4e5 D3D-97: test cross-queue Wait-before-Signal
Exercise copy/compute and direct/direct waits with synthetic fences on Vulkan. AI-assisted (Codex).
2026-11-22 13:55:14 +03:00
fdf8eebf13 vk_harness: guard the shader-fma feature struct for Vulkan headers without VK_KHR_shader_fma
The Linux CI's Vulkan headers predate VK_KHR_shader_fma, where ShaderFma has
no features member; the other tools chain it through link_after, which is
already guarded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:54:42 +01:00
059b46941f fix(dxgi): reject Get/SetMaximumFrameLatency on non-waitable swapchains with DXGI_ERROR_INVALID_CALL 2026-11-22 07:54:34 -03:00
de47dbd0aa d3d12_present_test runs under ctest; skipped (77) without a Vulkan device with presentation
tests/test_ctest_registration.py requires every built *_test to be run by
ctest. d3d12_present_test now exits 77 when vktest::Device can't be created
with presentation, like xbox_present_test, and is registered with
SKIP_RETURN_CODE 77.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:53:04 +01:00
05eb9ca9e2 GPU tests for the MIMG ops that had none (TEST-184)
The translator handles the image atomics, image_get_resinfo, image_get_lod
and the 32-bit image_bvh_intersect_ray, but no test ran them. Six hand-written
fixtures now do, with the expected words derived in each header from the
RDNA2 ISA definition of the instruction:

- cs_imgatomic: add, sub, and, or, xor, smin, smax, umin, umax and cmpswap on
  a 2D r32 uint image. 0xfffffff0 tells the signed min/max from the unsigned
  ones, each with a case that goes the other way; cmpswap hits and misses; one
  op runs without glc; 63 lanes are off; 64 threads add to one texel.
- cs_imgatomic3d: six cases on a 4x4x4 volume, the 3D path of the translator.
- cs_resinfo: a 16x4 image with five levels: levels 0, 1 and 3 in full, then
  dmask 0x3, 0xa and 0x8.
- ps_get_lod, ps_get_lod_array: calculated LOD 1 and 3 on the two-mip
  texture, the clamped LOD held by the last level and by the sampler's
  MAX_LOD; 2 and -3 on the one-level 2D array.
- cs_bvh32: the scene of cs_bvh through the 11-dword address form.

vk_store_test gets a "words" mode for the compute ones: it also binds the
uint image and a small volume as r32ui storage images (bindings 4 and 7) and
a 16x4 five-level image behind its real T#, fills the images and prints them;
check.py holds the expected words. The other two run on vk_texture_test and
vk_compute_test as they are.

All pass on an RX 7900 XTX and a Ryzen 9 7950X3D integrated GPU (RADV, Mesa
26.3.1) and on llvmpipe, natively and with LEONIDA_W64_EMULATE=1, and are
clean under the validation layer. No translator change was needed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 05:49:32 -05:00
da3ebde8ca test: decouple clipping tests from NaN-sensitive fragment output 2026-11-22 12:48:59 +02:00
be5ea1c404 OMSetStencilRef in a bundle reaches the list that executes it
ExecuteBundle copies the two stencil references back to the calling list
only when the bundle set them (stencil_ref_set_). OMSetFrontAndBackStencilRef
marks that; the older OMSetStencilRef assigned both faces without it, so a
bundle that only calls OMSetStencilRef lost its reference and the next draw
tested against the caller's old value.

Reported by Vonsek on #291 with a fixture compared against native D3D12:
1,050 red pixels expected after the bundle, 0 before this change.

d3d12_com_test gets the case next to its other bundle checks; it fails
without the change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 05:48:10 -05:00
21ff2aa25e Read back indirect draws from suballocated GPU buffers 2026-11-22 11:47:02 +01:00
4a4acf3e63 Register the compute, draw and present tests with ctest
main's tests/test_ctest_registration.py (#1258) fails on this branch after
the merge: d3d12_compute_test, d3d12_draw_test and d3d12_present_test are
built but no add_test runs them.

They are registered like their neighbours, with SKIP_RETURN_CODE 77, and
return 77 when vktest::Device::initialize() finds no Vulkan device, as the
other registered D3D12 tests do. Without that, the CPU runtime job, whose
runner has no Vulkan driver, would fail on them the way it did on
d3d12_predicated_copy before #1314.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 05:46:39 -05:00
4cfde416f8 Merge main (f85582e) into runtime/compute-path
On top of the merge candidate 70178d3 (Ryx69/Leonida#6, which merged main at
426023a): the 219 commits main gained since. Three hunks conflicted, in two
files; both follow the notes on #291 (ItsNotRexed 08:27 UTC, Vonsek 09:58 UTC
on 2026-11-22).

runtime/shims/d3d12_vulkan_device.cpp, device setup after the VulkanContext:
- the branch's GPU address arena is created first, as before;
- main's block that configures predication and the predicated byte copy
  (#1277) follows it;
- one load_host_image_copy call and main's lazy D24 converter (enabled only
  where D24_UNORM_S8_UINT is not usable) replace the branch's unconditional
  enable_depth24, which was the same code before main changed it.

runtime/src/vulkan_replay.h:
- CopyBuffer: main's version. It already adds ResourceBinding::buffer_offset
  to both offsets, as the branch did, and adds the overflow and overlap
  checks and the predicated copy. With the arena, source and destination are
  often the same VkBuffer; the overlap check compares the adjusted ranges.
- Predication: main's version. prepare() passes buffer_offset + the command's
  offset to prepare_predicate, so a default-heap buffer inside the arena is
  read at its own range; emit() captures the word and tests the capture's
  scratch slot, not the application's buffer.

Everything else merged without conflicts. Nothing in main's 219 commits adds
a caller that takes a buffer's Vulkan device address for its GPU VA.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 05:45:58 -05:00
217fbf5133 fix(d3d12): honor native RGB9E5 render-target support
Radeon advertises a color attachment for shared-exponent textures. Allow the native path to create the resource and RTV while keeping the mutable R32 UAV backing unavailable for render targets.
2026-11-22 11:45:17 +01:00
b8bd9f20a0 Runtime: apply backing-buffer offsets to CopyResource and CopyTexture 2026-11-22 13:44:57 +03:00
b9864d274a vk_compute_test: the heap of the bvh mode holds its BVH
The "bvh" mode writes its nodes at heap offsets 0x100 to 0x264, but with one
group the heap buffer is 64 words, 256 bytes. The host wrote past the mapped
range and the shader read the nodes through the buffer device address outside
the buffer. It worked because the memory allocation is larger than the buffer.

GPU-assisted validation reports it for cs_bvh on current main:
VUID-RuntimeSpirv-PhysicalStorageBuffer64-11819, "trying to read 4 bytes at
[..220, ..223) but this range does not belong to any buffer", the buffer being
256 bytes. The heap is now at least 0x280 bytes in this mode. The eight result
words are unchanged, and both BVH fixtures are clean under core and
GPU-assisted validation on RADV (RDNA2 integrated GPU) and llvmpipe.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 05:43:32 -05:00
db7538e8f0 test(vulkan): encode the sampled view format in the synthetic T#
The arbitrary texture key named an unsigned format for an RGBA8_UNORM view, sending explicit gathers down the wrong branch. Derive the T# format from the same Vulkan format used to create the view.
2026-11-22 11:40:48 +01:00
478c4a18e4 d3d12_r9g9b9e5_uav_test: skip the WARP comparison where WARP has no typed R9G9B9E5 UAVs
The UAV clear comparison builds its reference on WARP, which needs a
typed R9G9B9E5_SHAREDEXP UAV. Windows 10's WARP has none
(FORMAT_SUPPORT Support1 0x008013f0, no TYPED_UNORDERED_ACCESS_VIEW), so
its CreateCommittedResource with ALLOW_UNORDERED_ACCESS returned
E_INVALIDARG and the test failed at line 604 on every Windows 10 host
(the only ctest failure on main there). Ask WARP for the format first
and, without it, take the existing 'WARP unavailable' path: the layer's
six clear sequences must still succeed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 04:38:35 -06:00
dc0cd5debc Merge main into the constant lane-mask fix
Conflicts with main's DPP and TEST-175 entries in check.py,
run_gpu_tests.py and regen_fixtures.py: main's lists with
cs_w32_mask_imm / cs_w64_mask_imm added back.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:38:22 +01:00
de5c12ba53 Merge pull request #1361 from 73N1X 2026-11-22 05:37:55 -05:00
bfa0565b11 Tests: the 14 v_cmpx forms no test ran, GPU and CPU
v_cmpx_{eq,gt,le,lt,ngt,nle}_f32, v_cmpx_f_i32, v_cmpx_t_u32,
v_cmpx_{eq,gt,le}_i64 and v_cmpx_{ge,lt,ne}_u64 are translated but
appeared in no test, fixture or fuzzer table.

ps_vcmpx_forms runs each in the e32 encoding, and the f32 ones,
f_i32, t_u32, gt_i64 and ge_u64 in e64 too, on operands read from
memory: NaN on either side, signed zeros, -infinity, and 64-bit pairs
that only the low word, only the high word or the sign tells apart. It
also checks that an empty EXEC stays empty and that VCC is kept. The
four words are derived from the ISA in the .asm header.

test_vcmpx_forms.py re-derives those words, runs every form in both
encodings on a table of operands, and runs each on a 16-lane wave with
one lane switched off beforehand.

No translator change: all of them pass.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 11:37:54 +01:00