Commit Graph

1118 Commits

Author SHA1 Message Date
017d260438 fix(runtime): bind single-layer Texture1D shader-resource views
The device can allocate 1D textures and set 0 has a sampled 1D binding, but default and explicit views previously sampled the fallback. Use the texture dimension and the requested mip range when registering the view.
2026-11-22 12:38:59 +01:00
afaf5b0c15 Merge pull request #1450 from Vonsek 2026-11-22 06:38:07 -05:00
d6d5117244 Merge pull request #1440 from IAmNotSiob 2026-11-22 06:38:04 -05:00
db83d7a707 Merge pull request #1424 from Ryderadzeee 2026-11-22 06:38:00 -05:00
40f239be13 M2: pipelines bind the bindless set 0; textured quad through the descriptor path (d3d12_m2_textured_test)
Pipelines (graphics and compute) whose translated shader declares set-0 bindings were refused. Their layout now
holds the device's bindless set 0 and replay binds it at every draw and dispatch. d3d12_m2_textured_test drives
heaps, SRVs, a POINT sampler, two root descriptor tables and DrawIndexedInstanced with a translated PS that
loads the T#/S# from the tables; 4096 of 4096 pixels match, and the descriptor hash table is checked.
d3d12_translated_draw_test is registered with ctest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:34:41 +01:00
e1b3fca96d Runtime: depth <-> colour copies through a scratch buffer
CopyResource and CopyTextureRegion between D32_FLOAT and R32_FLOAT/UINT/SINT,
and between D16_UNORM and R16_FLOAT/UNORM, were refused at execution because
vkCmdCopyImage cannot mix a depth and a colour aspect. Host D3D12 and WARP
copy the bits, and #1134 listed these as not covered.

The replay now stages each such region image -> scratch buffer -> image.
The scratch comes from a new ScratchBuffers pool (vulkan_scratch.h):
device-local chunks handed out while a list is prepared and retired with
the submission's timeline value, like the depth24 converter's scratch, but
enabled on every GPU. Without it the copy is refused as unsupported before
anything is written.

Still refused: depth with stencil (two planes), D24 stored as D32, and
multisampled textures.

Tests: d3d12_copy_xfmt gains five depth <-> colour cases (R16 -> D16 both
ways, D32 -> R32_UINT, three mips, and a D32 -> R16 negative control), and a
depth <-> colour mismatch now fails it. vk_command_replay_test part H runs a
D32 -> R32 -> D32 round trip through the replay, and checks that a list is
refused with no scratch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:33:50 +02:00
ade4aa0b24 fix(d3d12): report usable single-sample RGB9E5 render targets
After the native attachment and feature-mask changes merged, Radeon could create and clear the resource despite a negative capability query. Check the advertised bit against the physical attachment capability before a focused test can skip.
2026-11-22 12:31:00 +01:00
ba4687404d Merge origin/main (bb2e1842) into d3d90-castable-placed
Third merge round (118 commits): D3D-97's per-queue priorities keep the
GPU address arena's bufferDeviceAddress enable; main's VK_KHR_shader_fma
probing chains after the PR's PSO feature enables; the backing-offset and
hardened whole-buffer-copy refactors replace the PR's older lines.
2026-11-22 03:30:40 -08:00
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
09b08df5d1 Support SINT and SNORM RTVs for typeless RGBA8 textures 2026-11-22 15:17:12 +04: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
35804cf199 Merge pull request #1404 from kovaaper 2026-11-22 06:08:14 -05:00
89f1d25eef Merge pull request #1388 from Dominik 2026-11-22 06:08:09 -05:00
6f0b78805b Merge pull request #1375 from Vonsek 2026-11-22 06:08:05 -05: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
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
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
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
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
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
d01d1df494 Merge pull request #1306 from zneel 2026-11-22 05:37:40 -05:00
2f6881a065 Merge pull request #908 from AlxcBTW 2026-11-22 05:37:39 -05:00
d630dd7db8 fma: test_fma_khr runs on its own; no startup line when the device lacks VK_KHR_shader_fma
test_fma_khr put tools/ on the path only through support, so it failed when
run alone; it now inserts TOOLS_DIR itself like test_f16_fma_rounding. The
standalone device no longer prints on every start when the feature is
missing (the tools refuse an FMAKHR module where it matters).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:34:52 +01:00
8f5ee29f85 Merge remote-tracking branch 'origin/main' into w-m15 2026-11-22 11:33:54 +01:00
e6f8478e9b D3D-62: create the converter on every GPU; merge with the concurrent-queue test
The converter was made only where the GPU lacks D24_UNORM_S8_UINT (1c5463b4). 96-bit textures need it on every
GPU, so it is always created; it costs nothing until a copy uses it (lazy pipeline, lazy tracker lock).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 11:26:48 +01:00
0723014a83 D3D-62: converter split test, COPY queue, footprint refusal, ctest skip
- depth24_convert_test: 96-bit texels split into rows (1 KiB range) and slices (1 MiB range).
- d3d12_rgb96_test: an upload and a readback on a COPY queue; GetCopyableFootprints refuses what creation
  refuses (as WARP); returns 77 without a Vulkan GPU or WARP so ctest skips; large timings behind LEONIDA_RGB96_LARGE.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 11:26:48 +01:00
