summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorMaciej Cencora <m.cencora@gmail.com>2009-05-27 22:17:31 +0200
committerDave Airlie <airlied@redhat.com>2009-06-07 16:39:23 +1000
commita27b689d08d88f99ebccf58bbba64d3cfc668866 (patch)
tree4c281d727ab0b4339de3a628033defa985cad0f2 /src/mesa/drivers
parentab60a44331462b659f491dfb11e125daeb556973 (diff)
r300: fixup vertex attributes ordering
Always allocate the vertex program input registers in the same order as the vertex attributes are passed in vertex arrays.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index 949c0b499c..35e5ec0f8e 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -215,21 +215,8 @@ static void vp_dump_inputs(struct r300_vertex_program *vp, char *caller)
static unsigned long t_src_index(struct r300_vertex_program *vp,
struct prog_src_register *src)
{
- int i;
- int max_reg = -1;
-
if (src->File == PROGRAM_INPUT) {
- if (vp->inputs[src->Index] != -1)
- return vp->inputs[src->Index];
-
- for (i = 0; i < VERT_ATTRIB_MAX; i++)
- if (vp->inputs[i] > max_reg)
- max_reg = vp->inputs[i];
-
- vp->inputs[src->Index] = max_reg + 1;
-
- //vp_dump_inputs(vp, __FUNCTION__);
-
+ assert(vp->inputs[src->Index] != -1);
return vp->inputs[src->Index];
} else {
if (src->Index < 0) {
@@ -944,11 +931,17 @@ static GLuint *r300TranslateOpcodeXPD(struct r300_vertex_program *vp,
static void t_inputs_outputs(struct r300_vertex_program *vp)
{
int i;
- int cur_reg = 0;
+ int cur_reg;
- for (i = 0; i < VERT_ATTRIB_MAX; i++)
- vp->inputs[i] = -1;
+ cur_reg = -1;
+ for (i = 0; i < VERT_ATTRIB_MAX; i++) {
+ if (vp->key.InputsRead & (1 << i))
+ vp->inputs[i] = ++cur_reg;
+ else
+ vp->inputs[i] = -1;
+ }
+ cur_reg = 0;
for (i = 0; i < VERT_RESULT_MAX; i++)
vp->outputs[i] = -1;