From 2d5b86be25a7ccb729e746aa5e1bdd537d76df68 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Jan 2009 16:05:39 -0700 Subject: swrast: replace RENDER_START/FINISH macros with inline functions --- src/mesa/swrast/s_bitmap.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/mesa/swrast/s_bitmap.c') diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c index 35b34e654f..5e7822cf32 100644 --- a/src/mesa/swrast/s_bitmap.c +++ b/src/mesa/swrast/s_bitmap.c @@ -50,7 +50,6 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ) { - SWcontext *swrast = SWRAST_CONTEXT(ctx); GLint row, col; GLuint count = 0; SWspan span; @@ -61,7 +60,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, if (!bitmap) return; - RENDER_START(swrast,ctx); + swrast_render_start(ctx); if (SWRAST_CONTEXT(ctx)->NewState) _swrast_validate_derived( ctx ); @@ -132,7 +131,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, } } - RENDER_FINISH(swrast,ctx); + swrast_render_finish(ctx); _mesa_unmap_bitmap_pbo(ctx, unpack); } @@ -157,7 +156,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, ASSERT(ctx->RenderMode == GL_RENDER); ASSERT(bitmap); - RENDER_START(swrast,ctx); + swrast_render_start(ctx); if (SWRAST_CONTEXT(ctx)->NewState) _swrast_validate_derived( ctx ); @@ -224,6 +223,6 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, } } - RENDER_FINISH(swrast,ctx); + swrast_render_finish(ctx); } #endif -- cgit v1.2.3 From 1b448c7a5cafa68eeead2a4c45f4362a9883383b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 3 Sep 2009 11:29:18 -0600 Subject: mesa: consolidate PBO map/unmap helpers Instead of _mesa_map_readpix_pbo() use _mesa_map_pbo_source(). Instead of _mesa_map_drawpix_pbo() and _mesa_map_bitmap_pbo() use _mesa_map_pbo_dest(). --- src/mesa/main/bufferobj.c | 99 ++++++++++--------------------- src/mesa/main/bufferobj.h | 27 +++------ src/mesa/state_tracker/st_cb_bitmap.c | 6 +- src/mesa/state_tracker/st_cb_drawpixels.c | 10 ++-- src/mesa/state_tracker/st_cb_readpixels.c | 6 +- src/mesa/state_tracker/st_cb_texture.c | 4 +- src/mesa/swrast/s_bitmap.c | 4 +- src/mesa/swrast/s_drawpix.c | 4 +- src/mesa/swrast/s_readpix.c | 4 +- 9 files changed, 60 insertions(+), 104 deletions(-) (limited to 'src/mesa/swrast/s_bitmap.c') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 81b77b6ff2..1ae63a0ef6 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -658,6 +658,8 @@ _mesa_update_default_objects_buffer_objects(GLcontext *ctx) * currently mapped. Whoever calls this function should check for that. * Remember, we can't use a PBO when it's mapped! * + * If we're not using a PBO, this is a no-op. + * * \param width width of image to read/write * \param height height of image to read/write * \param depth depth of image to read/write @@ -676,7 +678,8 @@ _mesa_validate_pbo_access(GLuint dimensions, GLvoid *start, *end; const GLubyte *sizeAddr; /* buffer size, cast to a pointer */ - ASSERT(_mesa_is_bufferobj(pack->BufferObj)); + if (!_mesa_is_bufferobj(pack->BufferObj)) + return GL_TRUE; /* no PBO, OK */ if (pack->BufferObj->Size == 0) /* no buffer! */ @@ -708,17 +711,18 @@ _mesa_validate_pbo_access(GLuint dimensions, /** - * If the source of glBitmap data is a PBO, check that we won't read out - * of buffer bounds, then map the buffer. - * If not sourcing from a PBO, just return the bitmap pointer. - * This is a helper function for (some) drivers. - * Return NULL if error. - * If non-null return, must call _mesa_unmap_bitmap_pbo() when done. + * For commands that read from a PBO (glDrawPixels, glTexImage, + * glPolygonStipple, etc), if we're reading from a PBO, map it read-only + * and return the pointer into the PBO. If we're not reading from a + * PBO, return \p src as-is. + * If non-null return, must call _mesa_unmap_pbo_source() when done. + * + * \return NULL if error, else pointer to start of data */ -const GLubyte * -_mesa_map_bitmap_pbo(GLcontext *ctx, +const GLvoid * +_mesa_map_pbo_source(GLcontext *ctx, const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap) + const GLvoid *src) { const GLubyte *buf; @@ -730,11 +734,11 @@ _mesa_map_bitmap_pbo(GLcontext *ctx, if (!buf) return NULL; - buf = ADD_POINTERS(buf, bitmap); + buf = ADD_POINTERS(buf, src); } else { /* unpack from normal memory */ - buf = bitmap; + buf = src; } return buf; @@ -742,13 +746,13 @@ _mesa_map_bitmap_pbo(GLcontext *ctx, /** - * Counterpart to _mesa_map_bitmap_pbo() - * This is a helper function for (some) drivers. + * Counterpart to _mesa_map_pbo_source() */ void -_mesa_unmap_bitmap_pbo(GLcontext *ctx, +_mesa_unmap_pbo_source(GLcontext *ctx, const struct gl_pixelstore_attrib *unpack) { + ASSERT(unpack != &ctx->Pack); /* catch pack/unpack mismatch */ if (_mesa_is_bufferobj(unpack->BufferObj)) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, unpack->BufferObj); @@ -757,57 +761,17 @@ _mesa_unmap_bitmap_pbo(GLcontext *ctx, /** - * \sa _mesa_map_bitmap_pbo - */ -const GLvoid * -_mesa_map_drawpix_pbo(GLcontext *ctx, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels) -{ - const GLvoid *buf; - - if (_mesa_is_bufferobj(unpack->BufferObj)) { - /* unpack from PBO */ - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - GL_READ_ONLY_ARB, - unpack->BufferObj); - if (!buf) - return NULL; - - buf = ADD_POINTERS(buf, pixels); - } - else { - /* unpack from normal memory */ - buf = pixels; - } - - return buf; -} - - -/** - * \sa _mesa_unmap_bitmap_pbo - */ -void -_mesa_unmap_drawpix_pbo(GLcontext *ctx, - const struct gl_pixelstore_attrib *unpack) -{ - if (_mesa_is_bufferobj(unpack->BufferObj)) { - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - unpack->BufferObj); - } -} - - -/** - * If PBO is bound, map the buffer, return dest pointer in mapped buffer. - * Call _mesa_unmap_readpix_pbo() when finished - * \return NULL if error + * For commands that write to a PBO (glReadPixels, glGetColorTable, etc), + * if we're writing to a PBO, map it write-only and return the pointer + * into the PBO. If we're not writing to a PBO, return \p dst as-is. + * If non-null return, must call _mesa_unmap_pbo_dest() when done. + * + * \return NULL if error, else pointer to start of data */ void * -_mesa_map_readpix_pbo(GLcontext *ctx, - const struct gl_pixelstore_attrib *pack, - GLvoid *dest) +_mesa_map_pbo_dest(GLcontext *ctx, + const struct gl_pixelstore_attrib *pack, + GLvoid *dest) { void *buf; @@ -831,12 +795,13 @@ _mesa_map_readpix_pbo(GLcontext *ctx, /** - * Counterpart to _mesa_map_readpix_pbo() + * Counterpart to _mesa_map_pbo_dest() */ void -_mesa_unmap_readpix_pbo(GLcontext *ctx, - const struct gl_pixelstore_attrib *pack) +_mesa_unmap_pbo_dest(GLcontext *ctx, + const struct gl_pixelstore_attrib *pack) { + ASSERT(pack != &ctx->Unpack); /* catch pack/unpack mismatch */ if (_mesa_is_bufferobj(pack->BufferObj)) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, pack->BufferObj); } diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index decb44a65e..2e7afc2d76 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -81,32 +81,23 @@ _mesa_validate_pbo_access(GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *ptr); -extern const GLubyte * -_mesa_map_bitmap_pbo(GLcontext *ctx, +extern const GLvoid * +_mesa_map_pbo_source(GLcontext *ctx, const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap); + const GLvoid *src); extern void -_mesa_unmap_bitmap_pbo(GLcontext *ctx, +_mesa_unmap_pbo_source(GLcontext *ctx, const struct gl_pixelstore_attrib *unpack); -extern const GLvoid * -_mesa_map_drawpix_pbo(GLcontext *ctx, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels); - -extern void -_mesa_unmap_drawpix_pbo(GLcontext *ctx, - const struct gl_pixelstore_attrib *unpack); - extern void * -_mesa_map_readpix_pbo(GLcontext *ctx, - const struct gl_pixelstore_attrib *pack, - GLvoid *dest); +_mesa_map_pbo_dest(GLcontext *ctx, + const struct gl_pixelstore_attrib *pack, + GLvoid *dest); extern void -_mesa_unmap_readpix_pbo(GLcontext *ctx, - const struct gl_pixelstore_attrib *pack); +_mesa_unmap_pbo_dest(GLcontext *ctx, + const struct gl_pixelstore_attrib *pack); extern void diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 3171b67376..902fb38d1a 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -275,7 +275,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, struct pipe_texture *pt; /* PBO source... */ - bitmap = _mesa_map_bitmap_pbo(ctx, unpack, bitmap); + bitmap = _mesa_map_pbo_source(ctx, unpack, bitmap); if (!bitmap) { return NULL; } @@ -287,7 +287,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, 0, width, height, 1, PIPE_TEXTURE_USAGE_SAMPLER); if (!pt) { - _mesa_unmap_bitmap_pbo(ctx, unpack); + _mesa_unmap_pbo_source(ctx, unpack); return NULL; } @@ -302,7 +302,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, unpack_bitmap(ctx->st, 0, 0, width, height, unpack, bitmap, dest, transfer->stride); - _mesa_unmap_bitmap_pbo(ctx, unpack); + _mesa_unmap_pbo_source(ctx, unpack); /* Release transfer */ screen->transfer_unmap(screen, transfer); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index d19a88fa7c..e00754a036 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -353,7 +353,7 @@ make_texture(struct st_context *st, assert(pipeFormat); cpp = st_sizeof_format(pipeFormat); - pixels = _mesa_map_drawpix_pbo(ctx, unpack, pixels); + pixels = _mesa_map_pbo_source(ctx, unpack, pixels); if (!pixels) return NULL; @@ -381,7 +381,7 @@ make_texture(struct st_context *st, pt = st_texture_create(st, PIPE_TEXTURE_2D, pipeFormat, 0, ptw, pth, 1, PIPE_TEXTURE_USAGE_SAMPLER); if (!pt) { - _mesa_unmap_drawpix_pbo(ctx, unpack); + _mesa_unmap_pbo_source(ctx, unpack); return NULL; } @@ -428,7 +428,7 @@ make_texture(struct st_context *st, ctx->_ImageTransferState = imageTransferStateSave; } - _mesa_unmap_drawpix_pbo(ctx, unpack); + _mesa_unmap_pbo_source(ctx, unpack); return pt; } @@ -681,7 +681,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, stmap = screen->transfer_map(screen, pt); - pixels = _mesa_map_drawpix_pbo(ctx, unpack, pixels); + pixels = _mesa_map_pbo_source(ctx, unpack, pixels); assert(pixels); /* if width > MAX_WIDTH, have to process image in chunks */ @@ -775,7 +775,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, skipPixels += spanWidth; } - _mesa_unmap_drawpix_pbo(ctx, unpack); + _mesa_unmap_pbo_source(ctx, unpack); /* unmap the stencil buffer */ screen->transfer_unmap(screen, pt); diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index ccf1a0b563..75424aa2e7 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -353,7 +353,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, return; } - dest = _mesa_map_readpix_pbo(ctx, &clippedPacking, dest); + dest = _mesa_map_pbo_dest(ctx, &clippedPacking, dest); if (!dest) return; @@ -380,7 +380,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, if (st_fast_readpixels(ctx, strb, x, y, width, height, format, type, pack, dest)) { /* success! */ - _mesa_unmap_readpix_pbo(ctx, &clippedPacking); + _mesa_unmap_pbo_dest(ctx, &clippedPacking); return; } @@ -534,7 +534,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, screen->tex_transfer_destroy(trans); - _mesa_unmap_readpix_pbo(ctx, &clippedPacking); + _mesa_unmap_pbo_dest(ctx, &clippedPacking); } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 90a059ca69..dc39a70121 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -870,7 +870,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, PIPE_TRANSFER_READ, 0, 0, width, height); - pixels = _mesa_map_readpix_pbo(ctx, &ctx->Pack, pixels); + pixels = _mesa_map_pbo_dest(ctx, &ctx->Pack, pixels); /* copy/pack data into user buffer */ if (st_equal_formats(stImage->pt->format, format, type)) { @@ -903,7 +903,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, } } - _mesa_unmap_readpix_pbo(ctx, &ctx->Pack); + _mesa_unmap_pbo_dest(ctx, &ctx->Pack); /* destroy the temp / dest surface */ util_destroy_rgba_surface(dst_texture, dst_surface); diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c index 5e7822cf32..3dbdf2a61a 100644 --- a/src/mesa/swrast/s_bitmap.c +++ b/src/mesa/swrast/s_bitmap.c @@ -56,7 +56,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, ASSERT(ctx->RenderMode == GL_RENDER); - bitmap = _mesa_map_bitmap_pbo(ctx, unpack, bitmap); + bitmap = (const GLubyte *) _mesa_map_pbo_source(ctx, unpack, bitmap); if (!bitmap) return; @@ -133,7 +133,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, swrast_render_finish(ctx); - _mesa_unmap_bitmap_pbo(ctx, unpack); + _mesa_unmap_pbo_source(ctx, unpack); } diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index a9ef8e685f..d31c402eea 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -847,7 +847,7 @@ _swrast_DrawPixels( GLcontext *ctx, if (swrast->NewState) _swrast_validate_derived( ctx ); - pixels = _mesa_map_drawpix_pbo(ctx, unpack, pixels); + pixels = _mesa_map_pbo_source(ctx, unpack, pixels); if (!pixels) { swrast_render_finish(ctx); _mesa_set_vp_override(ctx, save_vp_override); @@ -892,7 +892,7 @@ _swrast_DrawPixels( GLcontext *ctx, swrast_render_finish(ctx); _mesa_set_vp_override(ctx, save_vp_override); - _mesa_unmap_drawpix_pbo(ctx, unpack); + _mesa_unmap_pbo_source(ctx, unpack); } diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index e901fc6b5d..48b9408d24 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -574,7 +574,7 @@ _swrast_ReadPixels( GLcontext *ctx, return; } - pixels = _mesa_map_readpix_pbo(ctx, &clippedPacking, pixels); + pixels = _mesa_map_pbo_dest(ctx, &clippedPacking, pixels); if (!pixels) return; @@ -616,5 +616,5 @@ _swrast_ReadPixels( GLcontext *ctx, swrast_render_finish(ctx); - _mesa_unmap_readpix_pbo(ctx, &clippedPacking); + _mesa_unmap_pbo_dest(ctx, &clippedPacking); } -- cgit v1.2.3 From dc2ddb27d392e68aa2139b54e5d73bbdac19d5a9 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 8 Sep 2009 17:44:22 +0800 Subject: mesa/swrast: Respect mfeatures.h. FEATURE_accum, FEATURE_convolve, FEATURE_colortable, and FEATURE_drawpix cover part of the functionalities of swrast module. Disable them when the features are disabled. --- src/mesa/drivers/common/driverfuncs.c | 19 +++-- src/mesa/swrast/s_accum.c | 6 ++ src/mesa/swrast/s_accum.h | 11 +++ src/mesa/swrast/s_bitmap.c | 5 ++ src/mesa/swrast/s_copypix.c | 5 ++ src/mesa/swrast/s_drawpix.c | 5 ++ src/mesa/swrast/s_feedback.c | 5 ++ src/mesa/swrast/s_feedback.h | 45 +++++++++++ src/mesa/swrast/s_imaging.c | 12 +++ src/mesa/swrast/swrast.h | 53 +------------ src/mesa/swrast/swrast_features.h | 140 ++++++++++++++++++++++++++++++++++ 11 files changed, 247 insertions(+), 59 deletions(-) create mode 100644 src/mesa/swrast/swrast_features.h (limited to 'src/mesa/swrast/s_bitmap.c') diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 4d4d6ace7a..31a027e0e4 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -24,10 +24,14 @@ #include "main/glheader.h" +#include "main/accum.h" #include "main/imports.h" #include "main/arrayobj.h" #include "main/buffers.h" +#include "main/colortab.h" #include "main/context.h" +#include "main/convolve.h" +#include "main/drawpix.h" #include "main/framebuffer.h" #include "main/mipmap.h" #include "main/queryobj.h" @@ -85,14 +89,13 @@ _mesa_init_driver_functions(struct dd_function_table *driver) /* framebuffer/image functions */ driver->Clear = _swrast_Clear; - driver->Accum = _swrast_Accum; + + _MESA_INIT_ACCUM_FUNCTIONS(driver, _swrast_); + _MESA_INIT_DRAWPIX_FUNCTIONS(driver, _swrast_); _MESA_INIT_RASTPOS_FUNCTIONS(driver, _tnl_); - driver->DrawPixels = _swrast_DrawPixels; driver->ReadPixels = _swrast_ReadPixels; - driver->CopyPixels = _swrast_CopyPixels; - driver->Bitmap = _swrast_Bitmap; /* Texture functions */ driver->ChooseTextureFormat = _mesa_choose_tex_format; @@ -132,10 +135,10 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->UpdateTexturePalette = NULL; /* imaging */ - driver->CopyColorTable = _swrast_CopyColorTable; - driver->CopyColorSubTable = _swrast_CopyColorSubTable; - driver->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; - driver->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; + /* swrast does not need UpdateTexturePalette */ +#define _swrast_UpdateTexturePalette NULL + _MESA_INIT_COLORTABLE_FUNCTIONS(driver, _swrast_); + _MESA_INIT_CONVOLVE_FUNCTIONS(driver, _swrast_); /* Vertex/fragment programs */ driver->BindProgram = NULL; diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c index c6c7dbf5cf..c29ccf2d9b 100644 --- a/src/mesa/swrast/s_accum.c +++ b/src/mesa/swrast/s_accum.c @@ -73,6 +73,9 @@ #endif +#if FEATURE_accum + + /** * This is called when we fall out of optimized/unscaled accum buffer mode. * That is, we convert each unscaled accum buffer value into a scaled value @@ -597,3 +600,6 @@ _swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value) swrast_render_finish(ctx); } + + +#endif /* FEATURE_accum */ diff --git a/src/mesa/swrast/s_accum.h b/src/mesa/swrast/s_accum.h index 42e38cf02b..730c0254b2 100644 --- a/src/mesa/swrast/s_accum.h +++ b/src/mesa/swrast/s_accum.h @@ -30,8 +30,19 @@ #include "main/mtypes.h" +#if FEATURE_accum + extern void _swrast_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb); +#else /* FEATURE_accum */ + +static INLINE void +_swrast_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) +{ + ASSERT_NO_FEATURE(); +} #endif + +#endif /* S_ACCUM_H */ diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c index 3dbdf2a61a..b7a28a46e9 100644 --- a/src/mesa/swrast/s_bitmap.c +++ b/src/mesa/swrast/s_bitmap.c @@ -38,6 +38,8 @@ #include "s_span.h" +#if FEATURE_drawpix + /** * Render a bitmap. @@ -226,3 +228,6 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, swrast_render_finish(ctx); } #endif + + +#endif /* FEATURE_drawpix */ diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index 5ecfb1e90a..8f2db3afbb 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -40,6 +40,8 @@ #include "s_zoom.h" +#if FEATURE_drawpix + /** * Determine if there's overlap in an image copy. @@ -930,3 +932,6 @@ _swrast_CopyPixels( GLcontext *ctx, swrast_render_finish(ctx); } + + +#endif /* FEATURE_drawpix */ diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 6970b2e9cb..6ce449b2a8 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -39,6 +39,8 @@ #include "s_zoom.h" +#if FEATURE_drawpix + /** * Try to do a fast and simple RGB(a) glDrawPixels. @@ -896,3 +898,6 @@ _swrast_DrawPixels( GLcontext *ctx, _mesa_unmap_pbo_source(ctx, unpack); } + + +#endif /* FEATURE_drawpix */ diff --git a/src/mesa/swrast/s_feedback.c b/src/mesa/swrast/s_feedback.c index 47ed25ee10..0eea1d0c3b 100644 --- a/src/mesa/swrast/s_feedback.c +++ b/src/mesa/swrast/s_feedback.c @@ -34,6 +34,8 @@ #include "s_triangle.h" +#if FEATURE_feedback + static void feedback_vertex(GLcontext * ctx, const SWvertex * v, const SWvertex * pv) @@ -138,3 +140,6 @@ _swrast_select_point(GLcontext *ctx, const SWvertex *v) const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; _mesa_update_hitflag( ctx, v->attrib[FRAG_ATTRIB_WPOS][2] * zs ); } + + +#endif /* FEATURE_feedback */ diff --git a/src/mesa/swrast/s_feedback.h b/src/mesa/swrast/s_feedback.h index 9feab75dbb..994984f6f7 100644 --- a/src/mesa/swrast/s_feedback.h +++ b/src/mesa/swrast/s_feedback.h @@ -31,6 +31,8 @@ #include "swrast.h" +#if FEATURE_feedback + extern void _swrast_feedback_point( GLcontext *ctx, const SWvertex *v ); extern void _swrast_feedback_line( GLcontext *ctx, @@ -46,5 +48,48 @@ extern void _swrast_select_line( GLcontext *ctx, extern void _swrast_select_triangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ); +#else /* FEATURE_feedback */ + +static INLINE void +_swrast_feedback_point( GLcontext *ctx, const SWvertex *v ) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_swrast_feedback_line( GLcontext *ctx, + const SWvertex *v1, const SWvertex *v2 ) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_swrast_feedback_triangle( GLcontext *ctx, const SWvertex *v0, + const SWvertex *v1, const SWvertex *v2 ) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_swrast_select_point( GLcontext *ctx, const SWvertex *v ) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_swrast_select_line( GLcontext *ctx, + const SWvertex *v1, const SWvertex *v2 ) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_swrast_select_triangle( GLcontext *ctx, const SWvertex *v0, + const SWvertex *v1, const SWvertex *v2 ) +{ + ASSERT_NO_FEATURE(); +} #endif + +#endif /* S_FEEDBACK_H */ diff --git a/src/mesa/swrast/s_imaging.c b/src/mesa/swrast/s_imaging.c index 3578b713f6..7cc97b7f03 100644 --- a/src/mesa/swrast/s_imaging.c +++ b/src/mesa/swrast/s_imaging.c @@ -34,6 +34,9 @@ #include "s_span.h" +#if FEATURE_colortable + + void _swrast_CopyColorTable( GLcontext *ctx, GLenum target, GLenum internalformat, @@ -103,6 +106,12 @@ _swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, } +#endif /* FEATURE_colortable */ + + +#if FEATURE_convolve + + void _swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, GLenum internalFormat, @@ -194,3 +203,6 @@ _swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, ctx->Unpack = packSave; /* restore pixel packing params */ ctx->NewState |= _NEW_PACKUNPACK; } + + +#endif /* FEATURE_convolve */ diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index c319ca62f9..a85d69bfbf 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -33,6 +33,7 @@ #define SWRAST_H #include "main/mtypes.h" +#include "swrast_features.h" /** * \struct SWvertex @@ -101,28 +102,6 @@ _swrast_DestroyContext( GLcontext *ctx ); extern struct swrast_device_driver * _swrast_GetDeviceDriverReference( GLcontext *ctx ); -extern void -_swrast_Bitmap( GLcontext *ctx, - GLint px, GLint py, - GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap ); - -extern void -_swrast_CopyPixels( GLcontext *ctx, - GLint srcx, GLint srcy, - GLint destx, GLint desty, - GLsizei width, GLsizei height, - GLenum type ); - -extern void -_swrast_DrawPixels( GLcontext *ctx, - GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels ); - extern void _swrast_ReadPixels( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, @@ -139,10 +118,6 @@ _swrast_BlitFramebuffer(GLcontext *ctx, extern void _swrast_Clear(GLcontext *ctx, GLbitfield buffers); -extern void -_swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value); - - /* Reset the stipple counter */ @@ -207,28 +182,6 @@ extern void _swrast_print_vertex( GLcontext *ctx, const SWvertex *v ); -/* - * Imaging fallbacks (a better solution should be found, perhaps - * moving all the imaging fallback code to a new module) - */ -extern void -_swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, - GLenum internalFormat, - GLint x, GLint y, GLsizei width, - GLsizei height); -extern void -_swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, - GLenum internalFormat, - GLint x, GLint y, GLsizei width); -extern void -_swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, - GLint x, GLint y, GLsizei width); -extern void -_swrast_CopyColorTable( GLcontext *ctx, - GLenum target, GLenum internalformat, - GLint x, GLint y, GLsizei width); - - /* * Texture fallbacks. Could also live in a new module * with the rest of the texture store fallbacks? @@ -287,6 +240,4 @@ struct swrast_device_driver { void (*SpanRenderFinish)(GLcontext *ctx); }; - - -#endif +#endif /* SWRAST_H */ diff --git a/src/mesa/swrast/swrast_features.h b/src/mesa/swrast/swrast_features.h new file mode 100644 index 0000000000..7b7b76460b --- /dev/null +++ b/src/mesa/swrast/swrast_features.h @@ -0,0 +1,140 @@ +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2006 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 swrast/swrast_features.h + * \brief Public interface to the software rasterization functions. + * \author Keith Whitwell + */ + +#ifndef SWRAST_FEATURES_H +#define SWRAST_FEATURES_H + +#include "main/mtypes.h" + + +#if FEATURE_accum + +extern void +_swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value); + +#endif + + +/* + * Imaging fallbacks (a better solution should be found, perhaps + * moving all the imaging fallback code to a new module) + */ +#if FEATURE_convolve + +extern void +_swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, + GLenum internalFormat, + GLint x, GLint y, GLsizei width, + GLsizei height); + +extern void +_swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, + GLenum internalFormat, + GLint x, GLint y, GLsizei width); + +#endif + + +#if FEATURE_colortable + +extern void +_swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width); + +extern void +_swrast_CopyColorTable( GLcontext *ctx, + GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width); + +#endif + + +#if FEATURE_drawpix + +extern void +_swrast_Bitmap( GLcontext *ctx, + GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ); + +extern void +_swrast_CopyPixels( GLcontext *ctx, + GLint srcx, GLint srcy, + GLint destx, GLint desty, + GLsizei width, GLsizei height, + GLenum type ); + +extern void +_swrast_DrawPixels( GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels ); + +#else /* FEATURE_drawpix */ + +static INLINE void +_swrast_Bitmap( GLcontext *ctx, + GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_swrast_CopyPixels( GLcontext *ctx, + GLint srcx, GLint srcy, + GLint destx, GLint desty, + GLsizei width, GLsizei height, + GLenum type ) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_swrast_DrawPixels( GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels ) +{ + ASSERT_NO_FEATURE(); +} + +#endif + + +#endif /* SWRAST_FEATURES_H */ -- cgit v1.2.3