diff options
author | Nicolai Hähnle <[email protected]> | 2017-03-31 13:02:34 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-04-05 15:29:43 +0200 |
commit | 4cf29427770f6900c5e84e3b30f2e72e65954548 (patch) | |
tree | 75436bd5a941d89e1ec73c513452c0aa8f960211 /src/gallium | |
parent | 1ee57b16beec5a9128c75a3191eed051317e9836 (diff) |
radeonsi: support 64-bit system values
For simplicitly, always store system values as 32-bit values or arrays
of 32-bit values. 64-bit values are unpacked and packed accordingly.
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c index 3e38f0d29ac..3b8951cd942 100644 --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c @@ -762,13 +762,29 @@ static LLVMValueRef fetch_system_value(struct lp_build_tgsi_context *bld_base, unsigned swizzle) { struct si_shader_context *ctx = si_shader_context(bld_base); - struct gallivm_state *gallivm = &ctx->gallivm; - + LLVMBuilderRef builder = ctx->gallivm.builder; LLVMValueRef cval = ctx->system_values[reg->Register.Index]; + + if (tgsi_type_is_64bit(type)) { + LLVMValueRef lo, hi; + + assert(swizzle == 0 || swizzle == 2); + + lo = LLVMBuildExtractElement( + builder, cval, LLVMConstInt(ctx->i32, swizzle, 0), ""); + hi = LLVMBuildExtractElement( + builder, cval, LLVMConstInt(ctx->i32, swizzle + 1, 0), ""); + + return si_llvm_emit_fetch_64bit(bld_base, type, lo, hi); + } + if (LLVMGetTypeKind(LLVMTypeOf(cval)) == LLVMVectorTypeKind) { - cval = LLVMBuildExtractElement(gallivm->builder, cval, - LLVMConstInt(ctx->i32, swizzle, 0), ""); + cval = LLVMBuildExtractElement( + builder, cval, LLVMConstInt(ctx->i32, swizzle, 0), ""); + } else { + assert(swizzle == 0); } + return bitcast(bld_base, type, cval); } |