zink: add screen interfaces for pipeline barriers
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tue, 30 Aug 2022 15:20:04 +0000 (11:20 -0400)
committerMarge Bot <emma+marge@anholt.net>
Mon, 19 Sep 2022 01:42:28 +0000 (01:42 +0000)
this will enable direct calling of the right function without the overhead
of having conditionals in the barrier functions themselves

eventually, the '2' variants will be widely enough deployed that
this can be deleted

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

src/gallium/drivers/zink/zink_screen.c
src/gallium/drivers/zink/zink_types.h

index 014d716..f7a84f2 100644 (file)
@@ -2440,6 +2440,14 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
    screen->base.vertex_state_destroy = zink_cache_vertex_state_destroy;
    glsl_type_singleton_init_or_ref();
 
+   if (screen->info.have_vulkan13 || screen->info.have_KHR_synchronization2) {
+      screen->image_barrier = zink_resource_image_barrier2;
+      screen->buffer_barrier = zink_resource_buffer_barrier2;
+   } else {
+      screen->image_barrier = zink_resource_image_barrier;
+      screen->buffer_barrier = zink_resource_buffer_barrier;
+   }
+
    screen->copy_context = zink_context(screen->base.context_create(&screen->base, NULL, ZINK_CONTEXT_COPY_ONLY));
    if (!screen->copy_context) {
       mesa_loge("zink: failed to create copy context");
index 56022b6..aa0bea6 100644 (file)
@@ -1107,6 +1107,9 @@ struct zink_screen {
 
    struct vk_dispatch_table vk;
 
+   void (*buffer_barrier)(struct zink_context *ctx, struct zink_resource *res, VkAccessFlags flags, VkPipelineStageFlags pipeline);
+   void (*image_barrier)(struct zink_context *ctx, struct zink_resource *res, VkImageLayout new_layout, VkAccessFlags flags, VkPipelineStageFlags pipeline);
+
    bool compact_descriptors;
    uint8_t desc_set_id[ZINK_MAX_DESCRIPTOR_SETS];