diff options
Diffstat (limited to 'src/mesa/drivers/x11')
-rw-r--r-- | src/mesa/drivers/x11/Makefile | 8 | ||||
-rw-r--r-- | src/mesa/drivers/x11/descrip.mms | 55 | ||||
-rw-r--r-- | src/mesa/drivers/x11/fakeglx.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/x11/glxapi.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/x11/glxheader.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/x11/sources | 8 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_api.c | 88 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_dd.c | 256 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_glide.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_line.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_tri.c | 200 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xmesaP.h | 4 |
12 files changed, 423 insertions, 225 deletions
diff --git a/src/mesa/drivers/x11/Makefile b/src/mesa/drivers/x11/Makefile index 51226eeae1..d2780e62c9 100644 --- a/src/mesa/drivers/x11/Makefile +++ b/src/mesa/drivers/x11/Makefile @@ -55,11 +55,11 @@ default: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) $(CORE_MESA) - @ $(TOP)/bin/mklib -o $(GL_LIB) \ - -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + @ $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \ - -install $(TOP)/$(LIB_DIR) \ - $(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(OBJECTS) $(CORE_MESA) + -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ + -id $(INSTALL_LIB_DIR)/lib$(GL_LIB).$(GL_MAJOR).dylib \ + $(GL_LIB_DEPS) $(OBJECTS) $(CORE_MESA) diff --git a/src/mesa/drivers/x11/descrip.mms b/src/mesa/drivers/x11/descrip.mms new file mode 100644 index 0000000000..648f683dfa --- /dev/null +++ b/src/mesa/drivers/x11/descrip.mms @@ -0,0 +1,55 @@ +# Makefile for core library for VMS +# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl +# Last revision : 3 October 2007 + +.first + define gl [----.include.gl] + define math [--.math] + define tnl [--.tnl] + define vbo [--.vbo] + define swrast [--.swrast] + define swrast_setup [--.swrast_setup] + define array_cache [--.array_cache] + define drivers [-] + define glapi [--.glapi] + define main [--.main] + define shader [--.shader] + +.include [----]mms-config. + +##### MACROS ##### + +VPATH = RCS + +INCDIR = [----.include],[--.main],[--.glapi],[--.shader] +LIBDIR = [----.lib] +CFLAGS =/include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm + +SOURCES = fakeglx.c glxapi.c xfonts.c xm_api.c xm_dd.c xm_line.c xm_span.c\ + xm_tri.c xm_buffer.c + +OBJECTS =fakeglx.obj,glxapi.obj,xfonts.obj,xm_api.obj,xm_dd.obj,xm_line.obj,\ + xm_span.obj,xm_tri.obj,xm_buffer.obj + +##### RULES ##### + +VERSION=Mesa V3.4 + +##### TARGETS ##### +# Make the library +$(LIBDIR)$(GL_LIB) : $(OBJECTS) + @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) + +clean : + purge + delete *.obj;* + +fakeglx.obj : fakeglx.c +glxapi.obj : glxapi.c +xfonts.obj : xfonts.c +xm_api.obj : xm_api.c +xm_buffer.obj : xm_buffer.c +xm_dd.obj : xm_dd.c +xm_line.obj : xm_line.c +xm_span.obj : xm_span.c +xm_tri.obj : xm_tri.c diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 7a170b4d3d..e5cd8f0b80 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -1183,11 +1183,12 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig ) * GLX_ARB_multisample */ case GLX_SAMPLE_BUFFERS_ARB: - /* ms not supported */ - return NULL; case GLX_SAMPLES_ARB: - /* ms not supported */ - return NULL; + parselist++; + if (*parselist++ != 0) + /* ms not supported */ + return NULL; + break; /* * FBConfig attribs. diff --git a/src/mesa/drivers/x11/glxapi.c b/src/mesa/drivers/x11/glxapi.c index 309a0008d7..c2ccce6f52 100644 --- a/src/mesa/drivers/x11/glxapi.c +++ b/src/mesa/drivers/x11/glxapi.c @@ -34,8 +34,8 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include "glheader.h" -#include "glapi.h" +#include "main/glheader.h" +#include "glapi/glapi.h" #include "glxapi.h" diff --git a/src/mesa/drivers/x11/glxheader.h b/src/mesa/drivers/x11/glxheader.h index a402191f13..15e8390583 100644 --- a/src/mesa/drivers/x11/glxheader.h +++ b/src/mesa/drivers/x11/glxheader.h @@ -34,6 +34,7 @@ #ifdef XFree86Server +# include "xorg-server.h" # include "resource.h" # include "windowstr.h" diff --git a/src/mesa/drivers/x11/sources b/src/mesa/drivers/x11/sources deleted file mode 100644 index d76d65eaad..0000000000 --- a/src/mesa/drivers/x11/sources +++ /dev/null @@ -1,8 +0,0 @@ -# Note: only listing sources needed for X server renderer -MESA_DRIVER_X11_SOURCES = \ -xm_api.c \ -xm_buffer.c \ -xm_dd.c \ -xm_line.c \ -xm_span.c \ -xm_tri.c diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 18b033666f..2eb88c1557 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -65,14 +65,14 @@ #include "glxheader.h" #include "GL/xmesa.h" #include "xmesaP.h" -#include "context.h" -#include "extensions.h" -#include "framebuffer.h" -#include "glthread.h" -#include "imports.h" -#include "macros.h" -#include "renderbuffer.h" -#include "teximage.h" +#include "main/context.h" +#include "main/extensions.h" +#include "main/framebuffer.h" +#include "glapi/glthread.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/renderbuffer.h" +#include "main/teximage.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "vbo/vbo.h" @@ -1339,6 +1339,67 @@ xmesa_convert_from_x_visual_type( int visualType ) /**********************************************************************/ +#ifdef IN_DRI_DRIVER +#define need_GL_VERSION_1_3 +#define need_GL_VERSION_1_4 +#define need_GL_VERSION_1_5 +#define need_GL_VERSION_2_0 + +/* sw extensions for imaging */ +#define need_GL_EXT_blend_color +#define need_GL_EXT_blend_minmax +#define need_GL_EXT_convolution +#define need_GL_EXT_histogram +#define need_GL_SGI_color_table + +/* sw extensions not associated with some GL version */ +#define need_GL_ARB_shader_objects +#define need_GL_ARB_vertex_program +#define need_GL_APPLE_vertex_array_object +#define need_GL_ATI_fragment_shader +#define need_GL_EXT_depth_bounds_test +#define need_GL_EXT_framebuffer_object +#define need_GL_EXT_framebuffer_blit +#define need_GL_EXT_gpu_program_parameters +#define need_GL_EXT_paletted_texture +#define need_GL_IBM_multimode_draw_arrays +#define need_GL_MESA_resize_buffers +#define need_GL_NV_vertex_program +#define need_GL_NV_fragment_program + +#include "extension_helper.h" +#include "utils.h" + +const struct dri_extension card_extensions[] = +{ + { "GL_VERSION_1_3", GL_VERSION_1_3_functions }, + { "GL_VERSION_1_4", GL_VERSION_1_4_functions }, + { "GL_VERSION_1_5", GL_VERSION_1_5_functions }, + { "GL_VERSION_2_0", GL_VERSION_2_0_functions }, + + { "GL_EXT_blend_color", GL_EXT_blend_color_functions }, + { "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions }, + { "GL_EXT_convolution", GL_EXT_convolution_functions }, + { "GL_EXT_histogram", GL_EXT_histogram_functions }, + { "GL_SGI_color_table", GL_SGI_color_table_functions }, + + { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions }, + { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions }, + { "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions }, + { "GL_ATI_fragment_shader", GL_ATI_fragment_shader_functions }, + { "GL_EXT_depth_bounds_test", GL_EXT_depth_bounds_test_functions }, + { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, + { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, + { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions }, + { "GL_EXT_paletted_texture", GL_EXT_paletted_texture_functions }, + { "GL_IBM_multimode_draw_arrays", GL_IBM_multimode_draw_arrays_functions }, + { "GL_MESA_resize_buffers", GL_MESA_resize_buffers_functions }, + { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, + { "GL_NV_fragment_program", GL_NV_fragment_program_functions }, + { NULL, NULL } +}; +#endif + /* * Create a new X/Mesa visual. * Input: display - X11 display @@ -1384,6 +1445,14 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, XMesaVisual v; GLint red_bits, green_bits, blue_bits, alpha_bits; +#ifdef IN_DRI_DRIVER + /* driInitExtensions() should be called once per screen to setup extension + * indices. There is no need to call it when the context is created since + * XMesa enables mesa sw extensions on its own. + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); +#endif + #ifndef XFree86Server /* For debugging only */ if (_mesa_getenv("MESA_XSYNC")) { @@ -1570,8 +1639,9 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) _mesa_enable_1_4_extensions(mesaCtx); _mesa_enable_1_5_extensions(mesaCtx); _mesa_enable_2_0_extensions(mesaCtx); + _mesa_enable_2_1_extensions(mesaCtx); #if ENABLE_EXT_texure_compression_s3tc - if (c->Mesa_DXTn) { + if (mesaCtx->Mesa_DXTn) { _mesa_enable_extension(mesaCtx, "GL_EXT_texture_compression_s3tc"); _mesa_enable_extension(mesaCtx, "GL_S3_s3tc"); } diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 34287effe1..ec094b6021 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -424,7 +424,42 @@ xmesa_clear_buffers(GLcontext *ctx, GLbitfield buffers) #ifndef XFree86Server -/* XXX this was never tested in the Xserver environment */ +/* XXX these functions haven't been tested in the Xserver environment */ + + +/** + * Check if we can do an optimized glDrawPixels into an 8R8G8B visual. + */ +static GLboolean +can_do_DrawPixels_8R8G8B(GLcontext *ctx, GLenum format, GLenum type) +{ + if (format == GL_BGRA && + type == GL_UNSIGNED_BYTE && + ctx->DrawBuffer && + ctx->DrawBuffer->Name == 0 && + ctx->Pixel.ZoomX == 1.0 && /* no zooming */ + ctx->Pixel.ZoomY == 1.0 && + ctx->_ImageTransferState == 0 /* no color tables, scale/bias, etc */) { + const SWcontext *swrast = SWRAST_CONTEXT(ctx); + + if (swrast->NewState) + _swrast_validate_derived( ctx ); + + if ((swrast->_RasterMask & ~CLIP_BIT) == 0) /* no blend, z-test, etc */ { + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; + if (rb) { + struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb->Wrapped); + if (xrb && + xrb->pixmap && /* drawing to pixmap or window */ + xrb->Base.AlphaBits == 0) { + return GL_TRUE; + } + } + } + } + return GL_FALSE; +} + /** * This function implements glDrawPixels() with an XPutImage call when @@ -438,37 +473,16 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels ) { - const SWcontext *swrast = SWRAST_CONTEXT( ctx ); - struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; - struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb->Wrapped); - - if (swrast->NewState) - _swrast_validate_derived( ctx ); - - if (ctx->DrawBuffer->Name == 0 && - format == GL_BGRA && - type == GL_UNSIGNED_BYTE && - (swrast->_RasterMask & ~CLIP_BIT) == 0 && /* no blend, z-test, etc */ - ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ - ctx->Pixel.ZoomX == 1.0 && /* no zooming */ - ctx->Pixel.ZoomY == 1.0 && - xrb->pixmap && /* drawing to pixmap or window */ - xrb->St.Base.AlphaBits == 0) - { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); - XMesaDisplay *dpy = xmesa->xm_visual->display; - const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ + if (can_do_DrawPixels_8R8G8B(ctx, format, type)) { + const SWcontext *swrast = SWRAST_CONTEXT( ctx ); + struct gl_pixelstore_attrib clippedUnpack = *unpack; int dstX = x; int dstY = y; int w = width; int h = height; - struct gl_pixelstore_attrib clippedUnpack = *unpack; - ASSERT(xmesa->xm_visual->dithered_pf == PF_8R8G8B); - ASSERT(xmesa->xm_visual->undithered_pf == PF_8R8G8B); - ASSERT(dpy); - ASSERT(gc); + if (swrast->NewState) + _swrast_validate_derived( ctx ); if (unpack->BufferObj->Name) { /* unpack from PBO */ @@ -493,14 +507,26 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx, } if (_mesa_clip_drawpixels(ctx, &dstX, &dstY, &w, &h, &clippedUnpack)) { + const XMesaContext xmesa = XMESA_CONTEXT(ctx); + XMesaDisplay *dpy = xmesa->xm_visual->display; + XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); + const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ + struct xmesa_renderbuffer *xrb + = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped); + const int srcX = clippedUnpack.SkipPixels; + const int srcY = clippedUnpack.SkipRows; + const int rowLength = clippedUnpack.RowLength; + XMesaImage ximage; + + ASSERT(xmesa->xm_visual->dithered_pf == PF_8R8G8B); + ASSERT(xmesa->xm_visual->undithered_pf == PF_8R8G8B); + ASSERT(dpy); + ASSERT(gc); + /* This is a little tricky since all coordinates up to now have * been in the OpenGL bottom-to-top orientation. X is top-to-bottom * so we have to carefully compute the Y coordinates/addresses here. */ - int srcX = clippedUnpack.SkipPixels; - int srcY = clippedUnpack.SkipRows; - int rowLength = clippedUnpack.RowLength; - XMesaImage ximage; MEMSET(&ximage, 0, sizeof(XMesaImage)); ximage.width = width; ximage.height = height; @@ -511,9 +537,9 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx, ximage.bitmap_unit = 32; ximage.bitmap_bit_order = LSBFirst; ximage.bitmap_pad = 32; - ximage.depth = 24; - ximage.bytes_per_line = -rowLength * 4; /* negative to flip image */ + ximage.depth = 32; ximage.bits_per_pixel = 32; + ximage.bytes_per_line = -rowLength * 4; /* negative to flip image */ /* it seems we don't need to set the ximage.red/green/blue_mask fields */ /* flip Y axis for dest position */ dstY = YFLIP(xrb, dstY) - h + 1; @@ -535,6 +561,41 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx, /** + * Check if we can do an optimized glDrawPixels into an 5R6G5B visual. + */ +static GLboolean +can_do_DrawPixels_5R6G5B(GLcontext *ctx, GLenum format, GLenum type) +{ + if (format == GL_RGB && + type == GL_UNSIGNED_SHORT_5_6_5 && + !ctx->Color.DitherFlag && /* no dithering */ + ctx->DrawBuffer && + ctx->DrawBuffer->Name == 0 && + ctx->Pixel.ZoomX == 1.0 && /* no zooming */ + ctx->Pixel.ZoomY == 1.0 && + ctx->_ImageTransferState == 0 /* no color tables, scale/bias, etc */) { + const SWcontext *swrast = SWRAST_CONTEXT(ctx); + + if (swrast->NewState) + _swrast_validate_derived( ctx ); + + if ((swrast->_RasterMask & ~CLIP_BIT) == 0) /* no blend, z-test, etc */ { + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; + if (rb) { + struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb->Wrapped); + if (xrb && + xrb->pixmap && /* drawing to pixmap or window */ + xrb->Base.AlphaBits == 0) { + return GL_TRUE; + } + } + } + } + return GL_FALSE; +} + + +/** * This function implements glDrawPixels() with an XPutImage call when * drawing to the front buffer (X Window drawable). The image format * must be GL_RGB and image type must be GL_UNSIGNED_SHORT_5_6_5 to @@ -547,35 +608,17 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels ) { - struct xmesa_renderbuffer *xrb - = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - const SWcontext *swrast = SWRAST_CONTEXT( ctx ); - XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); - const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ - - ASSERT(dpy); - ASSERT(gc); - ASSERT(xmesa->xm_visual->undithered_pf == PF_5R6G5B); - - if (swrast->NewState) - _swrast_validate_derived( ctx ); - - if (xrb->pixmap && /* drawing to pixmap or window */ - format == GL_RGB && - type == GL_UNSIGNED_SHORT_5_6_5 && - !ctx->Color.DitherFlag && /* no dithering */ - (swrast->_RasterMask & ~CLIP_BIT) == 0 && /* no blend, z-test, etc */ - ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ - ctx->Pixel.ZoomX == 1.0 && /* no zooming */ - ctx->Pixel.ZoomY == 1.0) { + if (can_do_DrawPixels_5R6G5B(ctx, format, type)) { + const SWcontext *swrast = SWRAST_CONTEXT( ctx ); + struct gl_pixelstore_attrib clippedUnpack = *unpack; int dstX = x; int dstY = y; int w = width; int h = height; - struct gl_pixelstore_attrib clippedUnpack = *unpack; + if (swrast->NewState) + _swrast_validate_derived( ctx ); + if (unpack->BufferObj->Name) { /* unpack from PBO */ GLubyte *buf; @@ -599,14 +642,25 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, } if (_mesa_clip_drawpixels(ctx, &dstX, &dstY, &w, &h, &clippedUnpack)) { + const XMesaContext xmesa = XMESA_CONTEXT(ctx); + XMesaDisplay *dpy = xmesa->xm_visual->display; + XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); + const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ + struct xmesa_renderbuffer *xrb + = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped); + const int srcX = clippedUnpack.SkipPixels; + const int srcY = clippedUnpack.SkipRows; + const int rowLength = clippedUnpack.RowLength; + XMesaImage ximage; + + ASSERT(xmesa->xm_visual->undithered_pf == PF_5R6G5B); + ASSERT(dpy); + ASSERT(gc); + /* This is a little tricky since all coordinates up to now have * been in the OpenGL bottom-to-top orientation. X is top-to-bottom * so we have to carefully compute the Y coordinates/addresses here. */ - int srcX = clippedUnpack.SkipPixels; - int srcY = clippedUnpack.SkipRows; - int rowLength = clippedUnpack.RowLength; - XMesaImage ximage; MEMSET(&ximage, 0, sizeof(XMesaImage)); ximage.width = width; ximage.height = height; @@ -618,8 +672,8 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, ximage.bitmap_bit_order = LSBFirst; ximage.bitmap_pad = 16; ximage.depth = 16; - ximage.bytes_per_line = -rowLength * 2; /* negative to flip image */ ximage.bits_per_pixel = 16; + ximage.bytes_per_line = -rowLength * 2; /* negative to flip image */ /* it seems we don't need to set the ximage.red/green/blue_mask fields */ /* flip Y axis for dest position */ dstY = YFLIP(xrb, dstY) - h + 1; @@ -639,6 +693,42 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, } +/** + * Determine if we can do an optimized glCopyPixels. + */ +static GLboolean +can_do_CopyPixels(GLcontext *ctx, GLenum type) +{ + if (type == GL_COLOR && + ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ + ctx->Pixel.ZoomX == 1.0 && /* no zooming */ + ctx->Pixel.ZoomY == 1.0 && + ctx->Color.DrawBuffer[0] == GL_FRONT && /* copy to front buf */ + ctx->Pixel.ReadBuffer == GL_FRONT && /* copy from front buf */ + ctx->ReadBuffer->_ColorReadBuffer && + ctx->DrawBuffer->_ColorDrawBuffers[0]) { + const SWcontext *swrast = SWRAST_CONTEXT( ctx ); + + if (swrast->NewState) + _swrast_validate_derived( ctx ); + + if ((swrast->_RasterMask & ~CLIP_BIT) == 0x0 && + ctx->ReadBuffer && + ctx->ReadBuffer->_ColorReadBuffer && + ctx->DrawBuffer && + ctx->DrawBuffer->_ColorDrawBuffers[0]) { + struct xmesa_renderbuffer *srcXrb + = xmesa_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer->Wrapped); + struct xmesa_renderbuffer *dstXrb + = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped); + if (srcXrb->pixmap && dstXrb->pixmap) { + return GL_TRUE; + } + } + } + return GL_FALSE; +} + /** * Implement glCopyPixels for the front color buffer (or back buffer Pixmap) @@ -650,31 +740,19 @@ xmesa_CopyPixels( GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint destx, GLint desty, GLenum type ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - const SWcontext *swrast = SWRAST_CONTEXT( ctx ); - XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); - const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ - struct xmesa_renderbuffer *srcXrb - = xmesa_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer->Wrapped); - struct xmesa_renderbuffer *dstXrb - = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); - - ASSERT(dpy); - ASSERT(gc); - - if (swrast->NewState) - _swrast_validate_derived( ctx ); - - if (ctx->Color.DrawBuffer[0] == GL_FRONT && - ctx->Pixel.ReadBuffer == GL_FRONT && - srcXrb->pixmap && - dstXrb->pixmap && - type == GL_COLOR && - (swrast->_RasterMask & ~CLIP_BIT) == 0 && /* no blend, z-test, etc */ - ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ - ctx->Pixel.ZoomX == 1.0 && /* no zooming */ - ctx->Pixel.ZoomY == 1.0) { + if (can_do_CopyPixels(ctx, type)) { + const XMesaContext xmesa = XMESA_CONTEXT(ctx); + XMesaDisplay *dpy = xmesa->xm_visual->display; + XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); + const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ + struct xmesa_renderbuffer *srcXrb + = xmesa_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer->Wrapped); + struct xmesa_renderbuffer *dstXrb + = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped); + + ASSERT(dpy); + ASSERT(gc); + /* Note: we don't do any special clipping work here. We could, * but X will do it for us. */ @@ -687,6 +765,7 @@ xmesa_CopyPixels( GLcontext *ctx, _swrast_CopyPixels(ctx, srcx, srcy, width, height, destx, desty, type ); } } + #endif /* XFree86Server */ @@ -1079,7 +1158,8 @@ xmesa_init_driver_functions( XMesaVisual xmvisual, #ifndef XFree86Server driver->CopyPixels = xmesa_CopyPixels; if (xmvisual->undithered_pf == PF_8R8G8B && - xmvisual->dithered_pf == PF_8R8G8B) { + xmvisual->dithered_pf == PF_8R8G8B && + xmvisual->BitsPerPixel == 32) { driver->DrawPixels = xmesa_DrawPixels_8R8G8B; } else if (xmvisual->undithered_pf == PF_5R6G5B) { diff --git a/src/mesa/drivers/x11/xm_glide.c b/src/mesa/drivers/x11/xm_glide.c index ae4f4282db..cbd69b011a 100644 --- a/src/mesa/drivers/x11/xm_glide.c +++ b/src/mesa/drivers/x11/xm_glide.c @@ -64,7 +64,8 @@ FXcreateContext(XMesaVisual v, XMesaWindow w, XMesaContext c, XMesaBuffer b) attribs[numAttribs++] = FXMESA_NONE; /* [dBorca] we should take an envvar for `fxMesaSelectCurrentBoard'!!! */ - hw = fxMesaSelectCurrentBoard(0); +/* hw = fxMesaSelectCurrentBoard(0); */ + hw = GR_SSTTYPE_Voodoo2; /* if these fail, there's a new bug somewhere */ ASSERT(b->mesa_buffer.Width > 0); diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c index deeae5019c..9833b4c9f0 100644 --- a/src/mesa/drivers/x11/xm_line.c +++ b/src/mesa/drivers/x11/xm_line.c @@ -121,7 +121,7 @@ void xmesa_choose_point( GLcontext *ctx ) #define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \ - xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped) + xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped) /* @@ -587,8 +587,8 @@ get_line_func(GLcontext *ctx) const int depth = GET_VISUAL_DEPTH(xmesa->xm_visual); const struct xmesa_renderbuffer *xrb; - if ((ctx->DrawBuffer->_ColorDrawBufferMask[0] - & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) == 0) + if ((ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_FRONT_LEFT) && + (ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_BACK_LEFT)) return (swrast_line_func) NULL; if (ctx->RenderMode != GL_RENDER) return (swrast_line_func) NULL; if (ctx->Line.SmoothFlag) return (swrast_line_func) NULL; @@ -598,7 +598,7 @@ get_line_func(GLcontext *ctx) if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_line_func) NULL; if (xmbuf->swAlpha) return (swrast_line_func) NULL; - xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); + xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped); if (xrb->ximage && swrast->_RasterMask==DEPTH_BIT @@ -661,8 +661,8 @@ get_line_func(GLcontext *ctx) } #ifndef XFree86Server - if (ctx->DrawBuffer->_NumColorDrawBuffers[0] == 1 - && ctx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT + if (ctx->DrawBuffer->_NumColorDrawBuffers == 1 + && ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT && swrast->_RasterMask == LOGIC_OP_BIT && ctx->Color.LogicOp == GL_XOR && !ctx->Line.StippleFlag diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index 9f17083f90..158f284a5e 100644 --- a/src/mesa/drivers/x11/xm_tri.c +++ b/src/mesa/drivers/x11/xm_tri.c @@ -45,7 +45,7 @@ #define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \ - xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped) + xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped) /**********************************************************************/ @@ -66,7 +66,7 @@ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLint x = span.x, y = YFLIP(xrb, span.y); \ GLuint i; \ for (i = 0; i < span.end; i++, x++) { \ @@ -82,7 +82,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -102,7 +102,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -117,7 +117,7 @@ span.blue += span.blueStep; \ span.alpha += span.alphaStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -137,7 +137,7 @@ #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -152,7 +152,7 @@ span.blue += span.blueStep; \ span.alpha += span.alphaStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -171,7 +171,7 @@ #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -184,7 +184,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -202,7 +202,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -217,7 +217,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -232,7 +232,7 @@ #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -248,7 +248,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -265,7 +265,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -278,7 +278,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -296,7 +296,7 @@ #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -310,7 +310,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -327,7 +327,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ XDITHER_SETUP(y); \ @@ -342,7 +342,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -357,7 +357,7 @@ #define SETUP_CODE \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ XDITHER_SETUP(y); \ @@ -373,7 +373,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -390,7 +390,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ LOOKUP_SETUP; \ for (i = 0; i < span.end; i++) { \ @@ -404,7 +404,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -422,7 +422,7 @@ #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -436,7 +436,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -453,7 +453,7 @@ XMesaImage *img = xrb->ximage; \ unsigned long pixel; \ PACK_TRUECOLOR(pixel, v2->color[0], v2->color[1], v2->color[2]); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -463,7 +463,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -481,7 +481,7 @@ GET_XRB(xrb); \ GLuint p = PACK_8A8B8G8R( v2->color[0], v2->color[1],\ v2->color[2], v2->color[3]); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -490,7 +490,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -508,7 +508,7 @@ GET_XRB(xrb); \ GLuint p = PACK_8A8R8G8B(v2->color[0], v2->color[1], \ v2->color[2], v2->color[3]); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -517,7 +517,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -534,7 +534,7 @@ #define SETUP_CODE \ GET_XRB(xrb); \ GLuint p = PACK_8R8G8B( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -543,7 +543,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -561,7 +561,7 @@ #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = v2->color; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -573,7 +573,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -588,7 +588,7 @@ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -601,7 +601,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -618,7 +618,7 @@ #define SETUP_CODE \ GET_XRB(xrb); \ GLushort p = PACK_5R6G5B( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -627,7 +627,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -645,7 +645,7 @@ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ const GLubyte *color = v2->color; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -656,7 +656,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -673,7 +673,7 @@ #define SETUP_CODE \ GET_XRB(xrb); \ FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ FLAT_DITHER_ROW_SETUP(YFLIP(xrb, y)); \ @@ -684,7 +684,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -699,7 +699,7 @@ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; \ FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ FLAT_DITHER_ROW_SETUP(y); \ @@ -711,7 +711,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -731,7 +731,7 @@ GLubyte r = v2->color[0]; \ GLubyte g = v2->color[1]; \ GLubyte b = v2->color[2]; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -741,7 +741,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -762,7 +762,7 @@ GLubyte g = v2->color[1]; \ GLubyte b = v2->color[2]; \ GLubyte p = LOOKUP(r,g,b); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -771,7 +771,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -785,7 +785,7 @@ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -796,7 +796,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -812,7 +812,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = PACK_8A8B8G8R(FixedToInt(span.red), \ @@ -822,7 +822,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.alpha += span.alphaStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -838,7 +838,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = PACK_8A8R8G8B(FixedToInt(span.red), \ @@ -848,7 +848,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.alpha += span.alphaStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -863,7 +863,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = PACK_8R8G8B(FixedToInt(span.red), \ @@ -871,7 +871,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -886,7 +886,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ PIXEL_TYPE *pixel = pRow; \ for (i = 0; i < span.end; i++, pixel++) { \ @@ -896,7 +896,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -910,7 +910,7 @@ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -921,7 +921,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -936,7 +936,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) PACK_5R6G5B(FixedToInt(span.red), \ @@ -944,7 +944,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -960,7 +960,7 @@ #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -969,7 +969,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -984,7 +984,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ XDITHER_SETUP(y); \ @@ -994,7 +994,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -1007,7 +1007,7 @@ #define SETUP_CODE \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ XDITHER_SETUP(y); \ @@ -1018,7 +1018,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -1033,7 +1033,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ LOOKUP_SETUP; \ for (i = 0; i < span.end; i++) { \ @@ -1042,7 +1042,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -1058,7 +1058,7 @@ #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -1067,7 +1067,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -1082,12 +1082,12 @@ XMesaImage *img = xrb->ximage; \ unsigned long pixel; \ PACK_TRUECOLOR(pixel, v2->color[0], v2->color[1], v2->color[2]); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ XMesaPutPixel(img, x, y, pixel); \ - } + } } #include "swrast/s_tritemp.h" @@ -1103,11 +1103,11 @@ GET_XRB(xrb); \ unsigned long p = PACK_8B8G8R( v2->color[0], \ v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ - } + } } #include "swrast/s_tritemp.h" @@ -1123,11 +1123,11 @@ GET_XRB(xrb); \ unsigned long p = PACK_8R8G8B( v2->color[0], \ v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ - } + } } #include "swrast/s_tritemp.h" @@ -1143,11 +1143,11 @@ GET_XRB(xrb); \ unsigned long p = PACK_8R8G8B( v2->color[0], \ v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ - } + } } #include "swrast/s_tritemp.h" @@ -1162,14 +1162,14 @@ #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = v2->color; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ PIXEL_TYPE *pixel = pRow; \ for (i = 0; i < span.end; i++, pixel++) { \ pixel->r = color[RCOMP]; \ pixel->g = color[GCOMP]; \ pixel->b = color[BCOMP]; \ - } + } } #include "swrast/s_tritemp.h" @@ -1182,7 +1182,7 @@ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -1190,7 +1190,7 @@ PACK_TRUEDITHER(p, x, y, v2->color[0], \ v2->color[1], v2->color[2] ); \ XMesaPutPixel(img, x, y, p); \ - } + } } #include "swrast/s_tritemp.h" @@ -1206,11 +1206,11 @@ GET_XRB(xrb); \ unsigned long p = PACK_5R6G5B( v2->color[0], \ v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ - } + } } #include "swrast/s_tritemp.h" @@ -1226,13 +1226,13 @@ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ const GLubyte *color = v2->color; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ PACK_TRUEDITHER(pRow[i], x, y, color[RCOMP], \ color[GCOMP], color[BCOMP]); \ - } + } } #include "swrast/s_tritemp.h" @@ -1247,13 +1247,13 @@ #define SETUP_CODE \ GET_XRB(xrb); \ FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ FLAT_DITHER_ROW_SETUP(YFLIP(xrb, y)); \ for (i = 0; i < span.end; i++, x++) { \ pRow[i] = (PIXEL_TYPE) FLAT_DITHER(x); \ - } + } } #include "swrast/s_tritemp.h" @@ -1266,14 +1266,14 @@ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; \ FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ FLAT_DITHER_ROW_SETUP(y); \ for (i = 0; i < span.end; i++, x++) { \ unsigned long p = FLAT_DITHER(x); \ XMesaPutPixel(img, x, y, p ); \ - } + } } #include "swrast/s_tritemp.h" @@ -1291,12 +1291,12 @@ GLubyte r = v2->color[0]; \ GLubyte g = v2->color[1]; \ GLubyte b = v2->color[2]; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ pRow[i] = (PIXEL_TYPE) DITHER_HPCR(x, y, r, g, b); \ - } + } } #include "swrast/s_tritemp.h" @@ -1315,11 +1315,11 @@ GLubyte g = v2->color[1]; \ GLubyte b = v2->color[2]; \ GLubyte p = LOOKUP(r,g,b); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ - } + } } #include "swrast/s_tritemp.h" @@ -1502,8 +1502,8 @@ get_triangle_func(GLcontext *ctx) #endif /* trivial fallback tests */ - if ((ctx->DrawBuffer->_ColorDrawBufferMask[0] - & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) == 0) + if ((ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_FRONT_LEFT) && + (ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_BACK_LEFT)) return (swrast_tri_func) NULL; if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL; @@ -1519,7 +1519,7 @@ get_triangle_func(GLcontext *ctx) if (xmbuf->swAlpha) return (swrast_tri_func) NULL; - xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); + xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped); if (xrb->ximage) { if ( ctx->Light.ShadeModel==GL_SMOOTH diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index fd2dfcd79a..e0e69274d4 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -130,7 +130,7 @@ struct xmesa_visual { /** - * Context info, dDerived from GLcontext. + * Context info, derived from GLcontext. * Basically corresponds to a GLXContext. */ struct xmesa_context { @@ -549,7 +549,6 @@ xmesa_renderbuffer(struct gl_renderbuffer *rb) /** * Return pointer to XMesaContext corresponding to a Mesa GLcontext. * Since we're using structure containment, it's just a cast!. - * XXX should use inlined function for better type safety. */ static INLINE XMesaContext XMESA_CONTEXT(GLcontext *ctx) @@ -561,7 +560,6 @@ XMESA_CONTEXT(GLcontext *ctx) /** * Return pointer to XMesaBuffer corresponding to a Mesa GLframebuffer. * Since we're using structure containment, it's just a cast!. - * XXX should use inlined function for better type safety. */ static INLINE XMesaBuffer XMESA_BUFFER(GLframebuffer *b) |