2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 #include "s_context.h"
37 * Do depth test for a horizontal span of fragments.
38 * Input: zbuffer - array of z values in the zbuffer
39 * z - array of fragment z values
40 * Return: number of fragments which pass the test.
43 depth_test_span16( GLcontext
*ctx
, GLuint n
,
44 GLushort zbuffer
[], const GLuint z
[], GLubyte mask
[] )
48 /* switch cases ordered from most frequent to less frequent */
49 switch (ctx
->Depth
.Func
) {
51 if (ctx
->Depth
.Mask
) {
56 if (z
[i
] < zbuffer
[i
]) {
69 /* Don't update Z buffer */
73 if (z
[i
] < zbuffer
[i
]) {
85 if (ctx
->Depth
.Mask
) {
90 if (z
[i
] <= zbuffer
[i
]) {
101 /* Don't update Z buffer */
105 if (z
[i
] <= zbuffer
[i
]) {
117 if (ctx
->Depth
.Mask
) {
118 /* Update Z buffer */
122 if (z
[i
] >= zbuffer
[i
]) {
133 /* Don't update Z buffer */
137 if (z
[i
] >= zbuffer
[i
]) {
149 if (ctx
->Depth
.Mask
) {
150 /* Update Z buffer */
154 if (z
[i
] > zbuffer
[i
]) {
165 /* Don't update Z buffer */
169 if (z
[i
] > zbuffer
[i
]) {
181 if (ctx
->Depth
.Mask
) {
182 /* Update Z buffer */
186 if (z
[i
] != zbuffer
[i
]) {
197 /* Don't update Z buffer */
201 if (z
[i
] != zbuffer
[i
]) {
213 if (ctx
->Depth
.Mask
) {
214 /* Update Z buffer */
218 if (z
[i
] == zbuffer
[i
]) {
229 /* Don't update Z buffer */
233 if (z
[i
] == zbuffer
[i
]) {
245 if (ctx
->Depth
.Mask
) {
246 /* Update Z buffer */
256 /* Don't update Z buffer or mask */
261 _mesa_bzero(mask
, n
* sizeof(GLubyte
));
264 _mesa_problem(ctx
, "Bad depth func in depth_test_span16");
272 depth_test_span32( GLcontext
*ctx
, GLuint n
,
273 GLuint zbuffer
[], const GLuint z
[], GLubyte mask
[] )
277 /* switch cases ordered from most frequent to less frequent */
278 switch (ctx
->Depth
.Func
) {
280 if (ctx
->Depth
.Mask
) {
281 /* Update Z buffer */
283 for (i
=0; i
<n
; i
++) {
285 if (z
[i
] < zbuffer
[i
]) {
298 /* Don't update Z buffer */
300 for (i
=0; i
<n
; i
++) {
302 if (z
[i
] < zbuffer
[i
]) {
314 if (ctx
->Depth
.Mask
) {
315 /* Update Z buffer */
319 if (z
[i
] <= zbuffer
[i
]) {
330 /* Don't update Z buffer */
334 if (z
[i
] <= zbuffer
[i
]) {
346 if (ctx
->Depth
.Mask
) {
347 /* Update Z buffer */
351 if (z
[i
] >= zbuffer
[i
]) {
362 /* Don't update Z buffer */
366 if (z
[i
] >= zbuffer
[i
]) {
378 if (ctx
->Depth
.Mask
) {
379 /* Update Z buffer */
383 if (z
[i
] > zbuffer
[i
]) {
394 /* Don't update Z buffer */
398 if (z
[i
] > zbuffer
[i
]) {
410 if (ctx
->Depth
.Mask
) {
411 /* Update Z buffer */
415 if (z
[i
] != zbuffer
[i
]) {
426 /* Don't update Z buffer */
430 if (z
[i
] != zbuffer
[i
]) {
442 if (ctx
->Depth
.Mask
) {
443 /* Update Z buffer */
447 if (z
[i
] == zbuffer
[i
]) {
458 /* Don't update Z buffer */
462 if (z
[i
] == zbuffer
[i
]) {
474 if (ctx
->Depth
.Mask
) {
475 /* Update Z buffer */
485 /* Don't update Z buffer or mask */
490 _mesa_bzero(mask
, n
* sizeof(GLubyte
));
493 _mesa_problem(ctx
, "Bad depth func in depth_test_span32");
502 * Apply depth test to span of fragments.
505 depth_test_span( GLcontext
*ctx
, struct sw_span
*span
)
507 struct gl_framebuffer
*fb
= ctx
->DrawBuffer
;
508 struct gl_renderbuffer
*rb
= fb
->Attachment
[BUFFER_DEPTH
].Renderbuffer
;
509 const GLint x
= span
->x
;
510 const GLint y
= span
->y
;
511 const GLuint count
= span
->end
;
512 const GLuint
*zValues
= span
->array
->z
;
513 GLubyte
*mask
= span
->array
->mask
;
516 ASSERT((span
->arrayMask
& SPAN_XY
) == 0);
517 ASSERT(span
->arrayMask
& SPAN_Z
);
519 if (rb
->GetPointer(ctx
, rb
, 0, 0)) {
520 /* Directly access buffer */
521 if (ctx
->DrawBuffer
->Visual
.depthBits
<= 16) {
522 GLushort
*zbuffer
= (GLushort
*) rb
->GetPointer(ctx
, rb
, x
, y
);
523 passed
= depth_test_span16(ctx
, count
, zbuffer
, zValues
, mask
);
526 GLuint
*zbuffer
= (GLuint
*) rb
->GetPointer(ctx
, rb
, x
, y
);
527 passed
= depth_test_span32(ctx
, count
, zbuffer
, zValues
, mask
);
531 /* read depth values from buffer, test, write back */
532 if (rb
->DataType
== GL_UNSIGNED_SHORT
) {
533 GLushort zbuffer
[MAX_WIDTH
];
534 rb
->GetRow(ctx
, rb
, count
, x
, y
, zbuffer
);
535 passed
= depth_test_span16(ctx
, count
, zbuffer
, zValues
, mask
);
536 rb
->PutRow(ctx
, rb
, count
, x
, y
, zbuffer
, NULL
);
539 GLuint zbuffer
[MAX_WIDTH
];
540 ASSERT(rb
->DataType
== GL_UNSIGNED_INT
);
541 rb
->GetRow(ctx
, rb
, count
, x
, y
, zbuffer
);
542 passed
= depth_test_span32(ctx
, count
, zbuffer
, zValues
, mask
);
543 rb
->PutRow(ctx
, rb
, count
, x
, y
, zbuffer
, NULL
);
547 if (passed
< count
) {
548 span
->writeAll
= GL_FALSE
;
555 #define Z_ADDRESS(X, Y) (zStart + (Y) * stride + (X))
559 * Do depth testing for an array of fragments at assorted locations.
562 direct_depth_test_pixels16(GLcontext
*ctx
, GLushort
*zStart
, GLuint stride
,
563 GLuint n
, const GLint x
[], const GLint y
[],
564 const GLuint z
[], GLubyte mask
[] )
566 /* switch cases ordered from most frequent to less frequent */
567 switch (ctx
->Depth
.Func
) {
569 if (ctx
->Depth
.Mask
) {
570 /* Update Z buffer */
572 for (i
=0; i
<n
; i
++) {
574 GLushort
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
587 /* Don't update Z buffer */
589 for (i
=0; i
<n
; i
++) {
591 GLushort
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
604 if (ctx
->Depth
.Mask
) {
605 /* Update Z buffer */
607 for (i
=0; i
<n
; i
++) {
609 GLushort
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
622 /* Don't update Z buffer */
624 for (i
=0; i
<n
; i
++) {
626 GLushort
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
639 if (ctx
->Depth
.Mask
) {
640 /* Update Z buffer */
642 for (i
=0; i
<n
; i
++) {
644 GLushort
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
657 /* Don't update Z buffer */
659 for (i
=0; i
<n
; i
++) {
661 GLushort
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
674 if (ctx
->Depth
.Mask
) {
675 /* Update Z buffer */
677 for (i
=0; i
<n
; i
++) {
679 GLushort
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
692 /* Don't update Z buffer */
694 for (i
=0; i
<n
; i
++) {
696 GLushort
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
709 if (ctx
->Depth
.Mask
) {
710 /* Update Z buffer */
712 for (i
=0; i
<n
; i
++) {
714 GLushort
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
727 /* Don't update Z buffer */
729 for (i
=0; i
<n
; i
++) {
731 GLushort
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
744 if (ctx
->Depth
.Mask
) {
745 /* Update Z buffer */
747 for (i
=0; i
<n
; i
++) {
749 GLushort
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
762 /* Don't update Z buffer */
764 for (i
=0; i
<n
; i
++) {
766 GLushort
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
779 if (ctx
->Depth
.Mask
) {
780 /* Update Z buffer */
782 for (i
=0; i
<n
; i
++) {
784 GLushort
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
790 /* Don't update Z buffer or mask */
794 /* depth test never passes */
795 _mesa_bzero(mask
, n
* sizeof(GLubyte
));
798 _mesa_problem(ctx
, "Bad depth func in direct_depth_test_pixels");
805 * Do depth testing for an array of fragments with direct access to zbuffer.
808 direct_depth_test_pixels32(GLcontext
*ctx
, GLuint
*zStart
, GLuint stride
,
809 GLuint n
, const GLint x
[], const GLint y
[],
810 const GLuint z
[], GLubyte mask
[] )
812 /* switch cases ordered from most frequent to less frequent */
813 switch (ctx
->Depth
.Func
) {
815 if (ctx
->Depth
.Mask
) {
816 /* Update Z buffer */
818 for (i
=0; i
<n
; i
++) {
820 GLuint
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
833 /* Don't update Z buffer */
835 for (i
=0; i
<n
; i
++) {
837 GLuint
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
850 if (ctx
->Depth
.Mask
) {
851 /* Update Z buffer */
853 for (i
=0; i
<n
; i
++) {
855 GLuint
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
868 /* Don't update Z buffer */
870 for (i
=0; i
<n
; i
++) {
872 GLuint
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
885 if (ctx
->Depth
.Mask
) {
886 /* Update Z buffer */
888 for (i
=0; i
<n
; i
++) {
890 GLuint
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
903 /* Don't update Z buffer */
905 for (i
=0; i
<n
; i
++) {
907 GLuint
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
920 if (ctx
->Depth
.Mask
) {
921 /* Update Z buffer */
923 for (i
=0; i
<n
; i
++) {
925 GLuint
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
938 /* Don't update Z buffer */
940 for (i
=0; i
<n
; i
++) {
942 GLuint
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
955 if (ctx
->Depth
.Mask
) {
956 /* Update Z buffer */
958 for (i
=0; i
<n
; i
++) {
960 GLuint
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
973 /* Don't update Z buffer */
975 for (i
=0; i
<n
; i
++) {
977 GLuint
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
990 if (ctx
->Depth
.Mask
) {
991 /* Update Z buffer */
993 for (i
=0; i
<n
; i
++) {
995 GLuint
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
1008 /* Don't update Z buffer */
1010 for (i
=0; i
<n
; i
++) {
1012 GLuint
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
1013 if (z
[i
] == *zptr
) {
1025 if (ctx
->Depth
.Mask
) {
1026 /* Update Z buffer */
1028 for (i
=0; i
<n
; i
++) {
1030 GLuint
*zptr
= Z_ADDRESS(x
[i
], y
[i
]);
1036 /* Don't update Z buffer or mask */
1040 /* depth test never passes */
1041 _mesa_bzero(mask
, n
* sizeof(GLubyte
));
1044 _mesa_problem(ctx
, "Bad depth func in direct_depth_test_pixels");
1052 depth_test_pixels( GLcontext
*ctx
, struct sw_span
*span
)
1054 struct gl_framebuffer
*fb
= ctx
->DrawBuffer
;
1055 struct gl_renderbuffer
*rb
= fb
->Attachment
[BUFFER_DEPTH
].Renderbuffer
;
1056 const GLuint count
= span
->end
;
1057 const GLint
*x
= span
->array
->x
;
1058 const GLint
*y
= span
->array
->y
;
1059 const GLuint
*z
= span
->array
->z
;
1060 GLubyte
*mask
= span
->array
->mask
;
1062 if (rb
->GetPointer(ctx
, rb
, 0, 0)) {
1063 /* Directly access values */
1064 if (rb
->DataType
== GL_UNSIGNED_SHORT
) {
1065 GLushort
*zStart
= (GLushort
*) rb
->Data
;
1066 GLuint stride
= rb
->Width
;
1067 direct_depth_test_pixels16(ctx
, zStart
, stride
, count
, x
, y
, z
, mask
);
1070 GLuint
*zStart
= (GLuint
*) rb
->Data
;
1071 GLuint stride
= rb
->Width
;
1072 direct_depth_test_pixels32(ctx
, zStart
, stride
, count
, x
, y
, z
, mask
);
1076 /* read depth values from buffer, test, write back */
1077 if (rb
->DataType
== GL_UNSIGNED_SHORT
) {
1078 GLushort zbuffer
[MAX_WIDTH
];
1079 rb
->GetValues(ctx
, rb
, count
, x
, y
, zbuffer
);
1080 depth_test_span16(ctx
, count
, zbuffer
, z
, mask
);
1081 rb
->PutValues(ctx
, rb
, count
, x
, y
, zbuffer
, NULL
);
1084 GLuint zbuffer
[MAX_WIDTH
];
1085 ASSERT(rb
->DataType
== GL_UNSIGNED_INT
);
1086 rb
->GetValues(ctx
, rb
, count
, x
, y
, zbuffer
);
1087 depth_test_span32(ctx
, count
, zbuffer
, z
, mask
);
1088 rb
->PutValues(ctx
, rb
, count
, x
, y
, zbuffer
, NULL
);
1092 return count
; /* not really correct, but OK */
1097 * Apply depth (Z) buffer testing to the span.
1098 * \return approx number of pixels that passed (only zero is reliable)
1101 _swrast_depth_test_span( GLcontext
*ctx
, struct sw_span
*span
)
1103 if (span
->arrayMask
& SPAN_XY
)
1104 return depth_test_pixels(ctx
, span
);
1106 return depth_test_span(ctx
, span
);
1111 * GL_EXT_depth_bounds_test extension.
1112 * Discard fragments depending on whether the corresponding Z-buffer
1113 * values are outside the depth bounds test range.
1114 * Note: we test the Z buffer values, not the fragment Z values!
1115 * \return GL_TRUE if any fragments pass, GL_FALSE if no fragments pass
1118 _swrast_depth_bounds_test( GLcontext
*ctx
, struct sw_span
*span
)
1120 struct gl_framebuffer
*fb
= ctx
->DrawBuffer
;
1121 struct gl_renderbuffer
*rb
= fb
->Attachment
[BUFFER_DEPTH
].Renderbuffer
;
1122 GLuint zMin
= (GLuint
) (ctx
->Depth
.BoundsMin
* fb
->_DepthMaxF
+ 0.5F
);
1123 GLuint zMax
= (GLuint
) (ctx
->Depth
.BoundsMax
* fb
->_DepthMaxF
+ 0.5F
);
1124 GLubyte
*mask
= span
->array
->mask
;
1125 const GLuint count
= span
->end
;
1127 GLboolean anyPass
= GL_FALSE
;
1129 if (rb
->DataType
== GL_UNSIGNED_SHORT
) {
1130 /* get 16-bit values */
1131 GLushort zbuffer16
[MAX_WIDTH
], *zbuffer
;
1132 if (span
->arrayMask
& SPAN_XY
) {
1133 rb
->GetValues(ctx
, rb
, count
, span
->array
->x
, span
->array
->y
, zbuffer16
);
1134 zbuffer
= zbuffer16
;
1137 zbuffer
= rb
->GetPointer(ctx
, rb
, span
->x
, span
->y
);
1139 rb
->GetRow(ctx
, rb
, count
, span
->x
, span
->y
, zbuffer16
);
1140 zbuffer
= zbuffer16
;
1145 /* Now do the tests */
1146 for (i
= 0; i
< count
; i
++) {
1148 if (zbuffer
[i
] < zMin
|| zbuffer
[i
] > zMax
)
1156 /* get 32-bit values */
1157 GLuint zbuffer32
[MAX_WIDTH
], *zbuffer
;
1158 if (span
->arrayMask
& SPAN_XY
) {
1159 rb
->GetValues(ctx
, rb
, count
, span
->array
->x
, span
->array
->y
, zbuffer32
);
1160 zbuffer
= zbuffer32
;
1163 zbuffer
= rb
->GetPointer(ctx
, rb
, span
->x
, span
->y
);
1165 rb
->GetRow(ctx
, rb
, count
, span
->x
, span
->y
, zbuffer32
);
1166 zbuffer
= zbuffer32
;
1171 /* Now do the tests */
1172 for (i
= 0; i
< count
; i
++) {
1174 if (zbuffer
[i
] < zMin
|| zbuffer
[i
] > zMax
)
1187 /**********************************************************************/
1188 /***** Read Depth Buffer *****/
1189 /**********************************************************************/
1193 * Read a span of depth values from the depth buffer.
1194 * This function does clipping before calling the device driver function.
1196 * XXXX this is no longer a swrast function!!!
1200 _swrast_read_depth_span( GLcontext
*ctx
, struct gl_renderbuffer
*rb
,
1201 GLint n
, GLint x
, GLint y
, GLuint depth
[] )
1203 if (y
< 0 || y
>= (GLint
) rb
->Height
||
1204 x
+ (GLint
) n
<= 0 || x
>= (GLint
) rb
->Width
) {
1205 /* span is completely outside framebuffer */
1207 for (i
= 0; i
< n
; i
++)
1215 for (i
= 0; i
< dx
; i
++)
1221 if (x
+ n
> (GLint
) rb
->Width
) {
1222 GLint dx
= x
+ n
- (GLint
) rb
->Width
;
1224 for (i
= 0; i
< dx
; i
++)
1225 depth
[n
- i
- 1] = 0;
1232 /* we'll always return 32-bit values to our caller */
1234 _mesa_bzero(depth
, n
* sizeof(GLuint
));
1236 else if (rb
->DataType
== GL_UNSIGNED_INT
) {
1237 rb
->GetRow(ctx
, rb
, n
, x
, y
, depth
);
1240 GLushort temp
[MAX_WIDTH
];
1242 ASSERT(rb
->DataType
== GL_UNSIGNED_SHORT
);
1243 rb
->GetRow(ctx
, rb
, n
, x
, y
, temp
);
1244 for (i
= 0; i
< n
; i
++) {
1252 * Return a span of depth values from the depth buffer as floats in [0,1].
1253 * Input: n - how many pixels
1254 * x,y - location of first pixel
1255 * Output: depth - the array of depth values
1258 _swrast_read_depth_span_float( GLcontext
*ctx
, struct gl_renderbuffer
*rb
,
1259 GLint n
, GLint x
, GLint y
, GLfloat depth
[] )
1261 const GLfloat scale
= 1.0F
/ ctx
->DrawBuffer
->_DepthMaxF
;
1262 GLuint temp
[MAX_WIDTH
];
1265 assert(n
<= MAX_WIDTH
);
1267 _swrast_read_depth_span(ctx
, rb
, n
, x
, y
, temp
);
1268 for (i
= 0; i
< n
; i
++) {
1269 depth
[i
] = temp
[i
] * scale
;
1275 * Clear the depth buffer.
1276 * XXX this is no longer a swrast function!!!
1279 _swrast_clear_depth_buffer( GLcontext
*ctx
, struct gl_renderbuffer
*rb
)
1281 const GLuint clearValue
1282 = (GLuint
) (ctx
->Depth
.Clear
* ctx
->DrawBuffer
->_DepthMaxF
);
1283 GLint x
, y
, width
, height
;
1285 if (!rb
|| !ctx
->Depth
.Mask
) {
1286 /* no depth buffer, or writing to it is disabled */
1290 assert(rb
->_BaseFormat
== GL_DEPTH_COMPONENT
);
1292 /* compute region to clear */
1293 x
= ctx
->DrawBuffer
->_Xmin
;
1294 y
= ctx
->DrawBuffer
->_Ymin
;
1295 width
= ctx
->DrawBuffer
->_Xmax
- ctx
->DrawBuffer
->_Xmin
;
1296 height
= ctx
->DrawBuffer
->_Ymax
- ctx
->DrawBuffer
->_Ymin
;
1298 if (rb
->GetPointer(ctx
, rb
, 0, 0)) {
1299 /* Direct buffer access is possible. Either this is just malloc'd
1300 * memory, or perhaps the driver mmap'd the zbuffer memory.
1302 if (rb
->DataType
== GL_UNSIGNED_SHORT
) {
1303 if (width
== rb
->Width
&&
1304 (clearValue
& 0xff) == ((clearValue
>> 8) & 0xff)) {
1305 /* optimized case */
1306 GLushort
*dst
= (GLushort
*) rb
->GetPointer(ctx
, rb
, x
, y
);
1307 GLuint len
= width
* height
* sizeof(GLushort
);
1308 _mesa_memset(dst
, (clearValue
& 0xff), len
);
1313 for (i
= 0; i
< height
; i
++) {
1314 GLushort
*dst
= (GLushort
*) rb
->GetPointer(ctx
, rb
, x
, y
+ i
);
1315 for (j
= 0; j
< width
; j
++) {
1316 dst
[j
] = clearValue
;
1323 ASSERT(rb
->DataType
== GL_UNSIGNED_INT
);
1324 for (i
= 0; i
< height
; i
++) {
1325 GLuint
*dst
= (GLuint
*) rb
->GetPointer(ctx
, rb
, x
, y
+ i
);
1326 for (j
= 0; j
< width
; j
++) {
1327 dst
[j
] = clearValue
;
1333 /* Direct access not possible. Use PutRow to write new values. */
1334 if (rb
->DataType
== GL_UNSIGNED_SHORT
) {
1335 GLushort clearRow
[MAX_WIDTH
];
1337 for (j
= 0; j
< width
; j
++) {
1338 clearRow
[j
] = clearValue
;
1340 for (i
= 0; i
< height
; i
++) {
1341 rb
->PutRow(ctx
, rb
, width
, x
, y
+ i
, clearRow
, NULL
);
1345 GLuint clearRow
[MAX_WIDTH
];
1347 assert(rb
->DataType
== GL_UNSIGNED_INT
);
1348 for (j
= 0; j
< width
; j
++) {
1349 clearRow
[j
] = clearValue
;
1351 for (i
= 0; i
< height
; i
++) {
1352 rb
->PutRow(ctx
, rb
, width
, x
, y
+ i
, clearRow
, NULL
);