From fb206809ba2a131fd9034e10a00592f2d0d81fce Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 1 Aug 2007 12:58:38 -0600 Subject: Checkpoint: glClear changes - working, bug very rough. --- src/mesa/main/buffers.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/mesa/main/buffers.c') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 0e6ca8ea1c..bb019b5998 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -38,6 +38,8 @@ #include "fbobject.h" #include "state.h" +#include "state_tracker/st_draw.h" + #define BAD_MASK ~0u @@ -176,7 +178,15 @@ _mesa_Clear( GLbitfield mask ) } ASSERT(ctx->Driver.Clear); +#if 0 ctx->Driver.Clear(ctx, bufferMask); +#else + st_clear(ctx->st, + (mask & GL_COLOR_BUFFER_BIT) ? GL_TRUE : GL_FALSE, + (bufferMask & BUFFER_BIT_DEPTH) ? GL_TRUE : GL_FALSE, + (bufferMask & BUFFER_BIT_STENCIL) ? GL_TRUE : GL_FALSE, + (bufferMask & BUFFER_BIT_ACCUM) ? GL_TRUE : GL_FALSE); +#endif } } -- cgit v1.2.3 From 4f442d9ef5db42867c99a7288b4114a0340f73e6 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 2 Aug 2007 13:59:31 +0100 Subject: Reroute some clear functionality. Still require the intelClear() call to flush batchbuffers. That will be removed later... --- src/mesa/drivers/dri/i915pipe/intel_buffers.c | 120 ++------------------------ src/mesa/drivers/dri/i915pipe/intel_context.c | 7 +- src/mesa/main/buffers.c | 8 -- src/mesa/pipe/softpipe/sp_clear.c | 70 +++++---------- src/mesa/sources | 1 + src/mesa/state_tracker/st_cb_clear.c | 89 +++++++++++++++++++ src/mesa/state_tracker/st_context.c | 1 + src/mesa/state_tracker/st_draw.c | 11 --- 8 files changed, 125 insertions(+), 182 deletions(-) create mode 100644 src/mesa/state_tracker/st_cb_clear.c (limited to 'src/mesa/main/buffers.c') diff --git a/src/mesa/drivers/dri/i915pipe/intel_buffers.c b/src/mesa/drivers/dri/i915pipe/intel_buffers.c index e39220fe47..5e68a869bf 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_buffers.c +++ b/src/mesa/drivers/dri/i915pipe/intel_buffers.c @@ -295,110 +295,14 @@ intelWindowMoved(struct intel_context *intel) -/** - * Called by ctx->Driver.Clear. - * XXX NO LONGER USED - REMOVE IN NEAR FUTURE - */ -#if 0 -static void -intelClear(GLcontext *ctx, GLbitfield mask) -#else -static void -OLD_intelClear(struct pipe_context *pipe, - GLboolean color, GLboolean depth, - GLboolean stencil, GLboolean accum) -#endif -{ - GLcontext *ctx = (GLcontext *) pipe->glctx; - const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask); - GLbitfield tri_mask = 0; - GLbitfield blit_mask = 0; - GLbitfield swrast_mask = 0; - struct gl_framebuffer *fb = ctx->DrawBuffer; - GLuint i; - - GLbitfield mask; - - if (color) - mask = ctx->DrawBuffer->_ColorDrawBufferMask[0]; /*XXX temporary*/ - else - mask = 0x0; - - if (0) - fprintf(stderr, "%s\n", __FUNCTION__); - - /* HW color buffers (front, back, aux, generic FBO, etc) */ - if (colorMask == ~0) { - /* clear all R,G,B,A */ - /* XXX FBO: need to check if colorbuffers are software RBOs! */ - blit_mask |= (mask & BUFFER_BITS_COLOR); - } - else { - /* glColorMask in effect */ - tri_mask |= (mask & BUFFER_BITS_COLOR); - } - - /* HW stencil */ - if (stencil) { - const struct pipe_region *stencilRegion - = intel_get_rb_region(fb, BUFFER_STENCIL); - if (stencilRegion) { - /* have hw stencil */ - if ((ctx->Stencil.WriteMask[0] & 0xff) != 0xff) { - /* not clearing all stencil bits, so use triangle clearing */ - tri_mask |= BUFFER_BIT_STENCIL; - } - else { - /* clearing all stencil bits, use blitting */ - blit_mask |= BUFFER_BIT_STENCIL; - } - } - } - - /* HW depth */ - if (depth) { - /* clear depth with whatever method is used for stencil (see above) */ - if (tri_mask & BUFFER_BIT_STENCIL) - tri_mask |= BUFFER_BIT_DEPTH; - else - blit_mask |= BUFFER_BIT_DEPTH; - } - - /* SW fallback clearing */ - swrast_mask = mask & ~tri_mask & ~blit_mask; - - for (i = 0; i < BUFFER_COUNT; i++) { - GLuint bufBit = 1 << i; - if ((blit_mask | tri_mask) & bufBit) { - if (!fb->Attachment[i].Renderbuffer->ClassID) { - blit_mask &= ~bufBit; - tri_mask &= ~bufBit; - swrast_mask |= bufBit; - } - } - } - - - intelFlush(ctx); /* XXX intelClearWithBlit also does this */ - - if (blit_mask) - intelClearWithBlit(ctx, blit_mask); - -#if 0 - if (swrast_mask | tri_mask) - _swrast_Clear(ctx, swrast_mask | tri_mask); -#else - softpipe_clear(pipe, GL_FALSE, - (swrast_mask | tri_mask) & BUFFER_BIT_DEPTH, - (swrast_mask | tri_mask) & BUFFER_BIT_STENCIL, - (swrast_mask | tri_mask) & BUFFER_BIT_ACCUM); -#endif -} - -/** - * Clear buffers. Called via pipe->clear(). - */ +/* XXX - kludge required because softpipe_clear uses + * region->fill(), which still calls intelBlit(!), but doesn't + * flush the batchbuffer. + * + * One way or another, that behaviour should stop, and then this + * function can go aawy. + */ void intelClear(struct pipe_context *pipe, GLboolean color, GLboolean depth, @@ -407,19 +311,9 @@ intelClear(struct pipe_context *pipe, GLcontext *ctx = (GLcontext *) pipe->glctx; struct intel_context *intel = intel_context(ctx); - /* XXX - * Examine stencil and color writemasks to determine if we can clear - * with blits. - */ - - intelFlush(&intel->ctx); - LOCK_HARDWARE(intel); - softpipe_clear(pipe, color, depth, stencil, accum); intel_batchbuffer_flush(intel->batch); - - UNLOCK_HARDWARE(intel); } diff --git a/src/mesa/drivers/dri/i915pipe/intel_context.c b/src/mesa/drivers/dri/i915pipe/intel_context.c index be8235d7d1..0fc24c3b5a 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_context.c +++ b/src/mesa/drivers/dri/i915pipe/intel_context.c @@ -417,7 +417,12 @@ intelCreateContext(const __GLcontextModes * mesaVis, */ st_create_context( &intel->ctx, softpipe_create() ); - + + /* KW: Not sure I like this - we should only be talking to the + * state_tracker. The pipe code will need some way of talking to + * us, eg for batchbuffer ioctls, and there will need to be a + * buffer manager interface. So, this is a temporary hack, right? + */ intel->pipe = intel->ctx.st->pipe; intel->pipe->screen = intelScreen; intel->pipe->glctx = ctx; diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index bb019b5998..eea443c03c 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -178,15 +178,7 @@ _mesa_Clear( GLbitfield mask ) } ASSERT(ctx->Driver.Clear); -#if 0 ctx->Driver.Clear(ctx, bufferMask); -#else - st_clear(ctx->st, - (mask & GL_COLOR_BUFFER_BIT) ? GL_TRUE : GL_FALSE, - (bufferMask & BUFFER_BIT_DEPTH) ? GL_TRUE : GL_FALSE, - (bufferMask & BUFFER_BIT_STENCIL) ? GL_TRUE : GL_FALSE, - (bufferMask & BUFFER_BIT_ACCUM) ? GL_TRUE : GL_FALSE); -#endif } } diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/mesa/pipe/softpipe/sp_clear.c index a133b48891..09cc643003 100644 --- a/src/mesa/pipe/softpipe/sp_clear.c +++ b/src/mesa/pipe/softpipe/sp_clear.c @@ -60,53 +60,20 @@ color_value(GLuint format, const GLfloat color[4]) } } -static GLuint -color_mask(GLuint format, GLuint pipeMask) -{ - GLuint mask = 0x0; - switch (format) { - case PIPE_FORMAT_U_R8_G8_B8_A8: - if (pipeMask & PIPE_MASK_R) mask |= 0xff000000; - if (pipeMask & PIPE_MASK_G) mask |= 0x00ff0000; - if (pipeMask & PIPE_MASK_B) mask |= 0x0000ff00; - if (pipeMask & PIPE_MASK_A) mask |= 0x000000ff; - break; - case PIPE_FORMAT_U_A8_R8_G8_B8: - if (pipeMask & PIPE_MASK_R) mask |= 0x00ff0000; - if (pipeMask & PIPE_MASK_G) mask |= 0x0000ff00; - if (pipeMask & PIPE_MASK_B) mask |= 0x000000ff; - if (pipeMask & PIPE_MASK_A) mask |= 0xff000000; - break; - case PIPE_FORMAT_U_R5_G6_B5: - if (pipeMask & PIPE_MASK_R) mask |= 0xf800; - if (pipeMask & PIPE_MASK_G) mask |= 0x07e0; - if (pipeMask & PIPE_MASK_B) mask |= 0x001f; - if (pipeMask & PIPE_MASK_A) mask |= 0; - break; - default: - return 0; - } - return mask; -} - -/** - * XXX This should probaby be renamed to something like pipe_clear_with_blits() - * and moved into a device-independent pipe file. - */ void softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth, GLboolean stencil, GLboolean accum) { - const struct softpipe_context *softpipe = softpipe_context(pipe); + struct softpipe_context *softpipe = softpipe_context(pipe); GLint x, y, w, h; - softpipe_update_derived(softpipe); + softpipe_update_derived(softpipe); /* not needed?? */ - x = softpipe->cliprect.minx; - y = softpipe->cliprect.miny; - w = softpipe->cliprect.maxx - x; - h = softpipe->cliprect.maxy - y; + x = 0; + y = 0; + w = softpipe->framebuffer.cbufs[0]->width; + h = softpipe->framebuffer.cbufs[0]->height; if (color) { GLuint i; @@ -114,8 +81,7 @@ softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth, struct pipe_surface *ps = softpipe->framebuffer.cbufs[i]; GLuint clearVal = color_value(ps->format, softpipe->clear_color.color); - GLuint mask = color_mask(ps->format, softpipe->blend.colormask); - pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, mask); + pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, ~0); } } @@ -124,10 +90,13 @@ softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth, /* clear Z and stencil together */ struct pipe_surface *ps = softpipe->framebuffer.zbuf; if (ps->format == PIPE_FORMAT_S8_Z24) { - GLuint mask = (softpipe->stencil.write_mask[0] << 8) | 0xffffff; + GLuint mask = (softpipe->stencil.write_mask[0] << 8) | 0xffffff; GLuint clearVal = (GLuint) (softpipe->depth_test.clear * 0xffffff); + + assert (mask == ~0); + clearVal |= (softpipe->stencil.clear_value << 24); - pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, mask); + pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, ~0); } else { /* XXX Z24_S8 format? */ @@ -138,33 +107,36 @@ softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth, /* separate Z and stencil */ if (depth) { struct pipe_surface *ps = softpipe->framebuffer.zbuf; - GLuint mask, clearVal; + GLuint clearVal; switch (ps->format) { case PIPE_FORMAT_U_Z16: clearVal = (GLuint) (softpipe->depth_test.clear * 65535.0); - mask = 0xffff; break; case PIPE_FORMAT_U_Z32: clearVal = (GLuint) (softpipe->depth_test.clear * 0xffffffff); - mask = 0xffffffff; break; case PIPE_FORMAT_S8_Z24: clearVal = (GLuint) (softpipe->depth_test.clear * 0xffffff); - mask = 0xffffff; break; default: assert(0); } - pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, mask); + pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, ~0); } if (stencil) { struct pipe_surface *ps = softpipe->framebuffer.sbuf; GLuint clearVal = softpipe->stencil.clear_value; + + /* If this is not ~0, we shouldn't get here - clear should be + * done with geometry instead. + */ GLuint mask = softpipe->stencil.write_mask[0]; + assert((mask & 0xff) == 0xff); + switch (ps->format) { case PIPE_FORMAT_S8_Z24: clearVal = clearVal << 24; @@ -187,7 +159,7 @@ softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth, */ struct pipe_surface *ps = softpipe->framebuffer.abuf; GLuint clearVal = 0x0; /* XXX FIX */ - GLuint mask = !0; + GLuint mask = ~0; assert(ps); pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, mask); } diff --git a/src/mesa/sources b/src/mesa/sources index d9ee7266e5..d0fe3a979f 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -191,6 +191,7 @@ STATETRACKER_SOURCES = \ state_tracker/st_atom_stencil.c \ state_tracker/st_atom_stipple.c \ state_tracker/st_atom_viewport.c \ + state_tracker/st_cb_clear.c \ state_tracker/st_cb_program.c \ state_tracker/st_draw.c \ state_tracker/st_context.c \ diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c new file mode 100644 index 0000000000..d9cb83b8ad --- /dev/null +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -0,0 +1,89 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + /* + * Authors: + * Keith Whitwell + * Brian Paul + */ + +#include "st_context.h" +#include "glheader.h" +#include "macros.h" +#include "enums.h" +#include "st_context.h" +#include "st_atom.h" +#include "pipe/p_context.h" + + + +/* XXX: doesn't pick up the differences between front/back/left/right + * clears. Need to sort that out... + */ +static void st_clear(GLcontext *ctx, GLbitfield mask) +{ + struct st_context *st = ctx->st; + GLboolean color = (mask & BUFFER_BITS_COLOR) ? GL_TRUE : GL_FALSE; + GLboolean depth = (mask & BUFFER_BIT_DEPTH) ? GL_TRUE : GL_FALSE; + GLboolean stencil = (mask & BUFFER_BIT_STENCIL) ? GL_TRUE : GL_FALSE; + GLboolean accum = (mask & BUFFER_BIT_ACCUM) ? GL_TRUE : GL_FALSE; + GLboolean fullscreen = 1; /* :-) */ + + /* This makes sure the softpipe has the latest scissor, etc values */ + st_validate_state( st ); + + if (fullscreen) { + /* pipe->clear() should clear a particular surface, so that we + * can iterate over render buffers at this level and clear the + * ones GL is asking for. + * + * Will probably need something like pipe->clear_z_stencil() to + * cope with the special case of paired and unpaired z/stencil + * buffers, though could perhaps deal with them explicitly at + * this level. + */ + st->pipe->clear(st->pipe, color, depth, stencil, accum); + } + else { + /* Convert to geometry, etc: + */ + } +} + + +void st_init_cb_clear( struct st_context *st ) +{ + struct dd_function_table *functions = &st->ctx->Driver; + + functions->Clear = st_clear; +} + + +void st_destroy_cb_clear( struct st_context *st ) +{ +} + diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 6308e81a61..4d3f0ec4d3 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -58,6 +58,7 @@ struct st_context *st_create_context( GLcontext *ctx, st_init_atoms( st ); st_init_draw( st ); st_init_cb_program( st ); + st_init_cb_clear( st ); return st; } diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index a424d1dd05..95fa43df4d 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -107,14 +107,3 @@ void st_destroy_draw( struct st_context *st ) } -/** XXX temporary here */ -void -st_clear(struct st_context *st, GLboolean color, GLboolean depth, - GLboolean stencil, GLboolean accum) -{ - /* This makes sure the softpipe has the latest scissor, etc values */ - st_validate_state( st ); - - st->pipe->clear(st->pipe, color, depth, stencil, accum); -} - -- cgit v1.2.3 From 566ae9196b267492d9fcfb2be9065fb8017702f9 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 2 Aug 2007 14:20:13 -0600 Subject: remove st_draw.h include --- src/mesa/main/buffers.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/mesa/main/buffers.c') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index eea443c03c..0e6ca8ea1c 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -38,8 +38,6 @@ #include "fbobject.h" #include "state.h" -#include "state_tracker/st_draw.h" - #define BAD_MASK ~0u -- cgit v1.2.3 From 49adf51eeec31c9f3c995a70acc5008522689708 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 17 Oct 2007 16:18:45 -0600 Subject: Add some FLUSH_CURRENT() calls. Without these we can find ourselves in _mesa_load_state_parameters() computing derived lighting/material values whhen the current material properties haven't been updated from the VBO. This may be a somewhat wide-spread problem that needs more attention... --- src/mesa/main/buffers.c | 2 ++ src/mesa/main/drawpix.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src/mesa/main/buffers.c') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 0e6ca8ea1c..7a918c53a7 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -118,6 +118,8 @@ _mesa_Clear( GLbitfield mask ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT(ctx, 0); + if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glClear 0x%x\n", mask); diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 296dcf8f0b..e4be0d496e 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -276,6 +276,8 @@ _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT(ctx, 0); + if (width < 0 || height < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glReadPixels(width=%d height=%d)", width, height ); -- cgit v1.2.3 From ba0fcc47d61be6caa2f4a5f4eb0c36eba9e2cb59 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 29 Oct 2007 17:36:39 -0600 Subject: Set _NEW_BUFFERS in glRead/DrawBuffer(). Previously, we set _NEW_PIXEL and _NEW_COLOR in these functions, respectively. That correponds to the GL attribute groups, but doesn't make much sense otherwise. This could improve validation efficiency in a few places too. It looks like all the drivers are already checking for _NEW_BUFFERS in the right places (since that's the bit for FBO state) so we can trim out _NEW_PIXEL and _NEW_COLOR at any time. --- src/mesa/drivers/x11/xm_dd.c | 2 +- src/mesa/main/buffers.c | 4 ++-- src/mesa/main/state.c | 2 +- src/mesa/state_tracker/st_atom_framebuffer.c | 6 +----- 4 files changed, 5 insertions(+), 9 deletions(-) (limited to 'src/mesa/main/buffers.c') diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 3ee44bfbaf..8ae243ae66 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -841,7 +841,7 @@ xmesa_update_state( GLcontext *ctx, GLbitfield new_state ) * GL_DITHER, GL_READ/DRAW_BUFFER, buffer binding state, etc. effect * renderbuffer span/clear funcs. */ - if (new_state & (_NEW_COLOR | _NEW_PIXEL | _NEW_BUFFERS)) { + if (new_state & (_NEW_COLOR | _NEW_BUFFERS)) { XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); struct xmesa_renderbuffer *front_xrb, *back_xrb; diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 7a918c53a7..3cbd671bab 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -527,7 +527,7 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers, set_color_output(ctx, output, GL_NONE, 0x0); } - ctx->NewState |= _NEW_COLOR; + ctx->NewState |= _NEW_BUFFERS; } @@ -588,7 +588,7 @@ _mesa_ReadBuffer(GLenum buffer) if (!_mesa_readbuffer_update_fields(ctx, buffer)) return; - ctx->NewState |= _NEW_PIXEL; + ctx->NewState |= _NEW_BUFFERS; /* * Call device driver function. diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 41c657e9fd..0e4cf047c8 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1170,7 +1170,7 @@ _mesa_update_state_locked( GLcontext *ctx ) if (new_state & (_NEW_PROGRAM|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX)) _mesa_update_texture( ctx, new_state ); - if (new_state & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) + if (new_state & _NEW_BUFFERS) _mesa_update_framebuffer(ctx); if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index e776c9112d..aec51f5eed 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -85,14 +85,10 @@ update_framebuffer_state( struct st_context *st ) } -/** - * Note that glDrawBuffer() sets _NEW_COLOR, not _NEW_BUFFER. - */ - const struct st_tracked_state st_update_framebuffer = { .name = "st_update_framebuffer", .dirty = { - .mesa = (_NEW_BUFFERS | _NEW_COLOR), + .mesa = _NEW_BUFFERS, .st = 0, }, .update = update_framebuffer_state -- cgit v1.2.3 From 4be7296bfcba22a849f949d105ea385e6964cc25 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Jun 2008 14:55:24 -0600 Subject: mesa: refactor: move scissor functions into new scissor.c file --- src/mesa/main/api_exec.c | 1 + src/mesa/main/attrib.c | 1 + src/mesa/main/buffers.c | 75 ------------------------------------ src/mesa/main/buffers.h | 10 ----- src/mesa/main/context.c | 1 + src/mesa/main/scissor.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/scissor.h | 46 ++++++++++++++++++++++ src/mesa/main/sources | 2 + src/mesa/sources | 1 + 9 files changed, 151 insertions(+), 85 deletions(-) create mode 100644 src/mesa/main/scissor.c create mode 100644 src/mesa/main/scissor.h (limited to 'src/mesa/main/buffers.c') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index e0f081bdbc..a9696a6842 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -79,6 +79,7 @@ #endif #include "rastpos.h" #include "readpix.h" +#include "scissor.h" #include "state.h" #include "stencil.h" #include "teximage.h" diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 39666d175a..70b5121a9f 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -43,6 +43,7 @@ #include "matrix.h" #include "points.h" #include "polygon.h" +#include "scissor.h" #include "simple_list.h" #include "stencil.h" #include "texobj.h" diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 3cbd671bab..5424f442fe 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -699,79 +699,6 @@ _mesa_SampleCoverageARB(GLclampf value, GLboolean invert) -/** - * Define the scissor box. - * - * \param x, y coordinates of the scissor box lower-left corner. - * \param width width of the scissor box. - * \param height height of the scissor box. - * - * \sa glScissor(). - * - * Verifies the parameters and updates __GLcontextRec::Scissor. On a - * change flushes the vertices and notifies the driver via - * the dd_function_table::Scissor callback. - */ -void -_mesa_set_scissor(GLcontext *ctx, - GLint x, GLint y, GLsizei width, GLsizei height) -{ - if (x == ctx->Scissor.X && - y == ctx->Scissor.Y && - width == ctx->Scissor.Width && - height == ctx->Scissor.Height) - return; - - FLUSH_VERTICES(ctx, _NEW_SCISSOR); - ctx->Scissor.X = x; - ctx->Scissor.Y = y; - ctx->Scissor.Width = width; - ctx->Scissor.Height = height; - - if (ctx->Driver.Scissor) - ctx->Driver.Scissor( ctx, x, y, width, height ); -} - - -void GLAPIENTRY -_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (width < 0 || height < 0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glScissor" ); - return; - } - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height); - - _mesa_set_scissor(ctx, x, y, width, height); -} - - - -/**********************************************************************/ -/** \name Initialization */ -/*@{*/ - -/** - * Initialize the context's scissor state. - * \param ctx the GL context. - */ -void -_mesa_init_scissor(GLcontext *ctx) -{ - /* Scissor group */ - ctx->Scissor.Enabled = GL_FALSE; - ctx->Scissor.X = 0; - ctx->Scissor.Y = 0; - ctx->Scissor.Width = 0; - ctx->Scissor.Height = 0; -} - - /** * Initialize the context's multisample state. * \param ctx the GL context. @@ -786,5 +713,3 @@ _mesa_init_multisample(GLcontext *ctx) ctx->Multisample.SampleCoverageValue = 1.0; ctx->Multisample.SampleCoverageInvert = GL_FALSE; } - -/*@}*/ diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h index 208e7af2b9..50f2f47a04 100644 --- a/src/mesa/main/buffers.h +++ b/src/mesa/main/buffers.h @@ -65,22 +65,12 @@ _mesa_ReadBuffer( GLenum mode ); extern void GLAPIENTRY _mesa_ResizeBuffersMESA( void ); -extern void GLAPIENTRY -_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ); - extern void GLAPIENTRY _mesa_SampleCoverageARB(GLclampf value, GLboolean invert); -extern void -_mesa_init_scissor(GLcontext *ctx); - extern void _mesa_init_multisample(GLcontext *ctx); -extern void -_mesa_set_scissor(GLcontext *ctx, - GLint x, GLint y, GLsizei width, GLsizei height); - extern void _mesa_resizebuffers( GLcontext *ctx ); #endif diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 465d6b3f89..7ee6b2ec54 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -111,6 +111,7 @@ #include "polygon.h" #include "queryobj.h" #include "rastpos.h" +#include "scissor.h" #include "simple_list.h" #include "state.h" #include "stencil.h" diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c new file mode 100644 index 0000000000..b5f4cde789 --- /dev/null +++ b/src/mesa/main/scissor.c @@ -0,0 +1,99 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#include "main/glheader.h" +#include "main/context.h" +#include "main/scissor.h" + + +/** + * Called via glScissor + */ +void GLAPIENTRY +_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (width < 0 || height < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glScissor" ); + return; + } + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height); + + _mesa_set_scissor(ctx, x, y, width, height); +} + + +/** + * Define the scissor box. + * + * \param x, y coordinates of the scissor box lower-left corner. + * \param width width of the scissor box. + * \param height height of the scissor box. + * + * \sa glScissor(). + * + * Verifies the parameters and updates __GLcontextRec::Scissor. On a + * change flushes the vertices and notifies the driver via + * the dd_function_table::Scissor callback. + */ +void +_mesa_set_scissor(GLcontext *ctx, + GLint x, GLint y, GLsizei width, GLsizei height) +{ + if (x == ctx->Scissor.X && + y == ctx->Scissor.Y && + width == ctx->Scissor.Width && + height == ctx->Scissor.Height) + return; + + FLUSH_VERTICES(ctx, _NEW_SCISSOR); + ctx->Scissor.X = x; + ctx->Scissor.Y = y; + ctx->Scissor.Width = width; + ctx->Scissor.Height = height; + + if (ctx->Driver.Scissor) + ctx->Driver.Scissor( ctx, x, y, width, height ); +} + + +/** + * Initialize the context's scissor state. + * \param ctx the GL context. + */ +void +_mesa_init_scissor(GLcontext *ctx) +{ + /* Scissor group */ + ctx->Scissor.Enabled = GL_FALSE; + ctx->Scissor.X = 0; + ctx->Scissor.Y = 0; + ctx->Scissor.Width = 0; + ctx->Scissor.Height = 0; +} diff --git a/src/mesa/main/scissor.h b/src/mesa/main/scissor.h new file mode 100644 index 0000000000..b852a2122d --- /dev/null +++ b/src/mesa/main/scissor.h @@ -0,0 +1,46 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef SCISSOR_H +#define SCISSOR_H + + +#include "main/mtypes.h" + + +extern void GLAPIENTRY +_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ); + + +extern void +_mesa_set_scissor(GLcontext *ctx, + GLint x, GLint y, GLsizei width, GLsizei height); + + +extern void +_mesa_init_scissor(GLcontext *ctx); + + +#endif diff --git a/src/mesa/main/sources b/src/mesa/main/sources index 06f32f2275..60b6b5dc3f 100644 --- a/src/mesa/main/sources +++ b/src/mesa/main/sources @@ -50,6 +50,7 @@ readpix.c \ rastpos.c \ rbadaptors.c \ renderbuffer.c \ +scissor.c \ state.c \ stencil.c \ texcompress.c \ @@ -127,6 +128,7 @@ rbadaptors.h \ readpix.h \ renderbuffer.h \ simple_list.h \ +scissor.h \ state.h \ stencil.h \ texcompress.h \ diff --git a/src/mesa/sources b/src/mesa/sources index 21386ef4db..f18bbff436 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -52,6 +52,7 @@ MAIN_SOURCES = \ main/rbadaptors.c \ main/readpix.c \ main/renderbuffer.c \ + main/scissor.c \ main/shaders.c \ main/state.c \ main/stencil.c \ -- cgit v1.2.3 From eade430682516a445a2bf765165362dad19594f0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Jun 2008 15:01:02 -0600 Subject: mesa: refactor: move glClear, glClearColor into new clear.c file. --- src/mesa/main/api_exec.c | 1 + src/mesa/main/buffers.c | 144 +------------------------------------- src/mesa/main/buffers.h | 10 --- src/mesa/main/clear.c | 179 +++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/clear.h | 44 ++++++++++++ src/mesa/main/sources | 2 + src/mesa/sources | 1 + 7 files changed, 228 insertions(+), 153 deletions(-) create mode 100644 src/mesa/main/clear.c create mode 100644 src/mesa/main/clear.h (limited to 'src/mesa/main/buffers.c') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index a9696a6842..382091f580 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -46,6 +46,7 @@ #endif #include "arrayobj.h" #include "buffers.h" +#include "clear.h" #include "clip.h" #include "colortab.h" #include "context.h" diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 5424f442fe..d617ef9a32 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -25,7 +25,7 @@ /** * \file buffers.c - * General framebuffer-related functions, like glClear, glScissor, etc. + * glReadBuffer, DrawBuffer functions. */ @@ -42,148 +42,6 @@ #define BAD_MASK ~0u -#if _HAVE_FULL_GL -void GLAPIENTRY -_mesa_ClearIndex( GLfloat c ) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->Color.ClearIndex == (GLuint) c) - return; - - FLUSH_VERTICES(ctx, _NEW_COLOR); - ctx->Color.ClearIndex = (GLuint) c; - - if (!ctx->Visual.rgbMode && ctx->Driver.ClearIndex) { - /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */ - (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex ); - } -} -#endif - - -/** - * Specify the clear values for the color buffers. - * - * \param red red color component. - * \param green green color component. - * \param blue blue color component. - * \param alpha alpha component. - * - * \sa glClearColor(). - * - * Clamps the parameters and updates gl_colorbuffer_attrib::ClearColor. On a - * change, flushes the vertices and notifies the driver via the - * dd_function_table::ClearColor callback. - */ -void GLAPIENTRY -_mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) -{ - GLfloat tmp[4]; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - tmp[0] = CLAMP(red, 0.0F, 1.0F); - tmp[1] = CLAMP(green, 0.0F, 1.0F); - tmp[2] = CLAMP(blue, 0.0F, 1.0F); - tmp[3] = CLAMP(alpha, 0.0F, 1.0F); - - if (TEST_EQ_4V(tmp, ctx->Color.ClearColor)) - return; /* no change */ - - FLUSH_VERTICES(ctx, _NEW_COLOR); - COPY_4V(ctx->Color.ClearColor, tmp); - - if (ctx->Visual.rgbMode && ctx->Driver.ClearColor) { - /* it's OK to call glClearColor in CI mode but it should be a NOP */ - (*ctx->Driver.ClearColor)(ctx, ctx->Color.ClearColor); - } -} - - -/** - * Clear buffers. - * - * \param mask bit-mask indicating the buffers to be cleared. - * - * Flushes the vertices and verifies the parameter. If __GLcontextRec::NewState - * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin, - * etc. If the rasterization mode is set to GL_RENDER then requests the driver - * to clear the buffers, via the dd_function_table::Clear callback. - */ -void GLAPIENTRY -_mesa_Clear( GLbitfield mask ) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - - FLUSH_CURRENT(ctx, 0); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glClear 0x%x\n", mask); - - if (mask & ~(GL_COLOR_BUFFER_BIT | - GL_DEPTH_BUFFER_BIT | - GL_STENCIL_BUFFER_BIT | - GL_ACCUM_BUFFER_BIT)) { - /* invalid bit set */ - _mesa_error( ctx, GL_INVALID_VALUE, "glClear(0x%x)", mask); - return; - } - - if (ctx->NewState) { - _mesa_update_state( ctx ); /* update _Xmin, etc */ - } - - if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { - _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, - "glClear(incomplete framebuffer)"); - return; - } - - if (ctx->DrawBuffer->Width == 0 || ctx->DrawBuffer->Height == 0) - return; - - if (ctx->RenderMode == GL_RENDER) { - GLbitfield bufferMask; - - /* don't clear depth buffer if depth writing disabled */ - if (!ctx->Depth.Mask) - mask &= ~GL_DEPTH_BUFFER_BIT; - - /* Build the bitmask to send to device driver's Clear function. - * Note that the GL_COLOR_BUFFER_BIT flag will expand to 0, 1, 2 or 4 - * of the BUFFER_BIT_FRONT/BACK_LEFT/RIGHT flags, or one of the - * BUFFER_BIT_COLORn flags. - */ - bufferMask = 0; - if (mask & GL_COLOR_BUFFER_BIT) { - bufferMask |= ctx->DrawBuffer->_ColorDrawBufferMask[0]; - } - - if ((mask & GL_DEPTH_BUFFER_BIT) - && ctx->DrawBuffer->Visual.haveDepthBuffer) { - bufferMask |= BUFFER_BIT_DEPTH; - } - - if ((mask & GL_STENCIL_BUFFER_BIT) - && ctx->DrawBuffer->Visual.haveStencilBuffer) { - bufferMask |= BUFFER_BIT_STENCIL; - } - - if ((mask & GL_ACCUM_BUFFER_BIT) - && ctx->DrawBuffer->Visual.haveAccumBuffer) { - bufferMask |= BUFFER_BIT_ACCUM; - } - - ASSERT(ctx->Driver.Clear); - ctx->Driver.Clear(ctx, bufferMask); - } -} - - - /** * Return bitmask of BUFFER_BIT_* flags indicating which color buffers are * available to the rendering context (for drawing or reading). diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h index 50f2f47a04..ca0e7c411c 100644 --- a/src/mesa/main/buffers.h +++ b/src/mesa/main/buffers.h @@ -36,16 +36,6 @@ #include "mtypes.h" -extern void GLAPIENTRY -_mesa_ClearIndex( GLfloat c ); - -extern void GLAPIENTRY -_mesa_ClearColor( GLclampf red, GLclampf green, - GLclampf blue, GLclampf alpha ); - -extern void GLAPIENTRY -_mesa_Clear( GLbitfield mask ); - extern void GLAPIENTRY _mesa_DrawBuffer( GLenum mode ); diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c new file mode 100644 index 0000000000..434685984d --- /dev/null +++ b/src/mesa/main/clear.c @@ -0,0 +1,179 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * \file clear.c + * glClearColor, glClearIndex, glClear() functions. + */ + + + +#include "glheader.h" +#include "clear.h" +#include "context.h" +#include "colormac.h" +#include "state.h" + + + +#if _HAVE_FULL_GL +void GLAPIENTRY +_mesa_ClearIndex( GLfloat c ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Color.ClearIndex == (GLuint) c) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.ClearIndex = (GLuint) c; + + if (!ctx->Visual.rgbMode && ctx->Driver.ClearIndex) { + /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */ + (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex ); + } +} +#endif + + +/** + * Specify the clear values for the color buffers. + * + * \param red red color component. + * \param green green color component. + * \param blue blue color component. + * \param alpha alpha component. + * + * \sa glClearColor(). + * + * Clamps the parameters and updates gl_colorbuffer_attrib::ClearColor. On a + * change, flushes the vertices and notifies the driver via the + * dd_function_table::ClearColor callback. + */ +void GLAPIENTRY +_mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) +{ + GLfloat tmp[4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + tmp[0] = CLAMP(red, 0.0F, 1.0F); + tmp[1] = CLAMP(green, 0.0F, 1.0F); + tmp[2] = CLAMP(blue, 0.0F, 1.0F); + tmp[3] = CLAMP(alpha, 0.0F, 1.0F); + + if (TEST_EQ_4V(tmp, ctx->Color.ClearColor)) + return; /* no change */ + + FLUSH_VERTICES(ctx, _NEW_COLOR); + COPY_4V(ctx->Color.ClearColor, tmp); + + if (ctx->Visual.rgbMode && ctx->Driver.ClearColor) { + /* it's OK to call glClearColor in CI mode but it should be a NOP */ + (*ctx->Driver.ClearColor)(ctx, ctx->Color.ClearColor); + } +} + + +/** + * Clear buffers. + * + * \param mask bit-mask indicating the buffers to be cleared. + * + * Flushes the vertices and verifies the parameter. If __GLcontextRec::NewState + * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin, + * etc. If the rasterization mode is set to GL_RENDER then requests the driver + * to clear the buffers, via the dd_function_table::Clear callback. + */ +void GLAPIENTRY +_mesa_Clear( GLbitfield mask ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_CURRENT(ctx, 0); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glClear 0x%x\n", mask); + + if (mask & ~(GL_COLOR_BUFFER_BIT | + GL_DEPTH_BUFFER_BIT | + GL_STENCIL_BUFFER_BIT | + GL_ACCUM_BUFFER_BIT)) { + /* invalid bit set */ + _mesa_error( ctx, GL_INVALID_VALUE, "glClear(0x%x)", mask); + return; + } + + if (ctx->NewState) { + _mesa_update_state( ctx ); /* update _Xmin, etc */ + } + + if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { + _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, + "glClear(incomplete framebuffer)"); + return; + } + + if (ctx->DrawBuffer->Width == 0 || ctx->DrawBuffer->Height == 0) + return; + + if (ctx->RenderMode == GL_RENDER) { + GLbitfield bufferMask; + + /* don't clear depth buffer if depth writing disabled */ + if (!ctx->Depth.Mask) + mask &= ~GL_DEPTH_BUFFER_BIT; + + /* Build the bitmask to send to device driver's Clear function. + * Note that the GL_COLOR_BUFFER_BIT flag will expand to 0, 1, 2 or 4 + * of the BUFFER_BIT_FRONT/BACK_LEFT/RIGHT flags, or one of the + * BUFFER_BIT_COLORn flags. + */ + bufferMask = 0; + if (mask & GL_COLOR_BUFFER_BIT) { + bufferMask |= ctx->DrawBuffer->_ColorDrawBufferMask[0]; + } + + if ((mask & GL_DEPTH_BUFFER_BIT) + && ctx->DrawBuffer->Visual.haveDepthBuffer) { + bufferMask |= BUFFER_BIT_DEPTH; + } + + if ((mask & GL_STENCIL_BUFFER_BIT) + && ctx->DrawBuffer->Visual.haveStencilBuffer) { + bufferMask |= BUFFER_BIT_STENCIL; + } + + if ((mask & GL_ACCUM_BUFFER_BIT) + && ctx->DrawBuffer->Visual.haveAccumBuffer) { + bufferMask |= BUFFER_BIT_ACCUM; + } + + ASSERT(ctx->Driver.Clear); + ctx->Driver.Clear(ctx, bufferMask); + } +} diff --git a/src/mesa/main/clear.h b/src/mesa/main/clear.h new file mode 100644 index 0000000000..9a54ba14bc --- /dev/null +++ b/src/mesa/main/clear.h @@ -0,0 +1,44 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef CLEAR_H +#define CLEAR_H + + +#include "main/mtypes.h" + + +extern void GLAPIENTRY +_mesa_ClearIndex( GLfloat c ); + +extern void GLAPIENTRY +_mesa_ClearColor( GLclampf red, GLclampf green, + GLclampf blue, GLclampf alpha ); + +extern void GLAPIENTRY +_mesa_Clear( GLbitfield mask ); + + +#endif diff --git a/src/mesa/main/sources b/src/mesa/main/sources index 60b6b5dc3f..8043f4369e 100644 --- a/src/mesa/main/sources +++ b/src/mesa/main/sources @@ -11,6 +11,7 @@ attrib.c \ blend.c \ bufferobj.c \ buffers.c \ +clear.c \ clip.c \ colortab.c \ context.c \ @@ -84,6 +85,7 @@ bitset.h \ blend.h \ bufferobj.h \ buffers.h \ +clear.h \ clip.h \ colormac.h \ colortab.h \ diff --git a/src/mesa/sources b/src/mesa/sources index f18bbff436..95d665e3a1 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -12,6 +12,7 @@ MAIN_SOURCES = \ main/blend.c \ main/bufferobj.c \ main/buffers.c \ + main/clear.c \ main/clip.c \ main/colortab.c \ main/context.c \ -- cgit v1.2.3 From 9091015a9782ad15e58540a8fd61df83ea2bfe31 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Jun 2008 15:04:31 -0600 Subject: mesa: refactor: move _mesa_resizebuffers(), _mesa_ResizeBuffersMESA() to framebuffer.c --- src/mesa/main/attrib.c | 1 + src/mesa/main/buffers.c | 79 --------------------------------------------- src/mesa/main/buffers.h | 4 --- src/mesa/main/dlist.c | 1 + src/mesa/main/framebuffer.c | 78 ++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/framebuffer.h | 8 +++++ 6 files changed, 88 insertions(+), 83 deletions(-) (limited to 'src/mesa/main/buffers.c') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 70b5121a9f..63754569e6 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -30,6 +30,7 @@ #include "blend.h" #include "buffers.h" #include "bufferobj.h" +#include "clear.h" #include "colormac.h" #include "colortab.h" #include "context.h" diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index d617ef9a32..c767e62286 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -456,83 +456,6 @@ _mesa_ReadBuffer(GLenum buffer) } -#if _HAVE_FULL_GL - -/** - * XXX THIS IS OBSOLETE - drivers should take care of detecting window - * size changes and act accordingly, likely calling _mesa_resize_framebuffer(). - * - * GL_MESA_resize_buffers extension. - * - * When this function is called, we'll ask the window system how large - * the current window is. If it's a new size, we'll call the driver's - * ResizeBuffers function. The driver will then resize its color buffers - * as needed, and maybe call the swrast's routine for reallocating - * swrast-managed depth/stencil/accum/etc buffers. - * \note This function should only be called through the GL API, not - * from device drivers (as was done in the past). - */ - -void _mesa_resizebuffers( GLcontext *ctx ) -{ - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glResizeBuffersMESA\n"); - - if (!ctx->Driver.GetBufferSize) { - return; - } - - if (ctx->WinSysDrawBuffer) { - GLuint newWidth, newHeight; - GLframebuffer *buffer = ctx->WinSysDrawBuffer; - - assert(buffer->Name == 0); - - /* ask device driver for size of output buffer */ - ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight ); - - /* see if size of device driver's color buffer (window) has changed */ - if (buffer->Width != newWidth || buffer->Height != newHeight) { - if (ctx->Driver.ResizeBuffers) - ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight ); - } - } - - if (ctx->WinSysReadBuffer - && ctx->WinSysReadBuffer != ctx->WinSysDrawBuffer) { - GLuint newWidth, newHeight; - GLframebuffer *buffer = ctx->WinSysReadBuffer; - - assert(buffer->Name == 0); - - /* ask device driver for size of read buffer */ - ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight ); - - /* see if size of device driver's color buffer (window) has changed */ - if (buffer->Width != newWidth || buffer->Height != newHeight) { - if (ctx->Driver.ResizeBuffers) - ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight ); - } - } - - ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */ -} - - -/* - * XXX THIS IS OBSOLETE - */ -void GLAPIENTRY -_mesa_ResizeBuffersMESA( void ) -{ - GET_CURRENT_CONTEXT(ctx); - - if (ctx->Extensions.MESA_resize_buffers) - _mesa_resizebuffers( ctx ); -} - /* * XXX move somewhere else someday? @@ -553,8 +476,6 @@ _mesa_SampleCoverageARB(GLclampf value, GLboolean invert) ctx->NewState |= _NEW_MULTISAMPLE; } -#endif /* _HAVE_FULL_GL */ - /** diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h index ca0e7c411c..ba79db6871 100644 --- a/src/mesa/main/buffers.h +++ b/src/mesa/main/buffers.h @@ -52,15 +52,11 @@ _mesa_readbuffer_update_fields(GLcontext *ctx, GLenum buffer); extern void GLAPIENTRY _mesa_ReadBuffer( GLenum mode ); -extern void GLAPIENTRY -_mesa_ResizeBuffersMESA( void ); - extern void GLAPIENTRY _mesa_SampleCoverageARB(GLclampf value, GLboolean invert); extern void _mesa_init_multisample(GLcontext *ctx); -extern void _mesa_resizebuffers( GLcontext *ctx ); #endif diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index f933580b2d..07d279da30 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -52,6 +52,7 @@ #include "eval.h" #include "extensions.h" #include "feedback.h" +#include "framebuffer.h" #include "get.h" #include "glapi/glapi.h" #include "hash.h" diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 894d99afd2..96f1b30c9b 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -338,6 +338,84 @@ _mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, } + +/** + * XXX THIS IS OBSOLETE - drivers should take care of detecting window + * size changes and act accordingly, likely calling _mesa_resize_framebuffer(). + * + * GL_MESA_resize_buffers extension. + * + * When this function is called, we'll ask the window system how large + * the current window is. If it's a new size, we'll call the driver's + * ResizeBuffers function. The driver will then resize its color buffers + * as needed, and maybe call the swrast's routine for reallocating + * swrast-managed depth/stencil/accum/etc buffers. + * \note This function should only be called through the GL API, not + * from device drivers (as was done in the past). + */ +void +_mesa_resizebuffers( GLcontext *ctx ) +{ + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glResizeBuffersMESA\n"); + + if (!ctx->Driver.GetBufferSize) { + return; + } + + if (ctx->WinSysDrawBuffer) { + GLuint newWidth, newHeight; + GLframebuffer *buffer = ctx->WinSysDrawBuffer; + + assert(buffer->Name == 0); + + /* ask device driver for size of output buffer */ + ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight ); + + /* see if size of device driver's color buffer (window) has changed */ + if (buffer->Width != newWidth || buffer->Height != newHeight) { + if (ctx->Driver.ResizeBuffers) + ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight ); + } + } + + if (ctx->WinSysReadBuffer + && ctx->WinSysReadBuffer != ctx->WinSysDrawBuffer) { + GLuint newWidth, newHeight; + GLframebuffer *buffer = ctx->WinSysReadBuffer; + + assert(buffer->Name == 0); + + /* ask device driver for size of read buffer */ + ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight ); + + /* see if size of device driver's color buffer (window) has changed */ + if (buffer->Width != newWidth || buffer->Height != newHeight) { + if (ctx->Driver.ResizeBuffers) + ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight ); + } + } + + ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */ +} + + +/* + * XXX THIS IS OBSOLETE + */ +void GLAPIENTRY +_mesa_ResizeBuffersMESA( void ) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->Extensions.MESA_resize_buffers) + _mesa_resizebuffers( ctx ); +} + + + /** * Examine all the framebuffer's renderbuffers to update the Width/Height * fields of the framebuffer. If we have renderbuffers with different diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h index 4d76f3a90f..e9eeed28cb 100644 --- a/src/mesa/main/framebuffer.h +++ b/src/mesa/main/framebuffer.h @@ -53,6 +53,14 @@ extern void _mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, GLuint width, GLuint height); + +extern void +_mesa_resizebuffers( GLcontext *ctx ); + +extern void GLAPIENTRY +_mesa_ResizeBuffersMESA( void ); + + extern void _mesa_update_draw_buffer_bounds(GLcontext *ctx); -- cgit v1.2.3 From bce428c4a65fdcb890ea18bf4a1dfb42ed109006 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Jun 2008 15:09:21 -0600 Subject: mesa: refactor: move multisample-related functions into new multisample.c file --- src/mesa/main/api_exec.c | 1 + src/mesa/main/attrib.c | 1 + src/mesa/main/buffers.c | 38 -------------------------- src/mesa/main/buffers.h | 6 ----- src/mesa/main/context.c | 1 + src/mesa/main/multisample.c | 66 +++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/multisample.h | 38 ++++++++++++++++++++++++++ src/mesa/main/sources | 2 ++ src/mesa/sources | 1 + 9 files changed, 110 insertions(+), 44 deletions(-) create mode 100644 src/mesa/main/multisample.c create mode 100644 src/mesa/main/multisample.h (limited to 'src/mesa/main/buffers.c') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 382091f580..8cdbaada9b 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -71,6 +71,7 @@ #include "lines.h" #include "macros.h" #include "matrix.h" +#include "multisample.h" #include "pixel.h" #include "pixelstore.h" #include "points.h" diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 63754569e6..6ed82da203 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -42,6 +42,7 @@ #include "light.h" #include "lines.h" #include "matrix.h" +#include "multisample.h" #include "points.h" #include "polygon.h" #include "scissor.h" diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index c767e62286..1d07c68633 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -454,41 +454,3 @@ _mesa_ReadBuffer(GLenum buffer) if (ctx->Driver.ReadBuffer) (*ctx->Driver.ReadBuffer)(ctx, buffer); } - - - -/* - * XXX move somewhere else someday? - */ -void GLAPIENTRY -_mesa_SampleCoverageARB(GLclampf value, GLboolean invert) -{ - GET_CURRENT_CONTEXT(ctx); - - if (!ctx->Extensions.ARB_multisample) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleCoverageARB"); - return; - } - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); - ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0); - ctx->Multisample.SampleCoverageInvert = invert; - ctx->NewState |= _NEW_MULTISAMPLE; -} - - - -/** - * Initialize the context's multisample state. - * \param ctx the GL context. - */ -void -_mesa_init_multisample(GLcontext *ctx) -{ - ctx->Multisample.Enabled = GL_FALSE; - ctx->Multisample.SampleAlphaToCoverage = GL_FALSE; - ctx->Multisample.SampleAlphaToOne = GL_FALSE; - ctx->Multisample.SampleCoverage = GL_FALSE; - ctx->Multisample.SampleCoverageValue = 1.0; - ctx->Multisample.SampleCoverageInvert = GL_FALSE; -} diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h index ba79db6871..53d5fb80d4 100644 --- a/src/mesa/main/buffers.h +++ b/src/mesa/main/buffers.h @@ -52,11 +52,5 @@ _mesa_readbuffer_update_fields(GLcontext *ctx, GLenum buffer); extern void GLAPIENTRY _mesa_ReadBuffer( GLenum mode ); -extern void GLAPIENTRY -_mesa_SampleCoverageARB(GLclampf value, GLboolean invert); - -extern void -_mesa_init_multisample(GLcontext *ctx); - #endif diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 7ee6b2ec54..1b357ae6c2 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -105,6 +105,7 @@ #include "lines.h" #include "macros.h" #include "matrix.h" +#include "multisample.h" #include "pixel.h" #include "pixelstore.h" #include "points.h" diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c new file mode 100644 index 0000000000..e138087436 --- /dev/null +++ b/src/mesa/main/multisample.c @@ -0,0 +1,66 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/multisample.h" + + +/** + * Called via glSampleCoverageARB + */ +void GLAPIENTRY +_mesa_SampleCoverageARB(GLclampf value, GLboolean invert) +{ + GET_CURRENT_CONTEXT(ctx); + + if (!ctx->Extensions.ARB_multisample) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleCoverageARB"); + return; + } + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); + + ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0); + ctx->Multisample.SampleCoverageInvert = invert; + ctx->NewState |= _NEW_MULTISAMPLE; +} + + +/** + * Initialize the context's multisample state. + * \param ctx the GL context. + */ +void +_mesa_init_multisample(GLcontext *ctx) +{ + ctx->Multisample.Enabled = GL_FALSE; + ctx->Multisample.SampleAlphaToCoverage = GL_FALSE; + ctx->Multisample.SampleAlphaToOne = GL_FALSE; + ctx->Multisample.SampleCoverage = GL_FALSE; + ctx->Multisample.SampleCoverageValue = 1.0; + ctx->Multisample.SampleCoverageInvert = GL_FALSE; +} diff --git a/src/mesa/main/multisample.h b/src/mesa/main/multisample.h new file mode 100644 index 0000000000..4305900cc4 --- /dev/null +++ b/src/mesa/main/multisample.h @@ -0,0 +1,38 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef MULTISAMPLE_H +#define MULTISAMPLE_H + + +extern void GLAPIENTRY +_mesa_SampleCoverageARB(GLclampf value, GLboolean invert); + + +extern void +_mesa_init_multisample(GLcontext *ctx); + + +#endif diff --git a/src/mesa/main/sources b/src/mesa/main/sources index 8043f4369e..5379fa08f4 100644 --- a/src/mesa/main/sources +++ b/src/mesa/main/sources @@ -42,6 +42,7 @@ lines.c \ matrix.c \ mipmap.c \ mm.c \ +multisample.c \ occlude.c \ pixel.c \ pixelstore.c \ @@ -120,6 +121,7 @@ matrix.h \ mipmap.h \ mm.h \ mtypes.h \ +multisample.h \ occlude.h \ pixel.h \ pixelstore.h \ diff --git a/src/mesa/sources b/src/mesa/sources index 95d665e3a1..23b03932be 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -44,6 +44,7 @@ MAIN_SOURCES = \ main/matrix.c \ main/mipmap.c \ main/mm.c \ + main/multisample.c \ main/pixel.c \ main/pixelstore.c \ main/points.c \ -- cgit v1.2.3