Commit Graph

4696 Commits

Author SHA1 Message Date
0bc74260d4 feat(dxgi): implement Vulkan-backed IDXGIAdapter3 enumeration and swapchain state queries 2026-11-22 06:09:11 -03:00
40bd14777a Merge pull request #1249 from Felix Croasdale 2026-11-22 04:07:53 -05:00
130234319c Merge pull request #1247 from Vonsek 2026-11-22 04:07:52 -05:00
5f20f591de Merge pull request #1244 from Ryongen 2026-11-22 04:07:50 -05:00
06f211f63b Merge pull request #1241 from Vonsek 2026-11-22 04:07:50 -05:00
d8455a7ae8 Merge pull request #1235 from Vonsek 2026-11-22 04:07:48 -05:00
eddffb846d Merge pull request #1153 from ICUMADETHIS 2026-11-22 04:07:45 -05:00
22e6aec2a4 Merge pull request #856 from 73N1X 2026-11-22 04:07:44 -05:00
6ff753db81 clears: round ties to even whatever the FP mode, and run d3d12_clear in ctest
quantize_unorm/quantize_snorm used std::nearbyint, which follows the thread's
rounding mode (matheuskshn's review): under FE_DOWNWARD 0.5 on 8 bits gave 127
and 0.5 on SNORM8 gave 63. round_half_even uses floor() plus an explicit tie
check, which does not depend on the mode. clear_color_test converts the ties
under FE_DOWNWARD, FE_UPWARD and FE_TOWARDZERO and checks them once the
default mode is back; with nearbyint it fails as above.

d3d12_clear was left out of ctest until this lands (3fc0b21); it is registered
again, with SKIP_RETURN_CODE 77 as before.
2026-11-22 06:04:27 -03:00
a13ed408a4 Merge main (426023a) into the D3D-45 clear branch
- render_target_clear_color: main's integer conversion (every exposed UINT/SINT
  format, A2B10G10R10_UINT's 2-bit alpha) with this branch's normalised
  rounding (quantize_unorm, quantize_snorm) for the UNORM, SNORM and sRGB-alpha
  channels.
- Depth clears: main's D24-as-float conversion, then D16_UNORM through
  quantize_unorm.
- Format tables: main and this branch both mapped DXGI R16_UNORM and R8G8_SNORM
  and the R8G8_SNORM copy size; the duplicates are dropped.
- clear_color_test: main's table-driven integer checks plus this branch's
  normalised and integer cases. The float pass-through loop now uses
  R32_SFLOAT and R16G16B16A16_SFLOAT, since R8G8B8A8_UNORM values are rounded.
2026-11-22 06:04:16 -03:00
e63bf6bdef mc_command.run: a missing llvm-mc is one line, not a FileNotFoundError traceback
Without llvm-mc, run_gpu_tests.py, valu_fuzz.py, lds_fuzz.py,
image_fuzz.py, crosslane_fuzz.py and runtime/test/shaders/build.py
ended in 'FileNotFoundError: [WinError 2]' from subprocess.run: the first
step of TEST-71 on a Windows machine without one. Only shader_disasm.py
said what was missing. mc_command.run() starts an llvm-mc command and
turns a command that can't be started into shader_disasm.py's message
(set LLVM_MC or --llvm-mc, build_llvm_mc.ps1, the WSL form); the six
llvm-mc call sites use it. tests/test_mc_command.py covers run() and
each tool with a nonexistent LLVM_MC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 03:02:20 -06:00
23962cb6d6 fix(runtime): classify D24 readback depth from its raw bits
Intel UHD 770 reports maximum depth for NaNs in the float comparison path. Check the input encoding before rounding finite values and exercise both signs of every NaN payload on the GPU.
2026-11-22 10:00:25 +01:00
ac5dbfae74 fix(tests): reject non-finite packed interpolation readbacks
Python's maximum can ignore a NaN after a finite operand. Check every decoded result before reducing pixel errors so a broken high-half export cannot pass both GPU runners.
2026-11-22 09:54:16 +01:00
a8dd36df99 d3d12_xs_root_signature_test: skip 1.2 when the runtime doesn't know it
Windows 10's D3D12 runtime fails the 1.2 feature query with E_INVALIDARG instead of reporting a lower version, so the test failed there.
2026-11-22 09:52:41 +01:00
8163c74be5 Merge origin/main into d3d90-castable-placed (resolve #1083 conflicts) 2026-11-22 00:52:00 -08:00
759087b51b Merge origin/main into d3d90-castable-placed (resolve #1083 conflicts)
- register_samplers (main) and create_window_presenter (stack) both kept.
- Resource dtor: stack arena release + main deferred destroys.
- AS binding: main size/host_readable + stack console va.
- VulkanContext: main's lock split kept; stack arena/pipeline accessors
  moved to resource_mutex_ (execute copies replay_ under its shared lock),
  presenter lookups take it shared.
- README takes main wholesale; D3D-90 code and tests untouched.
2026-11-22 00:51:55 -08:00
70178d307c Merge main (426023a) into runtime/compute-path 2026-11-22 05:50:30 -03:00
68a4073154 Merge main (0d61c35) into runtime/compute-path
Resolved along the lines in #291 (comment by ItsNotRexed, 2026-11-22 08:27):

- Default-heap buffers stay in the GPU address arena: a VA is an arena offset,
  and every buffer's device address is heap_base + VA (upload and readback
  buffers: device address minus heap_base, as before).
- Acceleration structures: a buffer created in RAYTRACING_ACCELERATION_STRUCTURE
  state on a ray-tracing device stays out of the arena and keeps main's model,
  its VA being the VkAccelerationStructureKHR's device address, so BLAS
  addresses in TLAS instance descriptions are what Vulkan reads. It is
  registered by that VA. BuildRaytracingAccelerationStructure turns build
  inputs and scratch into heap_base + VA, and the arena gets the build-input
  usage on ray-tracing devices. Resource keeps one va_ (gpu_va_/buffer_va_
  removed).
- buffer_at keeps the size& signature; main's only caller (WriteBufferImmediate)
  is the branch's version, and ExecuteIndirect resolves its buffers by id.
- ~Resource keeps arena_release and main's defer_destroy.
- Main's split context locks: pipeline registration and heap_base/zero page
  take resource_mutex_ (prepare looks pipelines up under its shared lock);
  VulkanPresenter takes resource_mutex_ shared, plus tracker_mutex_ while it
  records the back buffer's transition.
- Standalone device: main's single instance-extension list and DXGI swapchain
  enable; info.presentation follows the same swapchain/surface condition, so
  create_window_presenter keeps working. Main's DeferredDeletionQueue,
  calibrated timestamps and ray-tracing extensions are kept next to the
  branch's presentation and feature enables.
- Command IR: Dispatch and Draw follow main's DebugMarker, ExecuteIndirect and
  BuildAccelerationStructure in the variant.
2026-11-22 05:50:20 -03:00
426023a585 Fix what the merge round broke: query_heap_type's lock and #1207's V#
- vulkan_backend.h: #1212's query_heap_type locked mutex_, which VulkanContext no longer has; query_pools_ is
  guarded by resource_mutex_ (add/remove take it unique), so the lookup takes it shared. The runtime didn't build.
- test_salu64_bitwise_data (#1207): its wave64 store went through a V# with word3 = 0 (OOB_SELECT 0, stride 0),
  out of range since #1104; it now uses the raw-buffer word3 the other semantic tests use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 03:45:19 -05:00
cdc9ab3735 fix(runtime): respect the device limit for sampler LOD bias
Literal GFX10 samplers can encode bias from -32 to +31. A decoded +31 exceeded the Vulkan sampler limit on both tested devices at registration. Bound the native bias while retaining the original S# for shader lookup.
2026-11-22 09:43:56 +01:00
8ccf429a56 Merge main into the S#/T# mip test (#319)
Conflicts in docs/d3d12_vulkan.md, runtime/CMakeLists.txt, check.py,
run_gpu_tests.py and test_shader_checks.py: main's versions with
vk_sampler_test, ps_ssharp and its checks added back (ps_ssharp is drawn
with vs_ids through DRAWN_WITH now).

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:43:07 +01:00
f3b9c009fa Test predication integration with queue kinds and tracker rollback
Inject a failed submit to verify the speculative tracker is not committed. Exercise direct, compute and copy queue readbacks, verify their host barrier source stages, omit host barriers for batches without readback writes, and reject predicate capture on copy queues.
2026-11-22 04:38:19 -04:00
4f2b8877f0 Merge pull request #1226 from Vonsek 2026-11-22 03:37:57 -05:00
432520f71c Merge pull request #1225 from quackottu 2026-11-22 03:37:56 -05:00
7a1e1cd407 Merge pull request #1221 from Vonsek 2026-11-22 03:37:54 -05:00
e7d204c6dc Merge pull request #1214 from quackottu 2026-11-22 03:37:52 -05:00
a3ac0c8ea8 Merge pull request #1212 from quackottu 2026-11-22 03:37:51 -05:00
8dbf3a686c Merge pull request #1211 from Vonsek 2026-11-22 03:37:51 -05:00
9055393d88 Merge pull request #1204 from quackottu 2026-11-22 03:37:48 -05:00
fd17f11a5c Translator: typed image_load fetches UINT/SINT formats from the sampled arrays (SHADER-151)
UINT/SINT image_load read the uint/sint storage arrays with OpImageRead, so
every typed load declared StorageImageReadWithoutFormat (missing on Intel
Xe-LP, #619), and read-only integer textures, which the runtime binds only in
the sampled arrays, read the fallback or past the 256-entry storage arrays.
They now fetch through uint/sint aliases of the dimension's sampled array;
a lookup miss takes the float path.

vk_store_test load fills the images before the dispatch, runs without
shaderStorageImageReadWithoutFormat and fails a module that declares it.
vk_image_fuzz no longer requires the without-format features, and binds
its UINT/SINT cases (#1087) as sampled images, as the runtime binds a
read-only texture, instead of storage-only images.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 08:37:47 +00:00
2defd8517d Merge pull request #1053 from Jess-Doit 2026-11-22 03:37:46 -05:00
445be4daa7 test(shader): check every D16 texture sample across the frame
At the center of the test texture red and green have the same value. Exchanging the two packed halves passed that check on hardware while 3584 pixels contained the wrong colors.
2026-11-22 09:36:10 +01:00
eb21bee162 Runtime: a released fence sets the events still waiting on it, and SetEventOnMultipleFenceCompletion with no fences is E_INVALIDARG 2026-11-22 14:06:06 +05:30
29345889be Runtime: capture full 64-bit predication values on the GPU 2026-11-22 04:34:35 -04:00
4c801298d0 test(runtime): verify reuse of a high sampled-image slot
A far-slot read alone cannot detect a stale descriptor after removal or a rewrite of the adjacent live view. Read the fallback, the replacement and its neighbour through the translated texture shader.
2026-11-22 09:31:46 +01:00
98f485f492 Translator: read the high f16 half in v_interp_p1ll_f16 / v_interp_p2_f16 (high) 2026-11-22 13:57:08 +05:30
be0e227dbd D3D12: refuse query calls the list type can't hold, and CreateQueryHeap node masks above 1 2026-11-22 13:54:34 +05:30
caad84c32b Translator: --mesh-compute runs mesh shaders without VK_EXT_mesh_shader
9,282 of the 26,503 shaders are mesh shaders, and a device without
VK_EXT_mesh_shader (NVIDIA Pascal, for one) can't run any of them. With
--mesh-compute each becomes a GLCompute module with the same workgroup size
and code; only the epilogue changes. After the same barrier, lane 0 writes
the vertex and primitive counts, lane i its vertex and its primitive, into
this workgroup's slot of an output buffer whose address is in push-constant
dwords 36-37 (152 bytes). The slot layout is mesh_compute_layout() and the
index records it as mesh_compute.

- tools/mesh_compute_vs.py: the vertex shader that draws the slots with a
  non-indexed draw of groups * max_primitives * 3 vertices; unused and
  culled primitives are clipped away, params keep their locations.
- vk_harness: VKH_MESH_COMPUTE (+ VKH_MESH_SLOT, VKH_MESH_PRIMS) dispatches
  the module, adds a compute->vertex barrier and draws.
- run_gpu_tests.py / check.py: LEONIDA_MESH_COMPUTE=1 (check.mesh_env).
- tests/test_mesh_compute.py; docs/design.md row "Mesh shaders as compute",
  docs/testing.md section.

GTX 1060 (Pascal) with LEONIDA_MESH_COMPUTE=1 LEONIDA_W64_EMULATE=1: all five
ms_* tests pass (SKIP before), zero validation messages. Mesh corpus: 9,282 of
9,282 translate and pass spirv-val with --mesh-compute --wave64-emulate, and
all 9,282 generated vertex shaders validate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSJXX67xeoorUsLJ2f9zms
2026-11-22 00:21:36 -08:00
a57ae52048 fix(runtime): apply the resource mip clamp to sampled cube views
Cube descriptors carry a minimum resource LOD but were excluded when building the sampled Vulkan view. Include them alongside array views so a point sample from a restricted cube cannot select an earlier mip.
2026-11-22 09:21:30 +01:00
6f4752d87b d3d12_depth_resolve_test: a host that differs from the clears is a host quirk
#1155's comparison failed on an RTX 4060 Ti: NVIDIA's D3D12 driver returns, for 12 of 31 D24S8 / R24G8 rectangle
resolves, planes that match neither the clears nor WARP, while the layer matches both (WARP: 26 of 26). The layer
is already checked against the clears above, so such a case is now reported as a host quirk and counted, not failed;
a host that matches the clears still has to agree with the layer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 03:20:02 -05:00
15aa49c006 d3d12: GetResourceAllocationInfo follows the PC runtime's 4 KiB, totals and flag rules
4 KiB alignment now counts the 4 KiB tiles covering the top mip of one
slice (at most 16; a volume's depth counts), instead of fitting the whole
image in 64 KiB. Multi-resource totals round up to the largest alignment,
saturate instead of wrapping, and an empty query is {0, 1}. Simultaneous
access with depth-stencil or MSAA, and a depth-stencil volume, are refused.
All measured against the host runtime on an RTX 5070 and WARP.
2026-11-22 13:45:20 +05:30
209f5e1f2a Merge pull request #1199 from quackottu 2026-11-22 03:14:28 -05:00
15d3ac8ad0 Merge pull request #1176 from quackottu 2026-11-22 03:14:22 -05:00
eda43133f8 Merge pull request #1172 from farhat 2026-11-22 03:14:21 -05:00
60fec60c6d Merge pull request #1169 from quackottu 2026-11-22 03:14:20 -05:00
a8b06e0c88 Merge pull request #1158 from quackottu 2026-11-22 03:14:17 -05:00
2a333b5c69 Merge pull request #1155 from quackottu 2026-11-22 03:14:16 -05:00
d1a814166e Merge pull request #1151 from marquezini 2026-11-22 03:14:15 -05:00
452af90c2f Merge pull request #1113 from Felix Croasdale 2026-11-22 03:14:12 -05:00
3921cdf981 Merge pull request #1081 from totonii 2026-11-22 03:14:11 -05:00