iris: Add stage to iris_compiled_shader

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27646>
This commit is contained in:
Caio Oliveira
2024-02-06 11:04:25 -08:00
committed by Marge Bot
parent 8ae528331c
commit be13c3ef9f
3 changed files with 17 additions and 6 deletions
+3
View File
@@ -553,6 +553,8 @@ struct iris_compiled_shader {
struct iris_binding_table bt;
gl_shader_stage stage;
/**
* Shader packets and other data derived from prog_data. These must be
* completely determined from prog_data.
@@ -1141,6 +1143,7 @@ struct iris_compiled_shader *iris_find_cached_shader(struct iris_context *ice,
struct iris_compiled_shader *iris_create_shader_variant(const struct iris_screen *,
void *mem_ctx,
gl_shader_stage stage,
enum iris_program_cache_id cache_id,
uint32_t key_size,
const void *key);
+8 -4
View File
@@ -1225,8 +1225,10 @@ find_or_add_variant(const struct iris_screen *screen,
}
}
gl_shader_stage stage = ish->nir->info.stage;
if (variant == NULL) {
variant = iris_create_shader_variant(screen, NULL, cache_id,
variant = iris_create_shader_variant(screen, NULL, stage, cache_id,
key_size, key);
/* Append our new variant to the shader's variant list. */
@@ -1240,6 +1242,7 @@ find_or_add_variant(const struct iris_screen *screen,
util_queue_fence_wait(&variant->ready);
}
assert(stage == variant->stage);
return variant;
}
@@ -1589,6 +1592,7 @@ iris_update_compiled_tcs(struct iris_context *ice)
if (shader == NULL) {
shader = iris_create_shader_variant(screen, ice->shaders.cache,
MESA_SHADER_TESS_CTRL,
IRIS_CACHE_TCS, sizeof(key), &key);
added = true;
}
@@ -2502,8 +2506,8 @@ iris_create_compute_state(struct pipe_context *ctx,
struct iris_cs_prog_key key = { KEY_INIT(base) };
struct iris_compiled_shader *shader =
iris_create_shader_variant(screen, NULL, IRIS_CACHE_CS,
sizeof(key), &key);
iris_create_shader_variant(screen, NULL, MESA_SHADER_COMPUTE,
IRIS_CACHE_CS, sizeof(key), &key);
/* Append our new variant to the shader's variant list. */
list_addtail(&shader->link, &ish->variants);
@@ -2717,7 +2721,7 @@ iris_create_shader_state(struct pipe_context *ctx,
struct u_upload_mgr *uploader = ice->shaders.uploader_unsync;
struct iris_compiled_shader *shader =
iris_create_shader_variant(screen, NULL,
iris_create_shader_variant(screen, NULL, info->stage,
(enum iris_program_cache_id) info->stage,
key_size, &key);
@@ -108,6 +108,7 @@ iris_delete_shader_variant(struct iris_compiled_shader *shader)
struct iris_compiled_shader *
iris_create_shader_variant(const struct iris_screen *screen,
void *mem_ctx,
gl_shader_stage stage,
enum iris_program_cache_id cache_id,
uint32_t key_size,
const void *key)
@@ -141,6 +142,8 @@ iris_create_shader_variant(const struct iris_screen *screen,
memcpy(&shader->key, key, key_size);
}
shader->stage = stage;
return shader;
}
@@ -236,8 +239,8 @@ iris_blorp_upload_shader(struct blorp_batch *blorp_batch, uint32_t stage,
memset(&bt, 0, sizeof(bt));
struct iris_compiled_shader *shader =
iris_create_shader_variant(screen, ice->shaders.cache, IRIS_CACHE_BLORP,
key_size, key);
iris_create_shader_variant(screen, ice->shaders.cache, stage,
IRIS_CACHE_BLORP, key_size, key);
iris_finalize_program(shader, prog_data, NULL, NULL, 0, 0, 0, &bt);
@@ -413,6 +416,7 @@ iris_ensure_indirect_generation_shader(struct iris_batch *batch)
struct iris_compiled_shader *shader =
iris_create_shader_variant(screen, ice->shaders.cache,
MESA_SHADER_FRAGMENT,
IRIS_CACHE_BLORP,
sizeof(key), &key);
iris_finalize_program(shader, &prog_data->base, NULL, NULL, 0, 0, 0, &bt);