33e7bc001611f0c64010dec4770e66707d04b828
[mesa.git] / src / mesa / main / buffers.c
1 /* $Id: buffers.c,v 1.16 2000/10/30 13:31:59 keithw Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.5
6 *
7 * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27
28 #ifdef PC_HEADER
29 #include "all.h"
30 #else
31 #include "glheader.h"
32 #include "accum.h"
33 #include "alphabuf.h"
34 #include "buffers.h"
35 #include "context.h"
36 #include "depth.h"
37 #include "enums.h"
38 #include "macros.h"
39 #include "masking.h"
40 #include "mem.h"
41 #include "stencil.h"
42 #include "state.h"
43 #include "types.h"
44 #endif
45
46
47
48 void
49 _mesa_ClearIndex( GLfloat c )
50 {
51 GET_CURRENT_CONTEXT(ctx);
52 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearIndex");
53 ctx->Color.ClearIndex = (GLuint) c;
54 ctx->NewState |= _NEW_COLOR;
55
56 if (!ctx->Visual.RGBAflag) {
57 /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */
58 (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex );
59 }
60 }
61
62
63
64 void
65 _mesa_ClearColor( GLclampf red, GLclampf green,
66 GLclampf blue, GLclampf alpha )
67 {
68 GET_CURRENT_CONTEXT(ctx);
69 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearColor");
70
71 ctx->Color.ClearColor[0] = CLAMP( red, 0.0F, 1.0F );
72 ctx->Color.ClearColor[1] = CLAMP( green, 0.0F, 1.0F );
73 ctx->Color.ClearColor[2] = CLAMP( blue, 0.0F, 1.0F );
74 ctx->Color.ClearColor[3] = CLAMP( alpha, 0.0F, 1.0F );
75 ctx->NewState |= _NEW_COLOR;
76
77 if (ctx->Visual.RGBAflag) {
78 GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF);
79 GLchan g = (GLint) (ctx->Color.ClearColor[1] * CHAN_MAXF);
80 GLchan b = (GLint) (ctx->Color.ClearColor[2] * CHAN_MAXF);
81 GLchan a = (GLint) (ctx->Color.ClearColor[3] * CHAN_MAXF);
82 (*ctx->Driver.ClearColor)( ctx, r, g, b, a );
83 }
84 }
85
86
87
88
89 /*
90 * Clear the color buffer when glColorMask or glIndexMask is in effect.
91 */
92 static void
93 clear_color_buffer_with_masking( GLcontext *ctx )
94 {
95 const GLint x = ctx->DrawBuffer->Xmin;
96 const GLint y = ctx->DrawBuffer->Ymin;
97 const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin;
98 const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin;
99
100 if (ctx->Visual.RGBAflag) {
101 /* RGBA mode */
102 const GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF);
103 const GLchan g = (GLint) (ctx->Color.ClearColor[1] * CHAN_MAXF);
104 const GLchan b = (GLint) (ctx->Color.ClearColor[2] * CHAN_MAXF);
105 const GLchan a = (GLint) (ctx->Color.ClearColor[3] * CHAN_MAXF);
106 GLint i;
107 for (i = 0; i < height; i++) {
108 GLchan rgba[MAX_WIDTH][4];
109 GLint j;
110 for (j=0; j<width; j++) {
111 rgba[j][RCOMP] = r;
112 rgba[j][GCOMP] = g;
113 rgba[j][BCOMP] = b;
114 rgba[j][ACOMP] = a;
115 }
116 _mesa_mask_rgba_span( ctx, width, x, y + i, rgba );
117 (*ctx->Driver.WriteRGBASpan)( ctx, width, x, y + i,
118 (CONST GLchan (*)[4]) rgba, NULL );
119 }
120 }
121 else {
122 /* Color index mode */
123 GLuint span[MAX_WIDTH];
124 GLubyte mask[MAX_WIDTH];
125 GLint i, j;
126 MEMSET( mask, 1, width );
127 for (i=0;i<height;i++) {
128 for (j=0;j<width;j++) {
129 span[j] = ctx->Color.ClearIndex;
130 }
131 _mesa_mask_index_span( ctx, width, x, y + i, span );
132 (*ctx->Driver.WriteCI32Span)( ctx, width, x, y + i, span, mask );
133 }
134 }
135 }
136
137
138
139 /*
140 * Clear a color buffer without index/channel masking.
141 */
142 static void
143 clear_color_buffer(GLcontext *ctx)
144 {
145 const GLint x = ctx->DrawBuffer->Xmin;
146 const GLint y = ctx->DrawBuffer->Ymin;
147 const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin;
148 const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin;
149 const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
150
151 if (ctx->Visual.RGBAflag) {
152 /* RGBA mode */
153 const GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF);
154 const GLchan g = (GLint) (ctx->Color.ClearColor[1] * CHAN_MAXF);
155 const GLchan b = (GLint) (ctx->Color.ClearColor[2] * CHAN_MAXF);
156 const GLchan a = (GLint) (ctx->Color.ClearColor[3] * CHAN_MAXF);
157 GLchan span[MAX_WIDTH][4];
158 GLint i;
159
160 ASSERT(colorMask == 0xffffffff);
161
162 for (i = 0; i < width; i++) {
163 span[i][RCOMP] = r;
164 span[i][GCOMP] = g;
165 span[i][BCOMP] = b;
166 span[i][ACOMP] = a;
167 }
168 for (i = 0; i < height; i++) {
169 (*ctx->Driver.WriteRGBASpan)( ctx, width, x, y + i,
170 (CONST GLchan (*)[4]) span, NULL );
171 }
172 }
173 else {
174 /* Color index mode */
175 ASSERT(ctx->Color.IndexMask == ~0);
176 if (ctx->Visual.IndexBits == 8) {
177 /* 8-bit clear */
178 GLchan span[MAX_WIDTH];
179 GLint i;
180 MEMSET(span, ctx->Color.ClearIndex, width);
181 for (i = 0; i < height; i++) {
182 (*ctx->Driver.WriteCI8Span)( ctx, width, x, y + i, span, NULL );
183 }
184 }
185 else {
186 /* non 8-bit clear */
187 GLuint span[MAX_WIDTH];
188 GLint i;
189 for (i = 0; i < width; i++) {
190 span[i] = ctx->Color.ClearIndex;
191 }
192 for (i = 0; i < height; i++) {
193 (*ctx->Driver.WriteCI32Span)( ctx, width, x, y + i, span, NULL );
194 }
195 }
196 }
197 }
198
199
200
201 /*
202 * Clear the front/back/left/right color buffers.
203 * This function is usually only called if we need to clear the
204 * buffers with masking.
205 */
206 static void
207 clear_color_buffers(GLcontext *ctx)
208 {
209 const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
210 GLuint bufferBit;
211
212 /* loop over four possible dest color buffers */
213 for (bufferBit = 1; bufferBit <= 8; bufferBit = bufferBit << 1) {
214 if (bufferBit & ctx->Color.DrawDestMask) {
215 if (bufferBit == FRONT_LEFT_BIT) {
216 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_LEFT);
217 (void) (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_LEFT);
218 }
219 else if (bufferBit == FRONT_RIGHT_BIT) {
220 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_RIGHT);
221 (void) (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_RIGHT);
222 }
223 else if (bufferBit == BACK_LEFT_BIT) {
224 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_LEFT);
225 (void) (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_LEFT);
226 }
227 else {
228 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT);
229 (void) (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_RIGHT);
230 }
231
232 if (colorMask != 0xffffffff) {
233 clear_color_buffer_with_masking(ctx);
234 }
235 else {
236 clear_color_buffer(ctx);
237 }
238 }
239 }
240
241 /* restore default read/draw buffers */
242 (void) (*ctx->Driver.SetDrawBuffer)( ctx, ctx->Color.DriverDrawBuffer );
243 (void) (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, ctx->Pixel.DriverReadBuffer );
244 }
245
246
247
248 void
249 _mesa_Clear( GLbitfield mask )
250 {
251 GET_CURRENT_CONTEXT(ctx);
252 #ifdef PROFILE
253 GLdouble t0 = gl_time();
254 #endif
255 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClear");
256
257 if (MESA_VERBOSE & VERBOSE_API)
258 fprintf(stderr, "glClear 0x%x\n", mask);
259
260 if (ctx->NewState) {
261 gl_update_state( ctx );
262 }
263
264 if (ctx->RenderMode==GL_RENDER) {
265 const GLint x = ctx->DrawBuffer->Xmin;
266 const GLint y = ctx->DrawBuffer->Ymin;
267 const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin;
268 const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin;
269 GLbitfield ddMask;
270 GLbitfield newMask;
271
272 /* don't clear depth buffer if depth writing disabled */
273 if (!ctx->Depth.Mask)
274 CLEAR_BITS(mask, GL_DEPTH_BUFFER_BIT);
275
276 /* Build bitmask to send to driver Clear function */
277 ddMask = mask & (GL_DEPTH_BUFFER_BIT |
278 GL_STENCIL_BUFFER_BIT |
279 GL_ACCUM_BUFFER_BIT);
280 if (mask & GL_COLOR_BUFFER_BIT) {
281 ddMask |= ctx->Color.DrawDestMask;
282 }
283
284 ASSERT(ctx->Driver.Clear);
285 newMask = (*ctx->Driver.Clear)( ctx, ddMask, !ctx->Scissor.Enabled,
286 x, y, width, height );
287
288 #ifdef DEBUG
289 {
290 GLbitfield legalBits = DD_FRONT_LEFT_BIT |
291 DD_FRONT_RIGHT_BIT |
292 DD_BACK_LEFT_BIT |
293 DD_BACK_RIGHT_BIT |
294 DD_DEPTH_BIT |
295 DD_STENCIL_BIT |
296 DD_ACCUM_BIT;
297 assert((newMask & (~legalBits)) == 0);
298 }
299 #endif
300
301 RENDER_START(ctx);
302
303 /* do software clearing here */
304 if (newMask) {
305 if (newMask & ctx->Color.DrawDestMask) clear_color_buffers(ctx);
306 if (newMask & GL_DEPTH_BUFFER_BIT) _mesa_clear_depth_buffer(ctx);
307 if (newMask & GL_ACCUM_BUFFER_BIT) _mesa_clear_accum_buffer(ctx);
308 if (newMask & GL_STENCIL_BUFFER_BIT) _mesa_clear_stencil_buffer(ctx);
309 }
310
311 /* clear software-based alpha buffer(s) */
312 if ( (mask & GL_COLOR_BUFFER_BIT)
313 && ctx->DrawBuffer->UseSoftwareAlphaBuffers
314 && ctx->Color.ColorMask[ACOMP]) {
315 _mesa_clear_alpha_buffers( ctx );
316 }
317
318 RENDER_FINISH(ctx);
319
320 #ifdef PROFILE
321 ctx->ClearTime += gl_time() - t0;
322 ctx->ClearCount++;
323 #endif
324 }
325 }
326
327
328 void
329 _mesa_DrawBuffer( GLenum mode )
330 {
331 GET_CURRENT_CONTEXT(ctx);
332 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDrawBuffer");
333
334 if (MESA_VERBOSE & VERBOSE_API)
335 fprintf(stderr, "glDrawBuffer %s\n", gl_lookup_enum_by_nr(mode));
336
337 switch (mode) {
338 case GL_AUX0:
339 case GL_AUX1:
340 case GL_AUX2:
341 case GL_AUX3:
342 /* AUX buffers not implemented in Mesa at this time */
343 gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
344 return;
345 case GL_RIGHT:
346 if (!ctx->Visual.StereoFlag) {
347 gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
348 return;}
349 if (ctx->Visual.DBflag)
350 ctx->Color.DrawDestMask = FRONT_RIGHT_BIT | BACK_RIGHT_BIT;
351 else
352 ctx->Color.DrawDestMask = FRONT_RIGHT_BIT;
353 break;
354 case GL_FRONT_RIGHT:
355 if (!ctx->Visual.StereoFlag) {
356 gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
357 return;
358 }
359 ctx->Color.DrawDestMask = FRONT_RIGHT_BIT;
360 break;
361 case GL_BACK_RIGHT:
362 if (!ctx->Visual.StereoFlag) {
363 gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
364 return;
365 }
366 if (!ctx->Visual.DBflag) {
367 gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
368 return;
369 }
370 ctx->Color.DrawDestMask = BACK_RIGHT_BIT;
371 break;
372 case GL_BACK_LEFT:
373 if (!ctx->Visual.DBflag) {
374 gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
375 return;
376 }
377 ctx->Color.DrawDestMask = BACK_LEFT_BIT;
378 break;
379 case GL_FRONT_AND_BACK:
380 if (!ctx->Visual.DBflag) {
381 gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
382 return;
383 }
384 if (ctx->Visual.StereoFlag)
385 ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT
386 | FRONT_RIGHT_BIT | BACK_RIGHT_BIT;
387 else
388 ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT;
389 break;
390 case GL_BACK:
391 if (!ctx->Visual.DBflag) {
392 gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
393 return;
394 }
395 if (ctx->Visual.StereoFlag)
396 ctx->Color.DrawDestMask = BACK_LEFT_BIT | BACK_RIGHT_BIT;
397 else
398 ctx->Color.DrawDestMask = BACK_LEFT_BIT;
399 break;
400 case GL_LEFT:
401 /* never an error */
402 if (ctx->Visual.DBflag)
403 ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT;
404 else
405 ctx->Color.DrawDestMask = FRONT_LEFT_BIT;
406 break;
407 case GL_FRONT_LEFT:
408 /* never an error */
409 ctx->Color.DrawDestMask = FRONT_LEFT_BIT;
410 break;
411 case GL_FRONT:
412 /* never an error */
413 if (ctx->Visual.StereoFlag)
414 ctx->Color.DrawDestMask = FRONT_LEFT_BIT | FRONT_RIGHT_BIT;
415 else
416 ctx->Color.DrawDestMask = FRONT_LEFT_BIT;
417 break;
418 case GL_NONE:
419 /* never an error */
420 ctx->Color.DrawDestMask = 0;
421 break;
422 default:
423 gl_error( ctx, GL_INVALID_ENUM, "glDrawBuffer" );
424 return;
425 }
426
427 /*
428 * Make the dest buffer mode more precise if possible
429 */
430 if (mode == GL_LEFT && !ctx->Visual.DBflag)
431 ctx->Color.DriverDrawBuffer = GL_FRONT_LEFT;
432 else if (mode == GL_RIGHT && !ctx->Visual.DBflag)
433 ctx->Color.DriverDrawBuffer = GL_FRONT_RIGHT;
434 else if (mode == GL_FRONT && !ctx->Visual.StereoFlag)
435 ctx->Color.DriverDrawBuffer = GL_FRONT_LEFT;
436 else if (mode == GL_BACK && !ctx->Visual.StereoFlag)
437 ctx->Color.DriverDrawBuffer = GL_BACK_LEFT;
438 else
439 ctx->Color.DriverDrawBuffer = mode;
440
441 /*
442 * Set current alpha buffer pointer
443 */
444 if (ctx->DrawBuffer->UseSoftwareAlphaBuffers) {
445 if (ctx->Color.DriverDrawBuffer == GL_FRONT_LEFT)
446 ctx->DrawBuffer->Alpha = ctx->DrawBuffer->FrontLeftAlpha;
447 else if (ctx->Color.DriverDrawBuffer == GL_BACK_LEFT)
448 ctx->DrawBuffer->Alpha = ctx->DrawBuffer->BackLeftAlpha;
449 else if (ctx->Color.DriverDrawBuffer == GL_FRONT_RIGHT)
450 ctx->DrawBuffer->Alpha = ctx->DrawBuffer->FrontRightAlpha;
451 else if (ctx->Color.DriverDrawBuffer == GL_BACK_RIGHT)
452 ctx->DrawBuffer->Alpha = ctx->DrawBuffer->BackRightAlpha;
453 }
454
455 /*
456 * If we get here there can't have been an error.
457 * Now see if device driver can implement the drawing to the target
458 * buffer(s). The driver may not be able to do GL_FRONT_AND_BACK mode
459 * for example. We'll take care of that in the core code by looping
460 * over the individual buffers.
461 */
462 ASSERT(ctx->Driver.SetDrawBuffer);
463 if ( (*ctx->Driver.SetDrawBuffer)(ctx, ctx->Color.DriverDrawBuffer) ) {
464 /* All OK, the driver will do all buffer writes */
465 ctx->Color.MultiDrawBuffer = GL_FALSE;
466 }
467 else {
468 /* We'll have to loop over the multiple draw buffer targets */
469 ctx->Color.MultiDrawBuffer = GL_TRUE;
470 /* Set drawing buffer to front for now */
471 (void) (*ctx->Driver.SetDrawBuffer)(ctx, GL_FRONT_LEFT);
472 }
473
474 ctx->Color.DrawBuffer = mode;
475 ctx->NewState |= _NEW_COLOR;
476 }
477
478
479
480 void
481 _mesa_ReadBuffer( GLenum mode )
482 {
483 GET_CURRENT_CONTEXT(ctx);
484 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glReadBuffer");
485
486 if (MESA_VERBOSE & VERBOSE_API)
487 fprintf(stderr, "glReadBuffer %s\n", gl_lookup_enum_by_nr(mode));
488
489 switch (mode) {
490 case GL_AUX0:
491 case GL_AUX1:
492 case GL_AUX2:
493 case GL_AUX3:
494 /* AUX buffers not implemented in Mesa at this time */
495 gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" );
496 return;
497 case GL_LEFT:
498 case GL_FRONT:
499 case GL_FRONT_LEFT:
500 /* Front-Left buffer, always exists */
501 ctx->Pixel.DriverReadBuffer = GL_FRONT_LEFT;
502 break;
503 case GL_BACK:
504 case GL_BACK_LEFT:
505 /* Back-Left buffer, requires double buffering */
506 if (!ctx->Visual.DBflag) {
507 gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" );
508 return;
509 }
510 ctx->Pixel.DriverReadBuffer = GL_BACK_LEFT;
511 break;
512 case GL_FRONT_RIGHT:
513 case GL_RIGHT:
514 if (!ctx->Visual.StereoFlag) {
515 gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" );
516 return;
517 }
518 ctx->Pixel.DriverReadBuffer = GL_FRONT_RIGHT;
519 break;
520 case GL_BACK_RIGHT:
521 if (!ctx->Visual.StereoFlag || !ctx->Visual.DBflag) {
522 gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" );
523 return;
524 }
525 ctx->Pixel.DriverReadBuffer = GL_BACK_RIGHT;
526 break;
527 default:
528 gl_error( ctx, GL_INVALID_ENUM, "glReadBuffer" );
529 return;
530 }
531
532 ctx->Pixel.ReadBuffer = mode;
533 ctx->NewState |= _NEW_PIXEL;
534 }
535
536
537 /*
538 * GL_MESA_resize_buffers extension
539 */
540 void
541 _mesa_ResizeBuffersMESA( void )
542 {
543 GLcontext *ctx = _mesa_get_current_context();
544
545 GLuint buf_width, buf_height;
546
547 if (MESA_VERBOSE & VERBOSE_API)
548 fprintf(stderr, "glResizeBuffersMESA\n");
549
550 /* ask device driver for size of output buffer */
551 (*ctx->Driver.GetBufferSize)( ctx, &buf_width, &buf_height );
552
553 /* see if size of device driver's color buffer (window) has changed */
554 if (ctx->DrawBuffer->Width == (GLint) buf_width &&
555 ctx->DrawBuffer->Height == (GLint) buf_height)
556 return;
557
558 ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */
559
560 /* save buffer size */
561 ctx->DrawBuffer->Width = buf_width;
562 ctx->DrawBuffer->Height = buf_height;
563
564 /* Reallocate other buffers if needed. */
565 if (ctx->DrawBuffer->UseSoftwareDepthBuffer) {
566 _mesa_alloc_depth_buffer( ctx );
567 }
568 if (ctx->DrawBuffer->UseSoftwareStencilBuffer) {
569 _mesa_alloc_stencil_buffer( ctx );
570 }
571 if (ctx->DrawBuffer->UseSoftwareAccumBuffer) {
572 _mesa_alloc_accum_buffer( ctx );
573 }
574 if (ctx->DrawBuffer->UseSoftwareAlphaBuffers) {
575 _mesa_alloc_alpha_buffers( ctx );
576 }
577 }