summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_depth.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2001-12-17 04:54:35 +0000
committerBrian Paul <[email protected]>2001-12-17 04:54:35 +0000
commit10f30eb43835c57c00783390a02d72daf4f78e26 (patch)
treed97fd3ed55c760c4d0fb8763d4819b46b35d15ca /src/mesa/swrast/s_depth.c
parent57d6e1aebf1f850686a2c8d3a246fb388ec23979 (diff)
first checkpoint commit of Klaus's new span code (struct sw_span)
Diffstat (limited to 'src/mesa/swrast/s_depth.c')
-rw-r--r--src/mesa/swrast/s_depth.c49
1 files changed, 46 insertions, 3 deletions
diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
index 5001081ae04..b892ffabb35 100644
--- a/src/mesa/swrast/s_depth.c
+++ b/src/mesa/swrast/s_depth.c
@@ -1,4 +1,4 @@
-/* $Id: s_depth.c,v 1.9 2001/03/19 02:25:36 keithw Exp $ */
+/* $Id: s_depth.c,v 1.10 2001/12/17 04:54:35 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -535,8 +535,8 @@ depth_test_span32( GLcontext *ctx, GLuint n, GLint x, GLint y,
* Apply depth test to span of fragments. Hardware or software z buffer.
*/
GLuint
-_mesa_depth_test_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLdepth z[], GLubyte mask[] )
+_old_depth_test_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLdepth z[], GLubyte mask[] )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (swrast->Driver.ReadDepthSpan) {
@@ -564,6 +564,49 @@ _mesa_depth_test_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
}
}
+/*
+ * Apply depth test to span of fragments. Hardware or software z buffer.
+ */
+GLuint
+_mesa_depth_test_span( GLcontext *ctx, struct sw_span *span)
+{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+
+ ASSERT(span->activeMask & SPAN_Z);
+ ASSERT(span->filledMask == GL_TRUE);
+ ASSERT(span->filledDepth == GL_TRUE);
+ SW_SPAN_SET_FLAG(span->testedDepth);
+
+ if (swrast->Driver.ReadDepthSpan) {
+ /* hardware-based depth buffer */
+ GLdepth zbuffer[MAX_WIDTH];
+ GLuint passed;
+ (*swrast->Driver.ReadDepthSpan)(ctx, span->end, span->x, span->y, zbuffer);
+ passed = depth_test_span32(ctx, span->end, span->x, span->y,
+ zbuffer, span->depth, span->mask);
+ ASSERT(swrast->Driver.WriteDepthSpan);
+ (*swrast->Driver.WriteDepthSpan)(ctx, span->end, span->x, span->y, zbuffer, span->mask);
+ if (passed < span->end)
+ span->write_all = GL_FALSE;
+ return passed;
+ }
+ else {
+ GLuint passed;
+ /* software depth buffer */
+ if (ctx->Visual.depthBits <= 16) {
+ GLushort *zptr = (GLushort *) Z_ADDRESS16(ctx, span->x, span->y);
+ passed = depth_test_span16(ctx, span->end, span->x, span->y, zptr, span->depth, span->mask);
+ }
+ else {
+ GLuint *zptr = (GLuint *) Z_ADDRESS32(ctx, span->x, span->y);
+ passed = depth_test_span32(ctx, span->end, span->x, span->y, zptr, span->depth, span->mask);
+ }
+ if (passed < span->end)
+ span->write_all = GL_FALSE;
+ return passed;
+ }
+}
+