-
/*
* 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"),
* 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
{
struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
VERTEX *v[3];
- GLfloat offset;
+ GLfloat offset = 0;
GLfloat z[3];
GLenum mode = GL_FILL;
- GLuint facing;
+ GLuint facing = 0;
LOCAL_VARS(3);
/* fprintf(stderr, "%s\n", __FUNCTION__); */
{
facing = AREA_IS_CCW( cc ) ^ ctx->Polygon._FrontBit;
- if (DO_TWOSTENCIL && ctx->Stencil.TestTwoSide) {
- ctx->_Facing = facing; /* mixed mode rendering: for 2-sided stencil test */
- }
-
if (DO_UNFILLED) {
if (facing) {
mode = ctx->Polygon.BackMode;
GLfloat bc = b * ic;
if ( ac < 0.0f ) ac = -ac;
if ( bc < 0.0f ) bc = -bc;
- offset += MAX2( ac, bc ) * ctx->Polygon.OffsetFactor;
+ offset += MAX2( ac, bc ) * ctx->Polygon.OffsetFactor / ctx->DrawBuffer->_MRD;
}
- offset *= ctx->MRD;
+ offset *= ctx->DrawBuffer->_MRD * (REVERSE_DEPTH ? -1.0 : 1.0);
}
}
#if DO_QUAD
#if DO_FULL_QUAD
-static void TAG(quad)( GLcontext *ctx,
+static void TAG(quadr)( GLcontext *ctx,
GLuint e0, GLuint e1, GLuint e2, GLuint e3 )
{
struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
VERTEX *v[4];
- GLfloat offset;
+ GLfloat offset = 0;
GLfloat z[4];
GLenum mode = GL_FILL;
- GLuint facing;
+ GLuint facing = 0;
LOCAL_VARS(4);
v[0] = (VERTEX *)GET_VERTEX(e0);
{
facing = AREA_IS_CCW( cc ) ^ ctx->Polygon._FrontBit;
- if (DO_TWOSTENCIL && ctx->Stencil.TestTwoSide) {
- ctx->_Facing = facing; /* mixed mode rendering: for 2-sided stencil test */
- }
-
if (DO_UNFILLED) {
if (facing) {
mode = ctx->Polygon.BackMode;
GLfloat bc = b * ic;
if ( ac < 0.0f ) ac = -ac;
if ( bc < 0.0f ) bc = -bc;
- offset += MAX2( ac, bc ) * ctx->Polygon.OffsetFactor;
+ offset += MAX2( ac, bc ) * ctx->Polygon.OffsetFactor / ctx->DrawBuffer->_MRD;
}
- offset *= ctx->MRD;
+ offset *= ctx->DrawBuffer->_MRD * (REVERSE_DEPTH ? -1.0 : 1.0);
}
}
}
}
#else
-static void TAG(quad)( GLcontext *ctx, GLuint e0,
+static void TAG(quadr)( GLcontext *ctx, GLuint e0,
GLuint e1, GLuint e2, GLuint e3 )
{
if (DO_UNFILLED) {
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) {
static void TAG(init)( void )
{
#if DO_QUAD
- TAB[IND].quad = TAG(quad);
+ TAB[IND].quad = TAG(quadr);
#endif
#if DO_TRI
TAB[IND].triangle = TAG(triangle);