Mesa (main): zink: add screen-based indexing to descriptor sets

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed May 25 04:15:05 UTC 2022


Module: Mesa
Branch: main
Commit: f7eb871efa90182128cc566717993d60588ac6ea
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f7eb871efa90182128cc566717993d60588ac6ea

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon May 16 16:54:47 2022 -0400

zink: add screen-based indexing to descriptor sets

this allows indirection for internal descriptor type -> vk descriptor set
and enables more easily altering the descriptor set index at runtime

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16645>

---

 src/gallium/drivers/zink/zink_screen.c | 7 +++++++
 src/gallium/drivers/zink/zink_screen.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index c40dcd14112..494321c3d27 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -2180,6 +2180,13 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
 
    zink_verify_device_extensions(screen);
 
+   screen->desc_set_id[ZINK_DESCRIPTOR_TYPES] = 0;
+   screen->desc_set_id[ZINK_DESCRIPTOR_TYPE_UBO] = 1;
+   screen->desc_set_id[ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW] = 2;
+   screen->desc_set_id[ZINK_DESCRIPTOR_TYPE_SSBO] = 3;
+   screen->desc_set_id[ZINK_DESCRIPTOR_TYPE_IMAGE] = 4;
+   screen->desc_set_id[ZINK_DESCRIPTOR_BINDLESS] = 5;
+
    if (screen->info.have_EXT_calibrated_timestamps && !check_have_device_time(screen))
       goto fail;
 
diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h
index f1c7f308e6e..a39b5f35e4b 100644
--- a/src/gallium/drivers/zink/zink_screen.h
+++ b/src/gallium/drivers/zink/zink_screen.h
@@ -164,6 +164,7 @@ struct zink_screen {
 
    struct vk_dispatch_table vk;
 
+   uint8_t desc_set_id[ZINK_MAX_DESCRIPTOR_SETS];
    bool (*descriptor_program_init)(struct zink_context *ctx, struct zink_program *pg);
    void (*descriptor_program_deinit)(struct zink_context *ctx, struct zink_program *pg);
    void (*descriptors_update)(struct zink_context *ctx, bool is_compute);



More information about the mesa-commit mailing list