Major check-in of changes for GL_EXT_framebuffer_object extension.
[mesa.git] / src / mesa / tnl_dd / t_dd_tritmp.h
index 5b17a6f6f0064483111f9fb41d549649511e6ef3..a822c38255e9a39735c867f2c3687ec51bd1db74 100644 (file)
@@ -1,9 +1,8 @@
-
 /*
  * Mesa 3-D graphics library
- * Version:  3.5
+ * Version:  6.3
  *
- * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -49,7 +48,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.
 #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 +273,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 *= ctx->DrawBuffer->_MRD * (REVERSE_DEPTH ? -1.0 : 1.0);
       }
    }
 
@@ -545,7 +549,7 @@ static void TAG(quad)( GLcontext *ctx,
            if ( bc < 0.0f ) bc = -bc;
            offset += MAX2( ac, bc ) * ctx->Polygon.OffsetFactor;
         }
-        offset *= ctx->MRD;
+        offset *= ctx->DrawBuffer->_MRD * (REVERSE_DEPTH ? -1.0 : 1.0);
       }
    }
 
@@ -744,7 +748,7 @@ static void TAG(line)( GLcontext *ctx, GLuint e0, GLuint e1 )
 static void TAG(points)( GLcontext *ctx, GLuint first, GLuint last )
 {
    struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
-   int i;
+   GLuint i;
    LOCAL_VARS(1);
 
    if (VB->Elts == 0) {