983862e2a8 Runtime: 96-bit R32G32B32 textures on the Vulkan layer (D3D-62)
R32G32B32_FLOAT/UINT/SINT/TYPELESS textures were refused ("texture format not
supported yet"). They are now R32G32B32A32 images on every GPU: most have no
optimal-tiling RGB32 image, and one that has would not avoid the repack, since
D3D12 places subresources at multiples of 512 bytes and Vulkan wants a copy's
buffer offset to be a multiple of the texel size
(VUID-vkCmdCopyBufferToImage-dstImage-07975).

- Footprints keep D3D12's 12-byte texels (compared with WARP).
- CopyTextureRegion between a texture and a buffer is repacked by the D24
  compute pass (depth24_convert.comp modes 2 and 3, Depth24Job::rgb96): the
  same scratch, parts and lifetime, texels of three words in the footprint and
  four in the scratch, copied uninterpreted. depth24_convert.inc is
  regenerated with the documented glslc command; the same glslc reproduces the
  previous blob byte for byte from the previous source.
- WriteToSubresource/ReadFromSubresource take the staged copy, as D24-as-D32.
- A view's T# names GFX10_FORMAT_32_32_32_*, so alpha reads as one.
- Refused: unordered access and depth (as WARP), render targets (WARP has
  them; not done, and FORMAT_SUPPORT and GetResourceAllocationInfo agree),
  copies between a 96-bit and a four-channel texture, views of another
  format family.

Tested on an RX 9070 XT (AMD 26.11.2), Windows 11: d3d12_rgb96_test matches
WARP and the expected texels bit for bit for 4 formats as 2D arrays with mips
and as volumes; d3d12_descriptor_test samples FLOAT, UINT and TYPELESS views.
Clean under the validation layer with sync validation; depth24_convert_test
and ctest (62) pass.

AI-assisted (Claude Code).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 11:26:48 +01:00
e256a2547c Translator: --fma khr emits OpFmaKHR for fused multiply-adds
GLSL.std.450 Fma may be split into two roundings by a driver (Vulkan
environment: inherited from OpFMul followed by OpFAdd); RDNA2 v_fma_* round
once. --fma khr (default stays glsl) emits OpFmaKHR with capability FMAKHR and
SPV_KHR_fma and lists shaderFmaFloat32 in the index. Runtime device creation
and the vk_* test programs enable VK_KHR_shader_fma when present; cs_fma_fused
tests single rounding; the mini interpreter learns OpFmaKHR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:25:37 +01:00
1ea8ac875d Merge remote-tracking branch 'origin/main' into presentx-core-v2-local
# Conflicts:
#	README.md
#	docs/d3d12_vulkan.md
#	runtime/CMakeLists.txt
#	runtime/shims/d3d12_com.h
#	runtime/shims/d3d12_vulkan_device.cpp
#	runtime/test/vk_test_device.h
2026-11-22 11:15:14 +01:00
d0ae89d817 Merge origin/main into m15-translated-draw-v2 (again)
main moved (c0ac5fd): vulkan_replay.h takes main's checked buffer copies (predicated copies, overlap and overflow
refusals). README's Xbox row is rebuilt from both sides (the previous merge commit had committed a zero-filled
README.md; this restores it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:11:09 +01:00
22d26c949d Merge origin/main into m15-translated-draw-v2
Conflicts (both sides kept): runtime/CMakeLists.txt (stub list), d3d12_com.h, d3d12_vulkan_device.cpp (arena buffers
with main's ray-tracing buffers and deferred destruction, calibrated timestamps, instance extensions, sampler
registration next to the window presenter), command_list.h, vulkan_backend.h, vulkan_replay.h, vk_test_device.h,
d3d12_state_map_test.cpp, docs and README. vulkan_present.h takes main's resource and tracker locks.

CI (linux-gpu-tests): ps_m15 and vs_m15 belong to d3d12_translated_draw_test. run_gpu_tests.py still assembles and
translates them but reports them as skipped (OTHER_HARNESS) instead of "no checker defined".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:08:08 +01:00
3ea9ca3b0c Merge pull request #1287 from LocranKing 2026-11-22 05:07:53 -05:00
10b5c2bcb3 Merge pull request #1285 from Emre Demir 2026-11-22 05:07:53 -05:00
b583c89998 Merge pull request #1277 from 73N1X 2026-11-22 04:38:00 -05:00
48496b96c1 d3d12: emulate R9G9B9E5_SHAREDEXP UAV textures with mutable R32_UINT 2026-11-22 06:37:10 -03:00
05b1dbdb10 d3d12: OPTIONS1 answers 16..16 lanes on Intel integrated GPUs like the host (D3D-121)
Intel's D3D12 driver reports a fixed WaveLaneCountMin/Max of 16 on its
integrated GPUs, where Vulkan reports the compiler's 8..32 range, so
compare_options1 failed on every Intel iGPU. Measured on Xe-LP: UHD 770
(32.0.101.6129) and Raptor Lake-S Mobile (101.7092). Discrete Arc keeps
the Vulkan range until TEST-57 measures it.
2026-11-22 12:37:02 +03:00
1c5463b430 perf(vulkan): restore parallel prepare() with lazy depth24 lock and native-D24 skip 2026-11-22 06:31:28 -03:00
9360ec9ec0 Runtime: predicate byte-granular CopyBufferRegion on the GPU
Build on the full 64-bit predicate snapshots from #856. Replay predicated buffer copies through a storage8 compute helper, retain descriptor batches through timeline completion, and reject missing capabilities or active statistics queries before submitting work.

Validate byte offsets, high predicate words, bounds, skipped destinations and pending descriptor lifetimes with CPU checks, 180 native WARP comparisons and 64 gated/reused GPU submissions. The existing OPTIONS19 host-capability mismatch also reproduces on base 4a36bb1; no tests are disabled.
2026-11-22 05:28:28 -04:00
d8455a7ae8 Merge pull request #1235 from Vonsek 2026-11-22 04:07:48 -05:00
22e6aec2a4 Merge pull request #856 from 73N1X 2026-11-22 04:07:44 -05: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
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
a3ac0c8ea8 Merge pull request #1212 from quackottu 2026-11-22 03:37:51 -05:00