Commit Graph

4696 Commits

Author SHA1 Message Date
aa2190bacb Trim comments 2026-11-22 12:29:31 +01:00
09ba78556a D3D12 device: host-like answers for meta commands, CheckDriverMatchingIdentifier and RemoveDevice
These ID3D12Device5 methods are on the 'not planned until the game's trace shows
them' list and were still generated E_NOTIMPL stubs. Answer them as D3D12 does on
a device without the feature (and as vkd3d-proton does):

- EnumerateMetaCommands: no meta commands (count 0, S_OK; null count E_INVALIDARG)
- EnumerateMetaCommandParameters / CreateMetaCommand: unknown command, E_INVALIDARG
- CheckDriverMatchingIdentifier: UNRECOGNIZED for serialized acceleration
  structures, UNSUPPORTED_TYPE for any other type
- RemoveDevice: GetDeviceRemovedReason reports DXGI_ERROR_DEVICE_REMOVED afterwards

Tested in d3d12_vulkan_device_test (RemoveDevice on a device of its own).
2026-11-22 12:26:23 +01:00
877d2a5087 Fix GetGPUVirtualAddress after merging M1.5 2026-11-22 12:23:03 +01:00
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
89f1d25eef Merge pull request #1388 from Dominik 2026-11-22 06:08:09 -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
bed399b7b6 D3D-97: preserve LF line endings in queue shim
Keep the published diff limited to queue leasing. AI-assisted (Codex).
2026-11-22 14:02:42 +03: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
fe2db46496 D3D-97: preserve LF line endings in CMakeLists
Keep the published diff limited to the new regression-test target. AI-assisted (Codex).
2026-11-22 14:01:26 +03: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
495910e15e d3d12: R9G9B9E5_SHAREDEXP never reports render-target, blend or MSAA support
D3D12 doesn't render to the shared-exponent format, but AMD's RDNA4 Vulkan driver (26.11.2) gives
E5B9G9R9_UFLOAT_PACK32 COLOR_ATTACHMENT and COLOR_ATTACHMENT_BLEND, and CheckFeatureSupport(FORMAT_SUPPORT)
passed them through as RENDER_TARGET, BLENDABLE and the multisample bits. d3d12_r9g9b9e5_uav (#1287) failed
on an RX 9070 at its RENDER_TARGET == 0 check. The format's render-target, blend, depth-stencil and
multisample bits are now cleared whatever the driver advertises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:58:14 +00: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
c2967a5e60 Register d3d12_present_test with ctest
#908 brought the M0 present test (70 frames to a window, then a resize) but no add_test ran it, which
test_ctest_registration catches. It is registered like its neighbours (exit 77 is a skip) and passes on an
RTX 4060 Ti.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 05:56:34 -05: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
9fbe517bd9 D3D-97: lease separate Vulkan queues for D3D12 waits
Give each live standalone D3D12 queue its own graphics-family VkQueue so cross-queue Wait-before-Signal can progress. Preserve legacy caller-owned devices. AI-assisted (Codex).
2026-11-22 13:53:09 +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
6a748a9171 D3D-97: register cross-queue regression test
Build a synthetic Wait-before-Signal test. AI-assisted (Codex).
2026-11-22 13:50:19 +03: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