summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_shader.c
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-12-06 14:18:34 +1100
committerTimothy Arceri <[email protected]>2018-01-05 11:58:55 +1100
commit9c2f877830b25744d2fdd930a12959723c6c42f3 (patch)
tree5a879b516134dbc0e801cdff8693766cb20a4450 /src/gallium/drivers/radeonsi/si_shader.c
parentf93740efc1c75e26a7cb4bb7b41a60fcfdd4fed3 (diff)
radeonsi: add unpack_llvm_param() helper
This allows us to pass the llvm param directly rather than looking it up. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_shader.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 87719e0fdbb..dc7f12ce6a8 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -241,13 +241,10 @@ unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index)
/**
* Get the value of a shader input parameter and extract a bitfield.
*/
-static LLVMValueRef unpack_param(struct si_shader_context *ctx,
- unsigned param, unsigned rshift,
- unsigned bitwidth)
+static LLVMValueRef unpack_llvm_param(struct si_shader_context *ctx,
+ LLVMValueRef value, unsigned rshift,
+ unsigned bitwidth)
{
- LLVMValueRef value = LLVMGetParam(ctx->main_fn,
- param);
-
if (LLVMGetTypeKind(LLVMTypeOf(value)) == LLVMFloatTypeKind)
value = ac_to_integer(&ctx->ac, value);
@@ -264,6 +261,15 @@ static LLVMValueRef unpack_param(struct si_shader_context *ctx,
return value;
}
+static LLVMValueRef unpack_param(struct si_shader_context *ctx,
+ unsigned param, unsigned rshift,
+ unsigned bitwidth)
+{
+ LLVMValueRef value = LLVMGetParam(ctx->main_fn, param);
+
+ return unpack_llvm_param(ctx, value, rshift, bitwidth);
+}
+
static LLVMValueRef get_rel_patch_id(struct si_shader_context *ctx)
{
switch (ctx->type) {