From 1927d11fc04856fa1bc1b92136a2fc6c42bcc72a Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 20 Jun 2019 15:20:52 +0200 Subject: zink: pass screen instead of device to program-functions Acked-by: Jordan Justen --- src/gallium/drivers/zink/zink_context.c | 4 ++-- src/gallium/drivers/zink/zink_program.c | 21 ++++++++++++--------- src/gallium/drivers/zink/zink_program.h | 10 ++++++---- 3 files changed, 20 insertions(+), 15 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index b649137b2e6..6c8b0bb641d 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -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); diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index 9398fa2d03f..9c1b4876abe 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -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; diff --git a/src/gallium/drivers/zink/zink_program.h b/src/gallium/drivers/zink/zink_program.h index d4357fc9deb..ca989f9c4bd 100644 --- a/src/gallium/drivers/zink/zink_program.h +++ b/src/gallium/drivers/zink/zink_program.h @@ -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); -- cgit v1.2.3