3 * Frame buffer management.
7 * Mesa 3-D graphics library
10 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
19 * The above copyright notice and this permission notice shall be included
20 * in all copies or substantial portions of the Software.
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
26 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 _mesa_ClearIndex( GLfloat c
)
47 GET_CURRENT_CONTEXT(ctx
);
48 ASSERT_OUTSIDE_BEGIN_END(ctx
);
50 if (ctx
->Color
.ClearIndex
== (GLuint
) c
)
53 FLUSH_VERTICES(ctx
, _NEW_COLOR
);
54 ctx
->Color
.ClearIndex
= (GLuint
) c
;
56 if (!ctx
->Visual
.rgbMode
&& ctx
->Driver
.ClearIndex
) {
57 /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */
58 (*ctx
->Driver
.ClearIndex
)( ctx
, ctx
->Color
.ClearIndex
);
65 * Specify the clear values for the color buffers.
67 * \param red red color component.
68 * \param green green color component.
69 * \param blue blue color component.
70 * \param alpha alpha component.
74 * Clamps the parameters and updates gl_colorbuffer_attrib::ClearColor. On a
75 * change, flushes the vertices and notifies the driver via the
76 * dd_function_table::ClearColor callback.
79 _mesa_ClearColor( GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
82 GET_CURRENT_CONTEXT(ctx
);
83 ASSERT_OUTSIDE_BEGIN_END(ctx
);
85 tmp
[0] = CLAMP(red
, 0.0F
, 1.0F
);
86 tmp
[1] = CLAMP(green
, 0.0F
, 1.0F
);
87 tmp
[2] = CLAMP(blue
, 0.0F
, 1.0F
);
88 tmp
[3] = CLAMP(alpha
, 0.0F
, 1.0F
);
90 if (TEST_EQ_4V(tmp
, ctx
->Color
.ClearColor
))
91 return; /* no change */
93 FLUSH_VERTICES(ctx
, _NEW_COLOR
);
94 COPY_4V(ctx
->Color
.ClearColor
, tmp
);
96 if (ctx
->Visual
.rgbMode
&& ctx
->Driver
.ClearColor
) {
97 /* it's OK to call glClearColor in CI mode but it should be a NOP */
98 (*ctx
->Driver
.ClearColor
)(ctx
, ctx
->Color
.ClearColor
);
106 * \param mask bit-mask indicating the buffers to be cleared.
108 * Flushes the vertices and verifies the parameter. If __GLcontextRec::NewState
109 * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin,
110 * etc. If the rasterization mode is set to GL_RENDER then requests the driver
111 * to clear the buffers, via the dd_function_table::Clear callback.
114 _mesa_Clear( GLbitfield mask
)
116 GET_CURRENT_CONTEXT(ctx
);
117 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
119 if (MESA_VERBOSE
& VERBOSE_API
)
120 _mesa_debug(ctx
, "glClear 0x%x\n", mask
);
122 if (mask
& ~(GL_COLOR_BUFFER_BIT
|
123 GL_DEPTH_BUFFER_BIT
|
124 GL_STENCIL_BUFFER_BIT
|
125 GL_ACCUM_BUFFER_BIT
)) {
126 /* invalid bit set */
127 _mesa_error( ctx
, GL_INVALID_VALUE
, "glClear(0x%x)", mask
);
132 _mesa_update_state( ctx
); /* update _Xmin, etc */
135 if (ctx
->DrawBuffer
->_Status
!= GL_FRAMEBUFFER_COMPLETE_EXT
) {
136 _mesa_error(ctx
, GL_INVALID_FRAMEBUFFER_OPERATION_EXT
,
137 "glClear(incomplete framebuffer)");
141 if (ctx
->RenderMode
== GL_RENDER
) {
142 const GLint x
= ctx
->DrawBuffer
->_Xmin
;
143 const GLint y
= ctx
->DrawBuffer
->_Ymin
;
144 const GLint height
= ctx
->DrawBuffer
->_Ymax
- ctx
->DrawBuffer
->_Ymin
;
145 const GLint width
= ctx
->DrawBuffer
->_Xmax
- ctx
->DrawBuffer
->_Xmin
;
146 GLbitfield bufferMask
;
148 /* don't clear depth buffer if depth writing disabled */
149 if (!ctx
->Depth
.Mask
)
150 mask
&= ~GL_DEPTH_BUFFER_BIT
;
152 /* Build the bitmask to send to device driver's Clear function.
153 * Note that the GL_COLOR_BUFFER_BIT flag will expand to 0, 1, 2 or 4
154 * of the BUFFER_BIT_FRONT/BACK_LEFT/RIGHT flags, or one of the
155 * BUFFER_BIT_COLORn flags.
158 if (mask
& GL_COLOR_BUFFER_BIT
) {
159 bufferMask
|= ctx
->DrawBuffer
->_ColorDrawBufferMask
[0];
162 if ((mask
& GL_DEPTH_BUFFER_BIT
)
163 && ctx
->DrawBuffer
->Visual
.haveDepthBuffer
) {
164 bufferMask
|= BUFFER_BIT_DEPTH
;
167 if ((mask
& GL_STENCIL_BUFFER_BIT
)
168 && ctx
->DrawBuffer
->Visual
.haveStencilBuffer
) {
169 bufferMask
|= BUFFER_BIT_STENCIL
;
172 if ((mask
& GL_ACCUM_BUFFER_BIT
)
173 && ctx
->DrawBuffer
->Visual
.haveAccumBuffer
) {
174 bufferMask
|= BUFFER_BIT_ACCUM
;
177 ASSERT(ctx
->Driver
.Clear
);
178 ctx
->Driver
.Clear( ctx
, bufferMask
, (GLboolean
) !ctx
->Scissor
.Enabled
,
179 x
, y
, width
, height
);
186 * Return bitmask of BUFFER_BIT_* flags indicating which color buffers are
187 * available to the rendering context.
188 * This depends on the framebuffer we're writing to. For window system
189 * framebuffers we look at the framebuffer's visual. But for user-
190 * create framebuffers we look at the number of supported color attachments.
193 supported_buffer_bitmask(const GLcontext
*ctx
, GLuint framebufferID
)
195 GLbitfield mask
= 0x0;
197 if (framebufferID
> 0) {
198 /* A user-created renderbuffer */
200 ASSERT(ctx
->Extensions
.EXT_framebuffer_object
);
201 for (i
= 0; i
< ctx
->Const
.MaxColorAttachments
; i
++) {
202 mask
|= (BUFFER_BIT_COLOR0
<< i
);
206 /* A window system renderbuffer */
208 mask
= BUFFER_BIT_FRONT_LEFT
; /* always have this */
209 if (ctx
->Visual
.stereoMode
) {
210 mask
|= BUFFER_BIT_FRONT_RIGHT
;
211 if (ctx
->Visual
.doubleBufferMode
) {
212 mask
|= BUFFER_BIT_BACK_LEFT
| BUFFER_BIT_BACK_RIGHT
;
215 else if (ctx
->Visual
.doubleBufferMode
) {
216 mask
|= BUFFER_BIT_BACK_LEFT
;
219 for (i
= 0; i
< ctx
->Visual
.numAuxBuffers
; i
++) {
220 mask
|= (BUFFER_BIT_AUX0
<< i
);
229 * Helper routine used by glDrawBuffer and glDrawBuffersARB.
230 * Given a GLenum naming one or more color buffers (such as
231 * GL_FRONT_AND_BACK), return the corresponding bitmask of BUFFER_BIT_* flags.
234 draw_buffer_enum_to_bitmask(GLenum buffer
)
240 return BUFFER_BIT_FRONT_LEFT
| BUFFER_BIT_FRONT_RIGHT
;
242 return BUFFER_BIT_BACK_LEFT
| BUFFER_BIT_BACK_RIGHT
;
244 return BUFFER_BIT_FRONT_RIGHT
| BUFFER_BIT_BACK_RIGHT
;
246 return BUFFER_BIT_FRONT_RIGHT
;
248 return BUFFER_BIT_BACK_RIGHT
;
250 return BUFFER_BIT_BACK_LEFT
;
251 case GL_FRONT_AND_BACK
:
252 return BUFFER_BIT_FRONT_LEFT
| BUFFER_BIT_BACK_LEFT
253 | BUFFER_BIT_FRONT_RIGHT
| BUFFER_BIT_BACK_RIGHT
;
255 return BUFFER_BIT_FRONT_LEFT
| BUFFER_BIT_BACK_LEFT
;
257 return BUFFER_BIT_FRONT_LEFT
;
259 return BUFFER_BIT_AUX0
;
261 return BUFFER_BIT_AUX1
;
263 return BUFFER_BIT_AUX2
;
265 return BUFFER_BIT_AUX3
;
266 case GL_COLOR_ATTACHMENT0_EXT
:
267 return BUFFER_BIT_COLOR0
;
268 case GL_COLOR_ATTACHMENT1_EXT
:
269 return BUFFER_BIT_COLOR1
;
270 case GL_COLOR_ATTACHMENT2_EXT
:
271 return BUFFER_BIT_COLOR2
;
272 case GL_COLOR_ATTACHMENT3_EXT
:
273 return BUFFER_BIT_COLOR3
;
282 * Helper routine used by glReadBuffer.
283 * Given a GLenum naming a color buffer, return the index of the corresponding
284 * renderbuffer (a BUFFER_* value).
285 * return -1 for an invalid buffer.
288 read_buffer_enum_to_index(GLenum buffer
)
292 return BUFFER_FRONT_LEFT
;
294 return BUFFER_BACK_LEFT
;
296 return BUFFER_FRONT_RIGHT
;
298 return BUFFER_FRONT_RIGHT
;
300 return BUFFER_BACK_RIGHT
;
302 return BUFFER_BACK_LEFT
;
304 return BUFFER_FRONT_LEFT
;
306 return BUFFER_FRONT_LEFT
;
315 case GL_COLOR_ATTACHMENT0_EXT
:
316 return BUFFER_COLOR0
;
317 case GL_COLOR_ATTACHMENT1_EXT
:
318 return BUFFER_COLOR1
;
319 case GL_COLOR_ATTACHMENT2_EXT
:
320 return BUFFER_COLOR2
;
321 case GL_COLOR_ATTACHMENT3_EXT
:
322 return BUFFER_COLOR3
;
331 * Called by glDrawBuffer().
332 * Specify which renderbuffer(s) to draw into for the first color output.
333 * <buffer> can name zero, one, two or four renderbuffers!
334 * \sa _mesa_DrawBuffersARB
336 * \param buffer buffer token such as GL_LEFT or GL_FRONT_AND_BACK, etc.
339 _mesa_DrawBuffer(GLenum buffer
)
343 GET_CURRENT_CONTEXT(ctx
);
344 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
); /* too complex... */
346 if (MESA_VERBOSE
& VERBOSE_API
) {
347 _mesa_debug(ctx
, "glDrawBuffer %s\n", _mesa_lookup_enum_by_nr(buffer
));
350 bufferID
= ctx
->DrawBuffer
->Name
;
352 if (buffer
== GL_NONE
) {
356 const GLbitfield supportedMask
= supported_buffer_bitmask(ctx
, bufferID
);
357 destMask
= draw_buffer_enum_to_bitmask(buffer
);
358 if (destMask
== BAD_MASK
) {
359 /* totally bogus buffer */
360 _mesa_error(ctx
, GL_INVALID_ENUM
, "glDrawBuffer(buffer)");
363 destMask
&= supportedMask
;
364 if (destMask
== 0x0) {
365 /* none of the named color buffers exist! */
366 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glDrawBuffer(buffer)");
371 /* if we get here, there's no error so set new state */
372 _mesa_drawbuffers(ctx
, 1, &buffer
, &destMask
);
377 * Called by glDrawBuffersARB; specifies the destination color renderbuffers
378 * for N fragment program color outputs.
379 * \sa _mesa_DrawBuffer
380 * \param n number of outputs
381 * \param buffers array [n] of renderbuffer names. Unlike glDrawBuffer, the
382 * names cannot specify more than one buffer. For example,
383 * GL_FRONT_AND_BACK is illegal.
386 _mesa_DrawBuffersARB(GLsizei n
, const GLenum
*buffers
)
390 GLbitfield usedBufferMask
, supportedMask
;
391 GLbitfield destMask
[MAX_DRAW_BUFFERS
];
392 GET_CURRENT_CONTEXT(ctx
);
393 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
395 if (!ctx
->Extensions
.ARB_draw_buffers
) {
396 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glDrawBuffersARB");
399 if (n
< 1 || n
> (GLsizei
) ctx
->Const
.MaxDrawBuffers
) {
400 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDrawBuffersARB(n)");
404 bufferID
= ctx
->DrawBuffer
->Name
;
406 supportedMask
= supported_buffer_bitmask(ctx
, bufferID
);
407 usedBufferMask
= 0x0;
409 /* complicated error checking... */
410 for (output
= 0; output
< n
; output
++) {
411 if (buffers
[output
] == GL_NONE
) {
412 destMask
[output
] = 0x0;
415 destMask
[output
] = draw_buffer_enum_to_bitmask(buffers
[output
]);
416 if (destMask
[output
] == BAD_MASK
417 || _mesa_bitcount(destMask
[output
]) > 1) {
418 _mesa_error(ctx
, GL_INVALID_ENUM
, "glDrawBuffersARB(buffer)");
421 destMask
[output
] &= supportedMask
;
422 if (destMask
[output
] == 0) {
423 _mesa_error(ctx
, GL_INVALID_OPERATION
,
424 "glDrawBuffersARB(unsupported buffer)");
427 if (destMask
[output
] & usedBufferMask
) {
428 /* can't specify a dest buffer more than once! */
429 _mesa_error(ctx
, GL_INVALID_OPERATION
,
430 "glDrawBuffersARB(duplicated buffer)");
435 usedBufferMask
|= destMask
[output
];
439 /* OK, if we get here, there were no errors so set the new state */
440 _mesa_drawbuffers(ctx
, n
, buffers
, destMask
);
445 * Set color output state. Traditionally, there was only one color
446 * output, but fragment programs can now have several distinct color
447 * outputs (see GL_ARB_draw_buffers). This function sets the state
448 * for one such color output.
449 * \param ctx current context
450 * \param output which fragment program output
451 * \param buffer buffer to write to (like GL_LEFT)
452 * \param destMask BUFFER_* bitmask
453 * (like BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT).
456 set_color_output(GLcontext
*ctx
, GLuint output
, GLenum buffer
,
459 struct gl_framebuffer
*fb
= ctx
->DrawBuffer
;
461 ASSERT(output
< ctx
->Const
.MaxDrawBuffers
);
463 /* Set per-FBO state */
464 fb
->ColorDrawBuffer
[output
] = buffer
;
465 fb
->_ColorDrawBufferMask
[output
] = destMask
;
466 /* not really needed, will be set later */
467 fb
->_NumColorDrawBuffers
[output
] = 0;
469 /* Set traditional state var */
470 ctx
->Color
.DrawBuffer
[output
] = buffer
;
475 * Helper routine used by _mesa_DrawBuffer, _mesa_DrawBuffersARB and
476 * _mesa_PopAttrib to set drawbuffer state.
477 * All error checking will have been done prior to calling this function
478 * so nothing should go wrong at this point.
479 * \param ctx current context
480 * \param n number of color outputs to set
481 * \param buffers array[n] of colorbuffer names, like GL_LEFT.
482 * \param destMask array[n] of BUFFER_* bitmasks which correspond to the
483 * colorbuffer names. (i.e. GL_FRONT_AND_BACK =>
484 * BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT).
487 _mesa_drawbuffers(GLcontext
*ctx
, GLuint n
, const GLenum
*buffers
,
488 const GLbitfield
*destMask
)
490 GLbitfield mask
[MAX_DRAW_BUFFERS
];
494 /* compute destMask values now */
495 const GLuint bufferID
= ctx
->DrawBuffer
->Name
;
496 const GLbitfield supportedMask
= supported_buffer_bitmask(ctx
, bufferID
);
497 for (output
= 0; output
< n
; output
++) {
498 mask
[output
] = draw_buffer_enum_to_bitmask(buffers
[output
]);
499 ASSERT(mask
[output
] != BAD_MASK
);
500 mask
[output
] &= supportedMask
;
505 for (output
= 0; output
< n
; output
++) {
506 set_color_output(ctx
, output
, buffers
[output
], destMask
[output
]);
509 /* set remaining color outputs to NONE */
510 for (output
= n
; output
< ctx
->Const
.MaxDrawBuffers
; output
++) {
511 set_color_output(ctx
, output
, GL_NONE
, 0x0);
514 ctx
->NewState
|= _NEW_COLOR
;
517 * Call device driver function.
519 if (ctx
->Driver
.DrawBuffers
)
520 ctx
->Driver
.DrawBuffers(ctx
, n
, buffers
);
521 else if (ctx
->Driver
.DrawBuffer
)
522 ctx
->Driver
.DrawBuffer(ctx
, buffers
[0]);
528 * Called by glReadBuffer to set the source renderbuffer for reading pixels.
529 * \param mode color buffer such as GL_FRONT, GL_BACK, etc.
532 _mesa_ReadBuffer(GLenum buffer
)
534 struct gl_framebuffer
*fb
;
535 GLbitfield supportedMask
;
538 GET_CURRENT_CONTEXT(ctx
);
539 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
541 fb
= ctx
->ReadBuffer
;
544 if (MESA_VERBOSE
& VERBOSE_API
)
545 _mesa_debug(ctx
, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer
));
547 if (bufferID
> 0 && buffer
== GL_NONE
) {
548 /* This is legal for user-created framebuffer objects */
552 /* general case / window-system framebuffer */
553 srcBuffer
= read_buffer_enum_to_index(buffer
);
554 if (srcBuffer
== -1) {
555 _mesa_error(ctx
, GL_INVALID_ENUM
, "glReadBuffer(buffer=0x%x)", buffer
);
558 supportedMask
= supported_buffer_bitmask(ctx
, bufferID
);
559 if (((1 << srcBuffer
) & supportedMask
) == 0) {
560 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glReadBuffer(buffer=0x%x)", buffer
);
566 ctx
->Pixel
.ReadBuffer
= buffer
;
568 fb
->ColorReadBuffer
= buffer
;
569 fb
->_ColorReadBufferIndex
= srcBuffer
;
571 ctx
->NewState
|= _NEW_PIXEL
;
574 * Call device driver function.
576 if (ctx
->Driver
.ReadBuffer
)
577 (*ctx
->Driver
.ReadBuffer
)(ctx
, buffer
);
584 * GL_MESA_resize_buffers extension.
586 * When this function is called, we'll ask the window system how large
587 * the current window is. If it's a new size, we'll call the driver's
588 * ResizeBuffers function. The driver will then resize its color buffers
589 * as needed, and maybe call the swrast's routine for reallocating
590 * swrast-managed depth/stencil/accum/etc buffers.
591 * \note This function should only be called through the GL API, not
592 * from device drivers (as was done in the past).
595 void _mesa_resizebuffers( GLcontext
*ctx
)
597 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
);
599 if (MESA_VERBOSE
& VERBOSE_API
)
600 _mesa_debug(ctx
, "glResizeBuffersMESA\n");
602 if (ctx
->WinSysDrawBuffer
) {
603 GLuint newWidth
, newHeight
;
604 GLframebuffer
*buffer
= ctx
->WinSysDrawBuffer
;
606 assert(buffer
->Name
== 0);
608 /* ask device driver for size of output buffer */
609 ctx
->Driver
.GetBufferSize( buffer
, &newWidth
, &newHeight
);
611 /* see if size of device driver's color buffer (window) has changed */
612 if (buffer
->Width
!= newWidth
|| buffer
->Height
!= newHeight
) {
613 if (ctx
->Driver
.ResizeBuffers
)
614 ctx
->Driver
.ResizeBuffers(ctx
, buffer
, newWidth
, newHeight
);
618 if (ctx
->WinSysReadBuffer
619 && ctx
->WinSysReadBuffer
!= ctx
->WinSysDrawBuffer
) {
620 GLuint newWidth
, newHeight
;
621 GLframebuffer
*buffer
= ctx
->WinSysReadBuffer
;
623 assert(buffer
->Name
== 0);
625 /* ask device driver for size of read buffer */
626 ctx
->Driver
.GetBufferSize( buffer
, &newWidth
, &newHeight
);
628 /* see if size of device driver's color buffer (window) has changed */
629 if (buffer
->Width
!= newWidth
|| buffer
->Height
!= newHeight
) {
630 if (ctx
->Driver
.ResizeBuffers
)
631 ctx
->Driver
.ResizeBuffers(ctx
, buffer
, newWidth
, newHeight
);
635 ctx
->NewState
|= _NEW_BUFFERS
; /* to update scissor / window bounds */
639 _mesa_ResizeBuffersMESA( void )
641 GET_CURRENT_CONTEXT(ctx
);
643 _mesa_resizebuffers( ctx
);
648 * XXX move somewhere else someday?
651 _mesa_SampleCoverageARB(GLclampf value
, GLboolean invert
)
653 GET_CURRENT_CONTEXT(ctx
);
655 if (!ctx
->Extensions
.ARB_multisample
) {
656 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glSampleCoverageARB");
660 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
);
661 ctx
->Multisample
.SampleCoverageValue
= (GLfloat
) CLAMP(value
, 0.0, 1.0);
662 ctx
->Multisample
.SampleCoverageInvert
= invert
;
663 ctx
->NewState
|= _NEW_MULTISAMPLE
;
666 #endif /* _HAVE_FULL_GL */
671 * Define the scissor box.
673 * \param x, y coordinates of the scissor box lower-left corner.
674 * \param width width of the scissor box.
675 * \param height height of the scissor box.
679 * Verifies the parameters and updates __GLcontextRec::Scissor. On a
680 * change flushes the vertices and notifies the driver via
681 * the dd_function_table::Scissor callback.
684 _mesa_set_scissor(GLcontext
*ctx
,
685 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
687 if (x
== ctx
->Scissor
.X
&&
688 y
== ctx
->Scissor
.Y
&&
689 width
== ctx
->Scissor
.Width
&&
690 height
== ctx
->Scissor
.Height
)
693 FLUSH_VERTICES(ctx
, _NEW_SCISSOR
);
696 ctx
->Scissor
.Width
= width
;
697 ctx
->Scissor
.Height
= height
;
699 if (ctx
->Driver
.Scissor
)
700 ctx
->Driver
.Scissor( ctx
, x
, y
, width
, height
);
705 _mesa_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
707 GET_CURRENT_CONTEXT(ctx
);
708 ASSERT_OUTSIDE_BEGIN_END(ctx
);
710 if (width
< 0 || height
< 0) {
711 _mesa_error( ctx
, GL_INVALID_VALUE
, "glScissor" );
715 if (MESA_VERBOSE
& VERBOSE_API
)
716 _mesa_debug(ctx
, "glScissor %d %d %d %d\n", x
, y
, width
, height
);
718 _mesa_set_scissor(ctx
, x
, y
, width
, height
);
723 /**********************************************************************/
724 /** \name Initialization */
728 * Initialize the context's scissor state.
729 * \param ctx the GL context.
732 _mesa_init_scissor(GLcontext
*ctx
)
735 ctx
->Scissor
.Enabled
= GL_FALSE
;
738 ctx
->Scissor
.Width
= 0;
739 ctx
->Scissor
.Height
= 0;
744 * Initialize the context's multisample state.
745 * \param ctx the GL context.
748 _mesa_init_multisample(GLcontext
*ctx
)
750 ctx
->Multisample
.Enabled
= GL_FALSE
;
751 ctx
->Multisample
.SampleAlphaToCoverage
= GL_FALSE
;
752 ctx
->Multisample
.SampleAlphaToOne
= GL_FALSE
;
753 ctx
->Multisample
.SampleCoverage
= GL_FALSE
;
754 ctx
->Multisample
.SampleCoverageValue
= 1.0;
755 ctx
->Multisample
.SampleCoverageInvert
= GL_FALSE
;