mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
tgsi_to_nir: add basic compute shader support
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
This commit is contained in:
parent
5a0adfd9f0
commit
155789c8e7
1 changed files with 23 additions and 0 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue