Skip to content

Runtime: the 1/2/3 method variants on the Vulkan device (D3D-28, part 1) - #472

Merged
ItsNotRexed merged 1 commit into
ProjectLeonida:mainfrom
MrCheese5:d3d-28-method-variants
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ProjectLeonida:mainfrom
MrCheese5:d3d-28-method-variants

Conversation

@MrCheese5

Copy link
Copy Markdown
Contributor

Item: D3D-28, part 1 (#313; claimed in #156, where ezwinxdlmao released an overlapping claim)

CreateCommittedResource1/2/3, CreateCommandQueue1 and GetCopyableFootprints1 on the Vulkan-backed device, as thin wrappers over the methods already on main. D3D12_RESOURCE_DESC1 drops to D3D12_RESOURCE_DESC. The initial state or barrier layout is not used, because new textures are tracked UNDEFINED and moved on first use, as with the older methods. The newer arguments are answered as the PC runtime answers them, measured on an RTX 4090 (driver 621.14):

Argument Answer
protected resource session E_INVALIDARG (the layer reports no protected-session support)
SamplerFeedbackMipRegion on a texture E_INVALIDARG from CreateCommittedResource2/3; GetCopyableFootprints1 returns its failure answer (all ones)
SamplerFeedbackMipRegion on a buffer ignored
buffer initial layout other than UNDEFINED E_INVALIDARG
castable count with a null list no list (S_OK)
castable-format list E_INVALIDARG: it needs RelaxedFormatCastingSupported, which the layer doesn't report (D3D12_OPTIONS12 is unanswered). A device without relaxed casting refuses every list (ezwinxdlmao's 680M probe in #156)
CreateCommandQueue1 creator ID ignored

The table is also in docs/d3d12_vulkan.md §3.2. Thanks to ezwinxdlmao for releasing the claim and for the probe notes (slot 76, the null-list and footprint answers); this PR checks those answers live against the host runtime.

Not in this PR: CreateHeap1 and CreatePlacedResource1/2 wait for #286 (D3D-16). CreateSampler2 can now build on CreateSampler on main, but it comes separately, since its border-colour and non-normalized-coordinate flags need their own measured answers.

Tests: a new d3d12_method_variants_test (GPU). It calls the device directly, because the proxy's slot 76 is the Xbox texture method, not CreateCommittedResource3.

  • It runs 12 creation cases through CreateCommittedResource and each of 1/2/3: buffers on all three heap types, a render target, depth-stencil, a full mip chain, a BC7 array, a volume, 4x MSAA, and three shapes the base refuses. Results, null-output results, descriptions, heap properties, image-vs-buffer and Map must all match.
  • It runs 11 edge cases (the table above) on the layer and, when the host has a D3D12 device, compares each answer with the PC runtime live. Protected sessions and castable lists are checked on the layer alone.
  • GetCopyableFootprints1 vs GetCopyableFootprints field by field: 8 cases × 2 base offsets plus a null description.
  • A texture from CreateCommittedResource3 is uploaded, copied back and compared, on a queue from CreateCommandQueue1.

Results, on main at 4abd545:

  • d3d12_method_variants_test and d3d12_vulkan_device_test pass with LEONIDA_VK_VALIDATION=1 and no validation errors; every edge case matches the host runtime
  • ctest --test-dir runtime/build: 19/19 passed
  • Full runtime build (RelWithDebInfo, Ninja) with no warnings at /W4

Tested on an NVIDIA RTX 4090, driver 621.14, Windows 11 build 26200, MSVC 19.44, Vulkan SDK 1.4.363.0. No game files used.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

@dcastell1

Copy link
Copy Markdown
Contributor

Tested 659ad51 on an RTX 5090 (Blackwell), Windows 11 Pro 10.0.26300.9974, NVIDIA 621.24 / Vulkan 1.4.357, MSVC 19.44, clean RelWithDebInfo Ninja build with Vulkan SDK 1.4.363.1 tooling:

  • ctest --test-dir build --output-on-failure: 19/19 passed (7.43 s).
  • d3d12_method_variants_test: exit 0, D3D12 method variants: CreateCommittedResource1/2/3, CreateCommandQueue1 and GetCopyableFootprints1 matched their base methods and the PC runtime's edge-case answers; a texture round-tripped. The log shows the protected-session refusal on all three variants, the two-castable-format list refused without relaxed casting, and the sampler-feedback/texture cases.
  • d3d12_vulkan_device_test: exit 0.
  • LEONIDA_VK_VALIDATION=1 with the 1.4.363 layer: 0 VUID- or validation error/warning lines in both logs. VK_LOADER_LAYERS_DISABLE=~implicit~ was set because ReShade and the Epic/NVIDIA implicit layers are installed.

No game files were used.

@NRXM

NRXM commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 659ad51 on an NVIDIA RTX 4090 (621.24) and an AMD Radeon iGPU (2.0.353), Windows 11 (build 26300), MSVC 14.44, Vulkan SDK 1.4.363.0, clean Ninja build of runtime/: pass on both.

  • ctest 19/19 on each GPU
  • new d3d12_method_variants_test passes on both GPUs ("…matched their base methods and the PC runtime's edge-case answers; a texture round-tripped")
  • d3d12_com_test, d3d12_descriptor_test, d3d12_uint_clear_test, d3d12_vulkan_device_test and vk_command_replay_test exit 0 on each GPU
  • everything ran with LEONIDA_VK_VALIDATION=1 and VK_LOADER_LAYERS_DISABLE=~implicit~: no validation-layer errors on either GPU (only loader notices); the AMD run used VK_LOADER_DRIVERS_SELECT=*amd*

(AI-assisted test run.)

@kacper-serewis

Copy link
Copy Markdown
Contributor

Tested 659ad51 on RTX 5070 (Blackwell, subgroup 32..32), NVIDIA 616.56, Windows 11 Pro 26200: pass.

  • runtime built with MSVC 19.50 (build_runtime.ps1, Vulkan SDK 1.4.363.0); ctest 19/19
  • d3d12_method_variants_test exit 0: "CreateCommittedResource1/2/3, CreateCommandQueue1 and GetCopyableFootprints1 matched their base methods and the PC runtime's edge-case answers; a texture round-tripped"

CreateCommittedResource1/2/3, CreateCommandQueue1 and GetCopyableFootprints1
as thin wrappers over the existing methods. D3D12_RESOURCE_DESC1 drops to
D3D12_RESOURCE_DESC; the initial state or barrier layout is unused, because new
textures start UNDEFINED and move on first use. The newer arguments are answered
as the PC runtime answers them (measured on an RTX 4090, driver 621.14):

- a protected resource session: E_INVALIDARG (no session support reported);
- a sampler-feedback mip region: E_INVALIDARG on textures, ignored on buffers;
  GetCopyableFootprints1 returns its failure answer for such a texture;
- a buffer's initial layout other than UNDEFINED: E_INVALIDARG;
- a castable count with a null list: no list;
- a castable list: E_INVALIDARG, since it needs RelaxedFormatCastingSupported,
  which the layer does not report (D3D12_OPTIONS12 is unanswered);
- CreateCommandQueue1's creator ID: ignored.

d3d12_method_variants_test compares each variant with its base method, runs the
edge cases and, when the host has a D3D12 device, compares each answer with the
PC runtime live. Thanks to ezwinxdlmao for the probe notes in ProjectLeonida#156.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MrCheese5
MrCheese5 force-pushed the d3d-28-method-variants branch from 8c5d274 to 382daba Compare November 22, 2026 01:04
@ItsNotRexed
ItsNotRexed merged commit e90d40c into ProjectLeonida:main Nov 22, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants