ttn: Add new allow_disk_cache parameter

For now this parameter doesn't do anything.
It means the implementation is allowed to use
a cache on disk.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4993>
This commit is contained in:
Axel Davy 2020-05-12 21:52:40 +02:00 committed by Marge Bot
parent 6670475a44
commit 522bd414f3
14 changed files with 21 additions and 17 deletions

View File

@ -2582,11 +2582,14 @@ ttn_finalize_nir(struct ttn_compile *c, struct pipe_screen *screen)
struct nir_shader *
tgsi_to_nir(const void *tgsi_tokens,
struct pipe_screen *screen)
struct pipe_screen *screen,
bool allow_disk_cache)
{
struct ttn_compile *c;
struct nir_shader *s;
(void)allow_disk_cache;
c = ttn_compile_init(tgsi_tokens, NULL, screen);
s = c->build.shader;
ttn_finalize_nir(c, screen);

View File

@ -29,7 +29,8 @@
struct nir_shader *
tgsi_to_nir(const void *tgsi_tokens,
struct pipe_screen *screen);
struct pipe_screen *screen,
bool allow_disk_cache);
struct nir_shader *
tgsi_to_nir_noscreen(const void *tgsi_tokens,

View File

@ -406,7 +406,7 @@ etna_create_shader_state(struct pipe_context *pctx,
if (DBG_ENABLED(ETNA_DBG_NIR))
shader->nir = (pss->type == PIPE_SHADER_IR_NIR) ? pss->ir.nir :
tgsi_to_nir(pss->tokens, pctx->screen);
tgsi_to_nir(pss->tokens, pctx->screen, false);
else
shader->tokens = tgsi_dup_tokens(pss->tokens);

View File

@ -98,7 +98,7 @@ fd2_fp_state_create(struct pipe_context *pctx,
return NULL;
so->nir = (cso->type == PIPE_SHADER_IR_NIR) ? cso->ir.nir :
tgsi_to_nir(cso->tokens, pctx->screen);
tgsi_to_nir(cso->tokens, pctx->screen, false);
NIR_PASS_V(so->nir, nir_lower_io, nir_var_all, ir2_glsl_type_size,
(nir_lower_io_options)0);
@ -135,7 +135,7 @@ fd2_vp_state_create(struct pipe_context *pctx,
return NULL;
so->nir = (cso->type == PIPE_SHADER_IR_NIR) ? cso->ir.nir :
tgsi_to_nir(cso->tokens, pctx->screen);
tgsi_to_nir(cso->tokens, pctx->screen, false);
NIR_PASS_V(so->nir, nir_lower_io, nir_var_all, ir2_glsl_type_size,
(nir_lower_io_options)0);

View File

@ -139,7 +139,7 @@ ir3_shader_create(struct ir3_compiler *compiler,
if (ir3_shader_debug & IR3_DBG_DISASM) {
tgsi_dump(cso->tokens, 0);
}
nir = tgsi_to_nir(cso->tokens, screen);
nir = tgsi_to_nir(cso->tokens, screen, false);
}
struct ir3_stream_output_info stream_output;
@ -208,7 +208,7 @@ ir3_shader_create_compute(struct ir3_compiler *compiler,
if (ir3_shader_debug & IR3_DBG_DISASM) {
tgsi_dump(cso->prog, 0);
}
nir = tgsi_to_nir(cso->prog, screen);
nir = tgsi_to_nir(cso->prog, screen, false);
}
struct ir3_shader *shader = ir3_shader_from_nir(compiler, nir, NULL);

View File

@ -2217,7 +2217,7 @@ iris_create_shader_state(struct pipe_context *ctx,
struct nir_shader *nir;
if (state->type == PIPE_SHADER_IR_TGSI)
nir = tgsi_to_nir(state->tokens, ctx->screen);
nir = tgsi_to_nir(state->tokens, ctx->screen, false);
else
nir = state->ir.nir;

View File

@ -298,7 +298,7 @@ lima_create_fs_state(struct pipe_context *pctx,
else {
assert(cso->type == PIPE_SHADER_IR_TGSI);
nir = tgsi_to_nir(cso->tokens, pctx->screen);
nir = tgsi_to_nir(cso->tokens, pctx->screen, false);
}
so->base.type = PIPE_SHADER_IR_NIR;
@ -454,7 +454,7 @@ lima_create_vs_state(struct pipe_context *pctx,
else {
assert(cso->type == PIPE_SHADER_IR_TGSI);
nir = tgsi_to_nir(cso->tokens, pctx->screen);
nir = tgsi_to_nir(cso->tokens, pctx->screen, false);
}
lima_program_optimize_vs_nir(nir);

View File

@ -132,7 +132,7 @@ panfrost_shader_compile(struct panfrost_context *ctx,
s = nir_shader_clone(NULL, ir);
} else {
assert (ir_type == PIPE_SHADER_IR_TGSI);
s = tgsi_to_nir(ir, ctx->base.screen);
s = tgsi_to_nir(ir, ctx->base.screen, false);
}
s->info.stage = stage;

View File

@ -217,7 +217,7 @@ static void *si_create_compute_state(struct pipe_context *ctx, const struct pipe
if (cso->ir_type != PIPE_SHADER_IR_NATIVE) {
if (cso->ir_type == PIPE_SHADER_IR_TGSI) {
program->ir_type = PIPE_SHADER_IR_NIR;
sel->nir = tgsi_to_nir(cso->prog, ctx->screen);
sel->nir = tgsi_to_nir(cso->prog, ctx->screen, false);
} else {
assert(cso->ir_type == PIPE_SHADER_IR_NIR);
sel->nir = (struct nir_shader *)cso->prog;

View File

@ -2593,7 +2593,7 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
sel->so = state->stream_output;
if (state->type == PIPE_SHADER_IR_TGSI) {
sel->nir = tgsi_to_nir(state->tokens, ctx->screen);
sel->nir = tgsi_to_nir(state->tokens, ctx->screen, false);
} else {
assert(state->type == PIPE_SHADER_IR_NIR);
sel->nir = state->ir.nir;

View File

@ -303,7 +303,7 @@ v3d_uncompiled_shader_create(struct pipe_context *pctx,
tgsi_dump(ir, 0);
fprintf(stderr, "\n");
}
s = tgsi_to_nir(ir, pctx->screen);
s = tgsi_to_nir(ir, pctx->screen, false);
}
nir_variable_mode lower_mode = nir_var_all & ~nir_var_uniform;

View File

@ -2466,7 +2466,7 @@ vc4_shader_state_create(struct pipe_context *pctx,
tgsi_dump(cso->tokens, 0);
fprintf(stderr, "\n");
}
s = tgsi_to_nir(cso->tokens, pctx->screen);
s = tgsi_to_nir(cso->tokens, pctx->screen, false);
}
if (s->info.stage == MESA_SHADER_VERTEX)

View File

@ -108,7 +108,7 @@ zink_tgsi_to_nir(struct pipe_screen *screen, const struct tgsi_token *tokens)
fprintf(stderr, "---8<---\n\n");
}
return tgsi_to_nir(tokens, screen);
return tgsi_to_nir(tokens, screen, false);
}
static void

View File

@ -3836,7 +3836,7 @@ static void
nine_pipe_nir_shader_state_from_tgsi(struct pipe_shader_state *state, const struct tgsi_token *tgsi_tokens,
struct pipe_screen *screen)
{
struct nir_shader *nir = tgsi_to_nir(tgsi_tokens, screen);
struct nir_shader *nir = tgsi_to_nir(tgsi_tokens, screen, false);
if (unlikely(nine_shader_get_debug_flag(NINE_SHADER_DEBUG_OPTION_DUMP_NIR))) {
nir_print_shader(nir, stdout);