A translated shader can export NaN in alpha while RGB matches the reference. The previous maximum-error calculation discarded that channel and reported the entire frame as correct.
A far-slot read alone cannot detect a stale descriptor after removal or a rewrite of the adjacent live view. Read the fallback, the replacement and its neighbour through the translated texture shader.
Set 0's 2D, sampler and storage arrays were constexpr (4096 2D images, 1024
samplers, 256 per storage array): one full D3D12 sampler heap (2048) did
not fit and bind_image/bind_sampler fell back. They are now sized once, when
the device creates the set, from the update-after-bind or plain limits:
today's sizes as the floor, then samplers up to min(4096,
maxSamplerAllocationCount - 64), 2D images up to 65536, storage up to 4096.
Sizing at creation keeps the set layout fixed for the pipelines built on it.
Both harnesses create a pipeline layout with the 144-byte translated
user-data block and never checked maxPushConstantsSize, so on a
128-byte device (Intel Arc, some AMD drivers) they failed validation
instead of skipping, although every pixel was exact. Each now prints
"unsupported: need 144 push constant bytes, device has N" and exits
77 before creating anything, as vk_texture_test does since 0c84bff;
the range uses the same constant.
run_gpu_tests.py already reported ps_tex's 77 as SKIP; image_fuzz.py
skipped it with a fixed message and now quotes the harness's
unsupported line. CPU tests cover both runners' 77 path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the Compatibility Pack installed, Windows enumerates Mesa's D3D12
translation layer next to the real GPU, and Dozen reports DISCRETE_GPU. Every
harness used "the last discrete device wins", so it selected the wrapper and
the resulting failures looked like translator bugs (#915). One shared rank now
treats Microsoft's vendor as a translation layer, then prefers discrete over
integrated over virtual over CPU, keeping the first device on a tie. A CPU-only
test covers the reported enumeration without needing the Compatibility Pack.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
AI-assisted. Set 0 binding 2 is the table every T#/S# lookup probes.
BindlessSet allocated it HOST_VISIBLE | HOST_COHERENT and flush() memcpy'd into
the mapping, so a divergent lookup read it over PCIe: 19.5x slower for T#+S#
pairs and 46.2x for a divergent miss at 100k entries on an RTX 2060 SUPER
(vk_descriptor_bench, #639; 58-796x on the 5080).
The table now lives in DEVICE_LOCAL (HOST_VISIBLE kept as a fallback for a device
without it). flush() takes the command buffer that will use the set and uploads
only what changed: the whole table from a mapped staging buffer when the buffers
were just created (first use or growth), and the changed slots with
vkCmdUpdateBuffer otherwise, which copies the data into the command buffer while
recording so no staging bytes are read at execution. A TRANSFER_WRITE ->
SHADER_READ barrier follows, before the draws. DescriptorTable tracks the slots
that insert, replace, erase, clear and grow touched, including both slots of a
relocation, so a flush no longer rebuilds an 80 MiB table for one descriptor.
A command buffer whose vkQueueSubmit is rejected never runs the upload, so the
set keeps the obligation: VulkanQueue::execute reports the submit result through
a commit callback, and the set rebuilds the table on the next flush, which also
reports flush_needs_idle() and makes the device wait before it. The same wait now
honours the pre-existing contract for replaced/erased entries and for growth
(the device ignored flush_needs_idle() before), and frees the retired buffers
once the queue is idle instead of at teardown.
Verified on an NVIDIA RTX 2060 SUPER, Linux 620.73.04, Vulkan 1.4.357:
- ctest 10/10, including descriptor_table cases for the change list, relocation
marking and consume-once reads.
- vk_bindless_test with LEONIDA_VK_VALIDATION=1: 14 draws (probe depth, erase,
relocation, growth 64 -> 512 slots, rebind, failed-submit retry, other view,
removal) read back exact, table in device-local memory in both
descriptor-indexing configurations. With the retry disabled the test is red.
- GPU suite 64/91 with the same 27 64-wide skips as main, 0 failures; 91/91 with
LEONIDA_W64_EMULATE=1.
No game data; synthetic fixtures only.
Set 0 as the translator declares it (docs/design.md, docs/d3d12_vulkan.md
section 5), in runtime/src/vulkan_bindless.h: the twenty bindings with the
array sizes vk_pipeline_check uses, and DescriptorTable (descriptor_table.h)
behind binding 2.
- An image has one index in its dimension (2D, 2D array, 3D, 1D), the same
in every binding of that dimension. The storage arrays hold 256, so an
image with a storage view gets an index below 256 and a read-only one
goes above while there is room.
- Index 0 of every array is a fallback (a 1x1 image of zeros, a nearest
clamping sampler), because a miss in the table is index 0.
- Changes are queued and written by flush(), one write a slot: a view
removed before the next flush is never written, so it may be destroyed
at once.
- insert_key / erase_key change the table; flush() copies it to the buffer,
into a new and larger one when it has grown. Erasing compacts a probe
cluster, which moves other keys' entries, and a new buffer rewrites
binding 2: flush_needs_idle() says when a flush would do either, so the
owner can make sure no command buffer that uses the set is still running.
- With update after bind the set may be flushed between submissions; with
partially bound only index 0 is written at creation.
Test: vk_bindless_test, run by runtime/test/shaders/check.py and
scripts/run_gpu_tests.py. ps_tex.asm, a hand-written RDNA2 pixel shader
built by build.py, loads a T# and an S# from a descriptor table and
samples: the translator's own lookup against the table and the set. It
draws the gradient with the T# at the fourth slot probed, the fallback
after the key is erased, the gradient after the table has grown into a new
buffer, another view at the same index and the fallback after removal,
with and without the descriptor-indexing flags; and it adds, removes and
destroys a view before its first flush, which the validation layer reports
if the write is still made.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>