summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c
diff options
context:
space:
mode:
authorTom Stellard <tstellar@gmail.com>2010-10-29 22:27:04 -0700
committerTom Stellard <tstellar@gmail.com>2010-11-21 18:48:31 -0800
commit96f9580160bf769fbdcd005b48c7bf6e92d453f7 (patch)
treee6350eea33e1bc40fbb2483c7d8e97cf14295c25 /src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c
parent23f577dbd491bd045c47c6378bd23748255eb045 (diff)
r300/compiler: Add rc_get_readers()
Diffstat (limited to 'src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c')
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c
index a21fe8d3df..582d73b61f 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c
@@ -27,6 +27,7 @@
#include "radeon_program_pair.h"
+#include <stdlib.h>
/**
* Return the source slot where we installed the given register access,
@@ -225,3 +226,18 @@ unsigned int rc_source_type_that_arg_reads(
}
return ret;
}
+
+struct rc_pair_instruction_source * rc_pair_get_src(
+ struct rc_pair_instruction * pair_inst,
+ struct rc_pair_instruction_arg * arg)
+{
+ unsigned int type = rc_source_type_that_arg_reads(arg->Source,
+ arg->Swizzle);
+ if (type & RC_PAIR_SOURCE_RGB) {
+ return &pair_inst->RGB.Src[arg->Source];
+ } else if (type & RC_PAIR_SOURCE_ALPHA) {
+ return &pair_inst->Alpha.Src[arg->Source];
+ } else {
+ return NULL;
+ }
+}