Changed escaping of double quotes.
[mesa.git] / src / mesa / drivers / dri / common / depthtmp.h
1 /* $XFree86: xc/lib/GL/mesa/src/drv/common/depthtmp.h,v 1.5 2001/03/21 16:14:20 dawes Exp $ */
2
3 #ifndef DBG
4 #define DBG 0
5 #endif
6
7
8 #ifndef HAVE_HW_DEPTH_SPANS
9 #define HAVE_HW_DEPTH_SPANS 0
10 #endif
11 #ifndef HAVE_HW_DEPTH_PIXELS
12 #define HAVE_HW_DEPTH_PIXELS 0
13 #endif
14
15 #ifndef HW_READ_LOCK
16 #define HW_READ_LOCK() HW_LOCK()
17 #endif
18 #ifndef HW_READ_UNLOCK
19 #define HW_READ_UNLOCK() HW_UNLOCK()
20 #endif
21
22 static void TAG(WriteDepthSpan)( GLcontext *ctx,
23 GLuint n, GLint x, GLint y,
24 const GLdepth *depth,
25 const GLubyte mask[] )
26 {
27 HW_WRITE_LOCK()
28 {
29 GLint x1;
30 GLint n1;
31 LOCAL_DEPTH_VARS;
32
33 y = Y_FLIP( y );
34
35 #if HAVE_HW_DEPTH_SPANS
36 (void) x1; (void) n1;
37
38 if ( DBG ) fprintf( stderr, "WriteDepthSpan 0..%d (x1 %d)\n",
39 (int)n, (int)x );
40
41 WRITE_DEPTH_SPAN();
42 #else
43 HW_CLIPLOOP()
44 {
45 GLint i = 0;
46 CLIPSPAN( x, y, n, x1, n1, i );
47
48 if ( DBG ) fprintf( stderr, "WriteDepthSpan %d..%d (x1 %d) (mask %p)\n",
49 (int)i, (int)n1, (int)x1, mask );
50
51 if ( mask ) {
52 for ( ; n1>0 ; i++, x1++, n1-- ) {
53 if ( mask[i] ) WRITE_DEPTH( x1, y, depth[i] );
54 }
55 } else {
56 for ( ; n1>0 ; i++, x1++, n1-- ) {
57 WRITE_DEPTH( x1, y, depth[i] );
58 }
59 }
60 }
61 HW_ENDCLIPLOOP();
62 #endif
63 }
64 HW_WRITE_UNLOCK();
65 }
66
67 #if !HAVE_HW_DEPTH_SPANS
68 static void TAG(WriteMonoDepthSpan)( GLcontext *ctx,
69 GLuint n, GLint x, GLint y,
70 const GLdepth depth,
71 const GLubyte mask[] )
72 {
73 HW_WRITE_LOCK()
74 {
75 GLint x1;
76 GLint n1;
77 LOCAL_DEPTH_VARS;
78
79 y = Y_FLIP( y );
80
81 HW_CLIPLOOP()
82 {
83 GLint i = 0;
84 CLIPSPAN( x, y, n, x1, n1, i );
85
86 if ( DBG ) fprintf( stderr, "%s %d..%d (x1 %d) = %u\n",
87 __FUNCTION__, (int)i, (int)n1, (int)x1, (GLuint)depth );
88
89 if ( mask ) {
90 for ( ; n1>0 ; i++, x1++, n1-- ) {
91 if ( mask[i] ) WRITE_DEPTH( x1, y, depth );
92 }
93 } else {
94 for ( ; n1>0 ; x1++, n1-- ) {
95 WRITE_DEPTH( x1, y, depth );
96 }
97 }
98 }
99 HW_ENDCLIPLOOP();
100 }
101 HW_WRITE_UNLOCK();
102 }
103 #endif
104
105 static void TAG(WriteDepthPixels)( GLcontext *ctx,
106 GLuint n,
107 const GLint x[],
108 const GLint y[],
109 const GLdepth depth[],
110 const GLubyte mask[] )
111 {
112 HW_WRITE_LOCK()
113 {
114 GLuint i;
115 LOCAL_DEPTH_VARS;
116
117 if ( DBG ) fprintf( stderr, "WriteDepthPixels\n" );
118
119 #if HAVE_HW_DEPTH_PIXELS
120 (void) i;
121
122 WRITE_DEPTH_PIXELS();
123 #else
124 HW_CLIPLOOP()
125 {
126 for ( i = 0 ; i < n ; i++ ) {
127 if ( mask[i] ) {
128 const int fy = Y_FLIP( y[i] );
129 if ( CLIPPIXEL( x[i], fy ) )
130 WRITE_DEPTH( x[i], fy, depth[i] );
131 }
132 }
133 }
134 HW_ENDCLIPLOOP();
135 #endif
136 }
137 HW_WRITE_UNLOCK();
138 }
139
140
141 /* Read depth spans and pixels
142 */
143 static void TAG(ReadDepthSpan)( GLcontext *ctx,
144 GLuint n, GLint x, GLint y,
145 GLdepth depth[] )
146 {
147 HW_READ_LOCK()
148 {
149 GLint x1, n1;
150 LOCAL_DEPTH_VARS;
151
152 y = Y_FLIP( y );
153
154 if ( DBG ) fprintf( stderr, "ReadDepthSpan\n" );
155
156 #if HAVE_HW_DEPTH_SPANS
157 (void) x1; (void) n1;
158
159 READ_DEPTH_SPAN();
160 #else
161 HW_CLIPLOOP()
162 {
163 GLint i = 0;
164 CLIPSPAN( x, y, n, x1, n1, i );
165 for ( ; n1>0 ; i++, n1-- ) {
166 READ_DEPTH( depth[i], x+i, y );
167 }
168 }
169 HW_ENDCLIPLOOP();
170 #endif
171 }
172 HW_READ_UNLOCK();
173 }
174
175 static void TAG(ReadDepthPixels)( GLcontext *ctx, GLuint n,
176 const GLint x[], const GLint y[],
177 GLdepth depth[] )
178 {
179 HW_READ_LOCK()
180 {
181 GLuint i;
182 LOCAL_DEPTH_VARS;
183
184 if ( DBG ) fprintf( stderr, "ReadDepthPixels\n" );
185
186 #if HAVE_HW_DEPTH_PIXELS
187 (void) i;
188
189 READ_DEPTH_PIXELS();
190 #else
191 HW_CLIPLOOP()
192 {
193 for ( i = 0 ; i < n ;i++ ) {
194 int fy = Y_FLIP( y[i] );
195 if ( CLIPPIXEL( x[i], fy ) )
196 READ_DEPTH( depth[i], x[i], fy );
197 }
198 }
199 HW_ENDCLIPLOOP();
200 #endif
201 }
202 HW_READ_UNLOCK();
203 }
204
205
206 #if HAVE_HW_DEPTH_SPANS
207 #undef WRITE_DEPTH_SPAN
208 #undef WRITE_DEPTH_PIXELS
209 #undef READ_DEPTH_SPAN
210 #undef READ_DEPTH_PIXELS
211 #else
212 #undef WRITE_DEPTH
213 #undef READ_DEPTH
214 #endif
215 #undef TAG