summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300/r300_fragprog.c
diff options
context:
space:
mode:
authorRune Petersen <rune@megahurts.dk>2006-11-17 19:12:42 +0000
committerRune Petersen <rune@megahurts.dk>2006-11-17 19:12:42 +0000
commit6c9cc81601e87b87f11b89669175dc5bbae4c36b (patch)
tree3220a7b8fa3e30604604e9955597eb245f619d2e /src/mesa/drivers/dri/r300/r300_fragprog.c
parent0f614df7974a7126324a7fa5d80ee5c588a76f03 (diff)
fragment.position support
World position is calculated in the vertex shader and passed to the fragment shader via an unused texcoord.
Diffstat (limited to 'src/mesa/drivers/dri/r300/r300_fragprog.c')
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c
index 7793c5eb2e..cab5451214 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog.c
@@ -1555,6 +1555,13 @@ static void init_program(struct r300_fragment_program *rp)
}
InputsRead &= ~FRAG_BITS_TEX_ANY;
+ /* fragment position treated as a texcoord */
+ if (InputsRead & FRAG_BIT_WPOS) {
+ cs->inputs[FRAG_ATTRIB_WPOS].refcount = 0;
+ cs->inputs[FRAG_ATTRIB_WPOS].reg = get_hw_temp(rp);
+ }
+ InputsRead &= ~FRAG_BIT_WPOS;
+
/* Then primary colour */
if (InputsRead & FRAG_BIT_COL0) {
cs->inputs[FRAG_ATTRIB_COL0].refcount = 0;