summaryrefslogtreecommitdiff
path: root/src/mesa/swrast/s_depth.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2004-09-24 14:30:13 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2004-09-24 14:30:13 +0000
commit328a039413fd2b8649511f1ca130df2a59f2c71c (patch)
treef0739e2a41ee9ced641f6b2c3a9137d708e0899e /src/mesa/swrast/s_depth.c
parentd9873c59ef4d14b5e3137cb2d7c765797f82ac56 (diff)
patches for clearing hw depth buffers from software fallback (Nicolai Haehnle)
Diffstat (limited to 'src/mesa/swrast/s_depth.c')
-rw-r--r--src/mesa/swrast/s_depth.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
index fc242be2aa..34897ba931 100644
--- a/src/mesa/swrast/s_depth.c
+++ b/src/mesa/swrast/s_depth.c
@@ -1665,13 +1665,33 @@ _swrast_alloc_depth_buffer( GLframebuffer *buffer )
void
_swrast_clear_depth_buffer( GLcontext *ctx )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+
if (ctx->Visual.depthBits == 0
- || !ctx->DrawBuffer->DepthBuffer
|| !ctx->Depth.Mask) {
/* no depth buffer, or writing to it is disabled */
return;
}
+ if (swrast->Driver.WriteMonoDepthSpan) {
+ const GLdepth clearValue = (GLdepth)(ctx->Depth.Clear * ctx->DepthMax);
+ const GLint x = ctx->DrawBuffer->_Xmin;
+ const GLint y = ctx->DrawBuffer->_Ymin;
+ const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
+ const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
+ GLint i;
+
+ for (i = 0; i < height; i++) {
+ (*swrast->Driver.WriteMonoDepthSpan)( ctx, width, x, y + i,
+ clearValue, NULL );
+ }
+
+ return;
+ }
+
+ if (!ctx->DrawBuffer->DepthBuffer)
+ return;
+
/* The loops in this function have been written so the IRIX 5.3
* C compiler can unroll them. Hopefully other compilers can too!
*/