diff options
| author | Jolymmiles <75259437+Jolymmiles@users.noreply.github.com> | 2026-11-22 20:01:37 +0400 |
|---|---|---|
| committer | Jolymmiles <75259437+Jolymmiles@users.noreply.github.com> | 2026-11-22 20:01:37 +0400 |
| commit | 4f574add4bfedc05c1e6451917aaa529b2c96551 (patch) | |
| tree | bf1a5eb9e2bbbef2afc0469060c0b7eff9fd0e42 /runtime/src | |
| parent | 4eb6155d3ac4f9d3fadb0d095c4ce13e76783615 (diff) | |
d3d12_descriptor_test: the bindless capacity check follows the set's room
On MoltenVK (1.4.2, 1.4.3) the check sampled zeros: vkGetDescriptorSetLayoutSupport there accepts only layouts
of fewer than maxPerSetDescriptors (1212) descriptors, so size_bindings keeps the default 4096 2D images and
1024 samplers, and the test's 5001st view and 2100th sampler were refused as the arrays filled. MoltenVK does
create and sample a 65536-image, 4096-sampler set correctly (a native reproduction, and the whole test passes
under Wine with growth forced), so that is MoltenVK's to fix; the runtime keeps following the driver's answer.
The test now asks the set how much room it has (rt::d3d12::bindless_room, from BindlessSet::free_images and
free_samplers). Where the set holds the full counts nothing changes. Where it holds fewer, the test fills each
short array to its last index, checks the last view through the last sampler gives the texture, and that one
more view and sampler are refused and read as the fallbacks. The device logs at startup when its set holds
fewer samplers than a full shader-visible sampler heap. bindless_sizing_test gets MoltenVK's limits;
vk_bindless_test checks the free counts.
Diffstat (limited to 'runtime/src')
| -rw-r--r-- | runtime/src/vulkan_bindless.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/src/vulkan_bindless.h b/runtime/src/vulkan_bindless.h index 5f484bf16..d8a4c9846 100644 --- a/runtime/src/vulkan_bindless.h +++ b/runtime/src/vulkan_bindless.h | |||
| @@ -345,6 +345,14 @@ public: | |||
| 345 | return bindless::multisampled(dimension) ? 0 : features_.counts[bindless::storage_binding(dimension, 0)]; | 345 | return bindless::multisampled(dimension) ? 0 : features_.counts[bindless::storage_binding(dimension, 0)]; |
| 346 | } | 346 | } |
| 347 | std::uint32_t sampler_capacity() const { return features_.counts[bindless::sampler_binding]; } | 347 | std::uint32_t sampler_capacity() const { return features_.counts[bindless::sampler_binding]; } |
| 348 | // How many more images of a dimension, or samplers, add_image and add_sampler can take before they return 0. | ||
| 349 | std::uint32_t free_images(ImageDimension dimension) const { | ||
| 350 | const auto& used = image_used_[std::uint32_t(dimension)]; | ||
| 351 | return std::uint32_t(std::count(used.begin(), used.end(), std::uint8_t(0))); | ||
| 352 | } | ||
| 353 | std::uint32_t free_samplers() const { | ||
| 354 | return std::uint32_t(std::count(sampler_used_.begin(), sampler_used_.end(), std::uint8_t(0))); | ||
| 355 | } | ||
| 348 | // Set 0 of every pipeline layout made for translated shaders. | 356 | // Set 0 of every pipeline layout made for translated shaders. |
| 349 | VkDescriptorSetLayout layout() const { return layout_; } | 357 | VkDescriptorSetLayout layout() const { return layout_; } |
| 350 | // Bound at set 0. The same set for the life of this object: flush() updates it in place. | 358 | // Bound at set 0. The same set for the life of this object: flush() updates it in place. |