aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej Cencora <[email protected]>2009-07-12 15:09:15 +0200
committerMaciej Cencora <[email protected]>2009-07-13 19:28:15 +0200
commit582bd3466514b9fe24f18d99af2945f02709aacd (patch)
tree48a7d472ecc427296ce610ea333181c109ffe4bf
parentf06910f6c34f199dc187bd69ff1f6889ba498217 (diff)
r300: always assume all components are read by fragment program
Components of input attributes that are used by fragment program aren't part of vertex program key, and that may lead to situations when vertex program writes only TEX1.xy and fragment program reads TEX1.xyz, resulting in rendering errors. Reported-by: Nicolai Hähnle <[email protected]>
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.c54
1 files changed, 5 insertions, 49 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index c0b116156ab..de32013032f 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -1494,46 +1494,6 @@ static void addArtificialOutputs(GLcontext *ctx, struct gl_program *prog)
#undef ADD_OUTPUT
-static GLuint getUsedComponents(const GLuint swizzle)
-{
- GLuint ret;
-
- ret = 0;
-
- /* need to mask out ZERO, ONE and NIL swizzles */
- if (GET_SWZ(swizzle, SWIZZLE_X) <= SWIZZLE_W)
- ret |= 1 << (GET_SWZ(swizzle, SWIZZLE_X));
- if (GET_SWZ(swizzle, SWIZZLE_Y) <= SWIZZLE_W)
- ret |= 1 << (GET_SWZ(swizzle, SWIZZLE_Y));
- if (GET_SWZ(swizzle, SWIZZLE_Z) <= SWIZZLE_W)
- ret |= 1 << (GET_SWZ(swizzle, SWIZZLE_Z));
- if (GET_SWZ(swizzle, SWIZZLE_W) <= SWIZZLE_W)
- ret |= 1 << (GET_SWZ(swizzle, SWIZZLE_W));
-
- return ret;
-}
-
-static GLuint trackUsedComponents(const struct gl_program *prog, const GLuint attrib)
-{
- struct prog_instruction *inst;
- int tmp, i;
- GLuint ret;
-
- inst = prog->Instructions;
- ret = 0;
- while (inst->Opcode != OPCODE_END) {
- tmp = _mesa_num_inst_src_regs(inst->Opcode);
- for (i = 0; i < tmp; ++i) {
- if (inst->SrcReg[i].File == PROGRAM_INPUT && inst->SrcReg[i].Index == attrib) {
- ret |= getUsedComponents(inst->SrcReg[i].Swizzle);
- }
- }
- ++inst;
- }
-
- return ret;
-}
-
static void nqssadceInit(struct nqssadce_state* s)
{
r300ContextPtr r300 = R300_CONTEXT(s->Ctx);
@@ -1541,18 +1501,14 @@ static void nqssadceInit(struct nqssadce_state* s)
fp_reads = r300->selected_fp->Base->InputsRead;
{
- GLuint tmp;
-
if (fp_reads & FRAG_BIT_COL0) {
- tmp = trackUsedComponents(r300->selected_fp->Base, FRAG_ATTRIB_COL0);
- s->Outputs[VERT_RESULT_COL0].Sourced = tmp;
- s->Outputs[VERT_RESULT_BFC0].Sourced = tmp;
+ s->Outputs[VERT_RESULT_COL0].Sourced = WRITEMASK_XYZW;
+ s->Outputs[VERT_RESULT_BFC0].Sourced = WRITEMASK_XYZW;
}
if (fp_reads & FRAG_BIT_COL1) {
- tmp = trackUsedComponents(r300->selected_fp->Base, FRAG_ATTRIB_COL1);
- s->Outputs[VERT_RESULT_COL1].Sourced = tmp;
- s->Outputs[VERT_RESULT_BFC1].Sourced = tmp;
+ s->Outputs[VERT_RESULT_COL1].Sourced = WRITEMASK_XYZW;
+ s->Outputs[VERT_RESULT_BFC1].Sourced = WRITEMASK_XYZW;
}
}
@@ -1560,7 +1516,7 @@ static void nqssadceInit(struct nqssadce_state* s)
int i;
for (i = 0; i < 8; ++i) {
if (fp_reads & FRAG_BIT_TEX(i)) {
- s->Outputs[VERT_RESULT_TEX0 + i].Sourced = trackUsedComponents(r300->selected_fp->Base, FRAG_ATTRIB_TEX0 + i);
+ s->Outputs[VERT_RESULT_TEX0 + i].Sourced = WRITEMASK_XYZW;
}
}
}