summaryrefslogtreecommitdiffstats
path: root/src/mesa/tnl_dd
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/tnl_dd')
-rw-r--r--src/mesa/tnl_dd/t_dd_tritmp.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mesa/tnl_dd/t_dd_tritmp.h b/src/mesa/tnl_dd/t_dd_tritmp.h
index 5b17a6f6f00..bc1617eae33 100644
--- a/src/mesa/tnl_dd/t_dd_tritmp.h
+++ b/src/mesa/tnl_dd/t_dd_tritmp.h
@@ -49,7 +49,8 @@
* VERT_X(v): Alias for vertex x value.
* VERT_Y(v): Alias for vertex y value.
* VERT_Z(v): Alias for vertex z value.
- * DEPTH_SCALE: Scale for offset.
+ * DEPTH_SCALE: Scale for constant offset.
+ * REVERSE_DEPTH: Viewport depth range reversed.
*
* VERTEX: Hardware vertex type.
* GET_VERTEX(n): Retreive vertex with index n.
@@ -108,6 +109,10 @@
#define VERT_Z_ADD(v,val) VERT_Z(v) += val
#endif
+#ifndef REVERSE_DEPTH
+#define REVERSE_DEPTH 0
+#endif
+
/* disable twostencil for un-aware drivers */
#ifndef HAVE_STENCIL_TWOSIDE
#define HAVE_STENCIL_TWOSIDE 0
@@ -269,7 +274,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
if ( bc < 0.0f ) bc = -bc;
offset += MAX2( ac, bc ) * ctx->Polygon.OffsetFactor;
}
- offset *= ctx->MRD;
+ offset *= REVERSE_DEPTH ? -ctx->MRD : ctx->MRD;
}
}
@@ -545,7 +550,7 @@ static void TAG(quad)( GLcontext *ctx,
if ( bc < 0.0f ) bc = -bc;
offset += MAX2( ac, bc ) * ctx->Polygon.OffsetFactor;
}
- offset *= ctx->MRD;
+ offset *= REVERSE_DEPTH ? -ctx->MRD : ctx->MRD;
}
}