summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-08-25 11:35:01 +0100
committerDave Airlie <airlied@redhat.com>2011-08-25 16:49:20 +0100
commit7f1b9ddd12e97ac57c4818646c17521bb0c2c358 (patch)
treee7b2532a47545108872af73189f143c2a672e870 /src
parentb9eb4d8a59699e233255113acafae220c3d8fe3c (diff)
tgsi: add TXQ support. (v2)
this adds another callback in the sampler struct containing get_dims entry point. This is used to query the driver for the texture resource dimensions for the resource bound to the current sampler. v2: remove unusued variable, fix indent Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c30
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.h2
2 files changed, 31 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 587483c049..bfddf0db5f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -1920,7 +1920,35 @@ exec_txd(struct tgsi_exec_machine *mach,
}
}
+static void
+exec_txq(struct tgsi_exec_machine *mach,
+ const struct tgsi_full_instruction *inst)
+{
+ struct tgsi_sampler *sampler;
+ const uint unit = inst->Src[1].Register.Index;
+ int result[4];
+ union tgsi_exec_channel r[4], src;
+ uint chan;
+ int i,j;
+
+ fetch_source(mach, &src, &inst->Src[0], CHAN_X, TGSI_EXEC_DATA_INT);
+ sampler = mach->Samplers[unit];
+
+ sampler->get_dims(sampler, src.i[0], result);
+
+ for (i = 0; i < QUAD_SIZE; i++) {
+ for (j = 0; j < 4; j++) {
+ r[j].i[i] = result[j];
+ }
+ }
+ for (chan = 0; chan < NUM_CHANNELS; chan++) {
+ if (inst->Dst[0].Register.WriteMask & (1 << chan)) {
+ store_dest(mach, &r[chan], &inst->Dst[0], inst, chan,
+ TGSI_EXEC_DATA_INT);
+ }
+ }
+}
static void
exec_sample(struct tgsi_exec_machine *mach,
@@ -3718,7 +3746,7 @@ exec_instruction(
break;
case TGSI_OPCODE_TXQ:
- assert (0);
+ exec_txq(mach, inst);
break;
case TGSI_OPCODE_EMIT:
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index 6c32ccff32..2162a071a0 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -90,6 +90,8 @@ struct tgsi_sampler
const float c0[QUAD_SIZE],
enum tgsi_sampler_control control,
float rgba[NUM_CHANNELS][QUAD_SIZE]);
+ void (*get_dims)(struct tgsi_sampler *sampler, int level,
+ int dims[4]);
};
#define TGSI_EXEC_NUM_TEMPS 128