diff options
author | Keith Whitwell <[email protected]> | 2001-03-19 02:25:35 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2001-03-19 02:25:35 +0000 |
commit | 709892459922a32096fe9dd8261d0d92337bb02f (patch) | |
tree | 87782215d4531207c97b236a5dfa0d15c45aef8a /src/mesa/drivers | |
parent | d9bf6ccce9f5fea22d6a478c4afafea3c3c525c5 (diff) |
Split driver struct into swrast/tnl/core components.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/glide/fxdd.c | 77 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxddspan.c | 60 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxtris.c | 29 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxvb.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/osmesa/osmesa.c | 117 | ||||
-rw-r--r-- | src/mesa/drivers/svga/svgamesa.c | 73 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_api.c | 13 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_dd.c | 68 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_span.c | 309 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xmesaP.h | 5 |
10 files changed, 395 insertions, 363 deletions
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index 83a5196683e..d389124ff57 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -60,6 +60,7 @@ #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" +#include "tnl/t_context.h" #include "tnl/t_pipeline.h" #include "array_cache/acache.h" @@ -300,27 +301,6 @@ fxDDSetDrawBuffer(GLcontext * ctx, GLenum mode) } -/* Set the buffer used for reading */ -/* XXX support for separate read/draw buffers hasn't been tested */ -static void -fxDDSetReadBuffer(GLcontext * ctx, GLframebuffer * buffer, GLenum mode) -{ - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; - (void) buffer; - - if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDSetBuffer(%x)\n", (int) mode); - } - - if (mode == GL_FRONT_LEFT) { - fxMesa->currentFB = GR_BUFFER_FRONTBUFFER; - FX_grRenderBuffer(fxMesa->currentFB); - } - else if (mode == GL_BACK_LEFT) { - fxMesa->currentFB = GR_BUFFER_BACKBUFFER; - FX_grRenderBuffer(fxMesa->currentFB); - } -} @@ -984,6 +964,7 @@ update_texture_scales(GLcontext * ctx) static void fxDDUpdateDDPointers(GLcontext * ctx, GLuint new_state) { + TNLcontext *tnl = TNL_CONTEXT(ctx); fxMesaContext fxMesa = FX_CONTEXT(ctx); _swrast_InvalidateState(ctx, new_state); @@ -1000,7 +981,6 @@ fxDDUpdateDDPointers(GLcontext * ctx, GLuint new_state) if (new_state & (_FX_NEW_IS_IN_HARDWARE | _FX_NEW_RENDERSTATE | _FX_NEW_SETUP_FUNCTION | _NEW_TEXTURE)) { - fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; if (new_state & _FX_NEW_IS_IN_HARDWARE) fxMesa->is_in_hardware = fxIsInHardware(ctx); @@ -1012,7 +992,7 @@ fxDDUpdateDDPointers(GLcontext * ctx, GLuint new_state) fxDDChooseRenderState(ctx); if (new_state & _FX_NEW_SETUP_FUNCTION) - ctx->Driver.BuildProjectedVertices = fx_validate_BuildProjVerts; + tnl->Driver.BuildProjectedVertices = fx_validate_BuildProjVerts; if (new_state & _NEW_TEXTURE) update_texture_scales(ctx); @@ -1071,68 +1051,48 @@ fxDDRenderFinish(GLcontext * ctx) void fxSetupDDPointers(GLcontext * ctx) { + TNLcontext *tnl = TNL_CONTEXT(ctx); + if (MESA_VERBOSE & VERBOSE_DRIVER) { fprintf(stderr, "fxmesa: fxSetupDDPointers()\n"); } ctx->Driver.UpdateState = fxDDUpdateDDPointers; - - ctx->Driver.WriteDepthSpan = fxDDWriteDepthSpan; - ctx->Driver.WriteDepthPixels = fxDDWriteDepthPixels; - ctx->Driver.ReadDepthSpan = fxDDReadDepthSpan; - ctx->Driver.ReadDepthPixels = fxDDReadDepthPixels; - ctx->Driver.GetString = fxDDGetString; - ctx->Driver.ClearIndex = NULL; ctx->Driver.ClearColor = fxDDClearColor; ctx->Driver.Clear = fxDDClear; - ctx->Driver.SetDrawBuffer = fxDDSetDrawBuffer; - ctx->Driver.SetReadBuffer = fxDDSetReadBuffer; ctx->Driver.GetBufferSize = fxDDBufferSize; - ctx->Driver.Accum = _swrast_Accum; ctx->Driver.Bitmap = fxDDDrawBitmap; ctx->Driver.CopyPixels = _swrast_CopyPixels; ctx->Driver.DrawPixels = _swrast_DrawPixels; ctx->Driver.ReadPixels = fxDDReadPixels; ctx->Driver.ResizeBuffersMESA = _swrast_alloc_buffers; - ctx->Driver.Finish = fxDDFinish; ctx->Driver.Flush = NULL; - - ctx->Driver.RenderStart = fxDDRenderStart; - ctx->Driver.RenderFinish = fxDDRenderFinish; - ctx->Driver.ResetLineStipple = _swrast_ResetLineStipple; - ctx->Driver.RenderPrimitive = fxDDRenderPrimitive; - - /* Install the oldstyle interp functions: - */ - ctx->Driver.RenderInterp = _swsetup_RenderInterp; - ctx->Driver.RenderCopyPV = _swsetup_RenderCopyPV; - ctx->Driver.RenderClippedLine = _swsetup_RenderClippedLine; - ctx->Driver.RenderClippedPolygon = _swsetup_RenderClippedPolygon; - ctx->Driver.TexImage1D = _mesa_store_teximage1d; ctx->Driver.TexImage2D = fxDDTexImage2D; ctx->Driver.TexImage3D = _mesa_store_teximage3d; ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d; ctx->Driver.TexSubImage2D = fxDDTexSubImage2D; ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d; - ctx->Driver.CopyTexImage1D = _mesa_copy_teximage1d; - ctx->Driver.CopyTexImage2D = _mesa_copy_teximage2d; - ctx->Driver.CopyTexSubImage1D = _mesa_copy_texsubimage1d; - ctx->Driver.CopyTexSubImage2D = _mesa_copy_texsubimage2d; - ctx->Driver.CopyTexSubImage3D = _mesa_copy_texsubimage3d; + ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d; + ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d; + ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d; + ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d; + ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d; ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage; - + ctx->Driver.CopyColorTable = _swrast_CopyColorTable; + ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable; + ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; + ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; ctx->Driver.TexEnv = fxDDTexEnv; ctx->Driver.TexParameter = fxDDTexParam; ctx->Driver.BindTexture = fxDDTexBind; ctx->Driver.DeleteTexture = fxDDTexDel; ctx->Driver.UpdateTexturePalette = fxDDTexPalette; - ctx->Driver.AlphaFunc = fxDDAlphaFunc; ctx->Driver.BlendFunc = fxDDBlendFunc; ctx->Driver.DepthFunc = fxDDDepthFunc; @@ -1145,7 +1105,14 @@ fxSetupDDPointers(GLcontext * ctx) ctx->Driver.ShadeModel = fxDDShadeModel; ctx->Driver.Enable = fxDDEnable; - + tnl->Driver.RenderStart = fxDDRenderStart; + tnl->Driver.RenderFinish = fxDDRenderFinish; + tnl->Driver.ResetLineStipple = _swrast_ResetLineStipple; + tnl->Driver.RenderPrimitive = fxDDRenderPrimitive; + tnl->Driver.RenderInterp = _swsetup_RenderInterp; + tnl->Driver.RenderCopyPV = _swsetup_RenderCopyPV; + tnl->Driver.RenderClippedLine = _swsetup_RenderClippedLine; + tnl->Driver.RenderClippedPolygon = _swsetup_RenderClippedPolygon; fxSetupDDSpanPointers(ctx); fxDDUpdateDDPointers(ctx, ~0); diff --git a/src/mesa/drivers/glide/fxddspan.c b/src/mesa/drivers/glide/fxddspan.c index e02e792deac..6d59e96f462 100644 --- a/src/mesa/drivers/glide/fxddspan.c +++ b/src/mesa/drivers/glide/fxddspan.c @@ -52,6 +52,7 @@ #if defined(FX) #include "fxdrv.h" +#include "swrast/swrast.h" #ifdef _MSC_VER #ifdef _WIN32 @@ -542,31 +543,54 @@ fxDDReadDepthPixels(GLcontext * ctx, GLuint n, +/* Set the buffer used for reading */ +/* XXX support for separate read/draw buffers hasn't been tested */ +static void +fxDDSetReadBuffer(GLcontext * ctx, GLframebuffer * buffer, GLenum mode) +{ + fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; + (void) buffer; + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDSetBuffer(%x)\n", (int) mode); + } + + if (mode == GL_FRONT_LEFT) { + fxMesa->currentFB = GR_BUFFER_FRONTBUFFER; + FX_grRenderBuffer(fxMesa->currentFB); + } + else if (mode == GL_BACK_LEFT) { + fxMesa->currentFB = GR_BUFFER_BACKBUFFER; + FX_grRenderBuffer(fxMesa->currentFB); + } +} + /************************************************************************/ + void fxSetupDDSpanPointers(GLcontext * ctx) { - ctx->Driver.WriteRGBASpan = fxDDWriteRGBASpan; - ctx->Driver.WriteRGBSpan = fxDDWriteRGBSpan; - ctx->Driver.WriteMonoRGBASpan = fxDDWriteMonoRGBASpan; - ctx->Driver.WriteRGBAPixels = fxDDWriteRGBAPixels; - ctx->Driver.WriteMonoRGBAPixels = fxDDWriteMonoRGBAPixels; - - ctx->Driver.WriteCI8Span = NULL; - ctx->Driver.WriteCI32Span = NULL; - ctx->Driver.WriteMonoCISpan = NULL; - ctx->Driver.WriteCI32Pixels = NULL; - ctx->Driver.WriteMonoCIPixels = NULL; - - /* ctx->Driver.ReadRGBASpan =fxDDReadRGBASpan; */ - ctx->Driver.ReadRGBASpan = read_R5G6B5_span; - ctx->Driver.ReadRGBAPixels = read_R5G6B5_pixels; - - ctx->Driver.ReadCI32Span = NULL; - ctx->Driver.ReadCI32Pixels = NULL; + struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx ); + + swdd->SetReadBuffer = fxDDSetReadBuffer; + + swdd->WriteRGBASpan = fxDDWriteRGBASpan; + swdd->WriteRGBSpan = fxDDWriteRGBSpan; + swdd->WriteMonoRGBASpan = fxDDWriteMonoRGBASpan; + swdd->WriteRGBAPixels = fxDDWriteRGBAPixels; + swdd->WriteMonoRGBAPixels = fxDDWriteMonoRGBAPixels; + + swdd->WriteDepthSpan = fxDDWriteDepthSpan; + swdd->WriteDepthPixels = fxDDWriteDepthPixels; + swdd->ReadDepthSpan = fxDDReadDepthSpan; + swdd->ReadDepthPixels = fxDDReadDepthPixels; + + /* swdd->ReadRGBASpan =fxDDReadRGBASpan; */ + swdd->ReadRGBASpan = read_R5G6B5_span; + swdd->ReadRGBAPixels = read_R5G6B5_pixels; } diff --git a/src/mesa/drivers/glide/fxtris.c b/src/mesa/drivers/glide/fxtris.c index a0c8383fdd1..22a4c8cde39 100644 --- a/src/mesa/drivers/glide/fxtris.c +++ b/src/mesa/drivers/glide/fxtris.c @@ -531,6 +531,7 @@ fx_null_tri(GLcontext * ctx, void fxDDChooseRenderState(GLcontext * ctx) { + TNLcontext *tnl = TNL_CONTEXT(ctx); fxMesaContext fxMesa = FX_CONTEXT(ctx); GLuint flags = ctx->_TriangleCaps; GLuint index = 0; @@ -539,12 +540,12 @@ fxDDChooseRenderState(GLcontext * ctx) /* Build software vertices directly. No acceleration is * possible. GrVertices may be insufficient for this mode. */ - ctx->Driver.PointsFunc = _swsetup_Points; - ctx->Driver.LineFunc = _swsetup_Line; - ctx->Driver.TriangleFunc = _swsetup_Triangle; - ctx->Driver.QuadFunc = _swsetup_Quad; - ctx->Driver.RenderTabVerts = _tnl_render_tab_verts; - ctx->Driver.RenderTabElts = _tnl_render_tab_elts; + tnl->Driver.PointsFunc = _swsetup_Points; + tnl->Driver.LineFunc = _swsetup_Line; + tnl->Driver.TriangleFunc = _swsetup_Triangle; + tnl->Driver.QuadFunc = _swsetup_Quad; + tnl->Driver.RenderTabVerts = _tnl_render_tab_verts; + tnl->Driver.RenderTabElts = _tnl_render_tab_elts; fxMesa->render_index = FX_FALLBACK_BIT; return; @@ -604,19 +605,19 @@ fxDDChooseRenderState(GLcontext * ctx) FX_grCullMode(fxMesa->cullMode); } - ctx->Driver.PointsFunc = rast_tab[index].points; - ctx->Driver.LineFunc = rast_tab[index].line; - ctx->Driver.TriangleFunc = rast_tab[index].triangle; - ctx->Driver.QuadFunc = rast_tab[index].quad; + tnl->Driver.PointsFunc = rast_tab[index].points; + tnl->Driver.LineFunc = rast_tab[index].line; + tnl->Driver.TriangleFunc = rast_tab[index].triangle; + tnl->Driver.QuadFunc = rast_tab[index].quad; fxMesa->render_index = index; if (fxMesa->render_index == 0) { - ctx->Driver.RenderTabVerts = fx_render_tab_verts; - ctx->Driver.RenderTabElts = fx_render_tab_elts; + tnl->Driver.RenderTabVerts = fx_render_tab_verts; + tnl->Driver.RenderTabElts = fx_render_tab_elts; } else { - ctx->Driver.RenderTabVerts = _tnl_render_tab_verts; - ctx->Driver.RenderTabElts = _tnl_render_tab_elts; + tnl->Driver.RenderTabVerts = _tnl_render_tab_verts; + tnl->Driver.RenderTabElts = _tnl_render_tab_elts; } } diff --git a/src/mesa/drivers/glide/fxvb.c b/src/mesa/drivers/glide/fxvb.c index 40acbb7e9e4..470ee748bb7 100644 --- a/src/mesa/drivers/glide/fxvb.c +++ b/src/mesa/drivers/glide/fxvb.c @@ -290,10 +290,11 @@ void fx_validate_BuildProjVerts(GLcontext * ctx, GLuint start, GLuint count, GLuint newinputs) { + TNLcontext *tnl = TNL_CONTEXT(ctx); fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; if (!fxMesa->is_in_hardware) - ctx->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices; + tnl->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices; else { GLuint setupindex = SETUP_XYZW; @@ -329,9 +330,9 @@ fx_validate_BuildProjVerts(GLcontext * ctx, GLuint start, GLuint count, fxPrintSetupFlags("fxmesa: vertex setup function", setupindex); fxMesa->setupindex = setupindex; - ctx->Driver.BuildProjectedVertices = fx_BuildProjVerts; + tnl->Driver.BuildProjectedVertices = fx_BuildProjVerts; } - ctx->Driver.BuildProjectedVertices(ctx, start, count, newinputs); + tnl->Driver.BuildProjectedVertices(ctx, start, count, newinputs); } diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index 0473717a0dc..4e0ae4b38bd 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -1,4 +1,4 @@ -/* $Id: osmesa.c,v 1.50 2001/03/08 17:33:33 brianp Exp $ */ +/* $Id: osmesa.c,v 1.51 2001/03/19 02:25:35 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -55,6 +55,7 @@ #include "swrast/s_lines.h" #include "swrast/s_triangle.h" #include "tnl/tnl.h" +#include "tnl/t_context.h" @@ -343,6 +344,11 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx ) { if (ctx) { + _swsetup_DestroyContext( &ctx->gl_ctx ); + _tnl_DestroyContext( &ctx->gl_ctx ); + _ac_DestroyContext( &ctx->gl_ctx ); + _swrast_DestroyContext( &ctx->gl_ctx ); + _mesa_destroy_visual( ctx->gl_visual ); _mesa_destroy_framebuffer( ctx->gl_buffer ); _mesa_free_context_data( &ctx->gl_ctx ); @@ -1757,6 +1763,8 @@ static const GLubyte *get_string( GLcontext *ctx, GLenum name ) static void osmesa_update_state( GLcontext *ctx, GLuint new_state ) { OSMesaContext osmesa = OSMESA_CONTEXT(ctx); + struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx ); + TNLcontext *tnl = TNL_CONTEXT(ctx); ASSERT((void *) osmesa == (void *) ctx->DriverCtx); @@ -1768,24 +1776,9 @@ static void osmesa_update_state( GLcontext *ctx, GLuint new_state ) ctx->Driver.GetString = get_string; ctx->Driver.UpdateState = osmesa_update_state; ctx->Driver.SetDrawBuffer = set_draw_buffer; - ctx->Driver.SetReadBuffer = set_read_buffer; ctx->Driver.ResizeBuffersMESA = _swrast_alloc_buffers; ctx->Driver.GetBufferSize = buffer_size; - ctx->Driver.RenderStart = _swsetup_RenderStart; - ctx->Driver.RenderFinish = _swsetup_RenderFinish; - ctx->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices; - ctx->Driver.RenderPrimitive = _swsetup_RenderPrimitive; - ctx->Driver.PointsFunc = _swsetup_Points; - ctx->Driver.LineFunc = _swsetup_Line; - ctx->Driver.TriangleFunc = _swsetup_Triangle; - ctx->Driver.QuadFunc = _swsetup_Quad; - ctx->Driver.ResetLineStipple = _swrast_ResetLineStipple; - ctx->Driver.RenderInterp = _swsetup_RenderInterp; - ctx->Driver.RenderCopyPV = _swsetup_RenderCopyPV; - ctx->Driver.RenderClippedLine = _swsetup_RenderClippedLine; - ctx->Driver.RenderClippedPolygon = _swsetup_RenderClippedPolygon; - ctx->Driver.Accum = _swrast_Accum; ctx->Driver.Bitmap = _swrast_Bitmap; ctx->Driver.Clear = clear; @@ -1799,61 +1792,83 @@ static void osmesa_update_state( GLcontext *ctx, GLuint new_state ) ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d; ctx->Driver.TexSubImage2D = _mesa_store_texsubimage2d; ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d; - ctx->Driver.CopyTexImage1D = _mesa_copy_teximage1d; - ctx->Driver.CopyTexImage2D = _mesa_copy_teximage2d; - ctx->Driver.CopyTexSubImage1D = _mesa_copy_texsubimage1d; - ctx->Driver.CopyTexSubImage2D = _mesa_copy_texsubimage2d; - ctx->Driver.CopyTexSubImage3D = _mesa_copy_texsubimage3d; ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage; + ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d; + ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d; + ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d; + ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d; + ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d; + ctx->Driver.CopyColorTable = _swrast_CopyColorTable; + ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable; + ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; + ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; + /* RGB(A) span/pixel functions */ if (osmesa->format == OSMESA_RGB) { - ctx->Driver.WriteRGBASpan = write_rgba_span_RGB; - ctx->Driver.WriteRGBSpan = write_rgb_span_RGB; - ctx->Driver.WriteMonoRGBASpan = write_monocolor_span_RGB; - ctx->Driver.WriteRGBAPixels = write_rgba_pixels_RGB; - ctx->Driver.WriteMonoRGBAPixels = write_monocolor_pixels_RGB; - ctx->Driver.ReadRGBASpan = read_rgba_span3; - ctx->Driver.ReadRGBAPixels = read_rgba_pixels3; + swdd->WriteRGBASpan = write_rgba_span_RGB; + swdd->WriteRGBSpan = write_rgb_span_RGB; + swdd->WriteMonoRGBASpan = write_monocolor_span_RGB; + swdd->WriteRGBAPixels = write_rgba_pixels_RGB; + swdd->WriteMonoRGBAPixels = write_monocolor_pixels_RGB; + swdd->ReadRGBASpan = read_rgba_span3; + swdd->ReadRGBAPixels = read_rgba_pixels3; } else if (osmesa->format == OSMESA_BGR) { - ctx->Driver.WriteRGBASpan = write_rgba_span_BGR; - ctx->Driver.WriteRGBSpan = write_rgb_span_BGR; - ctx->Driver.WriteMonoRGBASpan = write_monocolor_span_BGR; - ctx->Driver.WriteRGBAPixels = write_rgba_pixels_BGR; - ctx->Driver.WriteMonoRGBAPixels = write_monocolor_pixels_BGR; - ctx->Driver.ReadRGBASpan = read_rgba_span3; - ctx->Driver.ReadRGBAPixels = read_rgba_pixels3; + swdd->WriteRGBASpan = write_rgba_span_BGR; + swdd->WriteRGBSpan = write_rgb_span_BGR; + swdd->WriteMonoRGBASpan = write_monocolor_span_BGR; + swdd->WriteRGBAPixels = write_rgba_pixels_BGR; + swdd->WriteMonoRGBAPixels = write_monocolor_pixels_BGR; + swdd->ReadRGBASpan = read_rgba_span3; + swdd->ReadRGBAPixels = read_rgba_pixels3; } else { /* 4 bytes / pixel in frame buffer */ - ctx->Driver.WriteRGBSpan = write_rgb_span; - ctx->Driver.WriteRGBAPixels = write_rgba_pixels; - ctx->Driver.WriteMonoRGBASpan = write_monocolor_span; - ctx->Driver.WriteMonoRGBAPixels = write_monocolor_pixels; + swdd->WriteRGBSpan = write_rgb_span; + swdd->WriteRGBAPixels = write_rgba_pixels; + swdd->WriteMonoRGBASpan = write_monocolor_span; + swdd->WriteMonoRGBAPixels = write_monocolor_pixels; if (osmesa->format == OSMESA_RGBA && CHAN_TYPE == GL_UNSIGNED_BYTE && RCOMP==0 && GCOMP==1 && BCOMP==2 && ACOMP==3) { /* special, fast case */ - ctx->Driver.WriteRGBASpan = write_rgba_span_rgba; - ctx->Driver.ReadRGBASpan = read_rgba_span_rgba; + swdd->WriteRGBASpan = write_rgba_span_rgba; + swdd->ReadRGBASpan = read_rgba_span_rgba; } else { - ctx->Driver.WriteRGBASpan = write_rgba_span; - ctx->Driver.ReadRGBASpan = read_rgba_span; + swdd->WriteRGBASpan = write_rgba_span; + swdd->ReadRGBASpan = read_rgba_span; } - ctx->Driver.ReadRGBAPixels = read_rgba_pixels; + swdd->ReadRGBAPixels = read_rgba_pixels; } /* CI span/pixel functions */ - ctx->Driver.WriteCI32Span = write_index32_span; - ctx->Driver.WriteCI8Span = write_index8_span; - ctx->Driver.WriteMonoCISpan = write_monoindex_span; - ctx->Driver.WriteCI32Pixels = write_index_pixels; - ctx->Driver.WriteMonoCIPixels = write_monoindex_pixels; - ctx->Driver.ReadCI32Span = read_index_span; - ctx->Driver.ReadCI32Pixels = read_index_pixels; + swdd->WriteCI32Span = write_index32_span; + swdd->WriteCI8Span = write_index8_span; + swdd->WriteMonoCISpan = write_monoindex_span; + swdd->WriteCI32Pixels = write_index_pixels; + swdd->WriteMonoCIPixels = write_monoindex_pixels; + swdd->ReadCI32Span = read_index_span; + swdd->ReadCI32Pixels = read_index_pixels; + + swdd->SetReadBuffer = set_read_buffer; + + tnl->Driver.RenderStart = _swsetup_RenderStart; + tnl->Driver.RenderFinish = _swsetup_RenderFinish; + tnl->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices; + tnl->Driver.RenderPrimitive = _swsetup_RenderPrimitive; + tnl->Driver.PointsFunc = _swsetup_Points; + tnl->Driver.LineFunc = _swsetup_Line; + tnl->Driver.TriangleFunc = _swsetup_Triangle; + tnl->Driver.QuadFunc = _swsetup_Quad; + tnl->Driver.ResetLineStipple = _swrast_ResetLineStipple; + tnl->Driver.RenderInterp = _swsetup_RenderInterp; + tnl->Driver.RenderCopyPV = _swsetup_RenderCopyPV; + tnl->Driver.RenderClippedLine = _swsetup_RenderClippedLine; + tnl->Driver.RenderClippedPolygon = _swsetup_RenderClippedPolygon; + _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); diff --git a/src/mesa/drivers/svga/svgamesa.c b/src/mesa/drivers/svga/svgamesa.c index 4ce7343c523..a808241998e 100644 --- a/src/mesa/drivers/svga/svgamesa.c +++ b/src/mesa/drivers/svga/svgamesa.c @@ -1,4 +1,4 @@ -/* $Id: svgamesa.c,v 1.14 2001/03/03 20:33:29 brianp Exp $ */ +/* $Id: svgamesa.c,v 1.15 2001/03/19 02:25:36 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -277,6 +277,8 @@ static void set_read_buffer( GLcontext *ctx, GLframebuffer *colorBuffer, static void svgamesa_update_state( GLcontext *ctx, GLuint new_state ) { + struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx ); + /* Initialize all the pointers in the DD struct. Do this whenever */ /* a new context is made current or we change buffers via set_buffer! */ @@ -284,7 +286,6 @@ static void svgamesa_update_state( GLcontext *ctx, GLuint new_state ) ctx->Driver.GetBufferSize = get_buffer_size; ctx->Driver.SetDrawBuffer = set_draw_buffer; - ctx->Driver.SetReadBuffer = set_read_buffer; /* Software rasterizer pixel paths: */ @@ -294,21 +295,21 @@ static void svgamesa_update_state( GLcontext *ctx, GLuint new_state ) ctx->Driver.DrawPixels = _swrast_DrawPixels; ctx->Driver.ReadPixels = _swrast_ReadPixels; - ctx->Driver.PointsFunc = NULL; - ctx->Driver.LineFunc = NULL; - ctx->Driver.TriangleFunc = NULL; + /* Fill in the swrast driver interface: + */ + swdd->SetReadBuffer = set_read_buffer; switch (SVGABuffer.Depth) { case 8: ctx->Driver.ClearIndex = __clear_index8; ctx->Driver.Clear = __clear8; - ctx->Driver.ReadCI32Span = __read_ci32_span8; - ctx->Driver.ReadCI32Pixels = __read_ci32_pixels8; - ctx->Driver.WriteCI8Span = __write_ci8_span8; - ctx->Driver.WriteCI32Span = __write_ci32_span8; - ctx->Driver.WriteCI32Pixels = __write_ci32_pixels8; - ctx->Driver.WriteMonoCISpan = __write_mono_ci_span8; - ctx->Driver.WriteMonoCIPixels = __write_mono_ci_pixels8; + swdd->ReadCI32Span = __read_ci32_span8; + swdd->ReadCI32Pixels = __read_ci32_pixels8; + swdd->WriteCI8Span = __write_ci8_span8; + swdd->WriteCI32Span = __write_ci32_span8; + swdd->WriteCI32Pixels = __write_ci32_pixels8; + swdd->WriteMonoCISpan = __write_mono_ci_span8; + swdd->WriteMonoCIPixels = __write_mono_ci_pixels8; #ifdef SVGA_DEBUG SVGAlog("SVGAUpdateState: 8 bit mode."); #endif @@ -317,12 +318,12 @@ static void svgamesa_update_state( GLcontext *ctx, GLuint new_state ) case 15: ctx->Driver.ClearColor = __clear_color15; ctx->Driver.Clear = __clear15; - ctx->Driver.ReadRGBASpan = __read_rgba_span15; - ctx->Driver.ReadRGBAPixels = __read_rgba_pixels15; - ctx->Driver.WriteRGBASpan = __write_rgba_span15; - ctx->Driver.WriteRGBAPixels = __write_rgba_pixels15; - ctx->Driver.WriteMonoRGBASpan = __write_mono_rgba_span15; - ctx->Driver.WriteMonoRGBAPixels = __write_mono_rgba_pixels15; + swdd->ReadRGBASpan = __read_rgba_span15; + swdd->ReadRGBAPixels = __read_rgba_pixels15; + swdd->WriteRGBASpan = __write_rgba_span15; + swdd->WriteRGBAPixels = __write_rgba_pixels15; + swdd->WriteMonoRGBASpan = __write_mono_rgba_span15; + swdd->WriteMonoRGBAPixels = __write_mono_rgba_pixels15; #ifdef SVGA_DEBUG SVGAlog("SVGAUpdateState: 15 bit mode."); #endif @@ -330,12 +331,12 @@ static void svgamesa_update_state( GLcontext *ctx, GLuint new_state ) case 16: ctx->Driver.ClearColor = __clear_color16; ctx->Driver.Clear = __clear16; - ctx->Driver.ReadRGBASpan = __read_rgba_span16; - ctx->Driver.ReadRGBAPixels = __read_rgba_pixels16; - ctx->Driver.WriteRGBASpan = __write_rgba_span16; - ctx->Driver.WriteRGBAPixels = __write_rgba_pixels16; - ctx->Driver.WriteMonoRGBASpan = __write_mono_rgba_span16; - ctx->Driver.WriteMonoRGBAPixels = __write_mono_rgba_pixels16; + swdd->ReadRGBASpan = __read_rgba_span16; + swdd->ReadRGBAPixels = __read_rgba_pixels16; + swdd->WriteRGBASpan = __write_rgba_span16; + swdd->WriteRGBAPixels = __write_rgba_pixels16; + swdd->WriteMonoRGBASpan = __write_mono_rgba_span16; + swdd->WriteMonoRGBAPixels = __write_mono_rgba_pixels16; break; #ifdef SVGA_DEBUG SVGAlog("SVGAUpdateState: 16 bit mode."); @@ -343,12 +344,12 @@ static void svgamesa_update_state( GLcontext *ctx, GLuint new_state ) case 24: ctx->Driver.ClearColor = __clear_color24; ctx->Driver.Clear = __clear24; - ctx->Driver.ReadRGBASpan = __read_rgba_span24; - ctx->Driver.ReadRGBAPixels = __read_rgba_pixels24; - ctx->Driver.WriteRGBASpan = __write_rgba_span24; - ctx->Driver.WriteRGBAPixels = __write_rgba_pixels24; - ctx->Driver.WriteMonoRGBASpan = __write_mono_rgba_span24; - ctx->Driver.WriteMonoRGBAPixels = __write_mono_rgba_pixels24; + swdd->ReadRGBASpan = __read_rgba_span24; + swdd->ReadRGBAPixels = __read_rgba_pixels24; + swdd->WriteRGBASpan = __write_rgba_span24; + swdd->WriteRGBAPixels = __write_rgba_pixels24; + swdd->WriteMonoRGBASpan = __write_mono_rgba_span24; + swdd->WriteMonoRGBAPixels = __write_mono_rgba_pixels24; break; #ifdef SVGA_DEBUG SVGAlog("SVGAUpdateState: 32 bit mode."); @@ -356,12 +357,12 @@ static void svgamesa_update_state( GLcontext *ctx, GLuint new_state ) case 32: ctx->Driver.ClearColor = __clear_color32; ctx->Driver.Clear = __clear32; - ctx->Driver.ReadRGBASpan = __read_rgba_span32; - ctx->Driver.ReadRGBAPixels = __read_rgba_pixels32; - ctx->Driver.WriteRGBASpan = __write_rgba_span32; - ctx->Driver.WriteRGBAPixels = __write_rgba_pixels32; - ctx->Driver.WriteMonoRGBASpan = __write_mono_rgba_span32; - ctx->Driver.WriteMonoRGBAPixels = __write_mono_rgba_pixels32; + swdd->ReadRGBASpan = __read_rgba_span32; + swdd->ReadRGBAPixels = __read_rgba_pixels32; + swdd->WriteRGBASpan = __write_rgba_span32; + swdd->WriteRGBAPixels = __write_rgba_pixels32; + swdd->WriteMonoRGBASpan = __write_mono_rgba_span32; + swdd->WriteMonoRGBAPixels = __write_mono_rgba_pixels32; } } diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index abbec2d7dd1..96dfc4bfe47 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -1,4 +1,4 @@ -/* $Id: xm_api.c,v 1.18 2001/03/08 15:23:46 brianp Exp $ */ +/* $Id: xm_api.c,v 1.19 2001/03/19 02:25:36 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -1659,10 +1659,6 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) c->driContextPriv = driContextPriv; #endif - /* Set up some constant pointers: - */ - xmesa_init_pointers( ctx ); - /* Initialize the software rasterizer and helper modules. */ _swrast_CreateContext( ctx ); @@ -1672,6 +1668,11 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) xmesa_register_swrast_functions( ctx ); + /* Set up some constant pointers: + */ + xmesa_init_pointers( ctx ); + + /* Run the config file */ _mesa_context_initialize( ctx ); @@ -1692,6 +1693,8 @@ void XMesaDestroyContext( XMesaContext c ) if (c->gl_ctx) { _swsetup_DestroyContext( c->gl_ctx ); _swrast_DestroyContext( c->gl_ctx ); + _tnl_DestroyContext( c->gl_ctx ); + _ac_DestroyContext( c->gl_ctx ); _mesa_destroy_context( c->gl_ctx ); } diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index a73b3c69735..2bb04ae5044 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -1,4 +1,4 @@ -/* $Id: xm_dd.c,v 1.18 2001/03/03 20:33:30 brianp Exp $ */ +/* $Id: xm_dd.c,v 1.19 2001/03/19 02:25:36 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -41,6 +41,7 @@ #include "swrast/s_alphabuf.h" #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" +#include "tnl/t_context.h" /* @@ -181,8 +182,8 @@ set_draw_buffer( GLcontext *ctx, GLenum mode ) } -static void -set_read_buffer( GLcontext *ctx, GLframebuffer *buffer, GLenum mode ) +void +xmesa_set_read_buffer( GLcontext *ctx, GLframebuffer *buffer, GLenum mode ) { XMesaBuffer target; const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; @@ -933,27 +934,13 @@ void xmesa_update_state( GLcontext *ctx, GLuint new_state ) */ void xmesa_init_pointers( GLcontext *ctx ) { + TNLcontext *tnl; + ctx->Driver.GetString = get_string; ctx->Driver.GetBufferSize = get_buffer_size; ctx->Driver.Flush = flush; ctx->Driver.Finish = finish; - - /* Hooks for t_vb_render.c: - */ - ctx->Driver.RenderStart = _swsetup_RenderStart; - ctx->Driver.RenderFinish = _swsetup_RenderFinish; - ctx->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices; - ctx->Driver.RenderPrimitive = _swsetup_RenderPrimitive; - ctx->Driver.PointsFunc = _swsetup_Points; - ctx->Driver.LineFunc = _swsetup_Line; - ctx->Driver.TriangleFunc = _swsetup_Triangle; - ctx->Driver.QuadFunc = _swsetup_Quad; - ctx->Driver.ResetLineStipple = _swrast_ResetLineStipple; - ctx->Driver.RenderInterp = _swsetup_RenderInterp; - ctx->Driver.RenderCopyPV = _swsetup_RenderCopyPV; - ctx->Driver.RenderClippedLine = _swsetup_RenderClippedLine; - ctx->Driver.RenderClippedPolygon = _swsetup_RenderClippedPolygon; - + /* Software rasterizer pixel paths: */ ctx->Driver.Accum = _swrast_Accum; @@ -972,22 +959,49 @@ void xmesa_init_pointers( GLcontext *ctx ) ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d; ctx->Driver.TexSubImage2D = _mesa_store_texsubimage2d; ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d; - ctx->Driver.CopyTexImage1D = _mesa_copy_teximage1d; - ctx->Driver.CopyTexImage2D = _mesa_copy_teximage2d; - ctx->Driver.CopyTexSubImage1D = _mesa_copy_texsubimage1d; - ctx->Driver.CopyTexSubImage2D = _mesa_copy_texsubimage2d; - ctx->Driver.CopyTexSubImage3D = _mesa_copy_texsubimage3d; ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage; - /* + ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d; + ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d; + ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d; + ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d; + ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d; + + + /* Swrast hooks for imaging extensions: + */ + ctx->Driver.CopyColorTable = _swrast_CopyColorTable; + ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable; + ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; + ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; + + + /* Statechange callbacks: */ ctx->Driver.SetDrawBuffer = set_draw_buffer; - ctx->Driver.SetReadBuffer = set_read_buffer; ctx->Driver.ClearIndex = clear_index; ctx->Driver.ClearColor = clear_color; ctx->Driver.IndexMask = index_mask; ctx->Driver.ColorMask = color_mask; ctx->Driver.Enable = enable; + + /* Initialize the TNL driver interface: + */ + tnl = TNL_CONTEXT(ctx); + tnl->Driver.RenderStart = _swsetup_RenderStart; + tnl->Driver.RenderFinish = _swsetup_RenderFinish; + tnl->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices; + tnl->Driver.RenderPrimitive = _swsetup_RenderPrimitive; + tnl->Driver.PointsFunc = _swsetup_Points; + tnl->Driver.LineFunc = _swsetup_Line; + tnl->Driver.TriangleFunc = _swsetup_Triangle; + tnl->Driver.QuadFunc = _swsetup_Quad; + tnl->Driver.ResetLineStipple = _swrast_ResetLineStipple; + tnl->Driver.RenderInterp = _swsetup_RenderInterp; + tnl->Driver.RenderCopyPV = _swsetup_RenderCopyPV; + tnl->Driver.RenderClippedLine = _swsetup_RenderClippedLine; + tnl->Driver.RenderClippedPolygon = _swsetup_RenderClippedPolygon; + (void) DitherValues; /* silenced unused var warning */ } diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c index e87fd98a8a5..0991a44f7e9 100644 --- a/src/mesa/drivers/x11/xm_span.c +++ b/src/mesa/drivers/x11/xm_span.c @@ -1,4 +1,4 @@ -/* $Id: xm_span.c,v 1.10 2001/03/03 20:33:30 brianp Exp $ */ +/* $Id: xm_span.c,v 1.11 2001/03/19 02:25:36 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -36,7 +36,7 @@ #include "xmesaP.h" #include "extensions.h" - +#include "swrast/swrast.h" /* @@ -4236,6 +4236,7 @@ void xmesa_update_span_funcs( GLcontext *ctx ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; int depth=GET_VISUAL_DEPTH(xmesa->xm_visual); + struct swrast_device_driver *dd = _swrast_GetDeviceDriverReference( ctx ); /* * These drawing functions depend on color buffer config: @@ -4244,98 +4245,98 @@ void xmesa_update_span_funcs( GLcontext *ctx ) /* Writing to window or back pixmap */ switch (xmesa->pixelformat) { case PF_INDEX: - ctx->Driver.WriteCI32Span = write_span_index_pixmap; - ctx->Driver.WriteCI8Span = write_span_index8_pixmap; - ctx->Driver.WriteMonoCISpan = write_span_mono_index_pixmap; - ctx->Driver.WriteCI32Pixels = write_pixels_index_pixmap; - ctx->Driver.WriteMonoCIPixels = write_pixels_mono_index_pixmap; + dd->WriteCI32Span = write_span_index_pixmap; + dd->WriteCI8Span = write_span_index8_pixmap; + dd->WriteMonoCISpan = write_span_mono_index_pixmap; + dd->WriteCI32Pixels = write_pixels_index_pixmap; + dd->WriteMonoCIPixels = write_pixels_mono_index_pixmap; break; case PF_TRUECOLOR: - ctx->Driver.WriteRGBASpan = write_span_TRUECOLOR_pixmap; - ctx->Driver.WriteRGBSpan = write_span_rgb_TRUECOLOR_pixmap; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_pixmap; - ctx->Driver.WriteRGBAPixels = write_pixels_TRUECOLOR_pixmap; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_pixmap; + dd->WriteRGBASpan = write_span_TRUECOLOR_pixmap; + dd->WriteRGBSpan = write_span_rgb_TRUECOLOR_pixmap; + dd->WriteMonoRGBASpan = write_span_mono_pixmap; + dd->WriteRGBAPixels = write_pixels_TRUECOLOR_pixmap; + dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; break; case PF_TRUEDITHER: - ctx->Driver.WriteRGBASpan = write_span_TRUEDITHER_pixmap; - ctx->Driver.WriteRGBSpan = write_span_rgb_TRUEDITHER_pixmap; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_TRUEDITHER_pixmap; - ctx->Driver.WriteRGBAPixels = write_pixels_TRUEDITHER_pixmap; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_pixmap; + dd->WriteRGBASpan = write_span_TRUEDITHER_pixmap; + dd->WriteRGBSpan = write_span_rgb_TRUEDITHER_pixmap; + dd->WriteMonoRGBASpan = write_span_mono_TRUEDITHER_pixmap; + dd->WriteRGBAPixels = write_pixels_TRUEDITHER_pixmap; + dd->WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_pixmap; break; case PF_8A8B8G8R: - ctx->Driver.WriteRGBASpan = write_span_8A8B8G8R_pixmap; - ctx->Driver.WriteRGBSpan = write_span_rgb_8A8B8G8R_pixmap; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_pixmap; - ctx->Driver.WriteRGBAPixels = write_pixels_8A8B8G8R_pixmap; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_pixmap; + dd->WriteRGBASpan = write_span_8A8B8G8R_pixmap; + dd->WriteRGBSpan = write_span_rgb_8A8B8G8R_pixmap; + dd->WriteMonoRGBASpan = write_span_mono_pixmap; + dd->WriteRGBAPixels = write_pixels_8A8B8G8R_pixmap; + dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; break; case PF_8R8G8B: - ctx->Driver.WriteRGBASpan = write_span_8R8G8B_pixmap; - ctx->Driver.WriteRGBSpan = write_span_rgb_8R8G8B_pixmap; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_pixmap; - ctx->Driver.WriteRGBAPixels = write_pixels_8R8G8B_pixmap; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_pixmap; + dd->WriteRGBASpan = write_span_8R8G8B_pixmap; + dd->WriteRGBSpan = write_span_rgb_8R8G8B_pixmap; + dd->WriteMonoRGBASpan = write_span_mono_pixmap; + dd->WriteRGBAPixels = write_pixels_8R8G8B_pixmap; + dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; break; case PF_8R8G8B24: - ctx->Driver.WriteRGBASpan = write_span_8R8G8B24_pixmap; - ctx->Driver.WriteRGBSpan = write_span_rgb_8R8G8B24_pixmap; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_pixmap; - ctx->Driver.WriteRGBAPixels = write_pixels_8R8G8B24_pixmap; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_pixmap; + dd->WriteRGBASpan = write_span_8R8G8B24_pixmap; + dd->WriteRGBSpan = write_span_rgb_8R8G8B24_pixmap; + dd->WriteMonoRGBASpan = write_span_mono_pixmap; + dd->WriteRGBAPixels = write_pixels_8R8G8B24_pixmap; + dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; break; case PF_5R6G5B: - ctx->Driver.WriteRGBASpan = write_span_5R6G5B_pixmap; - ctx->Driver.WriteRGBSpan = write_span_rgb_5R6G5B_pixmap; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_pixmap; - ctx->Driver.WriteRGBAPixels = write_pixels_5R6G5B_pixmap; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_pixmap; + dd->WriteRGBASpan = write_span_5R6G5B_pixmap; + dd->WriteRGBSpan = write_span_rgb_5R6G5B_pixmap; + dd->WriteMonoRGBASpan = write_span_mono_pixmap; + dd->WriteRGBAPixels = write_pixels_5R6G5B_pixmap; + dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; break; case PF_DITHER_5R6G5B: - ctx->Driver.WriteRGBASpan = write_span_DITHER_5R6G5B_pixmap; - ctx->Driver.WriteRGBSpan = write_span_rgb_DITHER_5R6G5B_pixmap; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_TRUEDITHER_pixmap; - ctx->Driver.WriteRGBAPixels = write_pixels_DITHER_5R6G5B_pixmap; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_pixmap; + dd->WriteRGBASpan = write_span_DITHER_5R6G5B_pixmap; + dd->WriteRGBSpan = write_span_rgb_DITHER_5R6G5B_pixmap; + dd->WriteMonoRGBASpan = write_span_mono_TRUEDITHER_pixmap; + dd->WriteRGBAPixels = write_pixels_DITHER_5R6G5B_pixmap; + dd->WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_pixmap; break; case PF_DITHER: - ctx->Driver.WriteRGBASpan = write_span_DITHER_pixmap; - ctx->Driver.WriteRGBSpan = write_span_rgb_DITHER_pixmap; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_DITHER_pixmap; - ctx->Driver.WriteRGBAPixels = write_pixels_DITHER_pixmap; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_DITHER_pixmap; + dd->WriteRGBASpan = write_span_DITHER_pixmap; + dd->WriteRGBSpan = write_span_rgb_DITHER_pixmap; + dd->WriteMonoRGBASpan = write_span_mono_DITHER_pixmap; + dd->WriteRGBAPixels = write_pixels_DITHER_pixmap; + dd->WriteMonoRGBAPixels = write_pixels_mono_DITHER_pixmap; break; case PF_1BIT: - ctx->Driver.WriteRGBASpan = write_span_1BIT_pixmap; - ctx->Driver.WriteRGBSpan = write_span_rgb_1BIT_pixmap; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_1BIT_pixmap; - ctx->Driver.WriteRGBAPixels = write_pixels_1BIT_pixmap; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_1BIT_pixmap; + dd->WriteRGBASpan = write_span_1BIT_pixmap; + dd->WriteRGBSpan = write_span_rgb_1BIT_pixmap; + dd->WriteMonoRGBASpan = write_span_mono_1BIT_pixmap; + dd->WriteRGBAPixels = write_pixels_1BIT_pixmap; + dd->WriteMonoRGBAPixels = write_pixels_mono_1BIT_pixmap; break; case PF_HPCR: - ctx->Driver.WriteRGBASpan = write_span_HPCR_pixmap; - ctx->Driver.WriteRGBSpan = write_span_rgb_HPCR_pixmap; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_pixmap; - ctx->Driver.WriteRGBAPixels = write_pixels_HPCR_pixmap; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_pixmap; + dd->WriteRGBASpan = write_span_HPCR_pixmap; + dd->WriteRGBSpan = write_span_rgb_HPCR_pixmap; + dd->WriteMonoRGBASpan = write_span_mono_pixmap; + dd->WriteRGBAPixels = write_pixels_HPCR_pixmap; + dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; if (xmesa->xm_visual->hpcr_clear_flag) { - ctx->Driver.ClearColor = clear_color_HPCR_pixmap; + ctx->Driver.ClearColor = clear_color_HPCR_pixmap; } break; case PF_LOOKUP: - ctx->Driver.WriteRGBASpan = write_span_LOOKUP_pixmap; - ctx->Driver.WriteRGBSpan = write_span_rgb_LOOKUP_pixmap; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_pixmap; - ctx->Driver.WriteRGBAPixels = write_pixels_LOOKUP_pixmap; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_pixmap; + dd->WriteRGBASpan = write_span_LOOKUP_pixmap; + dd->WriteRGBSpan = write_span_rgb_LOOKUP_pixmap; + dd->WriteMonoRGBASpan = write_span_mono_pixmap; + dd->WriteRGBAPixels = write_pixels_LOOKUP_pixmap; + dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; break; case PF_GRAYSCALE: - ctx->Driver.WriteRGBASpan = write_span_GRAYSCALE_pixmap; - ctx->Driver.WriteRGBSpan = write_span_rgb_GRAYSCALE_pixmap; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_pixmap; - ctx->Driver.WriteRGBAPixels = write_pixels_GRAYSCALE_pixmap; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_pixmap; + dd->WriteRGBASpan = write_span_GRAYSCALE_pixmap; + dd->WriteRGBSpan = write_span_rgb_GRAYSCALE_pixmap; + dd->WriteMonoRGBASpan = write_span_mono_pixmap; + dd->WriteRGBAPixels = write_pixels_GRAYSCALE_pixmap; + dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; break; default: _mesa_problem(NULL,"Bad pixel format in xmesa_update_state (1)"); @@ -4346,128 +4347,128 @@ void xmesa_update_span_funcs( GLcontext *ctx ) /* Writing to back XImage */ switch (xmesa->pixelformat) { case PF_INDEX: - ctx->Driver.WriteCI32Span = write_span_index_ximage; + dd->WriteCI32Span = write_span_index_ximage; if (depth==8) - ctx->Driver.WriteCI8Span = write_span_index8_ximage8; + dd->WriteCI8Span = write_span_index8_ximage8; else - ctx->Driver.WriteCI8Span = write_span_index8_ximage; - ctx->Driver.WriteMonoCISpan = write_span_mono_index_ximage; - ctx->Driver.WriteCI32Pixels = write_pixels_index_ximage; - ctx->Driver.WriteMonoCIPixels = write_pixels_mono_index_ximage; + dd->WriteCI8Span = write_span_index8_ximage; + dd->WriteMonoCISpan = write_span_mono_index_ximage; + dd->WriteCI32Pixels = write_pixels_index_ximage; + dd->WriteMonoCIPixels = write_pixels_mono_index_ximage; break; case PF_TRUECOLOR: /* Generic RGB */ - ctx->Driver.WriteRGBASpan = write_span_TRUECOLOR_ximage; - ctx->Driver.WriteRGBSpan = write_span_rgb_TRUECOLOR_ximage; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_ximage; - ctx->Driver.WriteRGBAPixels = write_pixels_TRUECOLOR_ximage; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_ximage; + dd->WriteRGBASpan = write_span_TRUECOLOR_ximage; + dd->WriteRGBSpan = write_span_rgb_TRUECOLOR_ximage; + dd->WriteMonoRGBASpan = write_span_mono_ximage; + dd->WriteRGBAPixels = write_pixels_TRUECOLOR_ximage; + dd->WriteMonoRGBAPixels = write_pixels_mono_ximage; break; case PF_TRUEDITHER: - ctx->Driver.WriteRGBASpan = write_span_TRUEDITHER_ximage; - ctx->Driver.WriteRGBSpan = write_span_rgb_TRUEDITHER_ximage; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_TRUEDITHER_ximage; - ctx->Driver.WriteRGBAPixels = write_pixels_TRUEDITHER_ximage; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_ximage; + dd->WriteRGBASpan = write_span_TRUEDITHER_ximage; + dd->WriteRGBSpan = write_span_rgb_TRUEDITHER_ximage; + dd->WriteMonoRGBASpan = write_span_mono_TRUEDITHER_ximage; + dd->WriteRGBAPixels = write_pixels_TRUEDITHER_ximage; + dd->WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_ximage; break; case PF_8A8B8G8R: - ctx->Driver.WriteRGBASpan = write_span_8A8B8G8R_ximage; - ctx->Driver.WriteRGBSpan = write_span_rgb_8A8B8G8R_ximage; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_8A8B8G8R_ximage; - ctx->Driver.WriteRGBAPixels = write_pixels_8A8B8G8R_ximage; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_8A8B8G8R_ximage; + dd->WriteRGBASpan = write_span_8A8B8G8R_ximage; + dd->WriteRGBSpan = write_span_rgb_8A8B8G8R_ximage; + dd->WriteMonoRGBASpan = write_span_mono_8A8B8G8R_ximage; + dd->WriteRGBAPixels = write_pixels_8A8B8G8R_ximage; + dd->WriteMonoRGBAPixels = write_pixels_mono_8A8B8G8R_ximage; break; case PF_8R8G8B: - ctx->Driver.WriteRGBASpan = write_span_8R8G8B_ximage; - ctx->Driver.WriteRGBSpan = write_span_rgb_8R8G8B_ximage; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_8R8G8B_ximage; - ctx->Driver.WriteRGBAPixels = write_pixels_8R8G8B_ximage; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_8R8G8B_ximage; + dd->WriteRGBASpan = write_span_8R8G8B_ximage; + dd->WriteRGBSpan = write_span_rgb_8R8G8B_ximage; + dd->WriteMonoRGBASpan = write_span_mono_8R8G8B_ximage; + dd->WriteRGBAPixels = write_pixels_8R8G8B_ximage; + dd->WriteMonoRGBAPixels = write_pixels_mono_8R8G8B_ximage; break; case PF_8R8G8B24: - ctx->Driver.WriteRGBASpan = write_span_8R8G8B24_ximage; - ctx->Driver.WriteRGBSpan = write_span_rgb_8R8G8B24_ximage; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_8R8G8B24_ximage; - ctx->Driver.WriteRGBAPixels = write_pixels_8R8G8B24_ximage; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_8R8G8B24_ximage; + dd->WriteRGBASpan = write_span_8R8G8B24_ximage; + dd->WriteRGBSpan = write_span_rgb_8R8G8B24_ximage; + dd->WriteMonoRGBASpan = write_span_mono_8R8G8B24_ximage; + dd->WriteRGBAPixels = write_pixels_8R8G8B24_ximage; + dd->WriteMonoRGBAPixels = write_pixels_mono_8R8G8B24_ximage; break; case PF_5R6G5B: - ctx->Driver.WriteRGBASpan = write_span_5R6G5B_ximage; - ctx->Driver.WriteRGBSpan = write_span_rgb_5R6G5B_ximage; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_ximage; - ctx->Driver.WriteRGBAPixels = write_pixels_5R6G5B_ximage; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_ximage; + dd->WriteRGBASpan = write_span_5R6G5B_ximage; + dd->WriteRGBSpan = write_span_rgb_5R6G5B_ximage; + dd->WriteMonoRGBASpan = write_span_mono_ximage; + dd->WriteRGBAPixels = write_pixels_5R6G5B_ximage; + dd->WriteMonoRGBAPixels = write_pixels_mono_ximage; break; case PF_DITHER_5R6G5B: - ctx->Driver.WriteRGBASpan = write_span_DITHER_5R6G5B_ximage; - ctx->Driver.WriteRGBSpan = write_span_rgb_DITHER_5R6G5B_ximage; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_DITHER_5R6G5B_ximage; - ctx->Driver.WriteRGBAPixels = write_pixels_DITHER_5R6G5B_ximage; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_DITHER_5R6G5B_ximage; + dd->WriteRGBASpan = write_span_DITHER_5R6G5B_ximage; + dd->WriteRGBSpan = write_span_rgb_DITHER_5R6G5B_ximage; + dd->WriteMonoRGBASpan = write_span_mono_DITHER_5R6G5B_ximage; + dd->WriteRGBAPixels = write_pixels_DITHER_5R6G5B_ximage; + dd->WriteMonoRGBAPixels = write_pixels_mono_DITHER_5R6G5B_ximage; break; case PF_DITHER: if (depth==8) { - ctx->Driver.WriteRGBASpan = write_span_DITHER8_ximage; - ctx->Driver.WriteRGBSpan = write_span_rgb_DITHER8_ximage; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_DITHER8_ximage; - ctx->Driver.WriteRGBAPixels = write_pixels_DITHER8_ximage; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_DITHER8_ximage; + dd->WriteRGBASpan = write_span_DITHER8_ximage; + dd->WriteRGBSpan = write_span_rgb_DITHER8_ximage; + dd->WriteMonoRGBASpan = write_span_mono_DITHER8_ximage; + dd->WriteRGBAPixels = write_pixels_DITHER8_ximage; + dd->WriteMonoRGBAPixels = write_pixels_mono_DITHER8_ximage; } else { - ctx->Driver.WriteRGBASpan = write_span_DITHER_ximage; - ctx->Driver.WriteRGBSpan = write_span_rgb_DITHER_ximage; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_DITHER_ximage; - ctx->Driver.WriteRGBAPixels = write_pixels_DITHER_ximage; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_DITHER_ximage; + dd->WriteRGBASpan = write_span_DITHER_ximage; + dd->WriteRGBSpan = write_span_rgb_DITHER_ximage; + dd->WriteMonoRGBASpan = write_span_mono_DITHER_ximage; + dd->WriteRGBAPixels = write_pixels_DITHER_ximage; + dd->WriteMonoRGBAPixels = write_pixels_mono_DITHER_ximage; } break; case PF_1BIT: - ctx->Driver.WriteRGBASpan = write_span_1BIT_ximage; - ctx->Driver.WriteRGBSpan = write_span_rgb_1BIT_ximage; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_1BIT_ximage; - ctx->Driver.WriteRGBAPixels = write_pixels_1BIT_ximage; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_1BIT_ximage; + dd->WriteRGBASpan = write_span_1BIT_ximage; + dd->WriteRGBSpan = write_span_rgb_1BIT_ximage; + dd->WriteMonoRGBASpan = write_span_mono_1BIT_ximage; + dd->WriteRGBAPixels = write_pixels_1BIT_ximage; + dd->WriteMonoRGBAPixels = write_pixels_mono_1BIT_ximage; break; case PF_HPCR: - ctx->Driver.WriteRGBASpan = write_span_HPCR_ximage; - ctx->Driver.WriteRGBSpan = write_span_rgb_HPCR_ximage; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_HPCR_ximage; - ctx->Driver.WriteRGBAPixels = write_pixels_HPCR_ximage; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_HPCR_ximage; + dd->WriteRGBASpan = write_span_HPCR_ximage; + dd->WriteRGBSpan = write_span_rgb_HPCR_ximage; + dd->WriteMonoRGBASpan = write_span_mono_HPCR_ximage; + dd->WriteRGBAPixels = write_pixels_HPCR_ximage; + dd->WriteMonoRGBAPixels = write_pixels_mono_HPCR_ximage; if (xmesa->xm_visual->hpcr_clear_flag) { ctx->Driver.ClearColor = clear_color_HPCR_ximage; } break; case PF_LOOKUP: if (depth==8) { - ctx->Driver.WriteRGBASpan = write_span_LOOKUP8_ximage; - ctx->Driver.WriteRGBSpan = write_rgb_LOOKUP8_ximage; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_LOOKUP8_ximage; - ctx->Driver.WriteRGBAPixels = write_pixels_LOOKUP8_ximage; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_LOOKUP8_ximage; + dd->WriteRGBASpan = write_span_LOOKUP8_ximage; + dd->WriteRGBSpan = write_rgb_LOOKUP8_ximage; + dd->WriteMonoRGBASpan = write_span_mono_LOOKUP8_ximage; + dd->WriteRGBAPixels = write_pixels_LOOKUP8_ximage; + dd->WriteMonoRGBAPixels = write_pixels_mono_LOOKUP8_ximage; } else { - ctx->Driver.WriteRGBASpan = write_span_LOOKUP_ximage; - ctx->Driver.WriteRGBSpan = write_span_rgb_LOOKUP_ximage; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_ximage; - ctx->Driver.WriteRGBAPixels = write_pixels_LOOKUP_ximage; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_ximage; + dd->WriteRGBASpan = write_span_LOOKUP_ximage; + dd->WriteRGBSpan = write_span_rgb_LOOKUP_ximage; + dd->WriteMonoRGBASpan = write_span_mono_ximage; + dd->WriteRGBAPixels = write_pixels_LOOKUP_ximage; + dd->WriteMonoRGBAPixels = write_pixels_mono_ximage; } break; case PF_GRAYSCALE: if (depth==8) { - ctx->Driver.WriteRGBASpan = write_span_GRAYSCALE8_ximage; - ctx->Driver.WriteRGBSpan = write_span_rgb_GRAYSCALE8_ximage; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_GRAYSCALE8_ximage; - ctx->Driver.WriteRGBAPixels = write_pixels_GRAYSCALE8_ximage; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_GRAYSCALE8_ximage; + dd->WriteRGBASpan = write_span_GRAYSCALE8_ximage; + dd->WriteRGBSpan = write_span_rgb_GRAYSCALE8_ximage; + dd->WriteMonoRGBASpan = write_span_mono_GRAYSCALE8_ximage; + dd->WriteRGBAPixels = write_pixels_GRAYSCALE8_ximage; + dd->WriteMonoRGBAPixels = write_pixels_mono_GRAYSCALE8_ximage; } else { - ctx->Driver.WriteRGBASpan = write_span_GRAYSCALE_ximage; - ctx->Driver.WriteRGBSpan = write_span_rgb_GRAYSCALE_ximage; - ctx->Driver.WriteMonoRGBASpan = write_span_mono_ximage; - ctx->Driver.WriteRGBAPixels = write_pixels_GRAYSCALE_ximage; - ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_ximage; + dd->WriteRGBASpan = write_span_GRAYSCALE_ximage; + dd->WriteRGBSpan = write_span_rgb_GRAYSCALE_ximage; + dd->WriteMonoRGBASpan = write_span_mono_ximage; + dd->WriteRGBAPixels = write_pixels_GRAYSCALE_ximage; + dd->WriteMonoRGBAPixels = write_pixels_mono_ximage; } break; default: @@ -4477,8 +4478,10 @@ void xmesa_update_span_funcs( GLcontext *ctx ) } /* Pixel/span reading functions: */ - ctx->Driver.ReadCI32Span = read_index_span; - ctx->Driver.ReadRGBASpan = read_color_span; - ctx->Driver.ReadCI32Pixels = read_index_pixels; - ctx->Driver.ReadRGBAPixels = read_color_pixels; + dd->ReadCI32Span = read_index_span; + dd->ReadRGBASpan = read_color_span; + dd->ReadCI32Pixels = read_index_pixels; + dd->ReadRGBAPixels = read_color_pixels; + + dd->SetReadBuffer = xmesa_set_read_buffer; } diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index 8aa8a47b14f..34d07c9e820 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -1,4 +1,4 @@ -/* $Id: xmesaP.h,v 1.19 2001/01/08 04:06:20 keithw Exp $ */ +/* $Id: xmesaP.h,v 1.20 2001/03/19 02:25:36 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -551,4 +551,7 @@ extern GLboolean XMesaForceCurrent(XMesaContext c); extern GLboolean XMesaLoseCurrent(XMesaContext c); extern void XMesaReset( void ); +extern void xmesa_set_read_buffer( GLcontext *ctx, + GLframebuffer *buffer, GLenum mode ); + #endif |