diff options
author | Dave Airlie <airlied@redhat.com> | 2019-07-22 08:27:27 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2019-09-04 15:22:20 +1000 |
commit | db6c78f9c8cba64cd653166968912cbc5282f875 (patch) | |
tree | 8fae776eff61d4cf92e33d8912f29320d30bc62d /src | |
parent | 3312bed7b0164223f438c91bdcc287602a0ce8c4 (diff) |
gallivm: add new compute related intrinsics
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_tgsi.h | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h index ed3465874bc..5bc2f67dbf4 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h @@ -170,6 +170,9 @@ struct lp_bld_tgsi_system_values { LLVMValueRef prim_id; LLVMValueRef basevertex; LLVMValueRef invocation_id; + LLVMValueRef thread_id; + LLVMValueRef block_id; + LLVMValueRef grid_size; }; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index ef27b547b79..e097dcf5709 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -1690,6 +1690,7 @@ emit_fetch_system_value( LLVMBuilderRef builder = gallivm->builder; LLVMValueRef res; enum tgsi_opcode_type atype; // Actual type of the value + unsigned swizzle = swizzle_in & 0xffff; assert(!reg->Register.Indirect); @@ -1729,6 +1730,21 @@ emit_fetch_system_value( atype = TGSI_TYPE_UNSIGNED; break; + case TGSI_SEMANTIC_THREAD_ID: + res = LLVMBuildExtractValue(gallivm->builder, bld->system_values.thread_id, swizzle, ""); + atype = TGSI_TYPE_UNSIGNED; + break; + + case TGSI_SEMANTIC_BLOCK_ID: + res = lp_build_extract_broadcast(gallivm, lp_type_int_vec(32, 96), bld_base->uint_bld.type, bld->system_values.block_id, lp_build_const_int32(gallivm, swizzle)); + atype = TGSI_TYPE_UNSIGNED; + break; + + case TGSI_SEMANTIC_GRID_SIZE: + res = lp_build_extract_broadcast(gallivm, lp_type_int_vec(32, 96), bld_base->uint_bld.type, bld->system_values.grid_size, lp_build_const_int32(gallivm, swizzle)); + atype = TGSI_TYPE_UNSIGNED; + break; + default: assert(!"unexpected semantic in emit_fetch_system_value"); res = bld_base->base.zero; |