diff options
| author | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-22 15:51:40 +0100 |
|---|---|---|
| committer | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-22 15:51:40 +0100 |
| commit | df91c6624b69ee4e6c6eeca20ed68d331ed0e728 (patch) | |
| tree | 323c88b9df89bf8abaa2b98d10808474ab675dc2 /docs/d3d12_vulkan.md | |
| parent | b40d8039a98f57b26bd05860febbabbe59b97873 (diff) | |
| parent | 6a6704df1592e1dc4a3215ddf1423a78adb52045 (diff) | |
Merge main into test/valu-int-misc (#1492)
Conflicted files: runtime/test/shaders/check.py, scripts/run_gpu_tests.py
AI-assisted.
Diffstat (limited to 'docs/d3d12_vulkan.md')
| -rw-r--r-- | docs/d3d12_vulkan.md | 117 |
1 files changed, 104 insertions, 13 deletions
diff --git a/docs/d3d12_vulkan.md b/docs/d3d12_vulkan.md index 83951f226..6834672b7 100644 --- a/docs/d3d12_vulkan.md +++ b/docs/d3d12_vulkan.md | |||
| @@ -323,6 +323,11 @@ What is implemented (all of it testable without the game): | |||
| 323 | `d3d12_uav_clear_test`); | 323 | `d3d12_uav_clear_test`); |
| 324 | - the descriptor shader samples `B5G5R5A1_UNORM` through a 2D SRV. Opaque and transparent red check bit 15, | 324 | - the descriptor shader samples `B5G5R5A1_UNORM` through a 2D SRV. Opaque and transparent red check bit 15, |
| 325 | and mixed-channel texels check the five-bit color fields; | 325 | and mixed-channel texels check the five-bit color fields; |
| 326 | - `B8G8R8X8_UNORM`, `_UNORM_SRGB` and `_TYPELESS` (D3D-87) are `B8G8R8A8` images: clears, copies and footprints | ||
| 327 | keep all four bytes (WARP writes the clear's alpha into the X byte too), and shader views read alpha as 1. Its | ||
| 328 | typeless family is its own, so views to or from `B8G8R8A8` are refused (a castable-format list that names the | ||
| 329 | other family is not consulted yet). As on the host runtime, the family has no typed UAV, and a typed | ||
| 330 | `B8G8R8X8` texture cannot allow unordered access; | ||
| 326 | - `R10G10B10_XR_BIAS_A2_UNORM` maps to `VK_FORMAT_A2B10G10R10_UNORM_PACK32`, the same packed 10:10:10:2 | 331 | - `R10G10B10_XR_BIAS_A2_UNORM` maps to `VK_FORMAT_A2B10G10R10_UNORM_PACK32`, the same packed 10:10:10:2 |
| 327 | layout; the bias and scale are the application's shader work. Like the PC runtime, it accepts only a | 332 | layout; the bias and scale are the application's shader work. Like the PC runtime, it accepts only a |
| 328 | single-mip, single-sample 2D texture: extra mips, multisampling and 3D are refused in creation, allocation | 333 | single-mip, single-sample 2D texture: extra mips, multisampling and 3D are refused in creation, allocation |
| @@ -472,7 +477,9 @@ side inwards: | |||
| 472 | 477 | ||
| 473 | Growth leaves 64 descriptors of each limit to the other sets of a pipeline layout. It also stays within | 478 | Growth leaves 64 descriptors of each limit to the other sets of a pipeline layout. It also stays within |
| 474 | `maxPerSetDescriptors`, which never shrinks the default counts, because a layout past it may still be | 479 | `maxPerSetDescriptors`, which never shrinks the default counts, because a layout past it may still be |
| 475 | supported. The other arrays keep their default counts. On an RTX 5070 (driver 621.24, 1048576 of each type | 480 | supported: past it, the device grows only where `vkGetDescriptorSetLayoutSupport` accepts the grown layout. |
| 481 | Intel's UHD 770 (101.7092) reports 6159 and accepts the full sizes, so it gets the same set as an RTX (D3D-219). | ||
| 482 | The other arrays keep their default counts. On an RTX 5070 (driver 621.24, 1048576 of each type | ||
| 476 | and 4000 samplers) the set has 65536 2D images, 3936 samplers and 4096 storage indices in 2D: 93793 | 483 | and 4000 samplers) the set has 65536 2D images, 3936 samplers and 4096 storage indices in 2D: 93793 |
| 477 | descriptors, 3-6 MiB at 32-64 bytes a descriptor. The device prints the counts it chose, and | 484 | descriptors, 3-6 MiB at 32-64 bytes a descriptor. The device prints the counts it chose, and |
| 478 | `bindless_sizing_test` checks the rules on synthetic limits. | 485 | `bindless_sizing_test` checks the rules on synthetic limits. |
| @@ -661,14 +668,57 @@ The compute path, end to end: | |||
| 661 | - With `VK_EXT_conditional_rendering`, the arena is created with the conditional-rendering usage, and | 668 | - With `VK_EXT_conditional_rendering`, the arena is created with the conditional-rendering usage, and |
| 662 | `SetPredication` on a default-heap buffer reads at the buffer's offset in the arena plus the call's offset. | 669 | `SetPredication` on a default-heap buffer reads at the buffer's offset in the arena plus the call's offset. |
| 663 | - `CreateHeap` reserves the requested size in the arena at 64 KiB, and a buffer placed in it gets the heap's | 670 | - `CreateHeap` reserves the requested size in the arena at 64 KiB, and a buffer placed in it gets the heap's |
| 664 | place plus the placed offset as its console VA. A placed texture keeps its own `VkDeviceMemory` and a null VA, | 671 | place plus the placed offset as its console VA. A placed texture keeps its own `VkDeviceMemory` and a null VA; |
| 665 | and a tiled (`64KB_UNDEFINED_SWIZZLE`) placement is refused with `E_NOTIMPL`. `CreatePlacedResource2`'s | 672 | tiled (`64KB_UNDEFINED_SWIZZLE` and Xbox `0x101`) 2D/3D placed textures are backed the same way with |
| 666 | castable-format list reaches the placed texture's image as the committed path's does (D3D-90). | 673 | tile-multiple `GetResourceAllocationInfo`, `GetResourceTiling`, and host-matched `E_INVALIDARG` checks |
| 674 | (D3D-191). Multisampled 2D placed textures (`UNKNOWN` and `4x` tiled) share that backing with host-matched heap | ||
| 675 | and offset alignment checks (`4 MiB` vs `64 KiB`, `D3D-222`). `CreatePlacedResource2`'s castable-format list | ||
| 676 | reaches the placed texture's image as the committed path's does (D3D-90). | ||
| 667 | 677 | ||
| 668 | Known gaps: set 0 in pipelines (the device keeps the bindless set, but no pipeline declares or binds it yet) and | 678 | Known gaps: set 0 in pipelines (the device keeps the bindless set, but no pipeline declares or binds it yet) and |
| 669 | therefore every translated shader that declares bindings; tessellation, geometry and mesh pipelines, | 679 | therefore every translated shader that declares bindings; tessellation, geometry and mesh pipelines, |
| 670 | multisampled pipelines, several viewports, primitive restart; `requiredSubgroupSize = 64` for wave64 compute; | 680 | multisampled pipelines, several viewports, primitive restart; `requiredSubgroupSize = 64` for wave64 compute; |
| 671 | the game's present entry point (`PresentX`; the DXGI factory/swapchain and the presenter above are what it | 681 | the game's present entry point (`PresentX`; the DXGI factory/swapchain and the presenter above are what it |
| 682 | - **Subgroup size (compute and graphics PSOs).** A translated shader assumes one subgroup size, and a GPU whose | ||
| 683 | default differs runs it inexact: a wave64 shader reads lanes 32-63 of a 32-wide subgroup, and a wave32 pixel | ||
| 684 | shader on a 64-wide default reads the other half's lanes (AnyPS5 #487 on RDNA4). `runtime/src/subgroup_size.h` | ||
| 685 | decides, per stage, from the shader's index entry and what the device offers; the PSO chains the result. | ||
| 686 | - **Index fields:** `wave64`, `subgroup_size` (64 for wave64, 32 otherwise, `null` when emulated) and | ||
| 687 | `wave64_exchange` (present: translated with `--wave64-emulate`, exact on any size). | ||
| 688 | - **Device:** `subgroupSizeControl` and `computeFullSubgroups` are enabled where supported; | ||
| 689 | `minSubgroupSize`, `maxSubgroupSize`, `maxComputeWorkgroupSubgroups`, `requiredSubgroupSizeStages` (from | ||
| 690 | `VkPhysicalDeviceSubgroupSizeControlProperties`) and the default `subgroupSize` are kept in | ||
| 691 | `VulkanDeviceInfo::subgroup` and printed at device creation. | ||
| 692 | - **Emulated shaders:** nothing is required. | ||
| 693 | - **Native shaders:** `VkPipelineShaderStageRequiredSubgroupSizeCreateInfo{subgroup_size}` when the feature is | ||
| 694 | enabled, the stage is in `requiredSubgroupSizeStages`, the size is a power of two in [min, max] and, for | ||
| 695 | compute and mesh, the workgroup fits in size x `maxComputeWorkgroupSubgroups` (VUID-VkPipelineShaderStageCreateInfo-pNext-02755 | ||
| 696 | and -02756, VUID-VkPipelineShaderStageRequiredSubgroupSizeCreateInfo-requiredSubgroupSize-02760..02762). | ||
| 697 | A compute stage also gets `VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT` when | ||
| 698 | `computeFullSubgroups` is enabled and local size X is a multiple of the size (-flags-02785 for the feature, | ||
| 699 | -flags-08988 for the stage, -pNext-02757 for X). Wave32 shaders ask for 32 the same way. A device whose only size is the wanted one (NVIDIA, | ||
| 700 | wave32) needs no chain. Where the size cannot be required (stage not listed, feature off) but the device default is | ||
| 701 | the wanted one, the shader works as it is (`device_default`; nothing guarantees the default, so it is not logged | ||
| 702 | as inexact); any other size is `unavailable` and logged. | ||
| 703 | - **Which stages can be required:** it is the driver's list, not a fixed rule. The AMD Windows driver reports | ||
| 704 | FRAGMENT | COMPUTE | TASK | MESH (measured on a Radeon 880M, 26.11.2, sizes 32..64), so wave64 and wave32 pixel | ||
| 705 | shaders run exact there; so does current Mesa RADV on GFX10+ (COMPUTE | FRAGMENT | task/mesh, Mesa main at | ||
| 706 | 152b9cde, `src/amd/vulkan/radv_physical_device.c`, `requiredSubgroupSizeStages`; older Mesa reported compute only). | ||
| 707 | NVIDIA lists every stage but only size 32, so a native wave64 shader cannot get 64 there. Vertex and geometry | ||
| 708 | stages are in neither list. | ||
| 709 | - **A size the device cannot give** is logged once per stage with the first shader's name (and again at 10, 100, | ||
| 710 | 1000 shaders of that stage): `[rt] d3d12: <name> (<stage>) is a 64-wide shader but this device cannot require that | ||
| 711 | subgroup size ...`. For compute and mesh the fix is the build, `--wave64-emulate` (`make_game.py | ||
| 712 | --wave64-emulate auto` picks it for this GPU); a wave64 vertex, geometry or pixel shader has no emulation yet | ||
| 713 | (the ~10,000 wave64 pixel shaders are the open case on NVIDIA, SHADER-10). | ||
| 714 | - **Test:** `subgroup_size_test` (CPU) checks the decision against AMD-like, NVIDIA-like and old-RADV | ||
| 715 | properties and the resulting create-info chain; `d3d12_subgroup_test` (GPU) runs `cs_w64x_readlane` natively | ||
| 716 | and with `--wave64-emulate`, and `cs_wqm_w32`, through D3D12 PSOs and compares the read-back words. | ||
| 717 | |||
| 718 | Known gaps: set 0 in pipelines (the device keeps the bindless set, but no pipeline declares or binds it yet) and | ||
| 719 | therefore every translated shader that declares bindings; tessellation, geometry and mesh pipelines, | ||
| 720 | multisampled pipelines, several viewports, primitive restart; subgroup size for mesh pipelines (the decision covers them, no mesh PSO exists to chain it into), and for wave64 vertex, geometry and, on a GPU that cannot require 64 for pixel shaders (NVIDIA), pixel shaders, which have no emulation (SHADER-10); | ||
| 721 | the game's present entry point (DXGI factory/swapchain or `PresentX`; the presenter above is what either | ||
| 672 | calls), HDR and fullscreen; buffer and constant-buffer views (UAV clears read the descriptor bytes, so they do | 722 | calls), HDR and fullscreen; buffer and constant-buffer views (UAV clears read the descriptor bytes, so they do |
| 673 | not wait on view creation), typeless volume RTVs, depth-stencil resolves to a destination offset other than | 723 | not wait on view creation), typeless volume RTVs, depth-stencil resolves to a destination offset other than |
| 674 | the source rectangle's; | 724 | the source rectangle's; |
| @@ -679,8 +729,6 @@ depth SRVs are sampled next to a read-only DSV, M2); the index buffer is bound w | |||
| 679 | (`vkCmdBindIndexBuffer2`, Vulkan 1.4, takes one). | 729 | (`vkCmdBindIndexBuffer2`, Vulkan 1.4, takes one). |
| 680 | 730 | ||
| 681 | Known gaps found in review, not fixed here: | 731 | Known gaps found in review, not fixed here: |
| 682 | - **Wave64:** a wave64 compute shader runs at whatever subgroup size the driver picks, because no | ||
| 683 | `requiredSubgroupSize` is requested (claimed as a follow-up in #313). | ||
| 684 | - **Queues:** every D3D12 queue submits to one `VkQueue`, which runs batches in order. So a queue that waits on a | 732 | - **Queues:** every D3D12 queue submits to one `VkQueue`, which runs batches in order. So a queue that waits on a |
| 685 | fence another queue signals later (`B->Wait(f, n)` recorded before `A->Signal(f, n)`) holds back that signal, | 733 | fence another queue signals later (`B->Wait(f, n)` recorded before `A->Signal(f, n)`) holds back that signal, |
| 686 | and the GPU never progresses (woreksami's probe). Queues on separate Vulkan queues (#306 for copy and compute) | 734 | and the GPU never progresses (woreksami's probe). Queues on separate Vulkan queues (#306 for copy and compute) |
| @@ -699,6 +747,10 @@ CPU tests: | |||
| 699 | - `gfx10_descriptors_test` covers the T#, S# and V#: every field alone at its bit position, round trips, what | 747 | - `gfx10_descriptors_test` covers the T#, S# and V#: every field alone at its bit position, round trips, what |
| 700 | decoding refuses and ignores, the T#s the image test shaders build, sampler words as radv writes them, and the | 748 | decoding refuses and ignores, the T#s the image test shaders build, sampler words as radv writes them, and the |
| 701 | format table. `tests/test_gfx10_descriptors.py` compares that table with `tools/gfx10_formats.json`. | 749 | format table. `tests/test_gfx10_descriptors.py` compares that table with `tools/gfx10_formats.json`. |
| 750 | - `subgroup_size_test` covers the subgroup-size decision of section 3.2 without a GPU: synthetic index entries | ||
| 751 | (native and emulated wave64, wave32; compute, pixel, mesh, vertex) against AMD-like (32..64, FRAGMENT | COMPUTE | | ||
| 752 | TASK | MESH), NVIDIA-like (32 only, every stage) and old-RADV (COMPUTE only) properties, the limits (feature off, | ||
| 753 | `maxComputeWorkgroupSubgroups`, a size that is not a power of two), and the create-info chain. | ||
| 702 | 754 | ||
| 703 | The GPU tests read their results back. With `LEONIDA_VK_VALIDATION=1` they run under `VK_LAYER_KHRONOS_validation`, | 755 | The GPU tests read their results back. With `LEONIDA_VK_VALIDATION=1` they run under `VK_LAYER_KHRONOS_validation`, |
| 704 | and any validation error fails them. | 756 | and any validation error fails them. |
| @@ -859,6 +911,25 @@ and any validation error fails them. | |||
| 859 | - `xbox_present_test`: `PresentX` and the frame events (section 4.5, "what is implemented"), checked on swapchain pixels. | 911 | - `xbox_present_test`: `PresentX` and the frame events (section 4.5, "what is implemented"), checked on swapchain pixels. |
| 860 | there is one. A host that reports no non-normalized samplers is compared only on the 3 cases without the | 912 | there is one. A host that reports no non-normalized samplers is compared only on the 3 cases without the |
| 861 | flag. The other 19 are then checked against their recorded answers only. | 913 | flag. The other 19 are then checked against their recorded answers only. |
| 914 | - `d3d12_subgroup_test`: subgroup size control through D3D12 PSOs, on the PSOs of the device proxy. | ||
| 915 | - **Shaders:** `cs_w64x_readlane` (a `v_readlane` across both halves of a wave64) translated natively and with | ||
| 916 | `--wave64-emulate`, and `cs_wqm_w32`, built by `test/shaders/build.py` (needs `llvm-mc`: `LLVM_MC`). | ||
| 917 | - **Check:** each is dispatched through a PSO found by FSSM hash and the eight words it stores are compared. The | ||
| 918 | PSO's request (`pipeline_subgroup_requests`) must equal the decision function's. The native wave64 shader | ||
| 919 | must be exact where the device can give 64 (AMD: required size 64 plus full subgroups) and is reported, not | ||
| 920 | judged, where it cannot (NVIDIA); the emulated one must be exact everywhere. | ||
| 921 | - **Control:** a second run with nothing requested is printed. On the Radeon 880M the default compute subgroup is | ||
| 922 | already 64, so the wave64 controls are exact as well. | ||
| 923 | - **Probes:** GLSL shaders (`cs_sg_probe.comp`, `ps_sg_probe.frag`, `vs_sg_fullscreen.vert`) store `gl_SubgroupSize`, | ||
| 924 | so the size the driver used is observed for a wave64 entry, a wave32 entry and an emulated one. Where the PSO | ||
| 925 | required a size, the observed size must equal it. For a wave32 compute shader on a device whose default is not 32, | ||
| 926 | the control is asserted to differ (the request matters); a wave32 pixel shader on the 880M goes from 64-wide to | ||
| 927 | 32-wide with the request. | ||
| 928 | - **Wave64 pixel shader:** `ps_w64x_readlane.asm` (`v_readlane` of lanes 40, 5, 33 and 63) is drawn over 64x64 | ||
| 929 | pixels through a graphics PSO into a float target, and every pixel must carry the four values derived in the | ||
| 930 | .asm header where the PSO required 64: 4096 of 4096 on the 880M. The control is asserted to differ only where the | ||
| 931 | default pixel subgroup is not 64; the 880M runs pixel shaders 64-wide by default, so its control is exact too. On | ||
| 932 | the RTX 5070 the shader gets no 64 (0 of 4096 exact, not judged). | ||
| 862 | - `d3d12_descriptor_test`: descriptors through the proxy. | 933 | - `d3d12_descriptor_test`: descriptors through the proxy. |
| 863 | - Copies, checked on the slots' bytes: one run, range lists of different shapes on each side, null size | 934 | - Copies, checked on the slots' bytes: one run, range lists of different shapes on each side, null size |
| 864 | arrays, and a destination longer than its source. | 935 | arrays, and a destination longer than its source. |
| @@ -892,6 +963,17 @@ and any validation error fails them. | |||
| 892 | - the index has an entry with set-0 bindings for the same program ahead of the binding-free one, and the PSO | 963 | - the index has an entry with set-0 bindings for the same program ahead of the binding-free one, and the PSO |
| 893 | must take the binding-free one; | 964 | must take the binding-free one; |
| 894 | - a device that reports 128 bytes of push constants refuses the PSO. | 965 | - a device that reports 128 bytes of push constants refuses the PSO. |
| 966 | - `d3d12_set0_compute_test`: set 0 from the compute bind point, through the proxy and D3D12 alone. The index entry | ||
| 967 | of its shader lists set-0 bindings, so the PSO's layout holds the device's bindless set and replay binds it at | ||
| 968 | each dispatch; nothing in the test binds it. Four dispatches of `test/glsl/cs_set0_sample.comp` (GLSL written to | ||
| 969 | the translator's contract) load a T# and an S# from two descriptor tables and sample one tile to the right in U: | ||
| 970 | - two SRVs give their textures texel for texel, so the T# decides the image; | ||
| 971 | - 32 bytes no view was made for give the fallback image, one colour everywhere; | ||
| 972 | - a clamping sampler gives the texture's right edge, so the S# decides the sampler; | ||
| 973 | - a device without the bindless set refuses the PSO. | ||
| 974 | |||
| 975 | Removing the set-0 bind from the dispatch path makes this test fail (`VUID-vkCmdDispatch-None-08600`, measured on | ||
| 976 | llvmpipe); `d3d12_m2_textured_test` covers the bind at draws in the same way. | ||
| 895 | - `d3d12_draw_test`: milestone M1, through the proxy. | 977 | - `d3d12_draw_test`: milestone M1, through the proxy. |
| 896 | - **Pipeline:** a VS+PS PSO found by FSSM hash. The input layout is POSITION then COLOR, while the VS has them in | 978 | - **Pipeline:** a VS+PS PSO found by FSSM hash. The input layout is POSITION then COLOR, while the VS has them in |
| 897 | the opposite register order, so a match by position would fail. | 979 | the opposite register order, so a match by position would fail. |
| @@ -962,7 +1044,7 @@ The layer therefore owns the console VAs. It returns them from `ID3D12Resource:: | |||
| 962 | | Address space | Two ranges. A **BDA arena** holds buffers, descriptor heaps and shader code; its device address is `heap_base`. A separate **image key range** supplies unique console VAs for images; those keys are never added to `heap_base`. The arena's `VkBuffer` is created with all buffer usages the game can bind (uniform, storage, vertex, index, indirect, transfer) plus `SHADER_DEVICE_ADDRESS`, and its memory with `VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT`. | | 1044 | | Address space | Two ranges. A **BDA arena** holds buffers, descriptor heaps and shader code; its device address is `heap_base`. A separate **image key range** supplies unique console VAs for images; those keys are never added to `heap_base`. The arena's `VkBuffer` is created with all buffer usages the game can bind (uniform, storage, vertex, index, indirect, transfer) plus `SHADER_DEVICE_ADDRESS`, and its memory with `VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT`. | |
| 963 | | Buffers | A buffer resource is a range in the arena's single `VkBuffer`: offset = its console VA, size = the resource size. Buffer commands bind the arena buffer with that offset, so its device address is exactly `arena_bda + offset`; no per-resource `VkBuffer` object is needed. | | 1045 | | Buffers | A buffer resource is a range in the arena's single `VkBuffer`: offset = its console VA, size = the resource size. Buffer commands bind the arena buffer with that offset, so its device address is exactly `arena_bda + offset`; no per-resource `VkBuffer` object is needed. | |
| 964 | | Images | Each image gets a unique console VA key and lives in its own `VkDeviceMemory` (or a suballocated device-local image heap) with optimal tiling. Shader image access goes through the T#/hash table, so nothing dereferences the key. Keeping images out of the arena avoids forcing optimal-tiled images into the arena's memory type and keeps the arena sized by buffers, not textures. | | 1046 | | Images | Each image gets a unique console VA key and lives in its own `VkDeviceMemory` (or a suballocated device-local image heap) with optimal tiling. Shader image access goes through the T#/hash table, so nothing dereferences the key. Keeping images out of the arena avoids forcing optimal-tiled images into the arena's memory type and keeps the arena sized by buffers, not textures. | |
| 965 | | Heaps and placed resources | `CreateHeap` reserves the requested size in the arena, so a buffer placed at a 64 KiB-aligned offset is that offset into the arena and its console VA is the heap's place plus the offset. A placed texture gets its own `VkDeviceMemory` and a null VA, as in D3D12. Tiled (`64KB_UNDEFINED_SWIZZLE`) placements are refused with `E_NOTIMPL`; reserved resources are not implemented. | | 1047 | | Heaps and placed resources | `CreateHeap` reserves the requested size in the arena, so a buffer placed at a 64 KiB-aligned offset is that offset into the arena and its console VA is the heap's place plus the offset. A placed texture gets its own `VkDeviceMemory` and a null VA, as in D3D12. Tiled (`64KB_UNDEFINED_SWIZZLE` and Xbox `0x101`) 2D/3D placed textures (D3D-191) and multisampled 2D placed textures (D3D-222) share that backing, answer `GetResourceAllocationInfo` and `GetResourceTiling`, and check heap/offset alignments. | |
| 966 | | Descriptor heaps | Shader-visible CBV/SRV/UAV and sampler heaps are allocated in the low 4 GB of the arena. RTV/DSV heaps are host-side only. | | 1048 | | Descriptor heaps | Shader-visible CBV/SRV/UAV and sampler heaps are allocated in the low 4 GB of the arena. RTV/DSV heaps are host-side only. | |
| 967 | | Shader code | Each FSSM blob is uploaded to the arena; its console VA is the code base. | | 1049 | | Shader code | Each FSSM blob is uploaded to the arena; its console VA is the code base. | |
| 968 | | Upload/readback | `D3D12_HEAP_TYPE_UPLOAD`/`READBACK` resources are separate host-visible buffers outside the arena. Their console VAs are only used by copy APIs; if the game binds one as a vertex/index buffer or reads it in a shader, the layer biases the view/descriptor by `-heap_base` so the shader's addition lands on the host BDA (**Assumption**; **measured to fail for a V#**, see below). | | 1050 | | Upload/readback | `D3D12_HEAP_TYPE_UPLOAD`/`READBACK` resources are separate host-visible buffers outside the arena. Their console VAs are only used by copy APIs; if the game binds one as a vertex/index buffer or reads it in a shader, the layer biases the view/descriptor by `-heap_base` so the shader's addition lands on the host BDA (**Assumption**; **measured to fail for a V#**, see below). | |
| @@ -1088,6 +1170,9 @@ The layer's descriptor model: | |||
| 1088 | `VK_EXT_image_view_min_lod`. Vulkan allows the image-view minimum to be rounded down to an integer. | 1170 | `VK_EXT_image_view_min_lod`. Vulkan allows the image-view minimum to be rounded down to an integer. |
| 1089 | With nearest mip filtering, the UHD 770 and Arrow Lake Xe-LPG returned mip 0 for a 2D minimum of 0.75. | 1171 | With nearest mip filtering, the UHD 770 and Arrow Lake Xe-LPG returned mip 0 for a 2D minimum of 0.75. |
| 1090 | The Xe-LPG also returned mip 1 for a 2D-array minimum of 1.75. RTX and Radeon returned mips 1 and 2. | 1172 | The Xe-LPG also returned mip 1 for a 2D-array minimum of 1.75. RTX and Radeon returned mips 1 and 2. |
| 1173 | On Intel integrated GPUs the layer therefore passes the clamp rounded to the nearest level | ||
| 1174 | (`ceil(minLod + 0.5) - 1`), which point mip filtering selects exactly; linear mip filtering then blends from that | ||
| 1175 | whole level instead of the fraction (D3D-219). `LEONIDA_MIN_LOD_INTEGER=1` or `0` forces the rounding on or off. | ||
| 1091 | See [Vulkan image-level selection](https://docs.vulkan.org/spec/latest/chapters/textures.html#textures-image-level-selection) | 1176 | See [Vulkan image-level selection](https://docs.vulkan.org/spec/latest/chapters/textures.html#textures-image-level-selection) |
| 1092 | and the [Intel readbacks](https://github.com/ItsNotRexed/Leonida/pull/1015#issuecomment-7075135647). | 1177 | and the [Intel readbacks](https://github.com/ItsNotRexed/Leonida/pull/1015#issuecomment-7075135647). |
| 1093 | If the logical device lacks the feature, the runtime logs the unsupported view | 1178 | If the logical device lacks the feature, the runtime logs the unsupported view |
| @@ -1261,8 +1346,8 @@ Pipeline creation: | |||
| 1261 | `InputSlotClass`/`InstanceDataStepRate`. The index entry needs the semantic map (section 3.5). | 1346 | `InputSlotClass`/`InstanceDataStepRate`. The index entry needs the semantic map (section 3.5). |
| 1262 | - Enable the features the index entry lists: barycentrics, fragment interlock, mesh, geometry, Float64, Int64, | 1347 | - Enable the features the index entry lists: barycentrics, fragment interlock, mesh, geometry, Float64, Int64, |
| 1263 | buffer device address, storage image without format, maintenance8. | 1348 | buffer device address, storage image without format, maintenance8. |
| 1264 | - Request `requiredSubgroupSize = 64` for wave64 shaders when `VK_EXT_subgroup_size_control` offers it (AMD). | 1349 | - Request the subgroup size each shader was translated for (`requiredSubgroupSize` 64 or 32) where the device lists the stage |
| 1265 | Otherwise use the translator's 32-wide approximation and say so in the log. | 1350 | in `requiredSubgroupSizeStages`, and say so in the log where it cannot (section 3.2, "Subgroup size"). |
| 1266 | - Pipeline caches: use a `VkPipelineCache` keyed by driver/pipeline-cache UUID; the `pipelines` build stage already | 1351 | - Pipeline caches: use a `VkPipelineCache` keyed by driver/pipeline-cache UUID; the `pipelines` build stage already |
| 1267 | produces one. D3D12 `CachedPSO` blobs are driver-specific and are ignored (the PSO is rebuilt from its | 1352 | produces one. D3D12 `CachedPSO` blobs are driver-specific and are ignored (the PSO is rebuilt from its |
| 1268 | descriptors). `ID3D12PipelineLibrary` is an in-memory map plus the Vulkan cache. | 1353 | descriptors). `ID3D12PipelineLibrary` is an in-memory map plus the Vulkan cache. |
| @@ -2097,8 +2182,8 @@ Vulkan AS would be invisible to them. Two paths: | |||
| 2097 | the GPU and is checked against that reference. The standalone device uses it for `BuildRaytracingAccelerationStructure` | 2182 | the GPU and is checked against that reference. The standalone device uses it for `BuildRaytracingAccelerationStructure` |
| 2098 | and answers `GetRaytracingAccelerationStructurePrebuildInfo` from its layout, exactly. Acceleration-structure | 2183 | and answers `GetRaytracingAccelerationStructurePrebuildInfo` from its layout, exactly. Acceleration-structure |
| 2099 | buffers then keep their console VAs, the addresses the records name each other by. `LEONIDA_RT_AS=khr` keeps | 2184 | buffers then keep their console VAs, the addresses the records name each other by. `LEONIDA_RT_AS=khr` keeps |
| 2100 | #743's `VkAccelerationStructureKHR` builds (for `RayQueryKHR`), which the game's shaders can't read. Updates rebuild | 2185 | #743's `VkAccelerationStructureKHR` builds (for `RayQueryKHR`), which the game's shaders can't read. Updates refit |
| 2101 | the structure; compaction, copies, serialization and the Xbox batched/streaming builds are not implemented. The | 2186 | the source structure instead of rebuilding it ([bvh.md](bvh.md) §7a); compaction, copies, serialization and the Xbox batched/streaming builds are not implemented. The |
| 2102 | reported `RaytracingTier` is unchanged (`NOT_SUPPORTED`). Checked by `runtime/test/d3d12_xdxr_rt_test.cpp` through | 2187 | reported `RaytracingTier` is unchanged (`NOT_SUPPORTED`). Checked by `runtime/test/d3d12_xdxr_rt_test.cpp` through |
| 2103 | the D3D12 API. | 2188 | the D3D12 API. |
| 2104 | 2189 | ||
| @@ -2175,7 +2260,7 @@ store, load, mesh, geometry and BVH tests; this layer is the other half. | |||
| 2175 | | PS system inputs | `FragCoord` (xy/z/w), `FrontFacing`, barycentrics; enable `fragmentShaderBarycentric` and `fragmentShaderPixelInterlock` when the index entry asks. | | 2260 | | PS system inputs | `FragCoord` (xy/z/w), `FrontFacing`, barycentrics; enable `fragmentShaderBarycentric` and `fragmentShaderPixelInterlock` when the index entry asks. | |
| 2176 | | Mesh/geometry stages | `VK_EXT_mesh_shader`; the index's max vertices/primitives size the SPIR-V output arrays and are checked against the device's mesh properties; geometry stage for the 195 voxelize shaders; `DispatchMesh` → `vkCmdDrawMeshTasksEXT`. | | 2261 | | Mesh/geometry stages | `VK_EXT_mesh_shader`; the index's max vertices/primitives size the SPIR-V output arrays and are checked against the device's mesh properties; geometry stage for the 195 voxelize shaders; `DispatchMesh` → `vkCmdDrawMeshTasksEXT`. | |
| 2177 | | POPS collision | The runtime puts 0 (no collision, bit 31 clear) in the POPS collision SGPR; the translator uses fragment-shader interlock for ordering. **Open:** the exact SGPR location is a translator/driver detail not named in the current contract. | | 2262 | | POPS collision | The runtime puts 0 (no collision, bit 31 clear) in the POPS collision SGPR; the translator uses fragment-shader interlock for ordering. **Open:** the exact SGPR location is a translator/driver detail not named in the current contract. | |
| 2178 | | Wave size | `requiredSubgroupSize = 64` when supported (AMD); otherwise the translator's 32-wide approximation is explicit in the log. | | 2263 | | Wave size | The PSO asks for the size the shader was translated for (`requiredSubgroupSize` 64 or 32, section 3.2 "Subgroup size") where the stage is in `requiredSubgroupSizeStages`; a shader translated with `--wave64-emulate` asks for nothing. A size the device cannot give is named in the log. | |
| 2179 | | Code-embedded data | The whole FSSM blob is in the arena; `s_getpc_b64` becomes `code_base + next-instruction offset`. | | 2264 | | Code-embedded data | The whole FSSM blob is in the arena; `s_getpc_b64` becomes `code_base + next-instruction offset`. | |
| 2180 | 2265 | ||
| 2181 | ### 5.1 Descriptor hash table details | 2266 | ### 5.1 Descriptor hash table details |
| @@ -2518,6 +2603,12 @@ Xodus is LGPL-2.1 and is cited only for its coverage number, not as a code sourc | |||
| 2518 | - **Hash-table cost.** Every image/sampler access hashes a T#/S# and probes a storage buffer. **Measured (D3D-56, section 5.1)** on an RTX 5080 (driver 616.56): in `DEVICE_LOCAL` VRAM the lookup itself stays fast up to 100k entries (`3.0–3.7 us/1M` net wave-uniform full sweeps, `17.2–28.9 us/1M` net divergent hits), whereas `HOST_VISIBLE | HOST_COHERENT` system memory drops 9.6x–28x on uniform full sweeps and 59x–755x on divergent lookups at 10k–100k entries, and linear probing's 8-probe limit doubles a 100k table to `80.00 MiB` (`4.8%` load). **The runtime now keeps that table in `DEVICE_LOCAL` memory** and uploads only the slots that changed, from a mapped staging copy, with the copy and its barrier in the command buffer that will read it (D3D-76; 46.2x on a divergent miss at 100k on an RTX 2060 SUPER). Improving slot placement within the 8-probe window is the open optimisation (SHADER-100); Intel, RTX 5070 Ti Laptop and AMD RDNA3 are measured in section 5.1; Apple numbers remain open via `vk_descriptor_bench`. | 2603 | - **Hash-table cost.** Every image/sampler access hashes a T#/S# and probes a storage buffer. **Measured (D3D-56, section 5.1)** on an RTX 5080 (driver 616.56): in `DEVICE_LOCAL` VRAM the lookup itself stays fast up to 100k entries (`3.0–3.7 us/1M` net wave-uniform full sweeps, `17.2–28.9 us/1M` net divergent hits), whereas `HOST_VISIBLE | HOST_COHERENT` system memory drops 9.6x–28x on uniform full sweeps and 59x–755x on divergent lookups at 10k–100k entries, and linear probing's 8-probe limit doubles a 100k table to `80.00 MiB` (`4.8%` load). **The runtime now keeps that table in `DEVICE_LOCAL` memory** and uploads only the slots that changed, from a mapped staging copy, with the copy and its barrier in the command buffer that will read it (D3D-76; 46.2x on a divergent miss at 100k on an RTX 2060 SUPER). Improving slot placement within the 8-probe window is the open optimisation (SHADER-100); Intel, RTX 5070 Ti Laptop and AMD RDNA3 are measured in section 5.1; Apple numbers remain open via `vk_descriptor_bench`. |
| 2519 | - **Wave64.** On NVIDIA, wave64 shaders use the translator's 32-wide approximation; cross-half ops are approximate. | 2604 | - **Wave64.** On NVIDIA, wave64 shaders use the translator's 32-wide approximation; cross-half ops are approximate. |
| 2520 | AMD GPUs with 64-wide subgroups are exact. This is a known fidelity gap, not specific to the layer. | 2605 | AMD GPUs with 64-wide subgroups are exact. This is a known fidelity gap, not specific to the layer. |
| 2606 | - **Hash-table cost.** Every image/sampler access hashes a T#/S# and probes a storage buffer. **Measured (D3D-56, section 5.1)** on an RTX 5080 (driver 616.56): in `DEVICE_LOCAL` VRAM the lookup itself stays fast up to 100k entries (`3.0–3.7 us/1M` net wave-uniform full sweeps, `17.2–28.9 us/1M` net divergent hits), whereas `HOST_VISIBLE | HOST_COHERENT` system memory drops 9.6x–28x on uniform full sweeps and 59x–755x on divergent lookups at 10k–100k entries, and linear probing's 8-probe limit doubles a 100k table to `80.00 MiB` (`4.8%` load). **The runtime now keeps that table in `DEVICE_LOCAL` memory** and uploads only the slots that changed, from a mapped staging copy, with the copy and its barrier in the command buffer that will read it (D3D-76; 46.2x on a divergent miss at 100k on an RTX 2060 SUPER). Improving slot placement within the 8-probe window is the open optimisation (SHADER-100); AMD/Intel/Apple numbers remain open via `vk_descriptor_bench`. | ||
| 2607 | - **Wave64.** A native wave64 shader needs a 64-wide subgroup in its stage: AMD (Windows driver, RADV on GFX10+) can require | ||
| 2608 | it for compute, mesh and pixel shaders, NVIDIA cannot (32 only). There, compute and mesh shaders translated with | ||
| 2609 | `--wave64-emulate` are exact; wave64 pixel, vertex and geometry shaders have no emulation and keep the | ||
| 2610 | translator's 32-wide approximation (cross-half ops are approximate). This is a known fidelity gap, not specific to | ||
| 2611 | the layer. | ||
| 2521 | - **Xbox tiling/DCC.** Slot 76 and layout `0x101` are known, but the tiled data layout, detile path and DCC remain | 2612 | - **Xbox tiling/DCC.** Slot 76 and layout `0x101` are known, but the tiled data layout, detile path and DCC remain |
| 2522 | unknown. If the game assumes console tiling or compression metadata, the layer needs a detile/repack step. | 2613 | unknown. If the game assumes console tiling or compression metadata, the layer needs a detile/repack step. |
| 2523 | - **BVH builder DXIL.** 44 of the builder's 53 Xbox DXIL shaders fail the PC compiler; 22 have been lowered to | 2614 | - **BVH builder DXIL.** 44 of the builder's 53 Xbox DXIL shaders fail the PC compiler; 22 have been lowered to |
| @@ -2735,7 +2826,7 @@ on a PC device behind the Xbox-ABI proxy). Measured: | |||
| 2735 | (`+0x18`, `+0x28`, `+0x30`) the DLL writes commands through while there is room. Table and evidence: | 2826 | (`+0x18`, `+0x28`, `+0x30`) the DLL writes commands through while there is room. Table and evidence: |
| 2736 | [d3d12_command_objects.md §3.5a](d3d12_command_objects.md). | 2827 | [d3d12_command_objects.md §3.5a](d3d12_command_objects.md). |
| 2737 | Device slot 67 is a console-only compute-pipeline call, `DeserializeComputePipelineStateX` in the DLL's own | 2828 | Device slot 67 is a console-only compute-pipeline call, `DeserializeComputePipelineStateX` in the DLL's own |
| 2738 | messages, not the PC method at that index; the proxy now refuses it. The dispatch stops where the PC runtime | 2829 | messages, not the PC method at that index; the proxy routes it to `CreateComputePipelineState`. The dispatch stops where the PC runtime |
| 2739 | refuses the DLL's compute code at slot 62: the DLL's shaders carry an `ACCC` part instead of DXIL, an `FSPX` | 2830 | refuses the DLL's compute code at slot 62: the DLL's shaders carry an `ACCC` part instead of DXIL, an `FSPX` |
| 2740 | payload with an RDNA2 program ([fspx.md](fspx.md)). | 2831 | payload with an RDNA2 program ([fspx.md](fspx.md)). |
| 2741 | - Its `throw 1` reaches the caller. Before #965 the throw carried an image base of 0, because `_CxxThrowException` | 2832 | - Its `throw 1` reaches the caller. Before #965 the throw carried an image base of 0, because `_CxxThrowException` |