diff options
author | Marek Olšák <[email protected]> | 2019-07-31 21:30:22 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-08-12 14:52:17 -0400 |
commit | 155789c8e7cfa31084807a6f005413660dccf30a (patch) | |
tree | 77b1bf1a406347586e675d5d4a7c48c6f96e3af6 | |
parent | 5a0adfd9f0ca9816c637d7b5b3572d1374248afb (diff) |
tgsi_to_nir: add basic compute shader support
Reviewed-By: Timur Kristóf <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Connor Abbott <[email protected]>
-rw-r--r-- | src/gallium/auxiliary/nir/tgsi_to_nir.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c index 2d8ff251a30..1195d522239 100644 --- a/src/gallium/auxiliary/nir/tgsi_to_nir.c +++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c @@ -620,6 +620,14 @@ ttn_src_for_file_and_index(struct ttn_compile *c, unsigned file, unsigned index, op = nir_intrinsic_load_point_coord; load = nir_load_point_coord(b); break; + case TGSI_SEMANTIC_THREAD_ID: + op = nir_intrinsic_load_local_invocation_id; + load = nir_load_local_invocation_id(b); + break; + case TGSI_SEMANTIC_BLOCK_ID: + op = nir_intrinsic_load_work_group_id; + load = nir_load_work_group_id(b); + break; default: unreachable("bad system value"); } @@ -2438,6 +2446,15 @@ ttn_compile_init(const void *tgsi_tokens, case TGSI_PROPERTY_VS_BLIT_SGPRS_AMD: s->info.vs.blit_sgprs_amd = value; break; + case TGSI_PROPERTY_CS_FIXED_BLOCK_WIDTH: + s->info.cs.local_size[0] = value; + break; + case TGSI_PROPERTY_CS_FIXED_BLOCK_HEIGHT: + s->info.cs.local_size[1] = value; + break; + case TGSI_PROPERTY_CS_FIXED_BLOCK_DEPTH: + s->info.cs.local_size[2] = value; + break; default: if (value) { fprintf(stderr, "tgsi_to_nir: unhandled TGSI property %u = %u\n", @@ -2447,6 +2464,12 @@ ttn_compile_init(const void *tgsi_tokens, } } + if (s->info.stage == MESA_SHADER_COMPUTE && + (!s->info.cs.local_size[0] || + !s->info.cs.local_size[1] || + !s->info.cs.local_size[2])) + s->info.cs.local_size_variable = true; + c->inputs = rzalloc_array(c, struct nir_variable *, s->num_inputs); c->outputs = rzalloc_array(c, struct nir_variable *, s->num_outputs); |