summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/tgsi/exec
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-10-26 19:19:09 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-10-26 19:19:51 -0600
commit8fed2466e4056668a76a87cf935b5fbff8ae15ca (patch)
tree81345e5b5ee66dc2dd299f5b9ce29314f2e52735 /src/mesa/pipe/tgsi/exec
parent789d248558061fe4d65f664d6770a12b90fa2e34 (diff)
Re-implement GLSL texture sampler variables.
GLSL sampler variables indicate which texture unit to use for TEX instructions. Previously, this was baked into the fragment/vertex program and couldn't be readily changed once set. Now, SamplerUnits[] array indicates which texture unit is to be used for each sampler variable. These values are set with glUniform1i(). This is extra state that must be passed to the fragment/vertex program executor at runtime.
Diffstat (limited to 'src/mesa/pipe/tgsi/exec')
-rw-r--r--src/mesa/pipe/tgsi/exec/tgsi_exec.c5
-rw-r--r--src/mesa/pipe/tgsi/exec/tgsi_exec.h1
2 files changed, 5 insertions, 1 deletions
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c
index 0125f40dd2..66a81b4bd8 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c
@@ -1219,11 +1219,14 @@ exec_tex(struct tgsi_exec_machine *mach,
const struct tgsi_full_instruction *inst,
boolean biasLod)
{
- const uint unit = inst->FullSrcRegisters[1].SrcRegister.Index;
+ const uint sampler = inst->FullSrcRegisters[1].SrcRegister.Index;
+ const uint unit = mach->SamplerUnits[sampler];
union tgsi_exec_channel r[8];
uint chan_index;
float lodBias;
+ // printf("Sampler %u unit %u\n", sampler, unit);
+
switch (inst->InstructionExtTexture.Texture) {
case TGSI_TEXTURE_1D:
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.h b/src/mesa/pipe/tgsi/exec/tgsi_exec.h
index 1805e72487..38f9218520 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_exec.h
+++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.h
@@ -118,6 +118,7 @@ struct tgsi_exec_machine
struct tgsi_exec_vector *Temps;
struct tgsi_exec_vector *Addrs;
+ uint *SamplerUnits;
struct tgsi_sampler *Samplers;
float Imms[TGSI_EXEC_NUM_IMMEDIATES][4];