summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2004-04-19 15:03:16 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2004-04-19 15:03:16 +0000
commite63cb85cbc13c083f5d9f4640bb81ba9417a4f28 (patch)
treef53df83f3c69984dc98ba906f598d4de6add23c9
parent4697419c43c79585abd067d1dea438861691b9ae (diff)
do texcoord projective division in _swrast_span_default_texcoords()
-rw-r--r--src/mesa/swrast/s_span.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index b74f62b6c6..0abeaec135 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -126,7 +126,17 @@ _swrast_span_default_texcoords( GLcontext *ctx, struct sw_span *span )
{
GLuint i;
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
- COPY_4V(span->tex[i], ctx->Current.RasterTexCoords[i]);
+ const GLfloat *tc = ctx->Current.RasterTexCoords[i];
+ if (tc[3] > 0.0F) {
+ /* use (s/q, t/q, r/q, 1) */
+ span->tex[i][0] = tc[0] / tc[3];
+ span->tex[i][1] = tc[1] / tc[3];
+ span->tex[i][2] = tc[2] / tc[3];
+ span->tex[i][3] = 1.0;
+ }
+ else {
+ ASSIGN_4V(span->tex[i], 0.0F, 0.0F, 0.0F, 1.0F);
+ }
ASSIGN_4V(span->texStepX[i], 0.0F, 0.0F, 0.0F, 0.0F);
ASSIGN_4V(span->texStepY[i], 0.0F, 0.0F, 0.0F, 0.0F);
}