Added a Spanish translation by David Rubio Miguélezand a Dutch
[mesa.git] / src / mesa / drivers / dri / common / depthtmp.h
index f3da61e5199c49239cdad7ac04f60fabb0b635ce..ad26e6b8914ff648aebcaa059c299812d2f1f582 100644 (file)
@@ -45,15 +45,15 @@ static void TAG(WriteDepthSpan)( GLcontext *ctx,
               GLint i = 0;
               CLIPSPAN( x, y, n, x1, n1, i );
 
-              if ( DBG ) fprintf( stderr, "WriteDepthSpan %d..%d (x1 %d)\n",
-                                  (int)i, (int)n1, (int)x1 );
+              if ( DBG ) fprintf( stderr, "WriteDepthSpan %d..%d (x1 %d) (mask %p)\n",
+                                  (int)i, (int)n1, (int)x1, mask );
 
               if ( mask ) {
-                 for ( ; i < n1 ; i++, x1++ ) {
+                 for ( ; n1>0 ; i++, x1++, n1-- ) {
                     if ( mask[i] ) WRITE_DEPTH( x1, y, depth[i] );
                  }
               } else {
-                 for ( ; i < n1 ; i++, x1++ ) {
+                 for ( ; n1>0 ; i++, x1++, n1-- ) {
                     WRITE_DEPTH( x1, y, depth[i] );
                  }
               }
@@ -64,6 +64,44 @@ static void TAG(WriteDepthSpan)( GLcontext *ctx,
    HW_WRITE_UNLOCK();
 }
 
+#if !HAVE_HW_DEPTH_SPANS
+static void TAG(WriteMonoDepthSpan)( GLcontext *ctx,
+                                 GLuint n, GLint x, GLint y,
+                                const GLdepth depth,
+                                const GLubyte mask[] )
+{
+   HW_WRITE_LOCK()
+      {
+        GLint x1;
+        GLint n1;
+        LOCAL_DEPTH_VARS;
+
+        y = Y_FLIP( y );
+
+        HW_CLIPLOOP()
+           {
+              GLint i = 0;
+              CLIPSPAN( x, y, n, x1, n1, i );
+
+              if ( DBG ) fprintf( stderr, "%s %d..%d (x1 %d) = %u\n",
+                                  __FUNCTION__, (int)i, (int)n1, (int)x1, (GLuint)depth );
+
+              if ( mask ) {
+                 for ( ; n1>0 ; i++, x1++, n1-- ) {
+                    if ( mask[i] ) WRITE_DEPTH( x1, y, depth );
+                 }
+              } else {
+                 for ( ; n1>0 ; x1++, n1-- ) {
+                    WRITE_DEPTH( x1, y, depth );
+                 }
+              }
+           }
+        HW_ENDCLIPLOOP();
+      }
+   HW_WRITE_UNLOCK();
+}
+#endif
+
 static void TAG(WriteDepthPixels)( GLcontext *ctx,
                                   GLuint n,
                                   const GLint x[],
@@ -73,7 +111,7 @@ static void TAG(WriteDepthPixels)( GLcontext *ctx,
 {
    HW_WRITE_LOCK()
       {
-        GLint i;
+        GLuint i;
         LOCAL_DEPTH_VARS;
 
         if ( DBG ) fprintf( stderr, "WriteDepthPixels\n" );
@@ -124,8 +162,9 @@ static void TAG(ReadDepthSpan)( GLcontext *ctx,
            {
               GLint i = 0;
               CLIPSPAN( x, y, n, x1, n1, i );
-              for ( ; i < n1 ; i++ )
-                 READ_DEPTH( depth[i], (x1+i), y );
+              for ( ; n1>0 ; i++, n1-- ) {
+                 READ_DEPTH( depth[i], x+i, y );
+              }
            }
         HW_ENDCLIPLOOP();
 #endif
@@ -139,7 +178,7 @@ static void TAG(ReadDepthPixels)( GLcontext *ctx, GLuint n,
 {
    HW_READ_LOCK()
       {
-        GLint i;
+        GLuint i;
         LOCAL_DEPTH_VARS;
 
         if ( DBG ) fprintf( stderr, "ReadDepthPixels\n" );