zink: use only ZINK_BIND_DESCRIPTOR

ZINK_BIND_RESOURCE_DESCRIPTOR and ZINK_BIND_SAMPLER_DESCRIPTOR are
always used together, so that we can replace these two values with
ZINK_BIND_DESCRIPTOR and use only one bit to represent the value.
With that we can also remove the aliasing of ZINK_BIND_DESCRIPTOR with
PIPE_BIND_CONST_BW.

Fixes:  13c6ad0038
    zink: use a single descriptor buffer for all non-bindless types

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28016>
This commit is contained in:
Gert Wollny 2024-02-29 13:02:14 +01:00 committed by Marge Bot
parent 1bcb7f1eb8
commit 8e239dda41
3 changed files with 5 additions and 9 deletions

View File

@ -1588,7 +1588,7 @@ zink_batch_descriptor_init(struct zink_screen *screen, struct zink_batch_state *
}
if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_DB && !(bs->ctx->flags & ZINK_CONTEXT_COPY_ONLY)) {
unsigned bind = ZINK_BIND_RESOURCE_DESCRIPTOR | ZINK_BIND_SAMPLER_DESCRIPTOR;
unsigned bind = ZINK_BIND_DESCRIPTOR;
struct pipe_resource *pres = pipe_buffer_create(&screen->base, bind, 0, bs->ctx->dd.db.max_db_size * screen->base_descriptor_size);
if (!pres)
return false;
@ -1730,7 +1730,7 @@ zink_descriptors_init_bindless(struct zink_context *ctx)
ctx->dd.bindless_init = true;
if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_DB) {
unsigned bind = ZINK_BIND_RESOURCE_DESCRIPTOR | ZINK_BIND_SAMPLER_DESCRIPTOR;
unsigned bind = ZINK_BIND_DESCRIPTOR;
VkDeviceSize size;
VKSCR(GetDescriptorSetLayoutSizeEXT)(screen->dev, screen->bindless_layout, &size);
struct pipe_resource *pres = pipe_buffer_create(&screen->base, bind, 0, size);

View File

@ -282,10 +282,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.usage = 0;
if (bind & ZINK_BIND_SAMPLER_DESCRIPTOR)
bci.usage |= VK_BUFFER_USAGE_SAMPLER_DESCRIPTOR_BUFFER_BIT_EXT;
if (bind & ZINK_BIND_RESOURCE_DESCRIPTOR)
bci.usage |= VK_BUFFER_USAGE_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT;
bci.usage |= VK_BUFFER_USAGE_SAMPLER_DESCRIPTOR_BUFFER_BIT_EXT |
VK_BUFFER_USAGE_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT;
} else {
bci.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT |
VK_BUFFER_USAGE_TRANSFER_DST_BIT |

View File

@ -27,9 +27,7 @@
#include "zink_types.h"
#define ZINK_MAP_TEMPORARY (PIPE_MAP_DRV_PRV << 0)
#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)
#define ZINK_BIND_DESCRIPTOR (1u << 27)
#define ZINK_BIND_MUTABLE (1u << 28)
#define ZINK_BIND_DMABUF (1u << 29)
#define ZINK_BIND_TRANSIENT (1u << 30) //transient fb attachment