upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 03:14:28 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 03:14:28 -0500
commit209f5e1f2a42fcfbf9916c2d0333fa906bb931ef (patch)
tree953cab766d5e0a6aac2d53aa32c434689875ad30 /docs
parentde4d3321a34a6c4bed5ba5afe5fb5328095ceab1 (diff)
parentea512f284ce3b58c144850d70371091e1522ce72 (diff)
Merge pull request #1199 from quackottu
Diffstat (limited to 'docs')
-rw-r--r--docs/d3d12_vulkan.md48
1 files changed, 37 insertions, 11 deletions
diff --git a/docs/d3d12_vulkan.md b/docs/d3d12_vulkan.md
index 8471d9fcb..64cbcab20 100644
--- a/docs/d3d12_vulkan.md
+++ b/docs/d3d12_vulkan.md
@@ -391,16 +391,36 @@ What is implemented (all of it testable without the game):
391 391
392Descriptors and the bindless set (milestone M2, without the pipelines that will bind the set), from the shader's 392Descriptors and the bindless set (milestone M2, without the pipelines that will bind the set), from the shader's
393side inwards: 393side inwards:
394- **`runtime/src/vulkan_bindless.h`**: set 0 includes the twenty bindings the translator declares, with the 394- **`runtime/src/vulkan_bindless.h`**: set 0 includes the twenty bindings the translator declares, and
395 array sizes `vk_pipeline_check` uses, and `DescriptorTable` (`runtime/src/descriptor_table.h`, section 5.1) 395 `DescriptorTable` (`runtime/src/descriptor_table.h`, section 5.1) behind binding 2. One set for the device.
396 behind binding 2. One set for the device. Details: 396 The translator declares every array as a runtime array, so the counts are the runtime's choice. Details:
397 - The device sizes the arrays once, when it creates the set. It does not recreate the set, because pipeline
398 layouts are built on `bindless_set_layout()`. `bindless::size_bindings` reads the update-after-bind limits
399 (`maxPerStageDescriptorUpdateAfterBind*`, `maxDescriptorSetUpdateAfterBind*`,
400 `maxPerStageUpdateAfterBindResources`, `maxUpdateAfterBindDescriptorsInAllPools`), or the plain limits for a
401 set without update-after-bind. It starts from the default counts below (4096 sampled 2D images, 1024
402 samplers, 1024 2D-array, 256 1D, 256 3D and 256 per storage array). Where a limit is lower, it clamps the
403 sampler, storage and 2D arrays, in that order, and the device logs it. Next come the MS pairs that fit. Then it
404 grows the arrays, in the same order, towards the maximums:
405 - samplers: up to 4096, and at most `maxSamplerAllocationCount` less 64 for samplers outside the set. That
406 covers a full 2048-sampler D3D12 heap plus room for literal and static S#s.
407 - 2D images: up to 65536.
408 - storage arrays: up to 4096 each.
409
410 Growth leaves 64 descriptors of each limit to the other sets of a pipeline layout. It also stays within
411 `maxPerSetDescriptors`, which never shrinks the default counts, because a layout past it may still be
412 supported. The other arrays keep their default counts. On an RTX 5070 (driver 621.24, 1048576 of each type
413 and 4000 samplers) the set has 65536 2D images, 3936 samplers and 4096 storage indices in 2D: 93793
414 descriptors, 3-6 MiB at 32-64 bytes a descriptor. The device prints the counts it chose, and
415 `bindless_sizing_test` checks the rules on synthetic limits.
397 - An image has one index in its dimension (2D, 2D array, 3D, 1D, 2DMS or 2DMS array), shared by the 416 - An image has one index in its dimension (2D, 2D array, 3D, 1D, 2DMS or 2DMS array), shared by the
398 bindings for that dimension. The runtime adds sampled-image bindings in pairs for 2DMS and 2DMS array: 417 bindings for that dimension. The runtime adds sampled-image bindings in pairs for 2DMS and 2DMS array:
399 20/21 for floating-point and normalized color, 22/23 for unsigned integers, and 24/25 for signed integers. 418 20/21 for floating-point and normalized color, 22/23 for unsigned integers, and 24/25 for signed integers.
400 The runtime enables pairs that fit the device's descriptor limits and have a multisampled zero fallback 419 The runtime enables pairs that fit the device's descriptor limits and have a multisampled zero fallback
401 of the matching numeric class. A missed key reads zero at texel (0, 0), layer 0, sample 0. 420 of the matching numeric class. A missed key reads zero at texel (0, 0), layer 0, sample 0.
402 - The storage arrays are shorter (256), so an image with a storage view gets an index below 256 and a read-only 421 - The storage arrays are shorter (`BindlessSet::storage_capacity`). Each array holds at most as many images
403 one goes above where there is room. 422 as its dimension, and the 2D r32ui array is the same size as the other 2D storage arrays. So an image with a
423 storage view gets an index the storage arrays hold, and a read-only one goes above where there is room.
404 - Index 0 of every array is a fallback (a 1x1 image of zeros, a nearest clamping sampler), because a miss is 424 - Index 0 of every array is a fallback (a 1x1 image of zeros, a nearest clamping sampler), because a miss is
405 index 0. 425 index 0.
406 - Changes are queued and written by `flush()`, one write a slot, so a view that is removed before the next 426 - Changes are queued and written by `flush()`, one write a slot, so a view that is removed before the next
@@ -469,7 +489,8 @@ of root signatures, which are not registered yet; the literal S#s of shaders (`l
469which `rt::d3d12::register_samplers` registers without a heap slot but which nothing passes to it yet (the call at 489which `rt::d3d12::register_samplers` registers without a heap slot but which nothing passes to it yet (the call at
470pipeline creation comes with the shader index, #291); 490pipeline creation comes with the shader index, #291);
471custom border colours, minimum/maximum filters, and anisotropy or mirror-once addressing without the Vulkan 491custom border colours, minimum/maximum filters, and anisotropy or mirror-once addressing without the Vulkan
472feature, each logged and approximated; the storage arrays hold 255 images a dimension; nothing writes through a 492feature, each logged and approximated; the storage arrays hold 255 images a dimension at the default counts, more
493where the device has room (4095 2D and 1023 2D-array on an RTX 5070); nothing writes through a
473storage view in a D3D12-level test yet (`vk_bindless_test` goes through the storage bindings at the Vulkan 494storage view in a D3D12-level test yet (`vk_bindless_test` goes through the storage bindings at the Vulkan
474level). The set is flushed at every `ExecuteCommandLists`; a flush that erases keys or moves the table to a larger 495level). The set is flushed at every `ExecuteCommandLists`; a flush that erases keys or moves the table to a larger
475buffer (`BindlessSet::flush_needs_idle()`) first waits for the device to be idle and then frees the retired table 496buffer (`BindlessSet::flush_needs_idle()`) first waits for the device to be idle and then frees the retired table
@@ -526,7 +547,7 @@ and any validation error fails them.
526 loads a T# and an S# from a descriptor table and samples. The test draws the gradient with the T# at the fourth 547 loads a T# and an S# from a descriptor table and samples. The test draws the gradient with the T# at the fourth
527 slot probed, the fallback after the key is erased, the gradient again after the table has grown into a new 548 slot probed, the fallback after the key is erased, the gradient again after the table has grown into a new
528 buffer, another view at the same index, and the fallback after removal, with and without the 549 buffer, another view at the same index, and the fallback after removal, with and without the
529 descriptor-indexing flags. 550 descriptor-indexing flags. Last, it draws through a 2D image past 5000 others and a sampler past 2100 others.
530- `d3d12_com_test`: drives the COM objects through their vtables. It also checks that a queue `Wait` on a fence 551- `d3d12_com_test`: drives the COM objects through their vtables. It also checks that a queue `Wait` on a fence
531 the CPU has not signalled holds the GPU back. 552 the CPU has not signalled holds the GPU back.
532- `dxgi_swapchain_test`: creates a Win32 HWND and exercises `rt::d3d12::create_dxgi_factory`, 553- `dxgi_swapchain_test`: creates a Win32 HWND and exercises `rt::d3d12::create_dxgi_factory`,
@@ -643,6 +664,9 @@ and any validation error fails them.
643 this one in Vulkan and binds the device's set. It reads the texture through the view's own slot and through 664 this one in Vulkan and binds the device's set. It reads the texture through the view's own slot and through
644 a copy of it, and gets the fallback from a slot of bytes no view was made for and, after the texture is 665 a copy of it, and gets the fallback from a slot of bytes no view was made for and, after the texture is
645 destroyed, from the view's own bytes. 666 destroyed, from the view's own bytes.
667 - Capacity: 5000 distinct SRVs of that texture and one more, and 2100 distinct wrapping samplers in two
668 2048-slot heaps. The last view through the last sampler reads the texture one tile to the right. With the
669 sizes of before, both were past their arrays ("array is full") and the shader read the fallback.
646 670
647**Open:** whether the game uses command-list flags, bundles, or `ExecuteCommandLists` with many lists at once. All 671**Open:** whether the game uses command-list flags, bundles, or `ExecuteCommandLists` with many lists at once. All
648are supported by the IR; the trace will show which are hot. 672are supported by the IR; the trace will show which are hot.
@@ -785,10 +809,12 @@ The layer's descriptor model:
785 If the logical device lacks the feature, the runtime logs the unsupported view 809 If the logical device lacks the feature, the runtime logs the unsupported view
786 and its descriptor resolves to the fallback. A clamp at or below the first mip needs no extension. Above the 810 and its descriptor resolves to the fallback. A clamp at or below the first mip needs no extension. Above the
787 last mip, the view retains its dimensions and maps sampled channels to zero while preserving constant channels. 811 last mip, the view retains its dimensions and maps sampled channels to zero while preserving constant channels.
788- Set 0 is a fixed bindless layout. The GPU tests use 4096 sampled 2D images, 1024 samplers, 1024 2D-array 812- Set 0 is a fixed bindless layout, sized once when the device creates it. The defaults are 4096 sampled 2D
789 images, 256 1D, 256 3D, 1024 storage images and 256 per storage dimension/class; start there and grow by 813 images, 1024 samplers, 1024 2D-array images, 256 1D, 256 3D and 256 per storage dimension/class. The 2D, sampler and
790 recreating the set at a frame boundary. Use `UPDATE_AFTER_BIND` and `PARTIALLY_BOUND` so a new view does not 814 storage arrays grow to what the device's limits allow, up to 65536, 4096 and 4096 (see `vulkan_bindless.h`
791 require rewriting every descriptor; without those features, rebuild the set when it changes. 815 above). The set is not recreated to grow, because recreating it would invalidate the pipeline
816 layouts built on it. Use `UPDATE_AFTER_BIND` and `PARTIALLY_BOUND` so a new view does not require rewriting
817 every descriptor; without those features, rebuild the set when it changes.
792- The command buffer binds set 0 once; descriptor-heap changes only update the arrays and the hash table. 818- The command buffer binds set 0 once; descriptor-heap changes only update the arrays and the hash table.
793 819
794**Descriptor lifetime.** A bindless index may be referenced by in-flight command buffers after the resource is 820**Descriptor lifetime.** A bindless index may be referenced by in-flight command buffers after the resource is