summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_setup_point.c
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-10-06 09:40:51 +0100
committerJosé Fonseca <jfonseca@vmware.com>2010-10-06 11:46:41 +0100
commit06472ad7e835813ef7c9bf8a5cd8b62a25fa9cc3 (patch)
tree4849c8674d1a63664053f08fd81d68a7d1a37c3e /src/gallium/drivers/llvmpipe/lp_setup_point.c
parente74955eba3fc22fcf6e9111a4e5bbc095d34d357 (diff)
llvmpipe: Fix sprite coord perspective interpolation of Q.
Q coordinate's coefficients also need to be multiplied by w, otherwise it will have 1/w, causing problems with TXP.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_setup_point.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_point.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c
index c91e85f915..1295aeecd8 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_point.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c
@@ -105,6 +105,8 @@ texcoord_coef(struct lp_setup_context *setup,
unsigned sprite_coord_origin,
boolean perspective)
{
+ float w0 = info->v0[0][3];
+
assert(i < 4);
if (i == 0) {
@@ -118,13 +120,6 @@ texcoord_coef(struct lp_setup_context *setup,
point->inputs.a0[slot][0] = 0.5 - (dadx * x0 + dady * y0);
if (perspective) {
- /* Divide coefficients by vertex.w here.
- *
- * It would be clearer to always multiply by w0 above and
- * then divide it out for perspective projection here, but
- * doing it this way involves less algebra.
- */
- float w0 = info->v0[0][3];
point->inputs.dadx[slot][0] *= w0;
point->inputs.dady[slot][0] *= w0;
point->inputs.a0[slot][0] *= w0;
@@ -145,7 +140,6 @@ texcoord_coef(struct lp_setup_context *setup,
point->inputs.a0[slot][1] = 0.5 - (dadx * x0 + dady * y0);
if (perspective) {
- float w0 = info->v0[0][3];
point->inputs.dadx[slot][1] *= w0;
point->inputs.dady[slot][1] *= w0;
point->inputs.a0[slot][1] *= w0;
@@ -157,7 +151,7 @@ texcoord_coef(struct lp_setup_context *setup,
point->inputs.dady[slot][2] = 0.0f;
}
else {
- point->inputs.a0[slot][3] = 1.0f;
+ point->inputs.a0[slot][3] = perspective ? w0 : 1.0f;
point->inputs.dadx[slot][3] = 0.0f;
point->inputs.dady[slot][3] = 0.0f;
}