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;
198 if (framebufferID
> 0) {
199 /* 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 */
207 mask
= BUFFER_BIT_FRONT_LEFT
; /* always have this */
208 if (ctx
->Visual
.stereoMode
) {
209 mask
|= BUFFER_BIT_FRONT_RIGHT
;
210 if (ctx
->Visual
.doubleBufferMode
) {
211 mask
|= BUFFER_BIT_BACK_LEFT
| BUFFER_BIT_BACK_RIGHT
;
214 else if (ctx
->Visual
.doubleBufferMode
) {
215 mask
|= BUFFER_BIT_BACK_LEFT
;
218 for (i
= 0; i
< ctx
->Visual
.numAuxBuffers
; i
++) {
219 mask
|= (BUFFER_BIT_AUX0
<< i
);
228 * Helper routine used by glDrawBuffer and glDrawBuffersARB.
229 * Given a GLenum naming one or more color buffers (such as
230 * GL_FRONT_AND_BACK), return the corresponding bitmask of BUFFER_BIT_* flags.
233 draw_buffer_enum_to_bitmask(GLenum buffer
)
239 return BUFFER_BIT_FRONT_LEFT
| BUFFER_BIT_FRONT_RIGHT
;
241 return BUFFER_BIT_BACK_LEFT
| BUFFER_BIT_BACK_RIGHT
;
243 return BUFFER_BIT_FRONT_RIGHT
| BUFFER_BIT_BACK_RIGHT
;
245 return BUFFER_BIT_FRONT_RIGHT
;
247 return BUFFER_BIT_BACK_RIGHT
;
249 return BUFFER_BIT_BACK_LEFT
;
250 case GL_FRONT_AND_BACK
:
251 return BUFFER_BIT_FRONT_LEFT
| BUFFER_BIT_BACK_LEFT
252 | BUFFER_BIT_FRONT_RIGHT
| BUFFER_BIT_BACK_RIGHT
;
254 return BUFFER_BIT_FRONT_LEFT
| BUFFER_BIT_BACK_LEFT
;
256 return BUFFER_BIT_FRONT_LEFT
;
258 return BUFFER_BIT_AUX0
;
260 return BUFFER_BIT_AUX1
;
262 return BUFFER_BIT_AUX2
;
264 return BUFFER_BIT_AUX3
;
265 case GL_COLOR_ATTACHMENT0_EXT
:
266 return BUFFER_BIT_COLOR0
;
267 case GL_COLOR_ATTACHMENT1_EXT
:
268 return BUFFER_BIT_COLOR1
;
269 case GL_COLOR_ATTACHMENT2_EXT
:
270 return BUFFER_BIT_COLOR2
;
271 case GL_COLOR_ATTACHMENT3_EXT
:
272 return BUFFER_BIT_COLOR3
;
281 * Helper routine used by glReadBuffer.
282 * Given a GLenum naming a color buffer, return the index of the corresponding
283 * renderbuffer (a BUFFER_* value).
284 * return -1 for an invalid buffer.
287 read_buffer_enum_to_index(GLenum buffer
)
291 return BUFFER_FRONT_LEFT
;
293 return BUFFER_BACK_LEFT
;
295 return BUFFER_FRONT_RIGHT
;
297 return BUFFER_FRONT_RIGHT
;
299 return BUFFER_BACK_RIGHT
;
301 return BUFFER_BACK_LEFT
;
303 return BUFFER_FRONT_LEFT
;
305 return BUFFER_FRONT_LEFT
;
314 case GL_COLOR_ATTACHMENT0_EXT
:
315 return BUFFER_COLOR0
;
316 case GL_COLOR_ATTACHMENT1_EXT
:
317 return BUFFER_COLOR1
;
318 case GL_COLOR_ATTACHMENT2_EXT
:
319 return BUFFER_COLOR2
;
320 case GL_COLOR_ATTACHMENT3_EXT
:
321 return BUFFER_COLOR3
;
330 * Called by glDrawBuffer().
331 * Specify which renderbuffer(s) to draw into for the first color output.
332 * <buffer> can name zero, one, two or four renderbuffers!
333 * \sa _mesa_DrawBuffersARB
335 * \param buffer buffer token such as GL_LEFT or GL_FRONT_AND_BACK, etc.
338 _mesa_DrawBuffer(GLenum buffer
)
342 GET_CURRENT_CONTEXT(ctx
);
343 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
); /* too complex... */
345 if (MESA_VERBOSE
& VERBOSE_API
) {
346 _mesa_debug(ctx
, "glDrawBuffer %s\n", _mesa_lookup_enum_by_nr(buffer
));
349 bufferID
= ctx
->DrawBuffer
->Name
;
351 if (buffer
== GL_NONE
) {
355 const GLbitfield supportedMask
= supported_buffer_bitmask(ctx
, bufferID
);
356 destMask
= draw_buffer_enum_to_bitmask(buffer
);
357 if (destMask
== BAD_MASK
) {
358 /* totally bogus buffer */
359 _mesa_error(ctx
, GL_INVALID_ENUM
, "glDrawBuffer(buffer)");
362 destMask
&= supportedMask
;
363 if (destMask
== 0x0) {
364 /* none of the named color buffers exist! */
365 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glDrawBuffer(buffer)");
370 /* if we get here, there's no error so set new state */
371 _mesa_drawbuffers(ctx
, 1, &buffer
, &destMask
);
376 * Called by glDrawBuffersARB; specifies the destination color renderbuffers
377 * for N fragment program color outputs.
378 * \sa _mesa_DrawBuffer
379 * \param n number of outputs
380 * \param buffers array [n] of renderbuffer names. Unlike glDrawBuffer, the
381 * names cannot specify more than one buffer. For example,
382 * GL_FRONT_AND_BACK is illegal.
385 _mesa_DrawBuffersARB(GLsizei n
, const GLenum
*buffers
)
389 GLbitfield usedBufferMask
, supportedMask
;
390 GLbitfield destMask
[MAX_DRAW_BUFFERS
];
391 GET_CURRENT_CONTEXT(ctx
);
392 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
394 if (!ctx
->Extensions
.ARB_draw_buffers
) {
395 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glDrawBuffersARB");
398 if (n
< 1 || n
> (GLsizei
) ctx
->Const
.MaxDrawBuffers
) {
399 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDrawBuffersARB(n)");
403 bufferID
= ctx
->DrawBuffer
->Name
;
405 supportedMask
= supported_buffer_bitmask(ctx
, bufferID
);
406 usedBufferMask
= 0x0;
408 /* complicated error checking... */
409 for (output
= 0; output
< n
; output
++) {
410 if (buffers
[output
] == GL_NONE
) {
411 destMask
[output
] = 0x0;
414 destMask
[output
] = draw_buffer_enum_to_bitmask(buffers
[output
]);
415 if (destMask
[output
] == BAD_MASK
416 || _mesa_bitcount(destMask
[output
]) > 1) {
417 _mesa_error(ctx
, GL_INVALID_ENUM
, "glDrawBuffersARB(buffer)");
420 destMask
[output
] &= supportedMask
;
421 if (destMask
[output
] == 0) {
422 _mesa_error(ctx
, GL_INVALID_OPERATION
,
423 "glDrawBuffersARB(unsupported buffer)");
426 if (destMask
[output
] & usedBufferMask
) {
427 /* can't specify a dest buffer more than once! */
428 _mesa_error(ctx
, GL_INVALID_OPERATION
,
429 "glDrawBuffersARB(duplicated buffer)");
434 usedBufferMask
|= destMask
[output
];
438 /* OK, if we get here, there were no errors so set the new state */
439 _mesa_drawbuffers(ctx
, n
, buffers
, destMask
);
444 * Set color output state. Traditionally, there was only one color
445 * output, but fragment programs can now have several distinct color
446 * outputs (see GL_ARB_draw_buffers). This function sets the state
447 * for one such color output.
448 * \param ctx current context
449 * \param output which fragment program output
450 * \param buffer buffer to write to (like GL_LEFT)
451 * \param destMask BUFFER_* bitmask
452 * (like BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT).
455 set_color_output(GLcontext
*ctx
, GLuint output
, GLenum buffer
,
458 struct gl_framebuffer
*fb
= ctx
->DrawBuffer
;
460 ASSERT(output
< ctx
->Const
.MaxDrawBuffers
);
462 fb
->ColorDrawBuffer
[output
] = buffer
;
463 fb
->_ColorDrawBufferMask
[output
] = destMask
;
466 /* Set traditional state var */
467 ctx
->Color
.DrawBuffer
[output
] = buffer
;
470 /* not really needed, will be set later */
471 fb
->_NumColorDrawBuffers
[output
] = 0;
476 * Helper routine used by _mesa_DrawBuffer, _mesa_DrawBuffersARB and
477 * _mesa_PopAttrib to set drawbuffer state.
478 * All error checking will have been done prior to calling this function
479 * so nothing should go wrong at this point.
480 * \param ctx current context
481 * \param n number of color outputs to set
482 * \param buffers array[n] of colorbuffer names, like GL_LEFT.
483 * \param destMask array[n] of BUFFER_* bitmasks which correspond to the
484 * colorbuffer names. (i.e. GL_FRONT_AND_BACK =>
485 * BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT).
488 _mesa_drawbuffers(GLcontext
*ctx
, GLsizei n
, const GLenum
*buffers
,
489 const GLbitfield
*destMask
)
491 GLbitfield mask
[MAX_DRAW_BUFFERS
];
495 /* compute destMask values now */
496 const GLuint bufferID
= ctx
->DrawBuffer
->Name
;
497 const GLbitfield supportedMask
= supported_buffer_bitmask(ctx
, bufferID
);
498 for (output
= 0; output
< n
; output
++) {
499 mask
[output
] = draw_buffer_enum_to_bitmask(buffers
[output
]);
500 ASSERT(mask
[output
] != BAD_MASK
);
501 mask
[output
] &= supportedMask
;
506 for (output
= 0; output
< n
; output
++) {
507 set_color_output(ctx
, output
, buffers
[output
], destMask
[output
]);
510 /* set remaining color outputs to NONE */
511 for (output
= n
; output
< ctx
->Const
.MaxDrawBuffers
; output
++) {
512 set_color_output(ctx
, output
, GL_NONE
, 0x0);
515 ctx
->NewState
|= _NEW_COLOR
;
518 * Call device driver function.
520 if (ctx
->Driver
.DrawBuffers
)
521 ctx
->Driver
.DrawBuffers(ctx
, n
, buffers
);
522 else if (ctx
->Driver
.DrawBuffer
)
523 ctx
->Driver
.DrawBuffer(ctx
, buffers
[0]);
529 * Called by glReadBuffer to set the source renderbuffer for reading pixels.
530 * \param mode color buffer such as GL_FRONT, GL_BACK, etc.
533 _mesa_ReadBuffer(GLenum buffer
)
535 struct gl_framebuffer
*fb
;
536 GLbitfield supportedMask
;
539 GET_CURRENT_CONTEXT(ctx
);
540 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
542 fb
= ctx
->ReadBuffer
;
545 if (MESA_VERBOSE
& VERBOSE_API
)
546 _mesa_debug(ctx
, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer
));
548 if (bufferID
> 0 && buffer
== GL_NONE
) {
549 /* This is legal for user-created framebuffer objects */
553 /* general case / window-system framebuffer */
554 srcBuffer
= read_buffer_enum_to_index(buffer
);
555 if (srcBuffer
== -1) {
556 _mesa_error(ctx
, GL_INVALID_ENUM
, "glReadBuffer(buffer=0x%x)", buffer
);
559 supportedMask
= supported_buffer_bitmask(ctx
, bufferID
);
560 if (((1 << srcBuffer
) & supportedMask
) == 0) {
561 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glReadBuffer(buffer=0x%x)", buffer
);
567 ctx
->Pixel
.ReadBuffer
= buffer
;
569 fb
->ColorReadBuffer
= buffer
;
570 fb
->_ColorReadBufferIndex
= srcBuffer
;
572 ctx
->NewState
|= _NEW_PIXEL
;
575 * Call device driver function.
577 if (ctx
->Driver
.ReadBuffer
)
578 (*ctx
->Driver
.ReadBuffer
)(ctx
, buffer
);
585 * GL_MESA_resize_buffers extension.
587 * When this function is called, we'll ask the window system how large
588 * the current window is. If it's a new size, we'll call the driver's
589 * ResizeBuffers function. The driver will then resize its color buffers
590 * as needed, and maybe call the swrast's routine for reallocating
591 * swrast-managed depth/stencil/accum/etc buffers.
592 * \note This function should only be called through the GL API, not
593 * from device drivers (as was done in the past).
596 _mesa_ResizeBuffersMESA( void )
598 GET_CURRENT_CONTEXT(ctx
);
600 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
);
602 if (MESA_VERBOSE
& VERBOSE_API
)
603 _mesa_debug(ctx
, "glResizeBuffersMESA\n");
605 if (ctx
->WinSysDrawBuffer
) {
606 GLuint newWidth
, newHeight
;
607 GLframebuffer
*buffer
= ctx
->WinSysDrawBuffer
;
609 assert(buffer
->Name
== 0);
611 /* ask device driver for size of output buffer */
612 ctx
->Driver
.GetBufferSize( buffer
, &newWidth
, &newHeight
);
614 /* see if size of device driver's color buffer (window) has changed */
615 if (buffer
->Width
!= newWidth
|| buffer
->Height
!= newHeight
) {
616 if (ctx
->Driver
.ResizeBuffers
)
617 ctx
->Driver
.ResizeBuffers(ctx
, buffer
, newWidth
, newHeight
);
621 if (ctx
->WinSysReadBuffer
622 && ctx
->WinSysReadBuffer
!= ctx
->WinSysDrawBuffer
) {
623 GLuint newWidth
, newHeight
;
624 GLframebuffer
*buffer
= ctx
->WinSysReadBuffer
;
626 assert(buffer
->Name
== 0);
628 /* ask device driver for size of read buffer */
629 ctx
->Driver
.GetBufferSize( buffer
, &newWidth
, &newHeight
);
631 /* see if size of device driver's color buffer (window) has changed */
632 if (buffer
->Width
!= newWidth
|| buffer
->Height
!= newHeight
) {
633 if (ctx
->Driver
.ResizeBuffers
)
634 ctx
->Driver
.ResizeBuffers(ctx
, buffer
, newWidth
, newHeight
);
638 ctx
->NewState
|= _NEW_BUFFERS
; /* to update scissor / window bounds */
643 * XXX move somewhere else someday?
646 _mesa_SampleCoverageARB(GLclampf value
, GLboolean invert
)
648 GET_CURRENT_CONTEXT(ctx
);
650 if (!ctx
->Extensions
.ARB_multisample
) {
651 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glSampleCoverageARB");
655 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
);
656 ctx
->Multisample
.SampleCoverageValue
= (GLfloat
) CLAMP(value
, 0.0, 1.0);
657 ctx
->Multisample
.SampleCoverageInvert
= invert
;
658 ctx
->NewState
|= _NEW_MULTISAMPLE
;
661 #endif /* _HAVE_FULL_GL */
666 * Define the scissor box.
668 * \param x, y coordinates of the scissor box lower-left corner.
669 * \param width width of the scissor box.
670 * \param height height of the scissor box.
674 * Verifies the parameters and updates __GLcontextRec::Scissor. On a
675 * change flushes the vertices and notifies the driver via
676 * the dd_function_table::Scissor callback.
678 void _mesa_set_scissor( GLcontext
*ctx
,
679 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
681 if (x
== ctx
->Scissor
.X
&&
682 y
== ctx
->Scissor
.Y
&&
683 width
== ctx
->Scissor
.Width
&&
684 height
== ctx
->Scissor
.Height
)
687 FLUSH_VERTICES(ctx
, _NEW_SCISSOR
);
690 ctx
->Scissor
.Width
= width
;
691 ctx
->Scissor
.Height
= height
;
693 if (ctx
->Driver
.Scissor
)
694 ctx
->Driver
.Scissor( ctx
, x
, y
, width
, height
);
699 _mesa_Scissor( GLint x
, GLint y
, GLsizei width
, GLsizei height
)
701 GET_CURRENT_CONTEXT(ctx
);
702 ASSERT_OUTSIDE_BEGIN_END(ctx
);
704 if (width
< 0 || height
< 0) {
705 _mesa_error( ctx
, GL_INVALID_VALUE
, "glScissor" );
709 if (MESA_VERBOSE
& VERBOSE_API
)
710 _mesa_debug(ctx
, "glScissor %d %d %d %d\n", x
, y
, width
, height
);
712 _mesa_set_scissor(ctx
, x
, y
, width
, height
);
717 /**********************************************************************/
718 /** \name Initialization */
722 * Initialize the context's scissor state.
723 * \param ctx the GL context.
726 _mesa_init_scissor(GLcontext
*ctx
)
729 ctx
->Scissor
.Enabled
= GL_FALSE
;
732 ctx
->Scissor
.Width
= 0;
733 ctx
->Scissor
.Height
= 0;
738 * Initialize the context's multisample state.
739 * \param ctx the GL context.
742 _mesa_init_multisample(GLcontext
*ctx
)
744 ctx
->Multisample
.Enabled
= GL_FALSE
;
745 ctx
->Multisample
.SampleAlphaToCoverage
= GL_FALSE
;
746 ctx
->Multisample
.SampleAlphaToOne
= GL_FALSE
;
747 ctx
->Multisample
.SampleCoverage
= GL_FALSE
;
748 ctx
->Multisample
.SampleCoverageValue
= 1.0;
749 ctx
->Multisample
.SampleCoverageInvert
= GL_FALSE
;