Crafter.Graphics/tests
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jorijn van der Graaf 852ae8abe3
fix(descriptor-heap): round the buffer region up, align the reserved range for buffers too, and never size a heap at zero
DescriptorHeapVulkan
- The buffer region started at images * imageDescriptorSize /
  bufferDescriptorSize, rounded down. A descriptor_heap array indexes
  the heap from byte 0 in strides of its descriptor size, so buffer slot
  0 has to sit on a whole buffer descriptor past the images. Where the
  image descriptors were not a whole number of buffer descriptors, the
  first buffer descriptors overwrote the last image descriptors. Where
  they were less than one, the start was bumped to descriptor 1, but the
  heap was still sized as if the buffers began right after the images,
  so the last buffer descriptors went into the implementation's reserved
  range. Every descriptor size is a power of two, so both cases need
  image descriptors smaller than buffer descriptors, which NVIDIA (32
  and 16 bytes) and llvmpipe (64 and 16) do not have. The start now
  rounds up and the heap is sized from it (#163).
- The reserved range sat at a multiple of imageDescriptorAlignment only,
  where vkCmdBindResourceHeapEXT also wants bufferDescriptorAlignment
  (VUID-vkCmdBindResourceHeapEXT-pBindInfo-11435 and -11436). It now
  starts on a multiple of the larger. The buffer descriptors need no more
  than the rounding: each alignment is at most its descriptor size, so a
  whole number of descriptors is aligned.
- bufferStartElement is 16 bits and took the division unchecked, so an
  image region past 65535 buffer descriptors (16384 images on llvmpipe)
  wrapped the buffer region around onto the images. Slot counts whose
  buffer indices do not fit 16 bits, 0xFFFF being the empty slot, now
  throw, naming the counts. A heap without buffer slots has no buffer
  region, which starts at 0 as in descriptor-set mode, so image-only
  heaps have no index to fit.
- On a driver that reserves nothing (llvmpipe), a heap without sampler
  slots was a zero-size buffer, which every Initialize(1, 1, 0) made,
  and Window::Render bound its address each frame. Each heap now holds at
  least one descriptor, as each binding does in descriptor-set mode. That
  grows NVIDIA's sampler heap by one descriptor when no sampler slots are
  asked for; the resource heaps of the slot counts in the tree keep their
  layouts byte for byte.
- ComputeLayout holds the arithmetic, pure over the descriptor-heap
  properties, and Initialize goes through it. GetBufferOffset and
  GetBufferOffsetElement, which had their own copies of the old
  arithmetic and never had a caller, are gone.
- Bind(cmd, frame) binds a frame's heaps with the reserved ranges
  Initialize stored, or in descriptor-set mode the frame's descriptor
  set. Window::Render and the RTVolume example worked the reserved-range
  offset out from the heap's size with the image-alignment mask, and
  call Bind now. The window's per-heap cache of bind structs goes with
  it: keyed on the heap pointer, it kept binding the old buffers after a
  re-Initialize that reallocated them. The heap still ends with its
  reserved range, so code that derives the offset from the size keeps
  getting the right one.

Tests
- DescriptorHeapLayout: the issue's two layouts, the reserved range where
  buffer descriptors are aligned more strictly than image ones, every
  legal combination of descriptor sizes and alignments up to 256 bytes,
  no heap empty, the NVIDIA and llvmpipe layouts, the 16-bit limit and
  image-only heaps. Pure CPU, no device. Against the old arithmetic it
  fails 12 of its 18 checks.

Docs
- README.md's heap bullet and AGENTS.consumer.md say how to bind the
  heap outside the frame loop, and the consumer notes that Initialize
  throws when buffer indices would pass 16 bits. AGENTS.md lists
  ComputeLayout among the functions the pure-logic tests drive.

Closes #163.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 16:06:44 +01:00
..
BLASBuildOptions feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
DebugMessengerSeverity feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
DeferredDeletion feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
DeletionQueueThreads feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
DescriptorHeapLayout fix(descriptor-heap): round the buffer region up, align the reserved range for buffers too, and never size a heap at zero 2026-10-31 16:06:44 +01:00
DeviceFeatures feat(device): applications ask for the device features their shaders use 2026-10-31 06:40:02 +01:00
DeviceSelection feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
ExampleShaders fix(rt): split Sponza's combined image sampler into a heap texture and sampler 2026-10-31 08:25:52 +01:00
FeatureRequests feat(device): applications ask for the device features their shaders use 2026-10-31 06:40:02 +01:00
FontAdvanceCache SPDX license update 2026-07-22 18:09:06 +02:00
FontAtlasDirtyRect SPDX license update 2026-07-22 18:09:06 +02:00
FrameLoopSync SPDX license update 2026-07-22 18:09:06 +02:00
HeapASRead feat(device): applications ask for the device features their shaders use 2026-10-31 06:40:02 +01:00
HeapDynamicIndexHit feat(device): applications ask for the device features their shaders use 2026-10-31 06:40:02 +01:00
HeapSlotReuse feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
ImageStagingRelease feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
InputFieldCaretCache SPDX license update 2026-07-22 18:09:06 +02:00
InputFieldHitTest SPDX license update 2026-07-22 18:09:06 +02:00
MemoryTypeFallback SPDX license update 2026-07-22 18:09:06 +02:00
MeshDecompressStagingRelease feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
MeshLifetime feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
MipChainBarrierBatch SPDX license update 2026-07-22 18:09:06 +02:00
MipChainNonSquare feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
MouseScroll SPDX license update 2026-07-22 18:09:06 +02:00
PipelineCacheValidation SPDX license update 2026-07-22 18:09:06 +02:00
PipelineLifetime feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
PointerEnterLeave fix(win32): restore mouse moves, add enter and leave, capture drags, and close and destroy windows cleanly 2026-10-31 03:29:50 +01:00
PointerWin32 fix(win32): restore mouse moves, add enter and leave, capture drags, and close and destroy windows cleanly 2026-10-31 03:29:50 +01:00
PushConstantRewrite feat(device): applications ask for the device features their shaders use 2026-10-31 06:40:02 +01:00
RTPassPushData feat(device): applications ask for the device features their shaders use 2026-10-31 06:40:02 +01:00
SetupCmdBufferReuse SPDX license update 2026-07-22 18:09:06 +02:00
ShapeTextCache SPDX license update 2026-07-22 18:09:06 +02:00
SwapchainBarrierScope feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
SwapchainTransferDst feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
TLASBuildBarrier fix(rt): rebuild TLASes in place, after earlier traces, and queue their handles like a Mesh's 2026-10-31 02:32:48 +01:00
TLASEmptyBuild test(rt): an empty scene's TLAS builds, then grows and shrinks 2026-10-19 03:03:16 +02:00
TLASHighWaterMark fix(rt): rebuild TLASes in place, after earlier traces, and queue their handles like a Mesh's 2026-10-31 02:32:48 +01:00
TLASInstanceDirtyTracking fix(rt): never destroy the static TLASes 2026-10-19 03:03:16 +02:00
TLASLifetime fix(rt): rebuild TLASes in place, after earlier traces, and queue their handles like a Mesh's 2026-10-31 02:32:48 +01:00
UIClipFlag SPDX license update 2026-07-22 18:09:06 +02:00
UIFallbackParity feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
UIFusedShader test(ui): the descriptor-set fallback draws the same frame as the heap 2026-10-06 17:28:46 +02:00
UploadInFlight feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
UploadStrategy SPDX license update 2026-07-22 18:09:06 +02:00
VulkanBufferAddress feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
VulkanBufferFlushGate SPDX license update 2026-07-22 18:09:06 +02:00
VulkanBufferRangedFlush SPDX license update 2026-07-22 18:09:06 +02:00
VulkanBufferResizeReuse SPDX license update 2026-07-22 18:09:06 +02:00
VulkanShaderLifetime feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00
WindowOptionalGlobals fix(wayland): open windows on compositors without xdg-decoration, viewporter or fractional scale 2026-10-31 09:59:13 +01:00
WindowUpdateClock feat: windows on their own clock, deferred deletion for every handle owner, staged re-uploads, and RTPass push data 2026-10-20 20:20:29 +02:00