Merge commit 'origin/gallium-0.1' into gallium-0.1
[mesa.git] / src / mesa / state_tracker / st_cb_clear.c
1 /**************************************************************************
2 *
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 /*
29 * Authors:
30 * Keith Whitwell <keith@tungstengraphics.com>
31 * Brian Paul
32 */
33
34 #include "main/glheader.h"
35 #include "main/macros.h"
36 #include "shader/prog_instruction.h"
37 #include "st_atom.h"
38 #include "st_cache.h"
39 #include "st_context.h"
40 #include "st_cb_accum.h"
41 #include "st_cb_clear.h"
42 #include "st_cb_fbo.h"
43 #include "st_draw.h"
44 #include "st_program.h"
45 #include "st_public.h"
46 #include "st_mesa_to_tgsi.h"
47
48 #include "pipe/p_context.h"
49 #include "pipe/p_state.h"
50 #include "pipe/p_defines.h"
51 #include "pipe/p_winsys.h"
52
53
54
55
56
57 static GLuint
58 color_value(enum pipe_format pipeFormat, const GLfloat color[4])
59 {
60 GLubyte r, g, b, a;
61
62 UNCLAMPED_FLOAT_TO_UBYTE(r, color[0]);
63 UNCLAMPED_FLOAT_TO_UBYTE(g, color[1]);
64 UNCLAMPED_FLOAT_TO_UBYTE(b, color[2]);
65 UNCLAMPED_FLOAT_TO_UBYTE(a, color[3]);
66
67 switch (pipeFormat) {
68 case PIPE_FORMAT_R8G8B8A8_UNORM:
69 return (r << 24) | (g << 16) | (b << 8) | a;
70 case PIPE_FORMAT_A8R8G8B8_UNORM:
71 return (a << 24) | (r << 16) | (g << 8) | b;
72 case PIPE_FORMAT_B8G8R8A8_UNORM:
73 return (b << 24) | (g << 16) | (r << 8) | a;
74 case PIPE_FORMAT_R5G6B5_UNORM:
75 return ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3);
76 default:
77 assert(0);
78 return 0;
79 }
80 }
81
82
83 static uint
84 depth_value(enum pipe_format pipeFormat, GLfloat value)
85 {
86 switch (pipeFormat) {
87 case PIPE_FORMAT_Z16_UNORM:
88 return (uint) (value * 0xffff);
89 case PIPE_FORMAT_Z32_UNORM:
90 /* special-case to avoid overflow */
91 if (value == 1.0)
92 return 0xffffffff;
93 else
94 return (uint) (value * 0xffffffff);
95 case PIPE_FORMAT_S8Z24_UNORM:
96 return (uint) (value * 0xffffff);
97 case PIPE_FORMAT_Z24S8_UNORM:
98 return ((uint) (value * 0xffffff)) << 8;
99 default:
100 assert(0);
101 return 0;
102 }
103 }
104
105
106 static GLboolean
107 is_depth_stencil_format(enum pipe_format pipeFormat)
108 {
109 switch (pipeFormat) {
110 case PIPE_FORMAT_S8Z24_UNORM:
111 case PIPE_FORMAT_Z24S8_UNORM:
112 return GL_TRUE;
113 default:
114 return GL_FALSE;
115 }
116 }
117
118
119
120 /**
121 * Create a simple fragment shader that just passes through the fragment color.
122 */
123 static struct st_fragment_program *
124 make_frag_shader(struct st_context *st)
125 {
126 GLcontext *ctx = st->ctx;
127 struct st_fragment_program *stfp;
128 struct gl_program *p;
129 GLuint interpMode[16];
130 GLuint i;
131
132 /* XXX temporary */
133 for (i = 0; i < 16; i++)
134 interpMode[i] = TGSI_INTERPOLATE_LINEAR;
135
136 p = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0);
137 if (!p)
138 return NULL;
139
140 p->NumInstructions = 2;
141 p->Instructions = _mesa_alloc_instructions(2);
142 if (!p->Instructions) {
143 ctx->Driver.DeleteProgram(ctx, p);
144 return NULL;
145 }
146 _mesa_init_instructions(p->Instructions, 2);
147 /* MOV result.color, fragment.color; */
148 p->Instructions[0].Opcode = OPCODE_MOV;
149 p->Instructions[0].DstReg.File = PROGRAM_OUTPUT;
150 p->Instructions[0].DstReg.Index = FRAG_RESULT_COLR;
151 p->Instructions[0].SrcReg[0].File = PROGRAM_INPUT;
152 p->Instructions[0].SrcReg[0].Index = FRAG_ATTRIB_COL0;
153 /* END; */
154 p->Instructions[1].Opcode = OPCODE_END;
155
156 p->InputsRead = FRAG_BIT_COL0;
157 p->OutputsWritten = (1 << FRAG_RESULT_COLR);
158
159 stfp = (struct st_fragment_program *) p;
160 st_translate_fragment_program(st, stfp, NULL,
161 stfp->tokens, ST_MAX_SHADER_TOKENS);
162
163 return stfp;
164 }
165
166
167 /**
168 * Create a simple vertex shader that just passes through the
169 * vertex position and color.
170 */
171 static struct st_vertex_program *
172 make_vertex_shader(struct st_context *st)
173 {
174 GLcontext *ctx = st->ctx;
175 struct st_vertex_program *stvp;
176 struct gl_program *p;
177
178 p = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
179 if (!p)
180 return NULL;
181
182 p->NumInstructions = 3;
183 p->Instructions = _mesa_alloc_instructions(3);
184 if (!p->Instructions) {
185 ctx->Driver.DeleteProgram(ctx, p);
186 return NULL;
187 }
188 _mesa_init_instructions(p->Instructions, 3);
189 /* MOV result.pos, vertex.pos; */
190 p->Instructions[0].Opcode = OPCODE_MOV;
191 p->Instructions[0].DstReg.File = PROGRAM_OUTPUT;
192 p->Instructions[0].DstReg.Index = VERT_RESULT_HPOS;
193 p->Instructions[0].SrcReg[0].File = PROGRAM_INPUT;
194 p->Instructions[0].SrcReg[0].Index = VERT_ATTRIB_POS;
195 /* MOV result.color, vertex.color; */
196 p->Instructions[1].Opcode = OPCODE_MOV;
197 p->Instructions[1].DstReg.File = PROGRAM_OUTPUT;
198 p->Instructions[1].DstReg.Index = VERT_RESULT_COL0;
199 p->Instructions[1].SrcReg[0].File = PROGRAM_INPUT;
200 p->Instructions[1].SrcReg[0].Index = VERT_ATTRIB_COLOR0;
201 /* END; */
202 p->Instructions[2].Opcode = OPCODE_END;
203
204 p->InputsRead = VERT_BIT_POS | VERT_BIT_COLOR0;
205 p->OutputsWritten = ((1 << VERT_RESULT_COL0) |
206 (1 << VERT_RESULT_HPOS));
207
208 stvp = (struct st_vertex_program *) p;
209 st_translate_vertex_program(st, stvp, NULL,
210 stvp->tokens, ST_MAX_SHADER_TOKENS);
211 assert(stvp->cso);
212
213 return stvp;
214 }
215
216
217
218 /**
219 * Draw a screen-aligned quadrilateral.
220 * Coords are window coords with y=0=bottom. These coords will be transformed
221 * by the vertex shader and viewport transform (which will flip Y if needed).
222 */
223 static void
224 draw_quad(GLcontext *ctx,
225 float x0, float y0, float x1, float y1, GLfloat z,
226 const GLfloat color[4])
227 {
228 GLfloat verts[4][2][4]; /* four verts, two attribs, XYZW */
229 GLuint i;
230
231 /* positions */
232 verts[0][0][0] = x0;
233 verts[0][0][1] = y0;
234
235 verts[1][0][0] = x1;
236 verts[1][0][1] = y0;
237
238 verts[2][0][0] = x1;
239 verts[2][0][1] = y1;
240
241 verts[3][0][0] = x0;
242 verts[3][0][1] = y1;
243
244 /* same for all verts: */
245 for (i = 0; i < 4; i++) {
246 verts[i][0][2] = z;
247 verts[i][0][3] = 1.0;
248 verts[i][1][0] = color[0];
249 verts[i][1][1] = color[1];
250 verts[i][1][2] = color[2];
251 verts[i][1][3] = color[3];
252 }
253
254 st_draw_vertices(ctx, PIPE_PRIM_QUADS, 4, (float *) verts, 2, GL_FALSE);
255 }
256
257
258
259 /**
260 * Do glClear by drawing a quadrilateral.
261 * The vertices of the quad will be computed from the
262 * ctx->DrawBuffer->_X/Ymin/max fields.
263 */
264 static void
265 clear_with_quad(GLcontext *ctx,
266 GLboolean color, GLboolean depth, GLboolean stencil)
267 {
268 struct st_context *st = ctx->st;
269 struct pipe_context *pipe = st->pipe;
270 const GLfloat x0 = ctx->DrawBuffer->_Xmin;
271 const GLfloat y0 = ctx->DrawBuffer->_Ymin;
272 const GLfloat x1 = ctx->DrawBuffer->_Xmax;
273 const GLfloat y1 = ctx->DrawBuffer->_Ymax;
274
275 /*
276 printf("%s %s%s%s %f,%f %f,%f\n", __FUNCTION__,
277 color ? "color, " : "",
278 depth ? "depth, " : "",
279 stencil ? "stencil" : "",
280 x0, y0,
281 x1, y1);
282 */
283
284 /* blend state: RGBA masking */
285 {
286 struct pipe_blend_state blend;
287 const struct cso_blend *cso;
288 memset(&blend, 0, sizeof(blend));
289 if (color) {
290 if (ctx->Color.ColorMask[0])
291 blend.colormask |= PIPE_MASK_R;
292 if (ctx->Color.ColorMask[1])
293 blend.colormask |= PIPE_MASK_G;
294 if (ctx->Color.ColorMask[2])
295 blend.colormask |= PIPE_MASK_B;
296 if (ctx->Color.ColorMask[3])
297 blend.colormask |= PIPE_MASK_A;
298 if (st->ctx->Color.DitherFlag)
299 blend.dither = 1;
300 }
301 cso = st_cached_blend_state(st, &blend);
302 pipe->bind_blend_state(pipe, cso->data);
303 }
304
305 /* depth_stencil state: always pass/set to ref value */
306 {
307 struct pipe_depth_stencil_alpha_state depth_stencil;
308 const struct cso_depth_stencil_alpha *cso;
309 memset(&depth_stencil, 0, sizeof(depth_stencil));
310 if (depth) {
311 depth_stencil.depth.enabled = 1;
312 depth_stencil.depth.writemask = 1;
313 depth_stencil.depth.func = PIPE_FUNC_ALWAYS;
314 }
315
316 if (stencil) {
317 depth_stencil.stencil[0].enabled = 1;
318 depth_stencil.stencil[0].func = PIPE_FUNC_ALWAYS;
319 depth_stencil.stencil[0].fail_op = PIPE_STENCIL_OP_REPLACE;
320 depth_stencil.stencil[0].zpass_op = PIPE_STENCIL_OP_REPLACE;
321 depth_stencil.stencil[0].zfail_op = PIPE_STENCIL_OP_REPLACE;
322 depth_stencil.stencil[0].ref_value = ctx->Stencil.Clear;
323 depth_stencil.stencil[0].value_mask = 0xff;
324 depth_stencil.stencil[0].write_mask = ctx->Stencil.WriteMask[0] & 0xff;
325 }
326 cso = st_cached_depth_stencil_alpha_state(st, &depth_stencil);
327 pipe->bind_depth_stencil_alpha_state(pipe, cso->data);
328 }
329
330 /* rasterizer state: nothing */
331 {
332 struct pipe_rasterizer_state raster;
333 const struct cso_rasterizer *cso;
334 memset(&raster, 0, sizeof(raster));
335 #if 0
336 /* don't do per-pixel scissor; we'll just draw a PIPE_PRIM_QUAD
337 * that matches the scissor bounds.
338 */
339 if (ctx->Scissor.Enabled)
340 raster.scissor = 1;
341 #endif
342 cso = st_cached_rasterizer_state(st, &raster);
343 pipe->bind_rasterizer_state(pipe, cso->data);
344 }
345
346 /* fragment shader state: color pass-through program */
347 {
348 static struct st_fragment_program *stfp = NULL;
349 if (!stfp) {
350 stfp = make_frag_shader(st);
351 }
352 pipe->bind_fs_state(pipe, stfp->cso->data);
353 }
354
355 /* vertex shader state: color/position pass-through */
356 {
357 static struct st_vertex_program *stvp = NULL;
358 if (!stvp) {
359 stvp = make_vertex_shader(st);
360 }
361 pipe->bind_vs_state(pipe, stvp->cso->data);
362 }
363
364 /* viewport state: viewport matching window dims */
365 {
366 const float width = ctx->DrawBuffer->Width;
367 const float height = ctx->DrawBuffer->Height;
368 struct pipe_viewport_state vp;
369 vp.scale[0] = 0.5 * width;
370 vp.scale[1] = -0.5 * height;
371 vp.scale[2] = 1.0;
372 vp.scale[3] = 1.0;
373 vp.translate[0] = 0.5 * width;
374 vp.translate[1] = 0.5 * height;
375 vp.translate[2] = 0.0;
376 vp.translate[3] = 0.0;
377 pipe->set_viewport_state(pipe, &vp);
378 }
379
380 /* draw quad matching scissor rect (XXX verify coord round-off) */
381 draw_quad(ctx, x0, y0, x1, y1, ctx->Depth.Clear, ctx->Color.ClearColor);
382
383 /* Restore pipe state */
384 pipe->bind_blend_state(pipe, st->state.blend->data);
385 pipe->bind_depth_stencil_alpha_state(pipe, st->state.depth_stencil->data);
386 pipe->bind_fs_state(pipe, st->state.fs->data);
387 pipe->bind_vs_state(pipe, st->state.vs->cso->data);
388 pipe->bind_rasterizer_state(pipe, st->state.rasterizer->data);
389 pipe->set_viewport_state(pipe, &st->state.viewport);
390 /* OR:
391 st_invalidate_state(ctx, _NEW_COLOR | _NEW_DEPTH | _NEW_STENCIL);
392 */
393 }
394
395
396 /**
397 * Determine if we need to clear the depth buffer by drawing a quad.
398 */
399 static INLINE GLboolean
400 check_clear_color_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
401 {
402 const struct st_renderbuffer *strb = st_renderbuffer(rb);
403
404 if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
405 return FALSE;
406
407 if (ctx->Scissor.Enabled)
408 return TRUE;
409
410 if (!ctx->Color.ColorMask[0] ||
411 !ctx->Color.ColorMask[1] ||
412 !ctx->Color.ColorMask[2] ||
413 !ctx->Color.ColorMask[3])
414 return TRUE;
415
416 return FALSE;
417 }
418
419
420 static INLINE GLboolean
421 check_clear_depth_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
422 {
423 const struct st_renderbuffer *strb = st_renderbuffer(rb);
424 const GLuint stencilMax = (1 << rb->StencilBits) - 1;
425 GLboolean maskStencil
426 = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;
427
428 if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
429 return FALSE;
430
431 if (ctx->Scissor.Enabled)
432 return TRUE;
433
434 if (maskStencil)
435 return TRUE;
436
437 return FALSE;
438 }
439
440
441 /**
442 * Determine if we need to clear the depth buffer by drawing a quad.
443 */
444 static INLINE GLboolean
445 check_clear_depth_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
446 {
447 const struct st_renderbuffer *strb = st_renderbuffer(rb);
448 const GLboolean isDS = is_depth_stencil_format(strb->surface->format);
449
450 if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
451 return FALSE;
452
453 if (ctx->Scissor.Enabled)
454 return TRUE;
455
456 if (isDS &&
457 strb->surface->status == PIPE_SURFACE_STATUS_DEFINED &&
458 ctx->DrawBuffer->Visual.stencilBits > 0)
459 return TRUE;
460
461 return FALSE;
462 }
463
464
465 /**
466 * Determine if we need to clear the stencil buffer by drawing a quad.
467 */
468 static INLINE GLboolean
469 check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
470 {
471 const struct st_renderbuffer *strb = st_renderbuffer(rb);
472 const GLboolean isDS = is_depth_stencil_format(strb->surface->format);
473 const GLuint stencilMax = (1 << rb->StencilBits) - 1;
474 const GLboolean maskStencil
475 = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;
476
477 if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
478 return FALSE;
479
480 if (maskStencil)
481 return TRUE;
482
483 if (ctx->Scissor.Enabled)
484 return TRUE;
485
486 /* This is correct, but it is necessary to look at the depth clear
487 * value held in the surface when it comes time to issue the clear,
488 * rather than taking depth and stencil clear values from the
489 * current state.
490 */
491 if (isDS &&
492 strb->surface->status == PIPE_SURFACE_STATUS_DEFINED &&
493 ctx->DrawBuffer->Visual.depthBits > 0)
494 return TRUE;
495
496 return FALSE;
497 }
498
499
500
501
502 static void
503 clear_color_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
504 {
505 if (!check_clear_color_with_quad( ctx, rb ))
506 {
507 struct st_renderbuffer *strb = st_renderbuffer(rb);
508
509 /* clear whole buffer w/out masking */
510 GLuint clearValue
511 = color_value(strb->surface->format, ctx->Color.ClearColor);
512 ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue);
513 }
514 else {
515 /* masking or scissoring */
516 clear_with_quad(ctx, GL_TRUE, GL_FALSE, GL_FALSE);
517 }
518 }
519
520
521 static void
522 clear_depth_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
523 {
524 struct st_renderbuffer *strb = st_renderbuffer(rb);
525 /*
526 const GLboolean isDS = is_depth_stencil_format(strb->surface->format);
527 */
528
529 assert(strb->surface->format);
530
531 if (check_clear_depth_with_quad(ctx, rb)) {
532 /* scissoring or we have a combined depth/stencil buffer */
533 clear_with_quad(ctx, GL_FALSE, GL_TRUE, GL_FALSE);
534 }
535 else {
536 /* simple clear of whole buffer */
537 uint clearValue = depth_value(strb->surface->format, ctx->Depth.Clear);
538 ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue);
539 }
540 }
541
542
543 static void
544 clear_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
545 {
546 struct st_renderbuffer *strb = st_renderbuffer(rb);
547
548 if (check_clear_stencil_with_quad(ctx, rb)) {
549 /* masking or scissoring or combined depth/stencil buffer */
550 clear_with_quad(ctx, GL_FALSE, GL_FALSE, GL_TRUE);
551 }
552 else {
553 /* simple clear of whole buffer */
554 GLuint clearValue = ctx->Stencil.Clear;
555 ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue);
556 }
557 }
558
559
560 static void
561 clear_depth_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
562 {
563 struct st_renderbuffer *strb = st_renderbuffer(rb);
564
565 assert(is_depth_stencil_format(strb->surface->format));
566
567 if (check_clear_depth_stencil_with_quad(ctx, rb)) {
568 /* clear whole buffer w/out masking */
569 GLuint clearValue = depth_value(strb->surface->format, ctx->Depth.Clear);
570
571 switch (strb->surface->format) {
572 case PIPE_FORMAT_S8Z24_UNORM:
573 clearValue |= ctx->Stencil.Clear << 24;
574 break;
575 case PIPE_FORMAT_Z24S8_UNORM:
576 clearValue |= ctx->Stencil.Clear;
577 break;
578 default:
579 assert(0);
580 }
581
582 ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue);
583 }
584 else {
585 /* masking or scissoring */
586 clear_with_quad(ctx, GL_FALSE, GL_TRUE, GL_TRUE);
587 }
588 }
589
590
591
592 /**
593 * Called via ctx->Driver.Clear()
594 * XXX: doesn't pick up the differences between front/back/left/right
595 * clears. Need to sort that out...
596 */
597 static void st_clear(GLcontext *ctx, GLbitfield mask)
598 {
599 static const GLbitfield BUFFER_BITS_DS
600 = (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL);
601 struct st_context *st = ctx->st;
602 struct gl_renderbuffer *depthRb
603 = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
604 struct gl_renderbuffer *stencilRb
605 = ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
606 GLbitfield cmask = mask & BUFFER_BITS_COLOR;
607
608 /* This makes sure the softpipe has the latest scissor, etc values */
609 st_validate_state( st );
610
611 /*
612 * XXX TO-DO:
613 * If we're going to use clear_with_quad() for any reason, use it to
614 * clear as many other buffers as possible.
615 * As it is now, we sometimes call clear_with_quad() three times to clear
616 * color/depth/stencil individually...
617 */
618
619 if (cmask) {
620 GLuint b;
621 for (b = 0; cmask; b++) {
622 if (cmask & (1 << b)) {
623 struct gl_renderbuffer *rb
624 = ctx->DrawBuffer->Attachment[b].Renderbuffer;
625 assert(rb);
626 clear_color_buffer(ctx, rb);
627 cmask &= ~(1 << b); /* turn off bit */
628 }
629 assert(b < BUFFER_COUNT);
630 }
631 }
632
633 if (mask & BUFFER_BIT_ACCUM) {
634 st_clear_accum_buffer(ctx,
635 ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer);
636 }
637
638 if ((mask & BUFFER_BITS_DS) == BUFFER_BITS_DS && depthRb == stencilRb) {
639 /* clearing combined depth + stencil */
640 clear_depth_stencil_buffer(ctx, depthRb);
641 }
642 else {
643 /* separate depth/stencil clears */
644 if (mask & BUFFER_BIT_DEPTH) {
645 clear_depth_buffer(ctx, depthRb);
646 }
647 if (mask & BUFFER_BIT_STENCIL) {
648 clear_stencil_buffer(ctx, stencilRb);
649 }
650 }
651 }
652
653
654 void st_init_clear_functions(struct dd_function_table *functions)
655 {
656 functions->Clear = st_clear;
657 }