summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Cencora <m.cencora@gmail.com>2009-06-05 18:32:05 +0200
committerMaciej Cencora <m.cencora@gmail.com>2009-06-11 23:24:25 +0200
commitde19eb0b0dba08b2ad3829b7ced94931139af843 (patch)
tree89342073d42091009ab1a13ff0262660bb62be43
parent2611e92da59ed3aedb0627889e185b63d4e5a532 (diff)
r300: fix vertex program bug
If the vertex program didn't write position attribute, the position invariant function would add necessary instructions, but the vertex position would be overwritten by artificial outputs insts added to satisfy fragment program requirements. Fixes "whole screen is gray" problem for HW TCL path in sauerbraten when shaders are enabled, and whole slew of wine d3d9 tests.
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index 66750b1c65..c41a8fdd62 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -1456,7 +1456,12 @@ void r300SelectVertexShader(r300ContextPtr r300)
wpos_idx = i;
}
- add_outputs(&wanted_key, VERT_RESULT_HPOS);
+ if (vpc->mesa_program.IsPositionInvariant) {
+ wanted_key.InputsRead |= (1 << VERT_ATTRIB_POS);
+ wanted_key.OutputsWritten |= (1 << VERT_RESULT_HPOS);
+ } else {
+ add_outputs(&wanted_key, VERT_RESULT_HPOS);
+ }
if (InputsRead & FRAG_BIT_COL0) {
add_outputs(&wanted_key, VERT_RESULT_COL0);
@@ -1466,17 +1471,16 @@ void r300SelectVertexShader(r300ContextPtr r300)
add_outputs(&wanted_key, VERT_RESULT_COL1);
}
+ if (InputsRead & FRAG_BIT_FOGC) {
+ add_outputs(&wanted_key, VERT_RESULT_FOGC);
+ }
+
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
if (InputsRead & (FRAG_BIT_TEX0 << i)) {
add_outputs(&wanted_key, VERT_RESULT_TEX0 + i);
}
}
- if (vpc->mesa_program.IsPositionInvariant) {
- /* we wan't position don't we ? */
- wanted_key.InputsRead |= (1 << VERT_ATTRIB_POS);
- }
-
for (vp = vpc->progs; vp; vp = vp->next)
if (_mesa_memcmp(&vp->key, &wanted_key, sizeof(wanted_key))
== 0) {