diff options
author | Keith Whitwell <[email protected]> | 2003-07-17 13:43:59 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2003-07-17 13:43:59 +0000 |
commit | 6dc85575000127630489b407c50a4b3ea87c9acb (patch) | |
tree | c79b24b7059577caf8201eeb7a42a6890721f52b /src/mesa/main/depth.c | |
parent | 44c699949ac09459771304a8aec8f2fc622057fb (diff) |
Merge Jose's documentation and core Mesa changes from embedded branch
Diffstat (limited to 'src/mesa/main/depth.c')
-rw-r--r-- | src/mesa/main/depth.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index 9d95500fcad..fa7eb63b069 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -140,3 +140,45 @@ _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ) ctx->Depth.BoundsMax = zmax; } + +/**********************************************************************/ +/***** Initialization *****/ +/**********************************************************************/ + +void _mesa_init_depth( GLcontext * ctx ) +{ + /* Depth buffer group */ + ctx->Depth.Test = GL_FALSE; + ctx->Depth.Clear = 1.0; + ctx->Depth.Func = GL_LESS; + ctx->Depth.Mask = GL_TRUE; + ctx->Depth.OcclusionTest = GL_FALSE; + + /* Z buffer stuff */ + if (ctx->Visual.depthBits == 0) { + /* Special case. Even if we don't have a depth buffer we need + * good values for DepthMax for Z vertex transformation purposes + * and for per-fragment fog computation. + */ + ctx->DepthMax = 1 << 16; + ctx->DepthMaxF = (GLfloat) ctx->DepthMax; + } + else if (ctx->Visual.depthBits < 32) { + ctx->DepthMax = (1 << ctx->Visual.depthBits) - 1; + ctx->DepthMaxF = (GLfloat) ctx->DepthMax; + } + else { + /* Special case since shift values greater than or equal to the + * number of bits in the left hand expression's type are undefined. + */ + ctx->DepthMax = 0xffffffff; + ctx->DepthMaxF = (GLfloat) ctx->DepthMax; + } + ctx->MRD = 1.0; /* Minimum resolvable depth value, for polygon offset */ + +#if FEATURE_ARB_occlusion_query + ctx->Occlusion.QueryObjects = _mesa_NewHashTable(); +#endif + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; +} |