zink: pass screen instead of device to program-functions
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Thu, 20 Jun 2019 13:20:52 +0000 (15:20 +0200)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 28 Oct 2019 08:51:45 +0000 (08:51 +0000)
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
src/gallium/drivers/zink/zink_context.c
src/gallium/drivers/zink/zink_program.c
src/gallium/drivers/zink/zink_program.h

index b649137b2e616ebe11bf8e66e7b649ca43a86c4b..6c8b0bb641de35b74a70d8c74ebd13d13aca89a9 100644 (file)
@@ -881,7 +881,7 @@ get_gfx_program(struct zink_context *ctx)
                                                          ctx->gfx_stages);
       if (!entry) {
          struct zink_gfx_program *prog;
-         prog = zink_create_gfx_program(zink_screen(ctx->base.screen)->dev,
+         prog = zink_create_gfx_program(zink_screen(ctx->base.screen),
                                                      ctx->gfx_stages);
          entry = _mesa_hash_table_insert(ctx->program_cache, prog->stages, prog);
          if (!entry)
@@ -917,7 +917,7 @@ zink_draw_vbo(struct pipe_context *pctx,
    if (!gfx_program)
       return;
 
-   VkPipeline pipeline = zink_get_gfx_pipeline(screen->dev, gfx_program,
+   VkPipeline pipeline = zink_get_gfx_pipeline(screen, gfx_program,
                                                &ctx->gfx_pipeline_state,
                                                dinfo->mode);
 
index 9398fa2d03fd65e39de349d23b60660a30668eb1..9c1b4876abe732a7308c4912d0d76f3bb971dd60 100644 (file)
@@ -104,7 +104,7 @@ equals_gfx_pipeline_state(const void *a, const void *b)
 }
 
 struct zink_gfx_program *
-zink_create_gfx_program(VkDevice dev,
+zink_create_gfx_program(struct zink_screen *screen,
                         struct zink_shader *stages[PIPE_SHADER_TYPES - 1])
 {
    struct zink_gfx_program *prog = CALLOC_STRUCT(zink_gfx_program);
@@ -122,11 +122,11 @@ zink_create_gfx_program(VkDevice dev,
    for (int i = 0; i < PIPE_SHADER_TYPES - 1; ++i)
       prog->stages[i] = stages[i];
 
-   prog->dsl = create_desc_set_layout(dev, stages);
+   prog->dsl = create_desc_set_layout(screen->dev, stages);
    if (!prog->dsl)
       goto fail;
 
-   prog->layout = create_pipeline_layout(dev, prog->dsl);
+   prog->layout = create_pipeline_layout(screen->dev, prog->dsl);
    if (!prog->layout)
       goto fail;
 
@@ -134,18 +134,19 @@ zink_create_gfx_program(VkDevice dev,
 
 fail:
    if (prog)
-      zink_destroy_gfx_program(dev, prog);
+      zink_destroy_gfx_program(screen, prog);
    return NULL;
 }
 
 void
-zink_destroy_gfx_program(VkDevice dev, struct zink_gfx_program *prog)
+zink_destroy_gfx_program(struct zink_screen *screen,
+                         struct zink_gfx_program *prog)
 {
    if (prog->layout)
-      vkDestroyPipelineLayout(dev, prog->layout, NULL);
+      vkDestroyPipelineLayout(screen->dev, prog->layout, NULL);
 
    if (prog->dsl)
-      vkDestroyDescriptorSetLayout(dev, prog->dsl, NULL);
+      vkDestroyDescriptorSetLayout(screen->dev, prog->dsl, NULL);
 
    FREE(prog);
 }
@@ -183,7 +184,8 @@ primitive_topology(enum pipe_prim_type mode)
 }
 
 VkPipeline
-zink_get_gfx_pipeline(VkDevice dev, struct zink_gfx_program *prog,
+zink_get_gfx_pipeline(struct zink_screen *screen,
+                      struct zink_gfx_program *prog,
                       struct zink_gfx_pipeline_state *state,
                       enum pipe_prim_type mode)
 {
@@ -194,7 +196,8 @@ zink_get_gfx_pipeline(VkDevice dev, struct zink_gfx_program *prog,
    struct hash_entry *entry = _mesa_hash_table_search(prog->pipelines[mode], state);
    if (!entry) {
       VkPrimitiveTopology vkmode = primitive_topology(mode);
-      VkPipeline pipeline = zink_create_gfx_pipeline(dev, prog, state, vkmode);
+      VkPipeline pipeline = zink_create_gfx_pipeline(screen->dev, prog,
+                                                     state, vkmode);
       if (pipeline == VK_NULL_HANDLE)
          return VK_NULL_HANDLE;
 
index d4357fc9debbed971051ce14fa68558aacbf3f19..ca989f9c4bd276116933d30766f45f3ba56f98f8 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "pipe/p_state.h"
 
-struct zink_context;
+struct zink_screen;
 struct zink_shader;
 struct zink_gfx_pipeline_state;
 
@@ -40,14 +40,16 @@ struct zink_gfx_program {
 };
 
 struct zink_gfx_program *
-zink_create_gfx_program(VkDevice dev,
+zink_create_gfx_program(struct zink_screen *screen,
                         struct zink_shader *stages[PIPE_SHADER_TYPES - 1]);
 
 void
-zink_destroy_gfx_program(VkDevice dev, struct zink_gfx_program *);
+zink_destroy_gfx_program(struct zink_screen *screen,
+                         struct zink_gfx_program *prog);
 
 VkPipeline
-zink_get_gfx_pipeline(VkDevice dev, struct zink_gfx_program *prog,
+zink_get_gfx_pipeline(struct zink_screen *screen,
+                      struct zink_gfx_program *prog,
                       struct zink_gfx_pipeline_state *state,
                       enum pipe_prim_type mode);