diff options
author | Marek Olšák <[email protected]> | 2019-08-01 12:29:05 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-08-12 14:52:17 -0400 |
commit | 8ac2583cd89dc7e8602eb967e2d502daaa31ae63 (patch) | |
tree | 704d4909acd386ca40587de7e51bc53985ddea43 /src/gallium/auxiliary/nir/tgsi_to_nir.c | |
parent | f3f1d0dfd034a31c4914148fefbd5543f5dd12fc (diff) |
tgsi_to_nir: add support for the stencil FS output
Reviewed-By: Timur Kristóf <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/nir/tgsi_to_nir.c')
-rw-r--r-- | src/gallium/auxiliary/nir/tgsi_to_nir.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c index f33ff1f818c..24187503a30 100644 --- a/src/gallium/auxiliary/nir/tgsi_to_nir.c +++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c @@ -418,6 +418,10 @@ ttn_emit_declaration(struct ttn_compile *c) var->data.location = FRAG_RESULT_DEPTH; var->type = glsl_float_type(); break; + case TGSI_SEMANTIC_STENCIL: + var->data.location = FRAG_RESULT_STENCIL; + var->type = glsl_int_type(); + break; default: fprintf(stderr, "Bad TGSI semantic: %d/%d\n", decl->Semantic.Name, decl->Semantic.Index); @@ -2330,12 +2334,15 @@ ttn_add_output_stores(struct ttn_compile *c) src.reg.base_offset = c->output_regs[i].offset; nir_ssa_def *store_value = nir_ssa_for_src(b, src, 4); - if (c->build.shader->info.stage == MESA_SHADER_FRAGMENT && - var->data.location == FRAG_RESULT_DEPTH) { - /* TGSI uses TGSI_SEMANTIC_POSITION.z for the depth output, while - * NIR uses a single float FRAG_RESULT_DEPTH. + if (c->build.shader->info.stage == MESA_SHADER_FRAGMENT) { + /* TGSI uses TGSI_SEMANTIC_POSITION.z for the depth output + * and TGSI_SEMANTIC_STENCIL.y for the stencil output, + * while NIR uses a single-component output. */ - store_value = nir_channel(b, store_value, 2); + if (var->data.location == FRAG_RESULT_DEPTH) + store_value = nir_channel(b, store_value, 2); + else if (var->data.location == FRAG_RESULT_STENCIL) + store_value = nir_channel(b, store_value, 1); } nir_store_deref(b, nir_build_deref_var(b, var), store_value, |