zink: avoid the descriptor set multiplier for bindless buffers

the bindless descriptor buffer is already correctly sized, so it needs
to avoid the huge set multiplier or it'll explode all available vram

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21216>
This commit is contained in:
Mike Blumenkrantz 2023-02-09 08:03:05 -05:00
parent f14571e393
commit 36595e94c7
3 changed files with 4 additions and 2 deletions

View file

@ -1489,7 +1489,7 @@ zink_descriptors_init_bindless(struct zink_context *ctx)
unsigned bind = ZINK_BIND_RESOURCE_DESCRIPTOR | ZINK_BIND_SAMPLER_DESCRIPTOR;
VkDeviceSize size;
VKSCR(GetDescriptorSetLayoutSizeEXT)(screen->dev, screen->bindless_layout, &size);
struct pipe_resource *pres = pipe_buffer_create(&screen->base, bind, 0, size);
struct pipe_resource *pres = pipe_buffer_create(&screen->base, bind, ZINK_USAGE_BINDLESS, size);
ctx->dd.db.bindless_db = zink_resource(pres);
ctx->dd.db.bindless_db_map = pipe_buffer_map(&ctx->base, pres, PIPE_MAP_READ | PIPE_MAP_WRITE, &ctx->dd.db.bindless_db_xfer);
zink_batch_bind_db(ctx);

View file

@ -180,7 +180,8 @@ create_bci(struct zink_screen *screen, const struct pipe_resource *templ, unsign
if (bind & ZINK_BIND_DESCRIPTOR) {
/* gallium sizes are all uint32_t, while the total size of this buffer may exceed that limit */
bci.size *= ZINK_DESCRIPTOR_BUFFER_MULTIPLIER;
if (templ->usage != ZINK_USAGE_BINDLESS)
bci.size *= ZINK_DESCRIPTOR_BUFFER_MULTIPLIER;
bci.usage = 0;
if (bind & ZINK_BIND_SAMPLER_DESCRIPTOR)
bci.usage |= VK_BUFFER_USAGE_SAMPLER_DESCRIPTOR_BUFFER_BIT_EXT;

View file

@ -27,6 +27,7 @@
#include "zink_types.h"
#define ZINK_MAP_TEMPORARY (PIPE_MAP_DRV_PRV << 0)
#define ZINK_USAGE_BINDLESS 128 //this is used for bindless descriptors
#define ZINK_BIND_SAMPLER_DESCRIPTOR (1u << 26)
#define ZINK_BIND_RESOURCE_DESCRIPTOR (1u << 27)
#define ZINK_BIND_DESCRIPTOR (ZINK_BIND_SAMPLER_DESCRIPTOR | ZINK_BIND_RESOURCE_DESCRIPTOR)