set_foreach(shader->programs, entry) {
if (shader->nir->info.stage == MESA_SHADER_COMPUTE) {
struct zink_compute_program *comp = (void*)entry->key;
- _mesa_hash_table_remove_key(ctx->compute_program_cache, comp->shader);
+ _mesa_hash_table_remove_key(&ctx->compute_program_cache, comp->shader);
comp->shader = NULL;
zink_compute_program_reference(screen, &comp, NULL);
} else {
enum pipe_shader_type pstage = pipe_shader_type_from_mesa(shader->nir->info.stage);
assert(pstage < ZINK_SHADER_COUNT);
if (shader->nir->info.stage != MESA_SHADER_TESS_CTRL || !shader->is_generated)
- _mesa_hash_table_remove_key(ctx->program_cache, prog->shaders);
+ _mesa_hash_table_remove_key(&ctx->program_cache, prog->shaders);
prog->shaders[pstage] = NULL;
if (shader->nir->info.stage == MESA_SHADER_TESS_EVAL && shader->generated)
/* automatically destroy generated tcs shaders when tes is destroyed */
u_upload_destroy(pctx->stream_uploader);
u_upload_destroy(pctx->const_uploader);
slab_destroy_child(&ctx->transfer_pool);
- _mesa_hash_table_destroy(ctx->program_cache, NULL);
- _mesa_hash_table_destroy(ctx->compute_program_cache, NULL);
+ _mesa_hash_table_clear(&ctx->program_cache, NULL);
+ _mesa_hash_table_clear(&ctx->compute_program_cache, NULL);
_mesa_hash_table_destroy(ctx->render_pass_cache, NULL);
slab_destroy_child(&ctx->transfer_pool_unsync);
if (!ctx->blitter)
goto fail;
- ctx->program_cache = _mesa_hash_table_create(NULL,
- hash_gfx_program,
- equals_gfx_program);
- ctx->compute_program_cache = _mesa_hash_table_create(NULL,
- _mesa_hash_pointer,
- _mesa_key_pointer_equal);
+ _mesa_hash_table_init(&ctx->program_cache, ctx, hash_gfx_program, equals_gfx_program);
+ _mesa_hash_table_init(&ctx->compute_program_cache, ctx, _mesa_hash_pointer, _mesa_key_pointer_equal);
ctx->render_pass_cache = _mesa_hash_table_create(NULL,
hash_render_pass_state,
equals_render_pass_state);
- if (!ctx->program_cache || !ctx->compute_program_cache || !ctx->render_pass_cache)
+ if (!ctx->render_pass_cache)
goto fail;
const uint8_t data[] = {0};
bool shader_reads_basevertex;
struct zink_gfx_pipeline_state gfx_pipeline_state;
enum pipe_prim_type gfx_prim_mode;
- struct hash_table *program_cache;
+ struct hash_table program_cache;
struct zink_gfx_program *curr_program;
struct zink_descriptor_data *dd;
struct zink_shader *compute_stage;
struct zink_compute_pipeline_state compute_pipeline_state;
- struct hash_table *compute_program_cache;
+ struct hash_table compute_program_cache;
struct zink_compute_program *curr_compute;
unsigned dirty_shader_stages : 6; /* mask of changed shader stages */
const unsigned bits = 1 << PIPE_SHADER_COMPUTE;
if (ctx->dirty_shader_stages & bits) {
struct zink_compute_program *comp = zink_create_compute_program(ctx, ctx->compute_stage);
- _mesa_hash_table_insert(ctx->compute_program_cache, comp->shader, comp);
+ _mesa_hash_table_insert(&ctx->compute_program_cache, comp->shader, comp);
ctx->compute_pipeline_state.dirty = true;
ctx->curr_compute = comp;
ctx->dirty_shader_stages &= bits;
unsigned bits = u_bit_consecutive(PIPE_SHADER_VERTEX, 5);
if (ctx->dirty_shader_stages & bits) {
struct zink_gfx_program *prog = NULL;
- struct hash_entry *entry = _mesa_hash_table_search(ctx->program_cache,
+ struct hash_entry *entry = _mesa_hash_table_search(&ctx->program_cache,
ctx->gfx_stages);
if (entry)
zink_update_gfx_program(ctx, (struct zink_gfx_program*)entry->data);
else {
prog = zink_create_gfx_program(ctx, ctx->gfx_stages);
- entry = _mesa_hash_table_insert(ctx->program_cache, prog->shaders, prog);
+ entry = _mesa_hash_table_insert(&ctx->program_cache, prog->shaders, prog);
}
prog = (struct zink_gfx_program*)(entry ? entry->data : NULL);
if (prog && prog != ctx->curr_program) {
{
if (stage == PIPE_SHADER_COMPUTE) {
if (shader && shader != ctx->compute_stage) {
- struct hash_entry *entry = _mesa_hash_table_search(ctx->compute_program_cache, shader);
+ struct hash_entry *entry = _mesa_hash_table_search(&ctx->compute_program_cache, shader);
if (entry) {
ctx->compute_pipeline_state.dirty = true;
ctx->curr_compute = entry->data;
/* the shader cache stores a mapping of zink_shader_key::VkShaderModule */
struct hash_table shader_cache[ZINK_SHADER_COUNT];
+
+ bool removed;
};
struct zink_gfx_program {