2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
26 #include "main/glheader.h"
27 #include "main/context.h"
28 #include "main/formats.h"
29 #include "main/format_unpack.h"
30 #include "main/format_pack.h"
31 #include "main/macros.h"
32 #include "main/imports.h"
34 #include "s_context.h"
40 #define Z_TEST(COMPARE) \
43 for (i = 0; i < n; i++) { \
48 zbuffer[i] = zfrag[i]; \
62 * Do depth test for an array of 16-bit Z values.
63 * @param zbuffer array of Z buffer values (16-bit)
64 * @param zfrag array of fragment Z values (use 16-bit in 32-bit uint)
65 * @param mask which fragments are alive, killed afterward
66 * @return number of fragments which pass the test.
69 depth_test_span16( struct gl_context
*ctx
, GLuint n
,
70 GLushort zbuffer
[], const GLuint zfrag
[], GLubyte mask
[] )
72 const GLboolean write
= ctx
->Depth
.Mask
;
75 /* switch cases ordered from most frequent to less frequent */
76 switch (ctx
->Depth
.Func
) {
78 Z_TEST(zfrag
[i
] < zbuffer
[i
]);
81 Z_TEST(zfrag
[i
] <= zbuffer
[i
]);
84 Z_TEST(zfrag
[i
] >= zbuffer
[i
]);
87 Z_TEST(zfrag
[i
] > zbuffer
[i
]);
90 Z_TEST(zfrag
[i
] != zbuffer
[i
]);
93 Z_TEST(zfrag
[i
] == zbuffer
[i
]);
99 memset(mask
, 0, n
* sizeof(GLubyte
));
102 _mesa_problem(ctx
, "Bad depth func in depth_test_span16");
110 * Do depth test for an array of 32-bit Z values.
111 * @param zbuffer array of Z buffer values (32-bit)
112 * @param zfrag array of fragment Z values (use 32-bits in 32-bit uint)
113 * @param mask which fragments are alive, killed afterward
114 * @return number of fragments which pass the test.
117 depth_test_span32( struct gl_context
*ctx
, GLuint n
,
118 GLuint zbuffer
[], const GLuint zfrag
[], GLubyte mask
[])
120 const GLboolean write
= ctx
->Depth
.Mask
;
123 /* switch cases ordered from most frequent to less frequent */
124 switch (ctx
->Depth
.Func
) {
126 Z_TEST(zfrag
[i
] < zbuffer
[i
]);
129 Z_TEST(zfrag
[i
] <= zbuffer
[i
]);
132 Z_TEST(zfrag
[i
] >= zbuffer
[i
]);
135 Z_TEST(zfrag
[i
] > zbuffer
[i
]);
138 Z_TEST(zfrag
[i
] != zbuffer
[i
]);
141 Z_TEST(zfrag
[i
] == zbuffer
[i
]);
147 memset(mask
, 0, n
* sizeof(GLubyte
));
150 _mesa_problem(ctx
, "Bad depth func in depth_test_span32");
158 * Clamp fragment Z values to the depth near/far range (glDepthRange()).
159 * This is used when GL_ARB_depth_clamp/GL_DEPTH_CLAMP is turned on.
160 * In that case, vertexes are not clipped against the near/far planes
161 * so rasterization will produce fragment Z values outside the usual
165 _swrast_depth_clamp_span( struct gl_context
*ctx
, SWspan
*span
)
167 struct gl_framebuffer
*fb
= ctx
->DrawBuffer
;
168 const GLuint count
= span
->end
;
169 GLint
*zValues
= (GLint
*) span
->array
->z
; /* sign change */
171 GLfloat min_f
, max_f
;
174 if (ctx
->ViewportArray
[0].Near
< ctx
->ViewportArray
[0].Far
) {
175 min_f
= ctx
->ViewportArray
[0].Near
;
176 max_f
= ctx
->ViewportArray
[0].Far
;
178 min_f
= ctx
->ViewportArray
[0].Far
;
179 max_f
= ctx
->ViewportArray
[0].Near
;
182 /* Convert floating point values in [0,1] to device Z coordinates in
184 * ex: If the Z buffer has 24 bits, DepthMax = 0xffffff.
186 * XXX this all falls apart if we have 31 or more bits of Z because
187 * the triangle rasterization code produces unsigned Z values. Negative
188 * vertex Z values come out as large fragment Z uints.
190 min
= (GLint
) (min_f
* fb
->_DepthMaxF
);
191 max
= (GLint
) (max_f
* fb
->_DepthMaxF
);
193 max
= 0x7fffffff; /* catch over flow for 30-bit z */
195 /* Note that we do the comparisons here using signed integers.
197 for (i
= 0; i
< count
; i
++) {
198 if (zValues
[i
] < min
)
200 if (zValues
[i
] > max
)
207 * Get array of 32-bit z values from the depth buffer. With clipping.
208 * Note: the returned values are always in the range [0, 2^32-1].
211 get_z32_values(struct gl_context
*ctx
, struct gl_renderbuffer
*rb
,
212 GLuint count
, const GLint x
[], const GLint y
[],
215 struct swrast_renderbuffer
*srb
= swrast_renderbuffer(rb
);
216 const GLint w
= rb
->Width
, h
= rb
->Height
;
217 const GLubyte
*map
= _swrast_pixel_address(rb
, 0, 0);
220 if (rb
->Format
== MESA_FORMAT_Z_UNORM32
) {
221 const GLint rowStride
= srb
->RowStride
;
222 for (i
= 0; i
< count
; i
++) {
223 if (x
[i
] >= 0 && y
[i
] >= 0 && x
[i
] < w
&& y
[i
] < h
) {
224 zbuffer
[i
] = *((GLuint
*) (map
+ y
[i
] * rowStride
+ x
[i
] * 4));
229 const GLint bpp
= _mesa_get_format_bytes(rb
->Format
);
230 const GLint rowStride
= srb
->RowStride
;
231 for (i
= 0; i
< count
; i
++) {
232 if (x
[i
] >= 0 && y
[i
] >= 0 && x
[i
] < w
&& y
[i
] < h
) {
233 const GLubyte
*src
= map
+ y
[i
] * rowStride
+ x
[i
] * bpp
;
234 _mesa_unpack_uint_z_row(rb
->Format
, 1, src
, &zbuffer
[i
]);
242 * Put an array of 32-bit z values into the depth buffer.
243 * Note: the z values are always in the range [0, 2^32-1].
246 put_z32_values(struct gl_context
*ctx
, struct gl_renderbuffer
*rb
,
247 GLuint count
, const GLint x
[], const GLint y
[],
248 const GLuint zvalues
[], const GLubyte mask
[])
250 struct swrast_renderbuffer
*srb
= swrast_renderbuffer(rb
);
251 const GLint w
= rb
->Width
, h
= rb
->Height
;
252 GLubyte
*map
= _swrast_pixel_address(rb
, 0, 0);
255 if (rb
->Format
== MESA_FORMAT_Z_UNORM32
) {
256 const GLint rowStride
= srb
->RowStride
;
257 for (i
= 0; i
< count
; i
++) {
258 if (mask
[i
] && x
[i
] >= 0 && y
[i
] >= 0 && x
[i
] < w
&& y
[i
] < h
) {
259 GLuint
*dst
= (GLuint
*) (map
+ y
[i
] * rowStride
+ x
[i
] * 4);
265 gl_pack_uint_z_func packZ
= _mesa_get_pack_uint_z_func(rb
->Format
);
266 const GLint bpp
= _mesa_get_format_bytes(rb
->Format
);
267 const GLint rowStride
= srb
->RowStride
;
268 for (i
= 0; i
< count
; i
++) {
269 if (mask
[i
] && x
[i
] >= 0 && y
[i
] >= 0 && x
[i
] < w
&& y
[i
] < h
) {
270 void *dst
= map
+ y
[i
] * rowStride
+ x
[i
] * bpp
;
271 packZ(zvalues
+ i
, dst
);
279 * Apply depth (Z) buffer testing to the span.
280 * \return approx number of pixels that passed (only zero is reliable)
283 _swrast_depth_test_span(struct gl_context
*ctx
, SWspan
*span
)
285 struct gl_framebuffer
*fb
= ctx
->DrawBuffer
;
286 struct gl_renderbuffer
*rb
= fb
->Attachment
[BUFFER_DEPTH
].Renderbuffer
;
287 const GLint bpp
= _mesa_get_format_bytes(rb
->Format
);
289 const GLuint count
= span
->end
;
290 const GLuint
*fragZ
= span
->array
->z
;
291 GLubyte
*mask
= span
->array
->mask
;
293 GLuint
*zBufferTemp
= NULL
;
295 GLuint zBits
= _mesa_get_format_bits(rb
->Format
, GL_DEPTH_BITS
);
296 GLboolean ztest16
= GL_FALSE
;
298 if (span
->arrayMask
& SPAN_XY
)
301 zStart
= _swrast_pixel_address(rb
, span
->x
, span
->y
);
303 if (rb
->Format
== MESA_FORMAT_Z_UNORM16
&& !(span
->arrayMask
& SPAN_XY
)) {
304 /* directly read/write row of 16-bit Z values */
305 zBufferVals
= zStart
;
308 else if (rb
->Format
== MESA_FORMAT_Z_UNORM32
&& !(span
->arrayMask
& SPAN_XY
)) {
309 /* directly read/write row of 32-bit Z values */
310 zBufferVals
= zStart
;
313 if (_mesa_get_format_datatype(rb
->Format
) != GL_UNSIGNED_NORMALIZED
) {
314 _mesa_problem(ctx
, "Incorrectly writing swrast's integer depth "
315 "values to %s depth buffer",
316 _mesa_get_format_name(rb
->Format
));
319 /* copy Z buffer values into temp buffer (32-bit Z values) */
320 zBufferTemp
= malloc(count
* sizeof(GLuint
));
324 if (span
->arrayMask
& SPAN_XY
) {
325 get_z32_values(ctx
, rb
, count
,
326 span
->array
->x
, span
->array
->y
, zBufferTemp
);
329 _mesa_unpack_uint_z_row(rb
->Format
, count
, zStart
, zBufferTemp
);
334 /* Convert depth buffer values from 32 to 24 bits to match the
335 * fragment Z values generated by rasterization.
337 for (i
= 0; i
< count
; i
++) {
338 zBufferTemp
[i
] >>= 8;
341 else if (zBits
== 16) {
343 /* Convert depth buffer values from 32 to 16 bits */
344 for (i
= 0; i
< count
; i
++) {
345 zBufferTemp
[i
] >>= 16;
352 zBufferVals
= zBufferTemp
;
355 /* do the depth test either with 16 or 32-bit values */
357 passed
= depth_test_span16(ctx
, count
, zBufferVals
, fragZ
, mask
);
359 passed
= depth_test_span32(ctx
, count
, zBufferVals
, fragZ
, mask
);
362 /* need to write temp Z values back into the buffer */
364 /* Convert depth buffer values back to 32-bit values. The least
365 * significant bits don't matter since they'll get dropped when
366 * they're packed back into the depth buffer.
370 for (i
= 0; i
< count
; i
++) {
371 zBufferTemp
[i
] = (zBufferTemp
[i
] << 8);
374 else if (zBits
== 16) {
376 for (i
= 0; i
< count
; i
++) {
377 zBufferTemp
[i
] = zBufferTemp
[i
] << 16;
381 if (span
->arrayMask
& SPAN_XY
) {
382 /* random locations */
383 put_z32_values(ctx
, rb
, count
, span
->array
->x
, span
->array
->y
,
388 gl_pack_uint_z_func packZ
= _mesa_get_pack_uint_z_func(rb
->Format
);
389 GLubyte
*dst
= zStart
;
391 for (i
= 0; i
< count
; i
++) {
393 packZ(&zBufferTemp
[i
], dst
);
402 if (passed
< count
) {
403 span
->writeAll
= GL_FALSE
;
410 * GL_EXT_depth_bounds_test extension.
411 * Discard fragments depending on whether the corresponding Z-buffer
412 * values are outside the depth bounds test range.
413 * Note: we test the Z buffer values, not the fragment Z values!
414 * \return GL_TRUE if any fragments pass, GL_FALSE if no fragments pass
417 _swrast_depth_bounds_test( struct gl_context
*ctx
, SWspan
*span
)
419 struct gl_framebuffer
*fb
= ctx
->DrawBuffer
;
420 struct gl_renderbuffer
*rb
= fb
->Attachment
[BUFFER_DEPTH
].Renderbuffer
;
422 GLuint zMin
= (GLuint
)((double)ctx
->Depth
.BoundsMin
* 0xffffffff);
423 GLuint zMax
= (GLuint
)((double)ctx
->Depth
.BoundsMax
* 0xffffffff);
424 GLubyte
*mask
= span
->array
->mask
;
425 const GLuint count
= span
->end
;
427 GLboolean anyPass
= GL_FALSE
;
429 const GLuint
*zBufferVals
;
431 zBufferTemp
= malloc(count
* sizeof(GLuint
));
433 /* don't generate a stream of OUT_OF_MEMORY errors here */
437 if (span
->arrayMask
& SPAN_XY
)
440 zStart
= _swrast_pixel_address(rb
, span
->x
, span
->y
);
442 if (rb
->Format
== MESA_FORMAT_Z_UNORM32
&& !(span
->arrayMask
& SPAN_XY
)) {
443 /* directly access 32-bit values in the depth buffer */
444 zBufferVals
= (const GLuint
*) zStart
;
447 /* Round the bounds to the precision of the zbuffer. */
448 if (rb
->Format
== MESA_FORMAT_Z_UNORM16
) {
449 zMin
= (zMin
& 0xffff0000) | (zMin
>> 16);
450 zMax
= (zMax
& 0xffff0000) | (zMax
>> 16);
453 zMin
= (zMin
& 0xffffff00) | (zMin
>> 24);
454 zMax
= (zMax
& 0xffffff00) | (zMax
>> 24);
457 /* unpack Z values into a temporary array */
458 if (span
->arrayMask
& SPAN_XY
) {
459 get_z32_values(ctx
, rb
, count
, span
->array
->x
, span
->array
->y
,
463 _mesa_unpack_uint_z_row(rb
->Format
, count
, zStart
, zBufferTemp
);
465 zBufferVals
= zBufferTemp
;
468 /* Now do the tests */
469 for (i
= 0; i
< count
; i
++) {
471 if (zBufferVals
[i
] < zMin
|| zBufferVals
[i
] > zMax
)
485 /**********************************************************************/
486 /***** Read Depth Buffer *****/
487 /**********************************************************************/
491 * Read a span of depth values from the given depth renderbuffer, returning
492 * the values as GLfloats.
493 * This function does clipping to prevent reading outside the depth buffer's
497 _swrast_read_depth_span_float(struct gl_context
*ctx
,
498 struct gl_renderbuffer
*rb
,
499 GLint n
, GLint x
, GLint y
, GLfloat depth
[])
502 /* really only doing this to prevent FP exceptions later */
503 memset(depth
, 0, n
* sizeof(GLfloat
));
507 if (y
< 0 || y
>= (GLint
) rb
->Height
||
508 x
+ n
<= 0 || x
>= (GLint
) rb
->Width
) {
509 /* span is completely outside framebuffer */
510 memset(depth
, 0, n
* sizeof(GLfloat
));
517 for (i
= 0; i
< dx
; i
++)
523 if (x
+ n
> (GLint
) rb
->Width
) {
524 GLint dx
= x
+ n
- (GLint
) rb
->Width
;
526 for (i
= 0; i
< dx
; i
++)
527 depth
[n
- i
- 1] = 0.0;
534 _mesa_unpack_float_z_row(rb
->Format
, n
, _swrast_pixel_address(rb
, x
, y
),
540 * Clear the given z/depth renderbuffer. If the buffer is a combined
541 * depth+stencil buffer, only the Z bits will be touched.
544 _swrast_clear_depth_buffer(struct gl_context
*ctx
)
546 struct gl_renderbuffer
*rb
=
547 ctx
->DrawBuffer
->Attachment
[BUFFER_DEPTH
].Renderbuffer
;
548 GLint x
, y
, width
, height
;
550 GLint rowStride
, i
, j
;
553 if (!rb
|| !ctx
->Depth
.Mask
) {
554 /* no depth buffer, or writing to it is disabled */
558 /* compute region to clear */
559 x
= ctx
->DrawBuffer
->_Xmin
;
560 y
= ctx
->DrawBuffer
->_Ymin
;
561 width
= ctx
->DrawBuffer
->_Xmax
- ctx
->DrawBuffer
->_Xmin
;
562 height
= ctx
->DrawBuffer
->_Ymax
- ctx
->DrawBuffer
->_Ymin
;
564 mapMode
= GL_MAP_WRITE_BIT
;
565 if (rb
->Format
== MESA_FORMAT_Z24_UNORM_S8_UINT
||
566 rb
->Format
== MESA_FORMAT_Z24_UNORM_X8_UINT
||
567 rb
->Format
== MESA_FORMAT_S8_UINT_Z24_UNORM
||
568 rb
->Format
== MESA_FORMAT_X8_UINT_Z24_UNORM
) {
569 mapMode
|= GL_MAP_READ_BIT
;
572 ctx
->Driver
.MapRenderbuffer(ctx
, rb
, x
, y
, width
, height
,
573 mapMode
, &map
, &rowStride
);
575 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glClear(depth)");
579 switch (rb
->Format
) {
580 case MESA_FORMAT_Z_UNORM16
:
582 GLfloat clear
= (GLfloat
) ctx
->Depth
.Clear
;
583 GLushort clearVal
= 0;
584 _mesa_pack_float_z_row(rb
->Format
, 1, &clear
, &clearVal
);
585 if (clearVal
== 0xffff && width
* 2 == rowStride
) {
587 memset(map
, 0xff, width
* height
* 2);
590 for (i
= 0; i
< height
; i
++) {
591 GLushort
*row
= (GLushort
*) map
;
592 for (j
= 0; j
< width
; j
++) {
600 case MESA_FORMAT_Z_UNORM32
:
601 case MESA_FORMAT_Z_FLOAT32
:
603 GLfloat clear
= (GLfloat
) ctx
->Depth
.Clear
;
605 _mesa_pack_float_z_row(rb
->Format
, 1, &clear
, &clearVal
);
606 for (i
= 0; i
< height
; i
++) {
607 GLuint
*row
= (GLuint
*) map
;
608 for (j
= 0; j
< width
; j
++) {
615 case MESA_FORMAT_Z24_UNORM_S8_UINT
:
616 case MESA_FORMAT_Z24_UNORM_X8_UINT
:
617 case MESA_FORMAT_S8_UINT_Z24_UNORM
:
618 case MESA_FORMAT_X8_UINT_Z24_UNORM
:
620 GLfloat clear
= (GLfloat
) ctx
->Depth
.Clear
;
624 if (rb
->Format
== MESA_FORMAT_Z24_UNORM_S8_UINT
||
625 rb
->Format
== MESA_FORMAT_Z24_UNORM_X8_UINT
)
630 _mesa_pack_float_z_row(rb
->Format
, 1, &clear
, &clearVal
);
631 for (i
= 0; i
< height
; i
++) {
632 GLuint
*row
= (GLuint
*) map
;
633 for (j
= 0; j
< width
; j
++) {
634 row
[j
] = (row
[j
] & mask
) | clearVal
;
641 case MESA_FORMAT_Z32_FLOAT_S8X24_UINT
:
644 GLfloat clearVal
= (GLfloat
) ctx
->Depth
.Clear
;
645 for (i
= 0; i
< height
; i
++) {
646 GLfloat
*row
= (GLfloat
*) map
;
647 for (j
= 0; j
< width
; j
++) {
648 row
[j
* 2] = clearVal
;
655 _mesa_problem(ctx
, "Unexpected depth buffer format %s"
656 " in _swrast_clear_depth_buffer()",
657 _mesa_get_format_name(rb
->Format
));
660 ctx
->Driver
.UnmapRenderbuffer(ctx
, rb
);
667 * Clear both depth and stencil values in a combined depth+stencil buffer.
670 _swrast_clear_depth_stencil_buffer(struct gl_context
*ctx
)
672 const GLubyte stencilBits
= ctx
->DrawBuffer
->Visual
.stencilBits
;
673 const GLuint writeMask
= ctx
->Stencil
.WriteMask
[0];
674 const GLuint stencilMax
= (1 << stencilBits
) - 1;
675 struct gl_renderbuffer
*rb
=
676 ctx
->DrawBuffer
->Attachment
[BUFFER_DEPTH
].Renderbuffer
;
677 GLint x
, y
, width
, height
;
680 GLint rowStride
, i
, j
;
682 /* check that we really have a combined depth+stencil buffer */
683 assert(rb
== ctx
->DrawBuffer
->Attachment
[BUFFER_STENCIL
].Renderbuffer
);
685 /* compute region to clear */
686 x
= ctx
->DrawBuffer
->_Xmin
;
687 y
= ctx
->DrawBuffer
->_Ymin
;
688 width
= ctx
->DrawBuffer
->_Xmax
- ctx
->DrawBuffer
->_Xmin
;
689 height
= ctx
->DrawBuffer
->_Ymax
- ctx
->DrawBuffer
->_Ymin
;
691 mapMode
= GL_MAP_WRITE_BIT
;
692 if ((writeMask
& stencilMax
) != stencilMax
) {
693 /* need to mask stencil values */
694 mapMode
|= GL_MAP_READ_BIT
;
697 ctx
->Driver
.MapRenderbuffer(ctx
, rb
, x
, y
, width
, height
,
698 mapMode
, &map
, &rowStride
);
700 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glClear(depth+stencil)");
704 switch (rb
->Format
) {
705 case MESA_FORMAT_Z24_UNORM_S8_UINT
:
706 case MESA_FORMAT_S8_UINT_Z24_UNORM
:
708 GLfloat zClear
= (GLfloat
) ctx
->Depth
.Clear
;
709 GLuint clear
= 0, mask
;
711 _mesa_pack_float_z_row(rb
->Format
, 1, &zClear
, &clear
);
713 if (rb
->Format
== MESA_FORMAT_Z24_UNORM_S8_UINT
) {
714 mask
= ((~writeMask
) & 0xff) << 24;
715 clear
|= (ctx
->Stencil
.Clear
& writeMask
& 0xff) << 24;
718 mask
= ((~writeMask
) & 0xff);
719 clear
|= (ctx
->Stencil
.Clear
& writeMask
& 0xff);
722 for (i
= 0; i
< height
; i
++) {
723 GLuint
*row
= (GLuint
*) map
;
725 for (j
= 0; j
< width
; j
++) {
726 row
[j
] = (row
[j
] & mask
) | clear
;
730 for (j
= 0; j
< width
; j
++) {
738 case MESA_FORMAT_Z32_FLOAT_S8X24_UINT
:
741 const GLfloat zClear
= (GLfloat
) ctx
->Depth
.Clear
;
742 const GLuint sClear
= ctx
->Stencil
.Clear
& writeMask
;
743 const GLuint sMask
= (~writeMask
) & 0xff;
744 for (i
= 0; i
< height
; i
++) {
745 GLfloat
*zRow
= (GLfloat
*) map
;
746 GLuint
*sRow
= (GLuint
*) map
;
747 for (j
= 0; j
< width
; j
++) {
748 zRow
[j
* 2 + 0] = zClear
;
751 for (j
= 0; j
< width
; j
++) {
752 sRow
[j
* 2 + 1] = (sRow
[j
* 2 + 1] & sMask
) | sClear
;
756 for (j
= 0; j
< width
; j
++) {
757 sRow
[j
* 2 + 1] = sClear
;
765 _mesa_problem(ctx
, "Unexpected depth buffer format %s"
766 " in _swrast_clear_depth_buffer()",
767 _mesa_get_format_name(rb
->Format
));
770 ctx
->Driver
.UnmapRenderbuffer(ctx
, rb
);