mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 12:28:38 +00:00
World runs fill one bindless image array a few minutes in: `a bindless image array is full; dimension 3: 4096
indices, 4092 T#s of 4090 textures`. Dimension 3 is 1D (ImageDimension: 2D, 2D array, 3D, 1D). From then on every
new 1D T# reads the fallback's zeros, and the console heaps count it as "no view for the T#'s format or range",
which went from 2-28 a window to over 4000.
Nothing leaks: the 4096 indices are the fallback, 4092 entries of image_entries and 3 replaced views, every one
held by a texture the runtime still has registered, and a texture's indices go back when it goes (forget_image,
the deferred bindless_slot release, remove_image). The cause is the size: size_bindings grew 2D images to 65536
but 3D and 1D only to 4096 and 2D arrays to 16384, constants that guessed how many textures of each dimension a
title keeps, whatever the device holds (RADV allows 8388606 sampled images, llvmpipe 1015808).
- vulkan_bindless.h: one maximum (max_images, 65536) for the sampled array of every single-sample dimension, in
place of max_2d_images, max_2d_array_images, max_3d_images and max_1d_images. The 2D-array, 3D and 1D arrays
grow together after 2D and the storage arrays, so on a device whose limits stop growth earlier none of them is
favoured. The bound is memory (each generation's pool holds every element): 325729 descriptors on an RTX 5070,
10-20 MiB at 32-64 bytes a descriptor. The shaders declare runtime arrays, so no shader changes; the set layout
changes, so compute pipelines get new journal names (hash_bindless_layout) and the pipeline cache is rebuilt.
- BindlessSet::image_refusal says why add_image returned 0: no array for the dimension, the array is full, or only
its shorter storage range is.
- d3d12_vulkan_device.cpp: bind_image_locked and bind_image_views_locked report that reason; bind_title_image
counts it ("the bindless array of the T#'s dimension is full", or "the bindless storage arrays of the T#'s
dimension are full") instead of "no view for the T#'s format or range". The once-per-dimension line names the
dimension, the storage range and how many of the textures holding indices are still registered at their address.
- docs/d3d12_vulkan.md: the sizes, and the new reason.
Tests: bindless_sizing_test checks RADV's and llvmpipe's limits (every sampled dimension at 65536; on main 1D and 3D
stop at 4096) and that the three dimensions share a short budget alike. vk_bindless_dimensions_test (new, GLSL
shader) sizes a set from the device, gives 5000 live 1D, 2D-array and 3D images an index each and reads every one
through its index, then fills the rest of the array: the next is refused as full, and removed indices come back at
once or, after an erased key, at the next flush. On main it fails at "1D: 4096 indices in the set".
vk_bindless_test's index-space case filled 1D expecting the first index to be 1, which held only while the 1D
array was as short as its storage arrays; it now checks every index once and that indices above the storage arrays
go first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.5 KiB
Plaintext
31 lines
1.5 KiB
Plaintext
#version 460
|
|
// Reads one texel of each of many images through the bindless set 0 (src/vulkan_bindless.h), for
|
|
// vk_bindless_dimensions_test: thread i reads the image at index indices[i] of the sampled array of one dimension
|
|
// (pc.dimension: 0 1D, 1 2D array, 2 3D; bindings 5, 3 and 6, as tools/rdna2spirv.py declares them) and writes the
|
|
// texel's red channel, as bits, to result[i]. One thread per workgroup, so each index is dynamically uniform and
|
|
// the test needs no non-uniform indexing feature.
|
|
#extension GL_EXT_nonuniform_qualifier : require
|
|
#extension GL_EXT_samplerless_texture_functions : require
|
|
|
|
layout(local_size_x = 1) in; // one image per workgroup: the index is uniform there
|
|
|
|
layout(push_constant) uniform Pass { uint dimension; uint count; } pc;
|
|
|
|
layout(set = 0, binding = 3) uniform texture2DArray layers[];
|
|
layout(set = 0, binding = 5) uniform texture1D lines[];
|
|
layout(set = 0, binding = 6) uniform texture3D volumes[];
|
|
|
|
layout(set = 1, binding = 0, std430) writeonly buffer Result { uint result[]; };
|
|
layout(set = 1, binding = 1, std430) readonly buffer Indices { uint indices[]; };
|
|
|
|
void main() {
|
|
const uint i = gl_GlobalInvocationID.x;
|
|
if (i >= pc.count) return;
|
|
const uint index = indices[i];
|
|
float red;
|
|
if (pc.dimension == 0) red = texelFetch(lines[index], 0, 0).r;
|
|
else if (pc.dimension == 1) red = texelFetch(layers[index], ivec3(0), 0).r;
|
|
else red = texelFetch(volumes[index], ivec3(0), 0).r;
|
|
result[i] = floatBitsToUint(red);
|
|
}
|