1 /* $XFree86: xc/lib/GL/mesa/src/drv/common/depthtmp.h,v 1.5 2001/03/21 16:14:20 dawes Exp $ */
8 #ifndef HAVE_HW_DEPTH_SPANS
9 #define HAVE_HW_DEPTH_SPANS 0
11 #ifndef HAVE_HW_DEPTH_PIXELS
12 #define HAVE_HW_DEPTH_PIXELS 0
16 #define HW_READ_LOCK() HW_LOCK()
18 #ifndef HW_READ_UNLOCK
19 #define HW_READ_UNLOCK() HW_UNLOCK()
22 static void TAG(WriteDepthSpan
)( GLcontext
*ctx
,
23 GLuint n
, GLint x
, GLint y
,
25 const GLubyte mask
[] )
35 #if HAVE_HW_DEPTH_SPANS
38 if ( DBG
) fprintf( stderr
, "WriteDepthSpan 0..%d (x1 %d)\n",
46 CLIPSPAN( x
, y
, n
, x1
, n1
, i
);
48 if ( DBG
) fprintf( stderr
, "WriteDepthSpan %d..%d (x1 %d)\n",
49 (int)i
, (int)n1
, (int)x1
);
52 for ( ; i
< n1
; i
++, x1
++ ) {
53 if ( mask
[i
] ) WRITE_DEPTH( x1
, y
, depth
[i
] );
56 for ( ; i
< n1
; i
++, x1
++ ) {
57 WRITE_DEPTH( x1
, y
, depth
[i
] );
67 #if !HAVE_HW_DEPTH_SPANS
68 static void TAG(WriteMonoDepthSpan
)( GLcontext
*ctx
,
69 GLuint n
, GLint x
, GLint y
,
71 const GLubyte mask
[] )
84 CLIPSPAN( x
, y
, n
, x1
, n1
, i
);
86 if ( DBG
) fprintf( stderr
, "%s %d..%d (x1 %d) = %u\n",
87 __FUNCTION__
, (int)i
, (int)n1
, (int)x1
, (GLuint
)depth
);
90 for ( ; i
< n1
; i
++, x1
++ ) {
91 if ( mask
[i
] ) WRITE_DEPTH( x1
, y
, depth
);
94 for ( ; i
< n1
; i
++, x1
++ ) {
95 WRITE_DEPTH( x1
, y
, depth
);
105 static void TAG(WriteDepthPixels
)( GLcontext
*ctx
,
109 const GLdepth depth
[],
110 const GLubyte mask
[] )
117 if ( DBG
) fprintf( stderr
, "WriteDepthPixels\n" );
119 #if HAVE_HW_DEPTH_PIXELS
122 WRITE_DEPTH_PIXELS();
126 for ( i
= 0 ; i
< n
; i
++ ) {
128 const int fy
= Y_FLIP( y
[i
] );
129 if ( CLIPPIXEL( x
[i
], fy
) )
130 WRITE_DEPTH( x
[i
], fy
, depth
[i
] );
141 /* Read depth spans and pixels
143 static void TAG(ReadDepthSpan
)( GLcontext
*ctx
,
144 GLuint n
, GLint x
, GLint y
,
154 if ( DBG
) fprintf( stderr
, "ReadDepthSpan\n" );
156 #if HAVE_HW_DEPTH_SPANS
157 (void) x1
; (void) n1
;
164 CLIPSPAN( x
, y
, n
, x1
, n1
, i
);
165 for ( ; i
< n1
; i
++ )
166 READ_DEPTH( depth
[i
], (x1
+i
), y
);
174 static void TAG(ReadDepthPixels
)( GLcontext
*ctx
, GLuint n
,
175 const GLint x
[], const GLint y
[],
183 if ( DBG
) fprintf( stderr
, "ReadDepthPixels\n" );
185 #if HAVE_HW_DEPTH_PIXELS
192 for ( i
= 0 ; i
< n
;i
++ ) {
193 int fy
= Y_FLIP( y
[i
] );
194 if ( CLIPPIXEL( x
[i
], fy
) )
195 READ_DEPTH( depth
[i
], x
[i
], fy
);
205 #if HAVE_HW_DEPTH_SPANS
206 #undef WRITE_DEPTH_SPAN
207 #undef WRITE_DEPTH_PIXELS
208 #undef READ_DEPTH_SPAN
209 #undef READ_DEPTH_PIXELS