diff options
author | Eric Anholt <[email protected]> | 2016-05-17 13:04:20 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2016-08-22 12:11:08 -0700 |
commit | 47e3cc7557144ea62cab65c86f0241ec53784d71 (patch) | |
tree | 8a17500969578611a1e0491e358c6dd6394781c9 /src/gallium/drivers/vc4/vc4_program.c | |
parent | d08f09c24e68c048f79500abe7f89e94960b55d2 (diff) |
vc4: Tell state_tracker that we would prefer NIR.
Before this series, the code generation path was:
GLSL IR -> TGSI -> NIR -> NIR clone -> QIR -> QPU
Now it's (generally)
GLSL IR -> NIR -> NIR clone -> QIR -> QPU
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_program.c')
-rw-r--r-- | src/gallium/drivers/vc4/vc4_program.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 1e8542fc27f..dd8c4210eee 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -1971,8 +1971,16 @@ static const nir_shader_compiler_options nir_options = { .lower_fsat = true, .lower_fsqrt = true, .lower_negate = true, + .native_integers = true, }; +const void * +vc4_screen_get_compiler_options(struct pipe_screen *pscreen, + enum pipe_shader_ir ir, unsigned shader) +{ + return &nir_options; +} + static int count_nir_instrs(nir_shader *nir) { @@ -2181,14 +2189,24 @@ vc4_shader_state_create(struct pipe_context *pctx, so->program_id = vc4->next_uncompiled_program_id++; - if (vc4_debug & VC4_DEBUG_TGSI) { - fprintf(stderr, "prog %d TGSI:\n", - so->program_id); - tgsi_dump(cso->tokens, 0); - fprintf(stderr, "\n"); - } + nir_shader *s; - nir_shader *s = tgsi_to_nir(cso->tokens, &nir_options); + if (cso->type == PIPE_SHADER_IR_NIR) { + /* The backend takes ownership of the NIR shader on state + * creation. + */ + s = cso->ir.nir; + } else { + assert(cso->type == PIPE_SHADER_IR_TGSI); + + if (vc4_debug & VC4_DEBUG_TGSI) { + fprintf(stderr, "prog %d TGSI:\n", + so->program_id); + tgsi_dump(cso->tokens, 0); + fprintf(stderr, "\n"); + } + s = tgsi_to_nir(cso->tokens, &nir_options); + } NIR_PASS_V(s, nir_opt_global_to_local); NIR_PASS_V(s, nir_convert_to_ssa); |