}
void
-zink_shader_free(struct zink_screen *screen, struct zink_shader *shader)
+zink_shader_free(struct zink_context *ctx, struct zink_shader *shader)
{
+ struct zink_screen *screen = zink_screen(ctx->base.screen);
vkDestroyShaderModule(screen->dev, shader->shader_module, NULL);
set_foreach(shader->programs, entry) {
- zink_gfx_program_remove_shader((void*)entry->key, shader);
+ struct zink_gfx_program *prog = (void*)entry->key;
+ _mesa_hash_table_remove_key(ctx->program_cache, prog->stages);
+ zink_destroy_gfx_program(screen, prog);
}
_mesa_set_destroy(shader->programs, NULL);
FREE(shader);
#include <vulkan/vulkan.h>
struct pipe_screen;
+struct zink_context;
struct zink_screen;
struct zink_gfx_program;
const struct pipe_stream_output_info *so_info);
void
-zink_shader_free(struct zink_screen *screen, struct zink_shader *shader);
+zink_shader_free(struct zink_context *ctx, struct zink_shader *shader);
#endif
zink_delete_vs_state(struct pipe_context *pctx,
void *cso)
{
- zink_shader_free(zink_screen(pctx->screen), cso);
+ zink_shader_free(zink_context(pctx), cso);
}
static void *
zink_delete_fs_state(struct pipe_context *pctx,
void *cso)
{
- zink_shader_free(zink_screen(pctx->screen), cso);
+ zink_shader_free(zink_context(pctx), cso);
}
static void
ctx->gfx_stages);
if (!entry) {
struct zink_gfx_program *prog;
- prog = zink_create_gfx_program(zink_screen(ctx->base.screen),
- ctx->gfx_stages);
+ prog = zink_create_gfx_program(ctx, ctx->gfx_stages);
entry = _mesa_hash_table_insert(ctx->program_cache, prog->stages, prog);
if (!entry)
return NULL;
}
struct zink_gfx_program *
-zink_create_gfx_program(struct zink_screen *screen,
+zink_create_gfx_program(struct zink_context *ctx,
struct zink_shader *stages[PIPE_SHADER_TYPES - 1])
{
+ struct zink_screen *screen = zink_screen(ctx->base.screen);
struct zink_gfx_program *prog = CALLOC_STRUCT(zink_gfx_program);
if (!prog)
goto fail;
return NULL;
}
-void
-zink_gfx_program_remove_shader(struct zink_gfx_program *prog, struct zink_shader *shader)
+static void
+gfx_program_remove_shader(struct zink_gfx_program *prog, struct zink_shader *shader)
{
enum pipe_shader_type p_stage = pipe_shader_type_from_mesa(shader->info.stage);
for (int i = 0; i < PIPE_SHADER_TYPES - 1; ++i) {
if (prog->stages[i])
- zink_gfx_program_remove_shader(prog, prog->stages[i]);
+ gfx_program_remove_shader(prog, prog->stages[i]);
}
/* unref all used render-passes */
#include "pipe/p_state.h"
+struct zink_context;
struct zink_screen;
struct zink_shader;
struct zink_gfx_pipeline_state;
};
struct zink_gfx_program *
-zink_create_gfx_program(struct zink_screen *screen,
+zink_create_gfx_program(struct zink_context *ctx,
struct zink_shader *stages[PIPE_SHADER_TYPES - 1]);
void
struct zink_gfx_pipeline_state *state,
enum pipe_prim_type mode);
-void
-zink_gfx_program_remove_shader(struct zink_gfx_program *prog, struct zink_shader *shader);
-
#endif