summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-11-30 14:23:00 +1000
committerEmil Velikov <emil.l.velikov@gmail.com>2015-12-12 19:39:02 +0000
commitefdf841238f63a616daaa1499098841d31b911f2 (patch)
treec15799f07b0210b56795547d7a055eb47e294189
parent5913a8c9ecf05ad7ee38cb1fe0358048731cc78c (diff)
r600/shader: split address get out to a function.
This will be used in the tess shaders. Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit 4d64459a92a4c1a64fb7051fd1320c14c1854dcb)
-rw-r--r--src/gallium/drivers/r600/r600_shader.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 4c68a4a2b79..5b0283a84fc 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -598,6 +598,11 @@ static int select_twoside_color(struct r600_shader_ctx *ctx, int front, int back
return 0;
}
+static inline int get_address_file_reg(struct r600_shader_ctx *ctx, int index)
+{
+ return index > 0 ? ctx->bc->index_reg[index - 1] : ctx->bc->ar_reg;
+}
+
static int vs_add_primid_output(struct r600_shader_ctx *ctx, int prim_id_sid)
{
int i;
@@ -7187,7 +7192,7 @@ static int tgsi_eg_arl(struct r600_shader_ctx *ctx)
struct r600_bytecode_alu alu;
int r;
int i, lasti = tgsi_last_instruction(inst->Dst[0].Register.WriteMask);
- unsigned reg = inst->Dst[0].Register.Index > 0 ? ctx->bc->index_reg[inst->Dst[0].Register.Index - 1] : ctx->bc->ar_reg;
+ unsigned reg = get_address_file_reg(ctx, inst->Dst[0].Register.Index);
assert(inst->Dst[0].Register.Index < 3);
memset(&alu, 0, sizeof(struct r600_bytecode_alu));