summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/Makefile.X114
-rw-r--r--src/mesa/array_cache/ac_import.c21
-rw-r--r--src/mesa/drivers/glide/fxdd.c77
-rw-r--r--src/mesa/drivers/glide/fxddspan.c60
-rw-r--r--src/mesa/drivers/glide/fxtris.c29
-rw-r--r--src/mesa/drivers/glide/fxvb.c7
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c117
-rw-r--r--src/mesa/drivers/svga/svgamesa.c73
-rw-r--r--src/mesa/drivers/x11/xm_api.c13
-rw-r--r--src/mesa/drivers/x11/xm_dd.c68
-rw-r--r--src/mesa/drivers/x11/xm_span.c309
-rw-r--r--src/mesa/drivers/x11/xmesaP.h5
-rw-r--r--src/mesa/main/Makefile.X114
-rw-r--r--src/mesa/main/colortab.c40
-rw-r--r--src/mesa/main/convolve.c47
-rw-r--r--src/mesa/main/dd.h398
-rw-r--r--src/mesa/main/drawpix.c6
-rw-r--r--src/mesa/main/mtypes.h39
-rw-r--r--src/mesa/main/state.c23
-rw-r--r--src/mesa/main/teximage.c8
-rw-r--r--src/mesa/main/texstore.c356
-rw-r--r--src/mesa/main/texstore.h32
-rw-r--r--src/mesa/swrast/s_aatriangle.c4
-rw-r--r--src/mesa/swrast/s_accum.c32
-rw-r--r--src/mesa/swrast/s_bitmap.c9
-rw-r--r--src/mesa/swrast/s_blend.c4
-rw-r--r--src/mesa/swrast/s_buffers.c32
-rw-r--r--src/mesa/swrast/s_context.c31
-rw-r--r--src/mesa/swrast/s_context.h19
-rw-r--r--src/mesa/swrast/s_copypix.c40
-rw-r--r--src/mesa/swrast/s_depth.c31
-rw-r--r--src/mesa/swrast/s_drawpix.c36
-rw-r--r--src/mesa/swrast/s_logic.c11
-rw-r--r--src/mesa/swrast/s_masking.c10
-rw-r--r--src/mesa/swrast/s_readpix.c32
-rw-r--r--src/mesa/swrast/s_span.c29
-rw-r--r--src/mesa/swrast/s_stencil.c58
-rw-r--r--src/mesa/swrast/s_triangle.c15
-rw-r--r--src/mesa/swrast/swrast.h258
-rw-r--r--src/mesa/swrast_setup/ss_tritmp.h4
-rw-r--r--src/mesa/tnl/t_context.c12
-rw-r--r--src/mesa/tnl/t_context.h106
-rw-r--r--src/mesa/tnl/t_imm_api.c6
-rw-r--r--src/mesa/tnl/t_pipeline.c10
-rw-r--r--src/mesa/tnl/t_vb_cliptmp.h29
-rw-r--r--src/mesa/tnl/t_vb_fog.c16
-rw-r--r--src/mesa/tnl/t_vb_render.c108
47 files changed, 1167 insertions, 1511 deletions
diff --git a/src/mesa/Makefile.X11 b/src/mesa/Makefile.X11
index 24109a739c..a2c0388f3b 100644
--- a/src/mesa/Makefile.X11
+++ b/src/mesa/Makefile.X11
@@ -1,4 +1,4 @@
-# $Id: Makefile.X11,v 1.46 2001/03/18 08:53:49 gareth Exp $
+# $Id: Makefile.X11,v 1.47 2001/03/19 02:25:35 keithw Exp $
# Mesa 3-D graphics library
# Version: 3.5
@@ -138,6 +138,7 @@ CORE_SOURCES = \
swrast/s_feedback.c \
swrast/s_fog.c \
swrast/s_histogram.c \
+ swrast/s_imaging.c \
swrast/s_lines.c \
swrast/s_logic.c \
swrast/s_masking.c \
@@ -149,6 +150,7 @@ CORE_SOURCES = \
swrast/s_span.c \
swrast/s_stencil.c \
swrast/s_texture.c \
+ swrast/s_texstore.c \
swrast/s_triangle.c \
swrast/s_zoom.c
diff --git a/src/mesa/array_cache/ac_import.c b/src/mesa/array_cache/ac_import.c
index 8bee54a529..1e5838a988 100644
--- a/src/mesa/array_cache/ac_import.c
+++ b/src/mesa/array_cache/ac_import.c
@@ -1,4 +1,4 @@
-/* $Id: ac_import.c,v 1.10 2001/03/17 18:04:54 keithw Exp $ */
+/* $Id: ac_import.c,v 1.11 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -266,7 +266,6 @@ static void import_color( GLcontext *ctx,
/* Limited choices at this stage:
*/
- /* XXX GLchan: is this right for GLchan? */
ASSERT(type == CHAN_TYPE);
ASSERT(stride == 4 * sizeof(GLchan) || stride == 0);
@@ -408,7 +407,7 @@ struct gl_client_array *_ac_import_texcoord( GLcontext *ctx,
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.TexCoord[unit].Type != type ||
- (reqstride != 0 && ac->Raw.TexCoord[unit].StrideB != (GLint) reqstride) ||
+ (reqstride != 0 && ac->Raw.TexCoord[unit].StrideB != (GLint)reqstride) ||
reqwriteable)
{
if (!ac->IsCached.TexCoord[unit])
@@ -459,10 +458,10 @@ struct gl_client_array *_ac_import_vertex( GLcontext *ctx,
}
struct gl_client_array *_ac_import_normal( GLcontext *ctx,
- GLenum type,
- GLuint reqstride,
- GLboolean reqwriteable,
- GLboolean *writeable )
+ GLenum type,
+ GLuint reqstride,
+ GLboolean reqwriteable,
+ GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
@@ -578,7 +577,7 @@ struct gl_client_array *_ac_import_secondarycolor( GLcontext *ctx,
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.SecondaryColor.Type != type ||
- (reqstride != 0 && ac->Raw.SecondaryColor.StrideB != (GLint) reqstride) ||
+ (reqstride != 0 && ac->Raw.SecondaryColor.StrideB != (GLint)reqstride) ||
reqwriteable)
{
if (!ac->IsCached.SecondaryColor)
@@ -666,12 +665,6 @@ void _ac_import_range( GLcontext *ctx, GLuint start, GLuint count )
{
ACcontext *ac = AC_CONTEXT(ctx);
- /* Discard cached data which has been invalidated by state changes
- * since last time. **ALREADY DONE**
- if (ac->NewState)
- _ac_update_state( ctx );
- */
-
if (!ctx->Array.LockCount) {
/* Not locked, discard cached data. Changes to lock
* status are caught via. _ac_invalidate_state().
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index 83a5196683..d389124ff5 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 e02e792dea..6d59e96f46 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 a0c8383fdd..22a4c8cde3 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 40acbb7e9e..470ee748bb 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 0473717a0d..4e0ae4b38b 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 4ce7343c52..a808241998 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 abbec2d7dd..96dfc4bfe4 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 a73b3c6973..2bb04ae504 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 e87fd98a8a..0991a44f7e 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 8aa8a47b14..34d07c9e82 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
diff --git a/src/mesa/main/Makefile.X11 b/src/mesa/main/Makefile.X11
index 24109a739c..a2c0388f3b 100644
--- a/src/mesa/main/Makefile.X11
+++ b/src/mesa/main/Makefile.X11
@@ -1,4 +1,4 @@
-# $Id: Makefile.X11,v 1.46 2001/03/18 08:53:49 gareth Exp $
+# $Id: Makefile.X11,v 1.47 2001/03/19 02:25:35 keithw Exp $
# Mesa 3-D graphics library
# Version: 3.5
@@ -138,6 +138,7 @@ CORE_SOURCES = \
swrast/s_feedback.c \
swrast/s_fog.c \
swrast/s_histogram.c \
+ swrast/s_imaging.c \
swrast/s_lines.c \
swrast/s_logic.c \
swrast/s_masking.c \
@@ -149,6 +150,7 @@ CORE_SOURCES = \
swrast/s_span.c \
swrast/s_stencil.c \
swrast/s_texture.c \
+ swrast/s_texstore.c \
swrast/s_triangle.c \
swrast/s_zoom.c
diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c
index eae856b300..5a50ae50e6 100644
--- a/src/mesa/main/colortab.c
+++ b/src/mesa/main/colortab.c
@@ -1,4 +1,4 @@
-/* $Id: colortab.c,v 1.37 2001/03/12 00:48:37 gareth Exp $ */
+/* $Id: colortab.c,v 1.38 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -609,28 +609,11 @@ void
_mesa_CopyColorTable(GLenum target, GLenum internalformat,
GLint x, GLint y, GLsizei width)
{
- GLchan data[MAX_WIDTH][4];
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
/* Select buffer to read from */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
- ctx->Pixel.DriverReadBuffer );
-
- if (width > MAX_WIDTH)
- width = MAX_WIDTH;
-
- /* read the data from framebuffer */
- RENDER_START(ctx);
- _mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, data );
- RENDER_FINISH(ctx);
-
- /* Restore reading from draw buffer (the default) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
- ctx->Color.DriverDrawBuffer );
-
- _mesa_ColorTable(target, internalformat, width,
- GL_RGBA, GL_UNSIGNED_BYTE, data);
+ ctx->Driver.CopyColorTable( ctx, target, internalformat, x, y, width );
}
@@ -640,27 +623,10 @@ void
_mesa_CopyColorSubTable(GLenum target, GLsizei start,
GLint x, GLint y, GLsizei width)
{
- GLchan data[MAX_WIDTH][4];
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- /* Select buffer to read from */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
- ctx->Pixel.DriverReadBuffer );
-
- if (width > MAX_WIDTH)
- width = MAX_WIDTH;
-
- /* read the data from framebuffer */
- RENDER_START(ctx);
- _mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, data );
- RENDER_FINISH(ctx);
-
- /* Restore reading from draw buffer (the default) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
- ctx->Color.DriverDrawBuffer );
-
- _mesa_ColorSubTable(target, start, width, GL_RGBA, GL_UNSIGNED_BYTE, data);
+ ctx->Driver.CopyColorSubTable( ctx, target, start, x, y, width );
}
diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c
index 5031f95b62..aedbf091a7 100644
--- a/src/mesa/main/convolve.c
+++ b/src/mesa/main/convolve.c
@@ -1,4 +1,4 @@
-/* $Id: convolve.c,v 1.22 2001/03/12 00:48:37 gareth Exp $ */
+/* $Id: convolve.c,v 1.23 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -468,7 +468,6 @@ void
_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width)
{
GLenum baseFormat;
- GLchan rgba[MAX_CONVOLUTION_WIDTH][4];
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -488,14 +487,8 @@ _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLi
return;
}
- /* read pixels from framebuffer */
- RENDER_START(ctx);
- _mesa_read_rgba_span(ctx, ctx->ReadBuffer, width, x, y, (GLchan (*)[4]) rgba);
- RENDER_FINISH(ctx);
-
- /* store as convolution filter */
- _mesa_ConvolutionFilter1D(target, internalFormat, width,
- GL_RGBA, CHAN_TYPE, rgba);
+ ctx->Driver.CopyConvolutionFilter1D( ctx, target,
+ internalFormat, x, y, width);
}
@@ -503,9 +496,6 @@ void
_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height)
{
GLenum baseFormat;
- GLint i;
- struct gl_pixelstore_attrib packSave;
- GLchan rgba[MAX_CONVOLUTION_HEIGHT][MAX_CONVOLUTION_WIDTH][4];
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -529,34 +519,9 @@ _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLi
return;
}
- /* read pixels from framebuffer */
- RENDER_START(ctx);
- for (i = 0; i < height; i++) {
- _mesa_read_rgba_span(ctx, ctx->ReadBuffer, width, x, y + i,
- (GLchan (*)[4]) rgba[i]);
- }
- RENDER_FINISH(ctx);
-
- /*
- * store as convolution filter
- */
- packSave = ctx->Unpack; /* save pixel packing params */
-
- ctx->Unpack.Alignment = 1;
- ctx->Unpack.RowLength = MAX_CONVOLUTION_WIDTH;
- ctx->Unpack.SkipPixels = 0;
- ctx->Unpack.SkipRows = 0;
- ctx->Unpack.ImageHeight = 0;
- ctx->Unpack.SkipImages = 0;
- ctx->Unpack.SwapBytes = GL_FALSE;
- ctx->Unpack.LsbFirst = GL_FALSE;
- ctx->NewState |= _NEW_PACKUNPACK;
-
- _mesa_ConvolutionFilter2D(target, internalFormat, width, height,
- GL_RGBA, CHAN_TYPE, rgba);
-
- ctx->Unpack = packSave; /* restore pixel packing params */
- ctx->NewState |= _NEW_PACKUNPACK;
+ ctx->Driver.CopyConvolutionFilter2D( ctx, target, internalFormat, x, y,
+ width, height );
+
}
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 1e3671b5e5..2dd3751faa 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1,4 +1,4 @@
-/* $Id: dd.h,v 1.58 2001/03/12 00:48:37 gareth Exp $ */
+/* $Id: dd.h,v 1.59 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -33,74 +33,6 @@
struct gl_pixelstore_attrib;
-
-/*
- * Device Driver (DD) interface
- *
- *
- * All device driver functions are accessed through pointers in the
- * dd_function_table struct (defined below) which is stored in the GLcontext
- * struct. Since the device driver is strictly accessed trough a table of
- * function pointers we can:
- * 1. switch between a number of different device drivers at runtime.
- * 2. use optimized functions dependant on current rendering state or
- * frame buffer configuration.
- *
- * The function pointers in the dd_function_table struct are divided into
- * two groups: mandatory and optional.
- * Mandatory functions have to be implemented by every device driver.
- * Optional functions may or may not be implemented by the device driver.
- * The optional functions provide ways to take advantage of special hardware
- * or optimized algorithms.
- *
- * The function pointers in the dd_function_table struct should first be
- * initialized in the driver's "MakeCurrent" function. The "MakeCurrent"
- * function is a little different in each device driver. See the X/Mesa,
- * GLX, or OS/Mesa drivers for examples.
- *
- * Later, Mesa may call the dd_function_table's UpdateState() function.
- * This function should initialize the dd_function_table's pointers again.
- * The UpdateState() function is called whenever the core (GL) rendering
- * state is changed in a way which may effect rasterization. For example,
- * the TriangleFunc() pointer may have to point to different functions
- * depending on whether smooth or flat shading is enabled.
- *
- * Note that the first argument to every device driver function is a
- * GLcontext *. In turn, the GLcontext->DriverCtx pointer points to
- * the driver-specific context struct. See the X/Mesa or OS/Mesa interface
- * for an example.
- *
- * For more information about writing a device driver see the drivers
- * in OSmesa/ and X/ for examples.
- *
- * Look below in the dd_function_table struct definition for descriptions
- * of each device driver function.
- *
- * More function pointers may be added as required.
- *
- *
- * Notes:
- * ------
- * RGBA = red/green/blue/alpha
- * CI = color index (color mapped mode)
- * mono = all pixels have the same color or index
- *
- * The write_ functions all take an array of mask flags which indicate
- * whether or not the pixel should be written. One special case exists
- * in the write_color_span function: if the mask array is NULL, then
- * draw all pixels. This is an optimization used for glDrawPixels().
- *
- * IN ALL CASES:
- * X coordinates start at 0 at the left and increase to the right
- * Y coordinates start at 0 at the bottom and increase upward
- *
- */
-
-
-
-
-
-
/* Mask bits sent to the driver Clear() function */
#define DD_FRONT_LEFT_BIT FRONT_LEFT_BIT /* 1 */
#define DD_FRONT_RIGHT_BIT FRONT_RIGHT_BIT /* 2 */
@@ -111,35 +43,6 @@ struct gl_pixelstore_attrib;
#define DD_ACCUM_BIT GL_ACCUM_BUFFER_BIT /* 0x00000200 */
-
-
-
-
-
-/* Point, line, triangle, quadrilateral and rectangle rasterizer
- * functions. These are specific to the tnl module and will shortly
- * move to a driver interface specific to that module.
- */
-typedef void (*points_func)( GLcontext *ctx, GLuint first, GLuint last );
-
-typedef void (*line_func)( GLcontext *ctx, GLuint v1, GLuint v2 );
-
-typedef void (*triangle_func)( GLcontext *ctx,
- GLuint v1, GLuint v2, GLuint v3 );
-
-typedef void (*quad_func)( GLcontext *ctx, GLuint v1, GLuint v2,
- GLuint v3, GLuint v4 );
-
-typedef void (*render_func)( GLcontext *ctx, GLuint start, GLuint count,
- GLuint flags );
-
-typedef void (*interp_func)( GLcontext *ctx,
- GLfloat t, GLuint dst, GLuint in, GLuint out,
- GLboolean force_boundary );
-
-typedef void (*copy_pv_func)( GLcontext *ctx, GLuint dst, GLuint src );
-
-
/*
* Device Driver function table.
*/
@@ -158,9 +61,9 @@ struct dd_function_table {
void (*UpdateState)( GLcontext *ctx, GLuint new_state );
/*
- * UpdateState() is called whenver Mesa thinks the device driver should
- * update its state and/or the other pointers (such as PointsFunc,
- * LineFunc, or TriangleFunc).
+ * UpdateState() is called to notify the driver after Mesa has made
+ * some internal state changes. This is in addition to any
+ * statechange callbacks Mesa may already have made.
*/
void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all,
@@ -194,120 +97,11 @@ struct dd_function_table {
* GL_NONE - disable buffer write in device driver.
*/
- void (*SetReadBuffer)( GLcontext *ctx, GLframebuffer *colorBuffer,
- GLenum buffer );
- /*
- * Specifies the current buffer for reading.
- * colorBuffer will be one of:
- * GL_FRONT_LEFT - this buffer always exists
- * GL_BACK_LEFT - when double buffering
- * GL_FRONT_RIGHT - when using stereo
- * GL_BACK_RIGHT - when using stereo and double buffering
- */
-
void (*GetBufferSize)( GLcontext *ctx, GLuint *width, GLuint *height );
/*
* Returns the width and height of the current color buffer.
*/
-
- /***
- *** Functions for writing pixels to the frame buffer:
- ***/
-
- void (*WriteRGBASpan)( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- CONST GLchan rgba[][4], const GLubyte mask[] );
- void (*WriteRGBSpan)( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- CONST GLchan rgb[][3], const GLubyte mask[] );
- /* Write a horizontal run of RGBA or RGB pixels.
- * If mask is NULL, draw all pixels.
- * If mask is not null, only draw pixel [i] when mask [i] is true.
- */
-
- void (*WriteMonoRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLchan color[4], const GLubyte mask[] );
- /* Write a horizontal run of RGBA pixels all with the same color.
- */
-
- void (*WriteRGBAPixels)( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- CONST GLchan rgba[][4], const GLubyte mask[] );
- /* Write array of RGBA pixels at random locations.
- */
-
- void (*WriteMonoRGBAPixels)( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLchan color[4], const GLubyte mask[] );
- /* Write an array of mono-RGBA pixels at random locations.
- */
-
- void (*WriteCI32Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLuint index[], const GLubyte mask[] );
- void (*WriteCI8Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLubyte index[], const GLubyte mask[] );
- /* Write a horizontal run of CI pixels. One function is for 32bpp
- * indexes and the other for 8bpp pixels (the common case). You mus
- * implement both for color index mode.
- */
-
- void (*WriteMonoCISpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- GLuint colorIndex, const GLubyte mask[] );
- /* Write a horizontal run of color index pixels using the color index
- * last specified by the Index() function.
- */
-
- void (*WriteCI32Pixels)( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLuint index[], const GLubyte mask[] );
- /*
- * Write a random array of CI pixels.
- */
-
- void (*WriteMonoCIPixels)( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint colorIndex, const GLubyte mask[] );
- /* Write a random array of color index pixels using the color index
- * last specified by the Index() function.
- */
-
-
- /***
- *** Functions to read pixels from frame buffer:
- ***/
-
- void (*ReadCI32Span)( const GLcontext *ctx,
- GLuint n, GLint x, GLint y, GLuint index[] );
- /* Read a horizontal run of color index pixels.
- */
-
- void (*ReadRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- GLchan rgba[][4] );
- /* Read a horizontal run of RGBA pixels.
- */
-
- void (*ReadCI32Pixels)( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint indx[], const GLubyte mask[] );
- /* Read a random array of CI pixels.
- */
-
- void (*ReadRGBAPixels)( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLchan rgba[][4], const GLubyte mask[] );
- /* Read a random array of RGBA pixels.
- */
-
-
- /**********************************************************************
- *** Optional functions: these functions may or may not be ***
- *** implemented by the device driver. If the device driver ***
- *** doesn't implement them it should never touch these pointers ***
- *** since Mesa will either set them to NULL or point them at a ***
- *** fall-back function. ***
- **********************************************************************/
-
void (*Finish)( GLcontext *ctx );
/*
* This is called whenever glFinish() is called.
@@ -326,73 +120,6 @@ struct dd_function_table {
/***
- *** For supporting hardware Z buffers:
- *** Either ALL or NONE of these functions must be implemented!
- *** NOTE that Each depth value is a 32-bit GLuint. If the depth
- *** buffer is less than 32 bits deep then the extra upperbits are zero.
- ***/
-
- void (*WriteDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLdepth depth[], const GLubyte mask[] );
- /* Write a horizontal span of values into the depth buffer. Only write
- * depth[i] value if mask[i] is nonzero.
- */
-
- void (*ReadDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
- GLdepth depth[] );
- /* Read a horizontal span of values from the depth buffer.
- */
-
-
- void (*WriteDepthPixels)( GLcontext *ctx, GLuint n,
- const GLint x[], const GLint y[],
- const GLdepth depth[], const GLubyte mask[] );
- /* Write an array of randomly positioned depth values into the
- * depth buffer. Only write depth[i] value if mask[i] is nonzero.
- */
-
- void (*ReadDepthPixels)( GLcontext *ctx, GLuint n,
- const GLint x[], const GLint y[],
- GLdepth depth[] );
- /* Read an array of randomly positioned depth values from the depth buffer.
- */
-
-
-
- /***
- *** For supporting hardware stencil buffers:
- *** Either ALL or NONE of these functions must be implemented!
- ***/
-
- void (*WriteStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLstencil stencil[], const GLubyte mask[] );
- /* Write a horizontal span of stencil values into the stencil buffer.
- * If mask is NULL, write all stencil values.
- * Else, only write stencil[i] if mask[i] is non-zero.
- */
-
- void (*ReadStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
- GLstencil stencil[] );
- /* Read a horizontal span of stencil values from the stencil buffer.
- */
-
- void (*WriteStencilPixels)( GLcontext *ctx, GLuint n,
- const GLint x[], const GLint y[],
- const GLstencil stencil[],
- const GLubyte mask[] );
- /* Write an array of stencil values into the stencil buffer.
- * If mask is NULL, write all stencil values.
- * Else, only write stencil[i] if mask[i] is non-zero.
- */
-
- void (*ReadStencilPixels)( GLcontext *ctx, GLuint n,
- const GLint x[], const GLint y[],
- GLstencil stencil[] );
- /* Read an array of stencil values from the stencil buffer.
- */
-
-
- /***
*** For hardware accumulation buffer:
***/
void (*Accum)( GLcontext *ctx, GLenum op, GLfloat value,
@@ -709,6 +436,27 @@ struct dd_function_table {
* is to be updated.
*/
+ /***
+ *** Imaging functionality:
+ ***/
+ void (*CopyColorTable)( GLcontext *ctx,
+ GLenum target, GLenum internalformat,
+ GLint x, GLint y, GLsizei width );
+
+ void (*CopyColorSubTable)( GLcontext *ctx,
+ GLenum target, GLsizei start,
+ GLint x, GLint y, GLsizei width );
+
+ void (*CopyConvolutionFilter1D)( GLcontext *ctx, GLenum target,
+ GLenum internalFormat,
+ GLint x, GLint y, GLsizei width );
+
+ void (*CopyConvolutionFilter2D)( GLcontext *ctx, GLenum target,
+ GLenum internalFormat,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height );
+
+
/***
*** State-changing functions (drawing functions are above)
@@ -768,17 +516,6 @@ struct dd_function_table {
void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
- /*** State-query functions
- ***
- *** Return GL_TRUE if query was completed, GL_FALSE otherwise.
- ***/
- GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result);
- GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result);
- GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result);
- GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result);
- GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result);
-
-
/***
*** Vertex array functions
***
@@ -801,85 +538,16 @@ struct dd_function_table {
void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr);
- /***
- *** TNL Pipeline
- ***/
-
- void (*PipelineStart)(GLcontext *ctx);
- void (*PipelineFinish)(GLcontext *ctx);
- /* Called before and after all pipeline stages.
- * These are a suitable place for grabbing/releasing hardware locks.
- */
-
- /***
- *** Rendering
- ***/
-
- void (*RenderStart)(GLcontext *ctx);
- void (*RenderFinish)(GLcontext *ctx);
- /* Called before and after all rendering operations, including DrawPixels,
- * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands.
- * These are a suitable place for grabbing/releasing hardware locks.
- */
-
- void (*RenderPrimitive)(GLcontext *ctx, GLenum mode);
- /* Called between RednerStart() and RenderFinish() to indicate the
- * type of primitive we're about to draw. Mode will be one of the
- * modes accepted by glBegin().
- */
-
- interp_func RenderInterp;
- copy_pv_func RenderCopyPV;
- void (*RenderClippedPolygon)( GLcontext *ctx, const GLuint *elts, GLuint n );
- void (*RenderClippedLine)( GLcontext *ctx, GLuint v0, GLuint v1 );
- /* Functions to interpolate between prebuilt vertices, copy flat-shade
- * provoking color, and to render clipped primitives.
- */
-
- /***
- *** Parameters for _tnl_render_stage
+ /*** State-query functions
+ ***
+ *** Return GL_TRUE if query was completed, GL_FALSE otherwise.
***/
- points_func PointsFunc; /* must now respect vb->elts */
- line_func LineFunc;
- triangle_func TriangleFunc;
- quad_func QuadFunc;
- /* These functions are called in order to render points, lines,
- * triangles and quads. These are only called via the T&L module.
- */
-
- render_func *RenderTabVerts;
- render_func *RenderTabElts;
- /* Render whole unclipped primitives (points, lines, linestrips,
- * lineloops, etc). The tables are indexed by the GL enum of the
- * primitive to be rendered.
- */
-
- void (*ResetLineStipple)( GLcontext *ctx );
- /* Reset the hardware's line stipple counter.
- */
-
- void (*BuildProjectedVertices)( GLcontext *ctx,
- GLuint start, GLuint end,
- GLuint new_inputs);
- /* This function is called whenever new vertices are required for
- * rendering. The vertices in question are those n such that start
- * <= n < end. The new_inputs parameter indicates those fields of
- * the vertex which need to be updated, if only a partial repair of
- * the vertex is required.
- *
- * This function is called only from _tnl_render_stage in tnl/t_render.c.
- */
-
+ GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result);
+ GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result);
+ GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result);
+ GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result);
+ GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result);
- GLboolean (*MultipassFunc)( GLcontext *ctx, GLuint passno );
- /* Driver may request additional render passes by returning GL_TRUE
- * when this function is called. This function will be called
- * after the first pass, and passes will be made until the function
- * returns GL_FALSE. If no function is registered, only one pass
- * is made.
- *
- * This function will be first invoked with passno == 1.
- */
/***
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index 4d7d938a69..4b34ddd707 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -1,4 +1,4 @@
-/* $Id: drawpix.c,v 1.50 2001/03/12 00:48:37 gareth Exp $ */
+/* $Id: drawpix.c,v 1.51 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -68,12 +68,8 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
y = (GLint) (ctx->Current.RasterPos[1] + 0.5F);
ctx->OcclusionResult = GL_TRUE;
-
- /* see if device driver can do the drawpix */
- RENDER_START(ctx);
ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type,
&ctx->Unpack, pixels);
- RENDER_FINISH(ctx);
}
else if (ctx->RenderMode==GL_FEEDBACK) {
if (ctx->Current.RasterPosValid) {
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 1ed5bad4c2..af3c3c94e8 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.27 2001/03/18 08:53:49 gareth Exp $ */
+/* $Id: mtypes.h,v 1.28 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -1702,43 +1702,6 @@ do { \
} while (0)
-#ifdef DEBUG
-
-#define RENDER_START(CTX) \
- do { \
- assert(!(CTX)->Rendering); \
- (CTX)->Rendering = GL_TRUE; \
- if ((CTX)->Driver.RenderStart) { \
- (*(CTX)->Driver.RenderStart)(CTX); \
- } \
- } while (0)
-
-#define RENDER_FINISH(CTX) \
- do { \
- assert((CTX)->Rendering); \
- (CTX)->Rendering = GL_FALSE; \
- if ((CTX)->Driver.RenderFinish) { \
- (*(CTX)->Driver.RenderFinish)(CTX); \
- } \
- } while (0)
-
-#else
-
-#define RENDER_START(CTX) \
- do { \
- if ((CTX)->Driver.RenderStart) { \
- (*(CTX)->Driver.RenderStart)(CTX); \
- } \
- } while (0)
-
-#define RENDER_FINISH(CTX) \
- do { \
- if ((CTX)->Driver.RenderFinish) { \
- (*(CTX)->Driver.RenderFinish)(CTX); \
- } \
- } while (0)
-
-#endif
#endif /* TYPES_H */
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 9c4685ed85..11de54ac35 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,4 +1,4 @@
-/* $Id: state.c,v 1.61 2001/03/12 00:48:38 gareth Exp $ */
+/* $Id: state.c,v 1.62 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -959,26 +959,7 @@ void _mesa_update_state( GLcontext *ctx )
ASSERT(ctx->Driver.UpdateState);
ASSERT(ctx->Driver.Clear);
ASSERT(ctx->Driver.SetDrawBuffer);
- ASSERT(ctx->Driver.SetReadBuffer);
ASSERT(ctx->Driver.GetBufferSize);
- if (ctx->Visual.rgbMode) {
- ASSERT(ctx->Driver.WriteRGBASpan);
- ASSERT(ctx->Driver.WriteRGBSpan);
- ASSERT(ctx->Driver.WriteMonoRGBASpan);
- ASSERT(ctx->Driver.WriteRGBAPixels);
- ASSERT(ctx->Driver.WriteMonoRGBAPixels);
- ASSERT(ctx->Driver.ReadRGBASpan);
- ASSERT(ctx->Driver.ReadRGBAPixels);
- }
- else {
- ASSERT(ctx->Driver.WriteCI32Span);
- ASSERT(ctx->Driver.WriteCI8Span);
- ASSERT(ctx->Driver.WriteMonoCISpan);
- ASSERT(ctx->Driver.WriteCI32Pixels);
- ASSERT(ctx->Driver.WriteMonoCIPixels);
- ASSERT(ctx->Driver.ReadCI32Span);
- ASSERT(ctx->Driver.ReadCI32Pixels);
- }
if (ctx->Visual.accumRedBits > 0) {
ASSERT(ctx->Driver.Accum);
}
@@ -1009,6 +990,4 @@ void _mesa_update_state( GLcontext *ctx )
ASSERT(ctx->Driver.GetCompressedTexImage);
ASSERT(ctx->Driver.BaseCompressedTexFormat);
}
- ASSERT(ctx->Driver.RenderStart);
- ASSERT(ctx->Driver.RenderFinish);
}
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d44b5d6ee6..cb7447769c 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1,4 +1,4 @@
-/* $Id: teximage.c,v 1.85 2001/03/18 08:53:49 gareth Exp $ */
+/* $Id: teximage.c,v 1.86 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -1349,11 +1349,13 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
}
}
+#if 0
/* one of these has to be non-zero! */
ASSERT(texImage->RedBits || texImage->IndexBits || texImage->AlphaBits ||
texImage->LuminanceBits || texImage->IntensityBits ||
texImage->DepthBits);
ASSERT(texImage->FetchTexel);
+#endif
/* state update */
texObj->Complete = GL_FALSE;
@@ -1461,11 +1463,13 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
}
}
+#if 0
/* one of these has to be non-zero! */
ASSERT(texImage->RedBits || texImage->IndexBits || texImage->AlphaBits ||
texImage->LuminanceBits || texImage->IntensityBits ||
texImage->DepthBits);
ASSERT(texImage->FetchTexel);
+#endif
/* state update */
texObj->Complete = GL_FALSE;
@@ -1566,11 +1570,13 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
}
}
+#if 0
/* one of these has to be non-zero! */
ASSERT(texImage->RedBits || texImage->IndexBits || texImage->AlphaBits ||
texImage->LuminanceBits || texImage->IntensityBits ||
texImage->DepthBits);
ASSERT(texImage->FetchTexel);
+#endif
/* state update */
texObj->Complete = GL_FALSE;
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 2b0c61aa19..66f47b889e 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -1,4 +1,4 @@
-/* $Id: texstore.c,v 1.15 2001/03/18 14:06:25 gareth Exp $ */
+/* $Id: texstore.c,v 1.16 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -47,8 +47,6 @@
#include "texformat.h"
#include "teximage.h"
#include "texstore.h"
-#include "swrast/s_depth.h" /* XXX this is kind of a cheat */
-#include "swrast/s_span.h"
/*
@@ -579,358 +577,6 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
/*
- * Read an RGBA image from the frame buffer.
- * This is used by glCopyTex[Sub]Image[12]D().
- * Input: ctx - the context
- * x, y - lower left corner
- * width, height - size of region to read
- * Return: pointer to block of GL_RGBA, GLchan data.
- */
-static GLchan *
-read_color_image( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- GLint stride, i;
- GLchan *image, *dst;
-
- image = (GLchan *) MALLOC(width * height * 4 * sizeof(GLchan));
- if (!image)
- return NULL;
-
- /* Select buffer to read from */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
- ctx->Pixel.DriverReadBuffer );
-
- RENDER_START(ctx);
-
- dst = image;
- stride = width * 4;
- for (i = 0; i < height; i++) {
- _mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y + i,
- (GLchan (*)[4]) dst );
- dst += stride;
- }
-
- RENDER_FINISH(ctx);
-
- /* Read from draw buffer (the default) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
- ctx->Color.DriverDrawBuffer );
-
- return image;
-}
-
-
-/*
- * As above, but read data from depth buffer.
- */
-static GLfloat *
-read_depth_image( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- GLint i;
- GLfloat *image, *dst;
-
- image = (GLfloat *) MALLOC(width * height * sizeof(GLfloat));
- if (!image)
- return NULL;
-
- RENDER_START(ctx);
-
- dst = image;
- for (i = 0; i < height; i++) {
- _mesa_read_depth_span_float(ctx, width, x, y + i, dst);
- dst += width;
- }
-
- RENDER_FINISH(ctx);
-
- return image;
-}
-
-
-
-static GLboolean
-is_depth_format(GLenum format)
-{
- switch (format) {
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT16_SGIX:
- case GL_DEPTH_COMPONENT24_SGIX:
- case GL_DEPTH_COMPONENT32_SGIX:
- return GL_TRUE;
- default:
- return GL_FALSE;
- }
-}
-
-
-/*
- * Fallback for Driver.CopyTexImage1D().
- */
-void
-_mesa_copy_teximage1d( GLcontext *ctx, GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y, GLsizei width, GLint border )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
- ASSERT(texObj);
- texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- ASSERT(texImage);
-
- ASSERT(ctx->Driver.TexImage1D);
-
- if (is_depth_format(internalFormat)) {
- /* read depth image from framebuffer */
- GLfloat *image = read_depth_image(ctx, x, y, width, 1);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D");
- return;
- }
-
- /* call glTexImage1D to redefine the texture */
- (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat,
- width, border,
- GL_DEPTH_COMPONENT, GL_FLOAT, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
- else {
- /* read RGBA image from framebuffer */
- GLchan *image = read_color_image(ctx, x, y, width, 1);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D");
- return;
- }
-
- /* call glTexImage1D to redefine the texture */
- (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat,
- width, border,
- GL_RGBA, CHAN_TYPE, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
-}
-
-
-/*
- * Fallback for Driver.CopyTexImage2D().
- */
-void
-_mesa_copy_teximage2d( GLcontext *ctx, GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint border )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
- ASSERT(texObj);
- texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- ASSERT(texImage);
-
- ASSERT(ctx->Driver.TexImage2D);
-
- if (is_depth_format(internalFormat)) {
- /* read depth image from framebuffer */
- GLfloat *image = read_depth_image(ctx, x, y, width, height);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D");
- return;
- }
-
- /* call glTexImage2D to redefine the texture */
- (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat,
- width, height, border,
- GL_DEPTH_COMPONENT, GL_FLOAT, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
- else {
- /* read RGBA image from framebuffer */
- GLchan *image = read_color_image(ctx, x, y, width, height);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D");
- return;
- }
-
- /* call glTexImage2D to redefine the texture */
- (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat,
- width, height, border,
- GL_RGBA, CHAN_TYPE, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
-}
-
-
-/*
- * Fallback for Driver.CopyTexSubImage1D().
- */
-void
-_mesa_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- struct gl_texture_unit *texUnit;
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
- ASSERT(texObj);
- texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- ASSERT(texImage);
-
- ASSERT(ctx->Driver.TexImage1D);
-
- if (is_depth_format(texImage->IntFormat)) {
- /* read depth image from framebuffer */
- GLfloat *image = read_depth_image(ctx, x, y, width, 1);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D");
- return;
- }
-
- /* call glTexImage1D to redefine the texture */
- (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width,
- GL_DEPTH_COMPONENT, GL_FLOAT, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
- else {
- GLchan *image = read_color_image(ctx, x, y, width, 1);
- if (!image) {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D" );
- return;
- }
-
- /* now call glTexSubImage1D to do the real work */
- (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width,
- GL_RGBA, CHAN_TYPE, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
-}
-
-
-/*
- * Fallback for Driver.CopyTexSubImage2D().
- */
-void
-_mesa_copy_texsubimage2d( GLcontext *ctx,
- GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint x, GLint y, GLsizei width, GLsizei height )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
- ASSERT(texObj);
- texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- ASSERT(texImage);
-
- ASSERT(ctx->Driver.TexImage2D);
-
- if (is_depth_format(texImage->IntFormat)) {
- /* read depth image from framebuffer */
- GLfloat *image = read_depth_image(ctx, x, y, width, height);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D");
- return;
- }
-
- /* call glTexImage1D to redefine the texture */
- (*ctx->Driver.TexSubImage2D)(ctx, target, level,
- xoffset, yoffset, width, height,
- GL_DEPTH_COMPONENT, GL_FLOAT, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
- else {
- /* read RGBA image from framebuffer */
- GLchan *image = read_color_image(ctx, x, y, width, height);
- if (!image) {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D" );
- return;
- }
-
- /* now call glTexSubImage2D to do the real work */
- (*ctx->Driver.TexSubImage2D)(ctx, target, level,
- xoffset, yoffset, width, height,
- GL_RGBA, CHAN_TYPE, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
-}
-
-
-/*
- * Fallback for Driver.CopyTexSubImage3D().
- */
-void
-_mesa_copy_texsubimage3d( GLcontext *ctx,
- GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint x, GLint y, GLsizei width, GLsizei height )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
- ASSERT(texObj);
- texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- ASSERT(texImage);
-
- ASSERT(ctx->Driver.TexImage3D);
-
- if (is_depth_format(texImage->IntFormat)) {
- /* read depth image from framebuffer */
- GLfloat *image = read_depth_image(ctx, x, y, width, height);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D");
- return;
- }
-
- /* call glTexImage1D to redefine the texture */
- (*ctx->Driver.TexSubImage3D)(ctx, target, level,
- xoffset, yoffset, zoffset, width, height, 1,
- GL_DEPTH_COMPONENT, GL_FLOAT, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
- else {
- /* read RGBA image from framebuffer */
- GLchan *image = read_color_image(ctx, x, y, width, height);
- if (!image) {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D" );
- return;
- }
-
- /* now call glTexSubImage3D to do the real work */
- (*ctx->Driver.TexSubImage3D)(ctx, target, level,
- xoffset, yoffset, zoffset, width, height, 1,
- GL_RGBA, CHAN_TYPE, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
-}
-
-
-
-/*
* Fallback for Driver.CompressedTexImage1D()
*/
void
diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h
index d23940e4e7..f51c0c0d63 100644
--- a/src/mesa/main/texstore.h
+++ b/src/mesa/main/texstore.h
@@ -1,4 +1,4 @@
-/* $Id: texstore.h,v 1.2 2001/02/19 20:01:42 brianp Exp $ */
+/* $Id: texstore.h,v 1.3 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -108,36 +108,6 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
extern void
-_mesa_copy_teximage1d(GLcontext *ctx, GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y, GLsizei width, GLint border);
-
-extern void
-_mesa_copy_teximage2d(GLcontext *ctx, GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint border);
-
-
-extern void
-_mesa_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint x, GLint y, GLsizei width);
-
-extern void
-_mesa_copy_texsubimage2d(GLcontext *ctx,
- GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint x, GLint y, GLsizei width, GLsizei height);
-
-extern void
-_mesa_copy_texsubimage3d(GLcontext *ctx,
- GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint x, GLint y, GLsizei width, GLsizei height);
-
-
-
-extern void
_mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
diff --git a/src/mesa/swrast/s_aatriangle.c b/src/mesa/swrast/s_aatriangle.c
index 1de030c776..df2182a0f0 100644
--- a/src/mesa/swrast/s_aatriangle.c
+++ b/src/mesa/swrast/s_aatriangle.c
@@ -1,4 +1,4 @@
-/* $Id: s_aatriangle.c,v 1.9 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_aatriangle.c,v 1.10 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -395,7 +395,7 @@ spec_multitex_aa_tri(GLcontext *ctx,
/*
- * Examine GL state and set ctx->Driver.TriangleFunc to an
+ * Examine GL state and set swrast->Triangle to an
* appropriate antialiased triangle rasterizer function.
*/
void
diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c
index 240992066e..d93396677f 100644
--- a/src/mesa/swrast/s_accum.c
+++ b/src/mesa/swrast/s_accum.c
@@ -1,4 +1,4 @@
-/* $Id: s_accum.c,v 1.8 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_accum.c,v 1.9 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -312,8 +312,8 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value,
if (value == 0.0F)
return;
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
- ctx->Pixel.DriverReadBuffer );
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ ctx->Pixel.DriverReadBuffer );
/* May have to leave optimized accum buffer mode */
if (swrast->_IntegerAccumScaler == 0.0 && value > 0.0 && value <= 1.0)
@@ -321,7 +321,7 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value,
if (swrast->_IntegerAccumMode && value != swrast->_IntegerAccumScaler)
rescale_accum(ctx);
- RENDER_START(ctx);
+ RENDER_START(swrast,ctx);
if (swrast->_IntegerAccumMode) {
/* simply add integer color values into accum buffer */
@@ -364,14 +364,14 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value,
}
}
/* restore read buffer = draw buffer (the default) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
- ctx->Color.DriverDrawBuffer );
- RENDER_FINISH(ctx);
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ ctx->Color.DriverDrawBuffer );
+ RENDER_FINISH(swrast,ctx);
break;
case GL_LOAD:
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
- ctx->Pixel.DriverReadBuffer );
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ ctx->Pixel.DriverReadBuffer );
/* This is a change to go into optimized accum buffer mode */
if (value > 0.0 && value <= 1.0) {
@@ -387,7 +387,7 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value,
swrast->_IntegerAccumScaler = 0.0;
}
- RENDER_START(ctx);
+ RENDER_START(swrast,ctx);
if (swrast->_IntegerAccumMode) {
/* just copy values into accum buffer */
GLint j;
@@ -429,9 +429,9 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value,
}
/* restore read buffer = draw buffer (the default) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
ctx->Color.DriverDrawBuffer );
- RENDER_FINISH(ctx);
+ RENDER_FINISH(swrast,ctx);
break;
case GL_RETURN:
@@ -439,7 +439,7 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value,
if (swrast->_IntegerAccumMode && value != 1.0)
rescale_accum(ctx);
- RENDER_START(ctx);
+ RENDER_START(swrast,ctx);
if (swrast->_IntegerAccumMode && swrast->_IntegerAccumScaler > 0) {
/* build lookup table to avoid many floating point multiplies */
static GLchan multTable[32768];
@@ -471,7 +471,7 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value,
if (colorMask != 0xffffffff) {
_mesa_mask_rgba_span( ctx, width, xpos, ypos, rgba );
}
- (*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos,
+ (*swrast->Driver.WriteRGBASpan)( ctx, width, xpos, ypos,
(const GLchan (*)[4])rgba, NULL );
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers
&& ctx->Color.ColorMask[ACOMP]) {
@@ -503,7 +503,7 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value,
if (colorMask != 0xffffffff) {
_mesa_mask_rgba_span( ctx, width, xpos, ypos, rgba );
}
- (*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos,
+ (*swrast->Driver.WriteRGBASpan)( ctx, width, xpos, ypos,
(const GLchan (*)[4])rgba, NULL );
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers
&& ctx->Color.ColorMask[ACOMP]) {
@@ -513,7 +513,7 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value,
ypos++;
}
}
- RENDER_FINISH(ctx);
+ RENDER_FINISH(swrast,ctx);
break;
default:
diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c
index 243219b75c..d22579c02f 100644
--- a/src/mesa/swrast/s_bitmap.c
+++ b/src/mesa/swrast/s_bitmap.c
@@ -1,4 +1,4 @@
-/* $Id: s_bitmap.c,v 1.6 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_bitmap.c,v 1.7 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -45,7 +45,8 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap )
{
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ struct pixel_buffer *PB = swrast->PB;
GLint row, col;
GLdepth fragZ;
GLfixed fogCoord;
@@ -53,6 +54,8 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
ASSERT(ctx->RenderMode == GL_RENDER);
ASSERT(bitmap);
+ RENDER_START(swrast,ctx);
+
if (SWRAST_CONTEXT(ctx)->NewState)
_swrast_validate_derived( ctx );
@@ -124,4 +127,6 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
}
_mesa_flush_pb(ctx);
+
+ RENDER_FINISH(swrast,ctx);
}
diff --git a/src/mesa/swrast/s_blend.c b/src/mesa/swrast/s_blend.c
index 3e15ae5deb..73ca3d1c52 100644
--- a/src/mesa/swrast/s_blend.c
+++ b/src/mesa/swrast/s_blend.c
@@ -1,4 +1,4 @@
-/* $Id: s_blend.c,v 1.6 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_blend.c,v 1.7 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -660,7 +660,7 @@ _mesa_blend_pixels( GLcontext *ctx,
}
/* Read pixels from current color buffer */
- (*ctx->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
+ (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
if (swrast->_RasterMask & ALPHABUF_BIT) {
_mesa_read_alpha_pixels( ctx, n, x, y, dest, mask );
}
diff --git a/src/mesa/swrast/s_buffers.c b/src/mesa/swrast/s_buffers.c
index 003e469559..409c3f6442 100644
--- a/src/mesa/swrast/s_buffers.c
+++ b/src/mesa/swrast/s_buffers.c
@@ -1,4 +1,4 @@
-/* $Id: s_buffers.c,v 1.7 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_buffers.c,v 1.8 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,6 +31,7 @@
#include "s_accum.h"
#include "s_alphabuf.h"
+#include "s_context.h"
#include "s_depth.h"
#include "s_masking.h"
#include "s_stencil.h"
@@ -44,6 +45,7 @@
static void
clear_color_buffer_with_masking( GLcontext *ctx )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLint x = ctx->DrawBuffer->_Xmin;
const GLint y = ctx->DrawBuffer->_Ymin;
const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
@@ -66,7 +68,7 @@ clear_color_buffer_with_masking( GLcontext *ctx )
rgba[j][ACOMP] = a;
}
_mesa_mask_rgba_span( ctx, width, x, y + i, rgba );
- (*ctx->Driver.WriteRGBASpan)( ctx, width, x, y + i,
+ (*swrast->Driver.WriteRGBASpan)( ctx, width, x, y + i,
(CONST GLchan (*)[4]) rgba, NULL );
}
}
@@ -81,7 +83,7 @@ clear_color_buffer_with_masking( GLcontext *ctx )
span[j] = ctx->Color.ClearIndex;
}
_mesa_mask_index_span( ctx, width, x, y + i, span );
- (*ctx->Driver.WriteCI32Span)( ctx, width, x, y + i, span, mask );
+ (*swrast->Driver.WriteCI32Span)( ctx, width, x, y + i, span, mask );
}
}
}
@@ -94,6 +96,7 @@ clear_color_buffer_with_masking( GLcontext *ctx )
static void
clear_color_buffer(GLcontext *ctx)
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLint x = ctx->DrawBuffer->_Xmin;
const GLint y = ctx->DrawBuffer->_Ymin;
const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
@@ -117,7 +120,7 @@ clear_color_buffer(GLcontext *ctx)
span[i][ACOMP] = a;
}
for (i = 0; i < height; i++) {
- (*ctx->Driver.WriteRGBASpan)( ctx, width, x, y + i,
+ (*swrast->Driver.WriteRGBASpan)( ctx, width, x, y + i,
(CONST GLchan (*)[4]) span, NULL );
}
}
@@ -131,7 +134,7 @@ clear_color_buffer(GLcontext *ctx)
GLint i;
MEMSET(span, ctx->Color.ClearIndex, width);
for (i = 0; i < height; i++) {
- (*ctx->Driver.WriteCI8Span)( ctx, width, x, y + i, span, NULL );
+ (*swrast->Driver.WriteCI8Span)( ctx, width, x, y + i, span, NULL );
}
}
else {
@@ -142,7 +145,7 @@ clear_color_buffer(GLcontext *ctx)
span[i] = ctx->Color.ClearIndex;
}
for (i = 0; i < height; i++) {
- (*ctx->Driver.WriteCI32Span)( ctx, width, x, y + i, span, NULL );
+ (*swrast->Driver.WriteCI32Span)( ctx, width, x, y + i, span, NULL );
}
}
}
@@ -158,6 +161,7 @@ clear_color_buffer(GLcontext *ctx)
static void
clear_color_buffers(GLcontext *ctx)
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
GLuint bufferBit;
@@ -166,19 +170,19 @@ clear_color_buffers(GLcontext *ctx)
if (bufferBit & ctx->Color.DrawDestMask) {
if (bufferBit == FRONT_LEFT_BIT) {
(void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_LEFT);
- (void) (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_LEFT);
+ (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_LEFT);
}
else if (bufferBit == FRONT_RIGHT_BIT) {
(void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_RIGHT);
- (void) (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_RIGHT);
+ (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_RIGHT);
}
else if (bufferBit == BACK_LEFT_BIT) {
(void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_LEFT);
- (void) (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_LEFT);
+ (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_LEFT);
}
else {
(void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT);
- (void) (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_RIGHT);
+ (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_RIGHT);
}
if (colorMask != 0xffffffff) {
@@ -192,7 +196,7 @@ clear_color_buffers(GLcontext *ctx)
/* restore default read/draw buffers */
(void) (*ctx->Driver.SetDrawBuffer)( ctx, ctx->Color.DriverDrawBuffer );
- (void) (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, ctx->Pixel.DriverReadBuffer );
+ (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, ctx->Pixel.DriverReadBuffer );
}
@@ -202,7 +206,7 @@ _swrast_Clear( GLcontext *ctx, GLbitfield mask,
GLboolean all,
GLint x, GLint y, GLint width, GLint height )
{
-
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
#ifdef DEBUG
{
GLbitfield legalBits = DD_FRONT_LEFT_BIT |
@@ -216,7 +220,7 @@ _swrast_Clear( GLcontext *ctx, GLbitfield mask,
}
#endif
- RENDER_START(ctx);
+ RENDER_START(swrast,ctx);
/* do software clearing here */
if (mask) {
@@ -233,7 +237,7 @@ _swrast_Clear( GLcontext *ctx, GLbitfield mask,
_mesa_clear_alpha_buffers( ctx );
}
- RENDER_FINISH(ctx);
+ RENDER_FINISH(swrast,ctx);
}
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index ffcdc718c2..20090bdb12 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -1,4 +1,4 @@
-/* $Id: s_context.c,v 1.17 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_context.c,v 1.18 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -316,6 +316,27 @@ _swrast_invalidate_state( GLcontext *ctx, GLuint new_state )
if (new_state & _SWRAST_NEW_TEXTURE_SAMPLE_FUNC)
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
swrast->TextureSample[i] = _swrast_validate_texture_sample;
+
+
+ if (ctx->Visual.rgbMode) {
+ ASSERT(swrast->Driver.WriteRGBASpan);
+ ASSERT(swrast->Driver.WriteRGBSpan);
+ ASSERT(swrast->Driver.WriteMonoRGBASpan);
+ ASSERT(swrast->Driver.WriteRGBAPixels);
+ ASSERT(swrast->Driver.WriteMonoRGBAPixels);
+ ASSERT(swrast->Driver.ReadRGBASpan);
+ ASSERT(swrast->Driver.ReadRGBAPixels);
+ }
+ else {
+ ASSERT(swrast->Driver.WriteCI32Span);
+ ASSERT(swrast->Driver.WriteCI8Span);
+ ASSERT(swrast->Driver.WriteMonoCISpan);
+ ASSERT(swrast->Driver.WriteCI32Pixels);
+ ASSERT(swrast->Driver.WriteMonoCIPixels);
+ ASSERT(swrast->Driver.ReadCI32Span);
+ ASSERT(swrast->Driver.ReadCI32Pixels);
+ }
+
}
@@ -471,6 +492,14 @@ _swrast_DestroyContext( GLcontext *ctx )
}
+struct swrast_device_driver *
+_swrast_GetDeviceDriverReference( GLcontext *ctx )
+{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ return &swrast->Driver;
+}
+
+
void
_swrast_print_vertex( GLcontext *ctx, const SWvertex *v )
{
diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h
index 7449cb2896..3bf9616d51 100644
--- a/src/mesa/swrast/s_context.h
+++ b/src/mesa/swrast/s_context.h
@@ -1,4 +1,4 @@
-/* $Id: s_context.h,v 1.7 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_context.h,v 1.8 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -100,6 +100,10 @@ typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *,
typedef struct
{
+ /* Driver interface:
+ */
+ struct swrast_device_driver Driver;
+
/* Configuration mechanisms to make software rasterizer match
* characteristics of the hardware rasterizer (if present):
*/
@@ -170,6 +174,19 @@ _swrast_validate_derived( GLcontext *ctx );
#define SWRAST_CONTEXT(ctx) ((SWcontext *)ctx->swrast_context)
+#define RENDER_START(SWctx, GLctx) \
+ do { \
+ if ((SWctx)->Driver.SpanRenderStart) { \
+ (*(SWctx)->Driver.SpanRenderStart)(GLctx); \
+ } \
+ } while (0)
+
+#define RENDER_FINISH(SWctx, GLctx) \
+ do { \
+ if ((SWctx)->Driver.SpanRenderFinish) { \
+ (*(SWctx)->Driver.SpanRenderFinish)(GLctx); \
+ } \
+ } while (0)
#endif
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index 1a8c0a069c..f85af995d3 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -1,4 +1,4 @@
-/* $Id: s_copypix.c,v 1.15 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_copypix.c,v 1.16 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -96,6 +96,7 @@ static void
copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
GLint width, GLint height, GLint destx, GLint desty)
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLdepth zspan[MAX_WIDTH];
GLboolean quick_draw;
GLint row;
@@ -147,7 +148,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
dest = tmpImage;
if (changeBuffer) {
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
ctx->Pixel.DriverReadBuffer );
if (ctx->Pixel.DriverReadBuffer == GL_FRONT_LEFT)
ctx->ReadBuffer->Alpha = ctx->ReadBuffer->FrontLeftAlpha;
@@ -176,7 +177,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
/* read from the draw buffer again (in case of blending) */
if (changeBuffer) {
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
ctx->Color.DriverDrawBuffer );
ctx->ReadBuffer->Alpha = saveReadAlpha;
}
@@ -277,7 +278,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
dy = desty + row;
if (quick_draw && dy >= 0 && dy < ctx->DrawBuffer->Height) {
- (*ctx->Driver.WriteRGBASpan)( ctx, width, destx, dy,
+ (*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy,
(const GLchan (*)[4])rgba, NULL );
}
else if (zoom) {
@@ -300,6 +301,7 @@ static void
copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
GLint width, GLint height, GLint destx, GLint desty)
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLdepth zspan[MAX_WIDTH];
GLchan rgba[MAX_WIDTH][4];
GLchan *tmpImage,*p;
@@ -357,7 +359,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer
|| ctx->DrawBuffer != ctx->ReadBuffer;
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
ctx->Pixel.DriverReadBuffer );
if (overlapping) {
@@ -369,7 +371,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
}
p = tmpImage;
if (changeBuffer) {
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
ctx->Pixel.DriverReadBuffer );
if (ctx->Pixel.DriverReadBuffer == GL_FRONT_LEFT)
ctx->ReadBuffer->Alpha = ctx->ReadBuffer->FrontLeftAlpha;
@@ -402,7 +404,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
else {
/* get from framebuffer */
if (changeBuffer) {
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
ctx->Pixel.DriverReadBuffer );
if (ctx->Pixel.DriverReadBuffer == GL_FRONT_LEFT) {
ctx->ReadBuffer->Alpha = ctx->ReadBuffer->FrontLeftAlpha;
@@ -422,7 +424,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
if (changeBuffer) {
/* read from the draw buffer again (in case of blending) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
ctx->Color.DriverDrawBuffer );
ctx->ReadBuffer->Alpha = saveReadAlpha;
}
@@ -521,7 +523,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
}
if (quick_draw && dy >= 0 && dy < ctx->DrawBuffer->Height) {
- (*ctx->Driver.WriteRGBASpan)( ctx, width, destx, dy,
+ (*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy,
(const GLchan (*)[4])rgba, NULL );
}
else if (zoom) {
@@ -534,7 +536,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
}
/* Restore pixel source to be the draw buffer (for blending, etc) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
ctx->Color.DriverDrawBuffer );
if (overlapping)
@@ -546,6 +548,7 @@ static void copy_ci_pixels( GLcontext *ctx,
GLint srcx, GLint srcy, GLint width, GLint height,
GLint destx, GLint desty )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLdepth zspan[MAX_WIDTH];
GLuint *tmpImage,*p;
GLint sy, dy, stepy;
@@ -584,7 +587,7 @@ static void copy_ci_pixels( GLcontext *ctx,
changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer
|| ctx->DrawBuffer != ctx->ReadBuffer;
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
ctx->Pixel.DriverReadBuffer );
if (overlapping) {
@@ -596,7 +599,7 @@ static void copy_ci_pixels( GLcontext *ctx,
}
p = tmpImage;
if (changeBuffer) {
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
ctx->Pixel.DriverReadBuffer );
}
for (j = 0; j < height; j++, ssy += stepy) {
@@ -618,7 +621,7 @@ static void copy_ci_pixels( GLcontext *ctx,
}
else {
if (changeBuffer) {
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
ctx->Pixel.DriverReadBuffer );
}
_mesa_read_index_span( ctx, ctx->ReadBuffer, width, srcx, sy, indexes );
@@ -626,7 +629,7 @@ static void copy_ci_pixels( GLcontext *ctx,
if (changeBuffer) {
/* set read buffer back to draw buffer (in case of logicops) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
ctx->Color.DriverDrawBuffer );
}
@@ -646,7 +649,7 @@ static void copy_ci_pixels( GLcontext *ctx,
}
/* Restore pixel source to be the draw buffer (for blending, etc) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
ctx->Color.DriverDrawBuffer );
if (overlapping)
@@ -860,7 +863,10 @@ _swrast_CopyPixels( GLcontext *ctx,
GLint destx, GLint desty,
GLenum type )
{
- if (SWRAST_CONTEXT(ctx)->NewState)
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ RENDER_START(swrast,ctx);
+
+ if (swrast->NewState)
_swrast_validate_derived( ctx );
if (type == GL_COLOR && ctx->Visual.rgbMode) {
@@ -878,4 +884,6 @@ _swrast_CopyPixels( GLcontext *ctx,
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glCopyPixels" );
}
+
+ RENDER_FINISH(swrast,ctx);
}
diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
index 19101a24c4..5001081ae0 100644
--- a/src/mesa/swrast/s_depth.c
+++ b/src/mesa/swrast/s_depth.c
@@ -1,4 +1,4 @@
-/* $Id: s_depth.c,v 1.8 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_depth.c,v 1.9 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -538,14 +538,15 @@ GLuint
_mesa_depth_test_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLdepth z[], GLubyte mask[] )
{
- if (ctx->Driver.ReadDepthSpan) {
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ if (swrast->Driver.ReadDepthSpan) {
/* hardware-based depth buffer */
GLdepth zbuffer[MAX_WIDTH];
GLuint passed;
- (*ctx->Driver.ReadDepthSpan)(ctx, n, x, y, zbuffer);
+ (*swrast->Driver.ReadDepthSpan)(ctx, n, x, y, zbuffer);
passed = depth_test_span32(ctx, n, x, y, zbuffer, z, mask);
- assert(ctx->Driver.WriteDepthSpan);
- (*ctx->Driver.WriteDepthSpan)(ctx, n, x, y, zbuffer, mask);
+ assert(swrast->Driver.WriteDepthSpan);
+ (*swrast->Driver.WriteDepthSpan)(ctx, n, x, y, zbuffer, mask);
return passed;
}
else {
@@ -1297,16 +1298,17 @@ _mesa_depth_test_pixels( GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLdepth z[], GLubyte mask[] )
{
- if (ctx->Driver.ReadDepthPixels) {
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ if (swrast->Driver.ReadDepthPixels) {
/* read depth values from hardware Z buffer */
GLdepth zbuffer[PB_SIZE];
- (*ctx->Driver.ReadDepthPixels)(ctx, n, x, y, zbuffer);
+ (*swrast->Driver.ReadDepthPixels)(ctx, n, x, y, zbuffer);
hardware_depth_test_pixels( ctx, n, zbuffer, z, mask );
/* update hardware Z buffer with new values */
- assert(ctx->Driver.WriteDepthPixels);
- (*ctx->Driver.WriteDepthPixels)(ctx, n, x, y, zbuffer, mask );
+ assert(swrast->Driver.WriteDepthPixels);
+ (*swrast->Driver.WriteDepthPixels)(ctx, n, x, y, zbuffer, mask );
}
else {
/* software depth testing */
@@ -1334,6 +1336,8 @@ void
_mesa_read_depth_span( GLcontext *ctx,
GLint n, GLint x, GLint y, GLdepth depth[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+
if (y < 0 || y >= ctx->DrawBuffer->Height ||
x + (GLint) n <= 0 || x >= ctx->DrawBuffer->Width) {
/* span is completely outside framebuffer */
@@ -1380,9 +1384,9 @@ _mesa_read_depth_span( GLcontext *ctx,
}
}
}
- else if (ctx->Driver.ReadDepthSpan) {
+ else if (swrast->Driver.ReadDepthSpan) {
/* read from hardware depth buffer */
- (*ctx->Driver.ReadDepthSpan)( ctx, n, x, y, depth );
+ (*swrast->Driver.ReadDepthSpan)( ctx, n, x, y, depth );
}
else {
/* no depth buffer */
@@ -1405,6 +1409,7 @@ void
_mesa_read_depth_span_float( GLcontext *ctx,
GLint n, GLint x, GLint y, GLfloat depth[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLfloat scale = 1.0F / ctx->DepthMaxF;
if (y < 0 || y >= ctx->DrawBuffer->Height ||
@@ -1452,12 +1457,12 @@ _mesa_read_depth_span_float( GLcontext *ctx,
}
}
}
- else if (ctx->Driver.ReadDepthSpan) {
+ else if (swrast->Driver.ReadDepthSpan) {
/* read from hardware depth buffer */
GLdepth d[MAX_WIDTH];
GLint i;
assert(n <= MAX_WIDTH);
- (*ctx->Driver.ReadDepthSpan)( ctx, n, x, y, d );
+ (*swrast->Driver.ReadDepthSpan)( ctx, n, x, y, d );
for (i = 0; i < n; i++) {
depth[i] = d[i] * scale;
}
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index 925d5dba6e..cfc1383a63 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -1,4 +1,4 @@
-/* $Id: s_drawpix.c,v 1.14 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_drawpix.c,v 1.15 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -100,6 +100,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels)
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_pixelstore_attrib *unpack = &ctx->Unpack;
GLchan rgb[MAX_WIDTH][3];
GLchan rgba[MAX_WIDTH][4];
@@ -210,7 +211,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
/* no zooming */
GLint row;
for (row=0; row<drawHeight; row++) {
- (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[4]) src, NULL);
src += rowLength * 4;
destY++;
@@ -221,7 +222,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
GLint row;
for (row=0; row<drawHeight; row++) {
destY--;
- (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[4]) src, NULL);
src += rowLength * 4;
}
@@ -247,7 +248,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
GLint row;
for (row=0; row<drawHeight; row++) {
- (*ctx->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[3]) src, NULL);
src += rowLength * 3;
destY++;
@@ -258,7 +259,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
GLint row;
for (row=0; row<drawHeight; row++) {
destY--;
- (*ctx->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[3]) src, NULL);
src += rowLength * 3;
}
@@ -292,7 +293,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
rgb[i][1] = src[i];
rgb[i][2] = src[i];
}
- (*ctx->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[3]) rgb, NULL);
src += rowLength;
destY++;
@@ -310,7 +311,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
rgb[i][2] = src[i];
}
destY--;
- (*ctx->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[3]) rgb, NULL);
src += rowLength;
}
@@ -353,7 +354,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
rgba[i][2] = *ptr++;
rgba[i][3] = *ptr++;
}
- (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[4]) rgba, NULL);
src += rowLength*2;
destY++;
@@ -373,7 +374,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
rgba[i][3] = *ptr++;
}
destY--;
- (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[4]) rgba, NULL);
src += rowLength*2;
}
@@ -410,7 +411,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
for (row=0; row<drawHeight; row++) {
ASSERT(drawWidth < MAX_WIDTH);
_mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba);
- (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
(const GLchan (*)[4]) rgba,
NULL);
src += rowLength;
@@ -425,7 +426,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
ASSERT(drawWidth < MAX_WIDTH);
_mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba);
destY--;
- (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[4]) rgba,
NULL);
src += rowLength;
@@ -452,7 +453,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
/* no zooming */
for (row=0; row<drawHeight; row++) {
- (*ctx->Driver.WriteCI8Span)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteCI8Span)(ctx, drawWidth, destX, destY,
src, NULL);
src += rowLength;
destY++;
@@ -703,6 +704,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_pixelstore_attrib *unpack = &ctx->Unpack;
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
const GLint desty = y;
@@ -830,7 +832,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
}
if (quickDraw) {
- (*ctx->Driver.WriteRGBASpan)( ctx, width, x, y,
+ (*swrast->Driver.WriteRGBASpan)( ctx, width, x, y,
(CONST GLchan (*)[]) rgba, NULL);
}
else if (zoom) {
@@ -862,11 +864,15 @@ _swrast_DrawPixels( GLcontext *ctx,
const struct gl_pixelstore_attrib *unpack,
const GLvoid *pixels )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
(void) unpack;
- if (SWRAST_CONTEXT(ctx)->NewState)
+
+ if (swrast->NewState)
_swrast_validate_derived( ctx );
+ RENDER_START(swrast,ctx);
+
switch (format) {
case GL_STENCIL_INDEX:
draw_stencil_pixels( ctx, x, y, width, height, type, pixels );
@@ -896,4 +902,6 @@ _swrast_DrawPixels( GLcontext *ctx,
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glDrawPixels(format)" );
}
+
+ RENDER_FINISH(swrast,ctx);
}
diff --git a/src/mesa/swrast/s_logic.c b/src/mesa/swrast/s_logic.c
index 399a8e8a76..2d763c7833 100644
--- a/src/mesa/swrast/s_logic.c
+++ b/src/mesa/swrast/s_logic.c
@@ -1,4 +1,4 @@
-/* $Id: s_logic.c,v 1.5 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_logic.c,v 1.6 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -169,9 +169,10 @@ void
_mesa_logicop_ci_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
GLuint index[], const GLubyte mask[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint dest[MAX_WIDTH];
/* Read dest values from frame buffer */
- (*ctx->Driver.ReadCI32Span)( ctx, n, x, y, dest );
+ (*swrast->Driver.ReadCI32Span)( ctx, n, x, y, dest );
index_logicop( ctx, n, index, dest, mask );
}
@@ -186,9 +187,10 @@ _mesa_logicop_ci_pixels( GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLuint index[], const GLubyte mask[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint dest[PB_SIZE];
/* Read dest values from frame buffer */
- (*ctx->Driver.ReadCI32Pixels)( ctx, n, x, y, dest, mask );
+ (*swrast->Driver.ReadCI32Pixels)( ctx, n, x, y, dest, mask );
index_logicop( ctx, n, index, dest, mask );
}
@@ -352,8 +354,9 @@ _mesa_logicop_rgba_pixels( GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLchan rgba[][4], const GLubyte mask[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLchan dest[PB_SIZE][4];
- (*ctx->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
+ (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
_mesa_read_alpha_pixels( ctx, n, x, y, dest, mask );
}
diff --git a/src/mesa/swrast/s_masking.c b/src/mesa/swrast/s_masking.c
index 7cacd1de38..b4433b2bc7 100644
--- a/src/mesa/swrast/s_masking.c
+++ b/src/mesa/swrast/s_masking.c
@@ -1,4 +1,4 @@
-/* $Id: s_masking.c,v 1.4 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_masking.c,v 1.5 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -91,6 +91,7 @@ _mesa_mask_rgba_pixels( GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLchan rgba[][4], const GLubyte mask[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLchan dest[PB_SIZE][4];
GLuint i;
@@ -101,7 +102,7 @@ _mesa_mask_rgba_pixels( GLcontext *ctx,
GLuint *rgba32 = (GLuint *) rgba;
GLuint *dest32 = (GLuint *) dest;
- (*ctx->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
+ (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
_mesa_read_alpha_pixels( ctx, n, x, y, dest, mask );
}
@@ -117,7 +118,7 @@ _mesa_mask_rgba_pixels( GLcontext *ctx,
const GLint bMask = ctx->Color.ColorMask[BCOMP];
const GLint aMask = ctx->Color.ColorMask[ACOMP];
- (*ctx->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
+ (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
_mesa_read_alpha_pixels( ctx, n, x, y, dest, mask );
}
@@ -165,11 +166,12 @@ _mesa_mask_index_pixels( GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLuint index[], const GLubyte mask[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint i;
GLuint fbindexes[PB_SIZE];
GLuint msrc, mdest;
- (*ctx->Driver.ReadCI32Pixels)( ctx, n, x, y, fbindexes, mask );
+ (*swrast->Driver.ReadCI32Pixels)( ctx, n, x, y, fbindexes, mask );
msrc = ctx->Color.IndexMask;
mdest = ~msrc;
diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c
index a24c44bebe..d95bba64c8 100644
--- a/src/mesa/swrast/s_readpix.c
+++ b/src/mesa/swrast/s_readpix.c
@@ -1,4 +1,4 @@
-/* $Id: s_readpix.c,v 1.10 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_readpix.c,v 1.11 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -53,6 +53,7 @@ read_index_pixels( GLcontext *ctx,
GLenum type, GLvoid *pixels,
const struct gl_pixelstore_attrib *packing )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLint i, readWidth;
/* error checking */
@@ -61,8 +62,8 @@ read_index_pixels( GLcontext *ctx,
return;
}
- ASSERT(ctx->Driver.SetReadBuffer);
- (*ctx->Driver.SetReadBuffer)(ctx, ctx->ReadBuffer,
+ ASSERT(swrast->Driver.SetReadBuffer);
+ (*swrast->Driver.SetReadBuffer)(ctx, ctx->ReadBuffer,
ctx->Pixel.DriverReadBuffer);
readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;
@@ -72,7 +73,7 @@ read_index_pixels( GLcontext *ctx,
GLuint index[MAX_WIDTH];
GLvoid *dest;
- (*ctx->Driver.ReadCI32Span)(ctx, readWidth, x, y + i, index);
+ (*swrast->Driver.ReadCI32Span)(ctx, readWidth, x, y + i, index);
dest = _mesa_image_address(packing, pixels, width, height,
GL_COLOR_INDEX, type, 0, i, 0);
@@ -81,7 +82,7 @@ read_index_pixels( GLcontext *ctx,
&ctx->Pack, ctx->_ImageTransferState);
}
- (*ctx->Driver.SetReadBuffer)(ctx, ctx->DrawBuffer,
+ (*swrast->Driver.SetReadBuffer)(ctx, ctx->DrawBuffer,
ctx->Color.DriverDrawBuffer);
}
@@ -221,6 +222,7 @@ read_fast_rgba_pixels( GLcontext *ctx,
GLvoid *pixels,
const struct gl_pixelstore_attrib *packing )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
/* can't do scale, bias, mapping, etc */
if (ctx->_ImageTransferState)
return GL_FALSE;
@@ -283,7 +285,7 @@ read_fast_rgba_pixels( GLcontext *ctx,
+ (skipRows * rowLength + skipPixels) * 4;
GLint row;
for (row=0; row<readHeight; row++) {
- (*ctx->Driver.ReadRGBASpan)(ctx, readWidth, srcX, srcY,
+ (*swrast->Driver.ReadRGBASpan)(ctx, readWidth, srcX, srcY,
(GLchan (*)[4]) dest);
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers) {
_mesa_read_alpha_span(ctx, readWidth, srcX, srcY,
@@ -313,15 +315,16 @@ read_rgba_pixels( GLcontext *ctx,
GLenum format, GLenum type, GLvoid *pixels,
const struct gl_pixelstore_attrib *packing )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLint readWidth;
- (*ctx->Driver.SetReadBuffer)(ctx, ctx->ReadBuffer, ctx->Pixel.DriverReadBuffer);
+ (*swrast->Driver.SetReadBuffer)(ctx, ctx->ReadBuffer, ctx->Pixel.DriverReadBuffer);
/* Try optimized path first */
if (read_fast_rgba_pixels( ctx, x, y, width, height,
format, type, pixels, packing )) {
- (*ctx->Driver.SetReadBuffer)(ctx, ctx->DrawBuffer, ctx->Color.DriverDrawBuffer);
+ (*swrast->Driver.SetReadBuffer)(ctx, ctx->DrawBuffer, ctx->Color.DriverDrawBuffer);
return; /* done! */
}
@@ -387,7 +390,7 @@ read_rgba_pixels( GLcontext *ctx,
}
else {
GLuint index[MAX_WIDTH];
- (*ctx->Driver.ReadCI32Span)(ctx, readWidth, x, y, index);
+ (*swrast->Driver.ReadCI32Span)(ctx, readWidth, x, y, index);
if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset !=0 ) {
_mesa_map_ci(ctx, readWidth, index);
}
@@ -433,7 +436,7 @@ read_rgba_pixels( GLcontext *ctx,
}
else {
GLuint index[MAX_WIDTH];
- (*ctx->Driver.ReadCI32Span)(ctx, readWidth, x, y, index);
+ (*swrast->Driver.ReadCI32Span)(ctx, readWidth, x, y, index);
if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset != 0) {
_mesa_map_ci(ctx, readWidth, index);
}
@@ -465,7 +468,7 @@ read_rgba_pixels( GLcontext *ctx,
}
}
- (*ctx->Driver.SetReadBuffer)(ctx, ctx->DrawBuffer, ctx->Color.DriverDrawBuffer);
+ (*swrast->Driver.SetReadBuffer)(ctx, ctx->DrawBuffer, ctx->Color.DriverDrawBuffer);
}
@@ -477,11 +480,14 @@ _swrast_ReadPixels( GLcontext *ctx,
const struct gl_pixelstore_attrib *pack,
GLvoid *pixels )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
(void) pack;
- if (SWRAST_CONTEXT(ctx)->NewState)
+ if (swrast->NewState)
_swrast_validate_derived( ctx );
+ RENDER_START(swrast,ctx);
+
switch (format) {
case GL_COLOR_INDEX:
read_index_pixels(ctx, x, y, width, height, type, pixels, &ctx->Pack);
@@ -509,4 +515,6 @@ _swrast_ReadPixels( GLcontext *ctx,
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glReadPixels(format)" );
}
+
+ RENDER_FINISH(swrast,ctx);
}
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index e7659d51a7..d26b042187 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -1,4 +1,4 @@
-/* $Id: s_span.c,v 1.11 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_span.c,v 1.12 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -127,6 +127,7 @@ static void multi_write_index_span( GLcontext *ctx, GLuint n,
GLint x, GLint y, const GLuint indexes[],
const GLubyte mask[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint bufferBit;
if (ctx->Color.DrawBuffer == GL_NONE)
@@ -158,7 +159,7 @@ static void multi_write_index_span( GLcontext *ctx, GLuint n,
else if (ctx->Color.IndexMask != 0xffffffff) {
_mesa_mask_index_span( ctx, n, x, y, indexTmp );
}
- (*ctx->Driver.WriteCI32Span)( ctx, n, x, y, indexTmp, mask );
+ (*swrast->Driver.WriteCI32Span)( ctx, n, x, y, indexTmp, mask );
}
}
@@ -261,7 +262,7 @@ void _mesa_write_index_span( GLcontext *ctx,
}
/* write pixels */
- (*ctx->Driver.WriteCI32Span)( ctx, n, x, y, index, mask );
+ (*swrast->Driver.WriteCI32Span)( ctx, n, x, y, index, mask );
}
}
@@ -350,7 +351,7 @@ void _mesa_write_monoindex_span( GLcontext *ctx,
else if (ctx->Color.IndexMask != 0xffffffff) {
_mesa_mask_index_span( ctx, n, x, y, indexes );
}
- (*ctx->Driver.WriteCI32Span)( ctx, n, x, y, indexes, mask );
+ (*swrast->Driver.WriteCI32Span)( ctx, n, x, y, indexes, mask );
}
}
else {
@@ -366,7 +367,7 @@ void _mesa_write_monoindex_span( GLcontext *ctx,
}
else {
/* normal situation: draw to exactly one buffer */
- (*ctx->Driver.WriteMonoCISpan)( ctx, n, x, y, index, mask );
+ (*swrast->Driver.WriteMonoCISpan)( ctx, n, x, y, index, mask );
}
}
}
@@ -426,7 +427,7 @@ static void multi_write_rgba_span( GLcontext *ctx, GLuint n,
_mesa_mask_rgba_span( ctx, n, x, y, rgbaTmp );
}
- (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y,
+ (*swrast->Driver.WriteRGBASpan)( ctx, n, x, y,
(const GLchan (*)[4]) rgbaTmp, mask );
if (swrast->_RasterMask & ALPHABUF_BIT) {
_mesa_write_alpha_span( ctx, n, x, y,
@@ -553,7 +554,7 @@ void _mesa_write_rgba_span( GLcontext *ctx,
}
/* write pixels */
- (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y,
+ (*swrast->Driver.WriteRGBASpan)( ctx, n, x, y,
(const GLchan (*)[4]) rgba,
write_all ? Null : mask );
@@ -693,7 +694,7 @@ void _mesa_write_monocolor_span( GLcontext *ctx,
}
/* write pixels */
- (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y,
+ (*swrast->Driver.WriteRGBASpan)( ctx, n, x, y,
(const GLchan (*)[4]) rgba,
write_all ? Null : mask );
if (swrast->_RasterMask & ALPHABUF_BIT) {
@@ -718,7 +719,7 @@ void _mesa_write_monocolor_span( GLcontext *ctx,
(const GLchan (*)[4]) rgba, mask );
}
else {
- (*ctx->Driver.WriteMonoRGBASpan)( ctx, n, x, y, color, mask );
+ (*swrast->Driver.WriteMonoRGBASpan)( ctx, n, x, y, color, mask );
if (swrast->_RasterMask & ALPHABUF_BIT) {
_mesa_write_mono_alpha_span( ctx, n, x, y, (GLchan) color[ACOMP],
write_all ? Null : mask );
@@ -887,7 +888,7 @@ void _mesa_write_texture_span( GLcontext *ctx,
_mesa_mask_rgba_span( ctx, n, x, y, rgba );
}
- (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLchan (*)[4])rgba,
+ (*swrast->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLchan (*)[4])rgba,
write_all ? Null : mask );
if (swrast->_RasterMask & ALPHABUF_BIT) {
_mesa_write_alpha_span( ctx, n, x, y, (const GLchan (*)[4]) rgba,
@@ -1042,7 +1043,7 @@ _mesa_write_multitexture_span( GLcontext *ctx,
_mesa_mask_rgba_span( ctx, n, x, y, rgba );
}
- (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLchan (*)[4])rgba,
+ (*swrast->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLchan (*)[4])rgba,
write_all ? Null : mask );
if (swrast->_RasterMask & ALPHABUF_BIT) {
_mesa_write_alpha_span( ctx, n, x, y, (const GLchan (*)[4])rgba,
@@ -1061,6 +1062,7 @@ void _mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer,
GLuint n, GLint x, GLint y,
GLchan rgba[][4] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (y < 0 || y >= buffer->Height
|| x + (GLint) n < 0 || x >= buffer->Width) {
/* completely above, below, or right */
@@ -1096,7 +1098,7 @@ void _mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer,
length = (GLint) n;
}
- (*ctx->Driver.ReadRGBASpan)( ctx, length, x + skip, y, rgba + skip );
+ (*swrast->Driver.ReadRGBASpan)( ctx, length, x + skip, y, rgba + skip );
if (buffer->UseSoftwareAlphaBuffers) {
_mesa_read_alpha_span( ctx, length, x + skip, y, rgba + skip );
}
@@ -1113,6 +1115,7 @@ void _mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer,
void _mesa_read_index_span( GLcontext *ctx, GLframebuffer *buffer,
GLuint n, GLint x, GLint y, GLuint indx[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (y < 0 || y >= buffer->Height
|| x + (GLint) n < 0 || x >= buffer->Width) {
/* completely above, below, or right */
@@ -1147,6 +1150,6 @@ void _mesa_read_index_span( GLcontext *ctx, GLframebuffer *buffer,
length = (GLint) n;
}
- (*ctx->Driver.ReadCI32Span)( ctx, length, skip + x, y, indx + skip );
+ (*swrast->Driver.ReadCI32Span)( ctx, length, skip + x, y, indx + skip );
}
}
diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c
index af782aa785..2b7bb91f73 100644
--- a/src/mesa/swrast/s_stencil.c
+++ b/src/mesa/swrast/s_stencil.c
@@ -1,4 +1,4 @@
-/* $Id: s_stencil.c,v 1.10 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_stencil.c,v 1.11 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -505,6 +505,7 @@ GLboolean
_mesa_stencil_and_ztest_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLdepth z[], GLubyte mask[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLstencil stencilRow[MAX_WIDTH];
GLstencil *stencil;
GLboolean result;
@@ -513,10 +514,10 @@ _mesa_stencil_and_ztest_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
ASSERT(n <= MAX_WIDTH);
/* Get initial stencil values */
- if (ctx->Driver.WriteStencilSpan) {
- ASSERT(ctx->Driver.ReadStencilSpan);
+ if (swrast->Driver.WriteStencilSpan) {
+ ASSERT(swrast->Driver.ReadStencilSpan);
/* Get stencil values from the hardware stencil buffer */
- (*ctx->Driver.ReadStencilSpan)(ctx, n, x, y, stencilRow);
+ (*swrast->Driver.ReadStencilSpan)(ctx, n, x, y, stencilRow);
stencil = stencilRow;
}
else {
@@ -527,9 +528,9 @@ _mesa_stencil_and_ztest_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
/* do all the stencil/depth testing/updating */
result = stencil_and_ztest_span( ctx, n, x, y, z, stencil, mask );
- if (ctx->Driver.WriteStencilSpan) {
+ if (swrast->Driver.WriteStencilSpan) {
/* Write updated stencil values into hardware stencil buffer */
- (ctx->Driver.WriteStencilSpan)(ctx, n, x, y, stencil, mask );
+ (swrast->Driver.WriteStencilSpan)(ctx, n, x, y, stencil, mask );
}
return result;
@@ -556,7 +557,7 @@ apply_stencil_op_to_pixels( const GLcontext *ctx,
const GLstencil invmask = (GLstencil) (~ctx->Stencil.WriteMask);
GLuint i;
- ASSERT(!ctx->Driver.WriteStencilSpan); /* software stencil buffer only! */
+ ASSERT(!SWRAST_CONTEXT(ctx)->Driver.WriteStencilSpan); /* software stencil buffer only! */
switch (oper) {
case GL_KEEP:
@@ -722,7 +723,7 @@ stencil_test_pixels( GLcontext *ctx, GLuint n,
GLuint i;
GLboolean allfail = GL_FALSE;
- ASSERT(!ctx->Driver.WriteStencilSpan); /* software stencil buffer only! */
+ ASSERT(!SWRAST_CONTEXT(ctx)->Driver.WriteStencilSpan); /* software stencil buffer only! */
/*
* Perform stencil test. The results of this operation are stored
@@ -910,16 +911,17 @@ _mesa_stencil_and_ztest_pixels( GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLdepth z[], GLubyte mask[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
ASSERT(ctx->Stencil.Enabled);
ASSERT(n <= PB_SIZE);
- if (ctx->Driver.WriteStencilPixels) {
+ if (swrast->Driver.WriteStencilPixels) {
/*** Hardware stencil buffer ***/
GLstencil stencil[PB_SIZE];
GLubyte origMask[PB_SIZE];
- ASSERT(ctx->Driver.ReadStencilPixels);
- (*ctx->Driver.ReadStencilPixels)(ctx, n, x, y, stencil);
+ ASSERT(swrast->Driver.ReadStencilPixels);
+ (*swrast->Driver.ReadStencilPixels)(ctx, n, x, y, stencil);
MEMCPY(origMask, mask, n * sizeof(GLubyte));
@@ -954,7 +956,7 @@ _mesa_stencil_and_ztest_pixels( GLcontext *ctx,
}
/* Write updated stencil values into hardware stencil buffer */
- (ctx->Driver.WriteStencilPixels)(ctx, n, x, y, stencil, origMask);
+ (swrast->Driver.WriteStencilPixels)(ctx, n, x, y, stencil, origMask);
return GL_TRUE;
}
@@ -1011,6 +1013,7 @@ void
_mesa_read_stencil_span( GLcontext *ctx,
GLint n, GLint x, GLint y, GLstencil stencil[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (y < 0 || y >= ctx->DrawBuffer->Height ||
x + n <= 0 || x >= ctx->DrawBuffer->Width) {
/* span is completely outside framebuffer */
@@ -1033,8 +1036,8 @@ _mesa_read_stencil_span( GLcontext *ctx,
ASSERT(n >= 0);
- if (ctx->Driver.ReadStencilSpan) {
- (*ctx->Driver.ReadStencilSpan)( ctx, (GLuint) n, x, y, stencil );
+ if (swrast->Driver.ReadStencilSpan) {
+ (*swrast->Driver.ReadStencilSpan)( ctx, (GLuint) n, x, y, stencil );
}
else if (ctx->DrawBuffer->Stencil) {
const GLstencil *s = STENCIL_ADDRESS( x, y );
@@ -1061,6 +1064,7 @@ void
_mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y,
const GLstencil stencil[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (y < 0 || y >= ctx->DrawBuffer->Height ||
x + n <= 0 || x >= ctx->DrawBuffer->Width) {
/* span is completely outside framebuffer */
@@ -1081,8 +1085,8 @@ _mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y,
return;
}
- if (ctx->Driver.WriteStencilSpan) {
- (*ctx->Driver.WriteStencilSpan)( ctx, n, x, y, stencil, NULL );
+ if (swrast->Driver.WriteStencilSpan) {
+ (*swrast->Driver.WriteStencilSpan)( ctx, n, x, y, stencil, NULL );
}
else if (ctx->DrawBuffer->Stencil) {
GLstencil *s = STENCIL_ADDRESS( x, y );
@@ -1212,8 +1216,9 @@ clear_software_stencil_buffer( GLcontext *ctx )
static void
clear_hardware_stencil_buffer( GLcontext *ctx )
{
- ASSERT(ctx->Driver.WriteStencilSpan);
- ASSERT(ctx->Driver.ReadStencilSpan);
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ ASSERT(swrast->Driver.WriteStencilSpan);
+ ASSERT(swrast->Driver.ReadStencilSpan);
if (ctx->Scissor.Enabled) {
/* clear scissor region only */
@@ -1228,11 +1233,11 @@ clear_hardware_stencil_buffer( GLcontext *ctx )
const GLstencil clearVal = (ctx->Stencil.Clear & mask);
GLstencil stencil[MAX_WIDTH];
GLint i;
- (*ctx->Driver.ReadStencilSpan)(ctx, width, x, y, stencil);
+ (*swrast->Driver.ReadStencilSpan)(ctx, width, x, y, stencil);
for (i = 0; i < width; i++) {
stencil[i] = (stencil[i] & invMask) | clearVal;
}
- (*ctx->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL);
+ (*swrast->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL);
}
}
else {
@@ -1243,7 +1248,7 @@ clear_hardware_stencil_buffer( GLcontext *ctx )
stencil[i] = ctx->Stencil.Clear;
}
for (y = ctx->DrawBuffer->_Ymin; y < ctx->DrawBuffer->_Ymax; y++) {
- (*ctx->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL);
+ (*swrast->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL);
}
}
}
@@ -1261,11 +1266,11 @@ clear_hardware_stencil_buffer( GLcontext *ctx )
for (y = 0; y < height; y++) {
GLstencil stencil[MAX_WIDTH];
GLint i;
- (*ctx->Driver.ReadStencilSpan)(ctx, width, x, y, stencil);
+ (*swrast->Driver.ReadStencilSpan)(ctx, width, x, y, stencil);
for (i = 0; i < width; i++) {
stencil[i] = (stencil[i] & invMask) | clearVal;
}
- (*ctx->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL);
+ (*swrast->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL);
}
}
else {
@@ -1279,7 +1284,7 @@ clear_hardware_stencil_buffer( GLcontext *ctx )
stencil[i] = ctx->Stencil.Clear;
}
for (y = 0; y < height; y++) {
- (*ctx->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL);
+ (*swrast->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL);
}
}
}
@@ -1293,8 +1298,9 @@ clear_hardware_stencil_buffer( GLcontext *ctx )
void
_mesa_clear_stencil_buffer( GLcontext *ctx )
{
- if (ctx->Driver.WriteStencilSpan) {
- ASSERT(ctx->Driver.ReadStencilSpan);
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ if (swrast->Driver.WriteStencilSpan) {
+ ASSERT(swrast->Driver.ReadStencilSpan);
clear_hardware_stencil_buffer(ctx);
}
else {
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index 4bf83d6bf2..066cab2f16 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -1,4 +1,4 @@
-/* $Id: s_triangle.c,v 1.19 2001/03/17 17:43:05 keithw Exp $ */
+/* $Id: s_triangle.c,v 1.20 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -26,12 +26,11 @@
/*
- * Triangle rasterizers
- * When the device driver doesn't implement triangle rasterization Mesa
- * will use these functions to draw triangles.
+ * When the device driver doesn't implement triangle rasterization it
+ * can hook in _swrast_Triangle, which eventually calls one of these
+ * functions to draw triangles.
*/
-
#include "glheader.h"
#include "context.h"
#include "colormac.h"
@@ -244,6 +243,7 @@ static void simple_textured_triangle( GLcontext *ctx,
#define S_SCALE twidth
#define T_SCALE theight
#define SETUP_CODE \
+ SWcontext *swrast = SWRAST_CONTEXT(ctx); \
struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \
GLint b = obj->BaseLevel; \
GLfloat twidth = (GLfloat) obj->Image[b]->Width; \
@@ -276,7 +276,7 @@ static void simple_textured_triangle( GLcontext *ctx,
ffs += fdsdx; \
fft += fdtdx; \
} \
- (*ctx->Driver.WriteRGBSpan)( ctx, n, LEFT, Y, \
+ (*swrast->Driver.WriteRGBSpan)( ctx, n, LEFT, Y, \
(CONST GLchan (*)[3]) rgb, NULL ); \
} \
}
@@ -304,6 +304,7 @@ static void simple_z_textured_triangle( GLcontext *ctx,
#define S_SCALE twidth
#define T_SCALE theight
#define SETUP_CODE \
+ SWcontext *swrast = SWRAST_CONTEXT(ctx); \
struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \
GLint b = obj->BaseLevel; \
GLfloat twidth = (GLfloat) obj->Image[b]->Width; \
@@ -347,7 +348,7 @@ static void simple_z_textured_triangle( GLcontext *ctx,
ffs += fdsdx; \
fft += fdtdx; \
} \
- (*ctx->Driver.WriteRGBSpan)( ctx, n, LEFT, Y, \
+ (*swrast->Driver.WriteRGBSpan)( ctx, n, LEFT, Y, \
(CONST GLchan (*)[3]) rgb, mask ); \
} \
}
diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h
index eaea8cd7e8..76453cdaef 100644
--- a/src/mesa/swrast/swrast.h
+++ b/src/mesa/swrast/swrast.h
@@ -1,4 +1,4 @@
-/* $Id: swrast.h,v 1.11 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: swrast.h,v 1.12 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -67,6 +67,7 @@ typedef struct {
} SWvertex;
+struct swrast_device_driver;
/* These are the public-access functions exported from swrast.
@@ -80,7 +81,10 @@ _swrast_CreateContext( GLcontext *ctx );
extern void
_swrast_DestroyContext( GLcontext *ctx );
-
+/* Get a (non-const) reference to the device driver struct for swrast.
+ */
+extern struct swrast_device_driver *
+_swrast_GetDeviceDriverReference( GLcontext *ctx );
extern void
_swrast_Bitmap( GLcontext *ctx,
@@ -168,4 +172,254 @@ _swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value );
extern void
_swrast_print_vertex( GLcontext *ctx, const SWvertex *v );
+
+/*
+ * Imaging fallbacks (a better solution should be found, perhaps
+ * moving all the imaging fallback code to a new module)
+ */
+void
+_swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target,
+ GLenum internalFormat,
+ GLint x, GLint y, GLsizei width,
+ GLsizei height);
+void
+_swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target,
+ GLenum internalFormat,
+ GLint x, GLint y, GLsizei width);
+void
+_swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start,
+ GLint x, GLint y, GLsizei width);
+void
+_swrast_CopyColorTable( GLcontext *ctx,
+ GLenum target, GLenum internalformat,
+ GLint x, GLint y, GLsizei width);
+
+
+/*
+ * Texture fallbacks, Brian Paul. Could also live in a new module
+ * with the rest of the texture store fallbacks?
+ */
+extern void
+_swrast_copy_teximage1d(GLcontext *ctx, GLenum target, GLint level,
+ GLenum internalFormat,
+ GLint x, GLint y, GLsizei width, GLint border);
+
+extern void
+_swrast_copy_teximage2d(GLcontext *ctx, GLenum target, GLint level,
+ GLenum internalFormat,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ GLint border);
+
+
+extern void
+_swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint x, GLint y, GLsizei width);
+
+extern void
+_swrast_copy_texsubimage2d(GLcontext *ctx,
+ GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint x, GLint y, GLsizei width, GLsizei height);
+
+extern void
+_swrast_copy_texsubimage3d(GLcontext *ctx,
+ GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint x, GLint y, GLsizei width, GLsizei height);
+
+
+
+/* The driver interface for the software rasterizer. Unless otherwise
+ * noted, all functions are mandatory.
+ */
+struct swrast_device_driver {
+
+ void (*SetReadBuffer)( GLcontext *ctx, GLframebuffer *colorBuffer,
+ GLenum buffer );
+ /*
+ * Specifies the current buffer for span/pixel reading.
+ * colorBuffer will be one of:
+ * GL_FRONT_LEFT - this buffer always exists
+ * GL_BACK_LEFT - when double buffering
+ * GL_FRONT_RIGHT - when using stereo
+ * GL_BACK_RIGHT - when using stereo and double buffering
+ */
+
+
+ /***
+ *** Functions for synchronizing access to the framebuffer:
+ ***/
+
+ void (*SpanRenderStart)(GLcontext *ctx);
+ void (*SpanRenderFinish)(GLcontext *ctx);
+ /* OPTIONAL.
+ *
+ * Called before and after all rendering operations, including DrawPixels,
+ * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands.
+ * These are a suitable place for grabbing/releasing hardware locks.
+ *
+ * NOTE: The swrast triangle/line/point routines *DO NOT* call
+ * these functions. Locking in that case must be organized by the
+ * driver by other mechanisms.
+ */
+
+ /***
+ *** Functions for writing pixels to the frame buffer:
+ ***/
+
+ void (*WriteRGBASpan)( const GLcontext *ctx,
+ GLuint n, GLint x, GLint y,
+ CONST GLchan rgba[][4], const GLubyte mask[] );
+ void (*WriteRGBSpan)( const GLcontext *ctx,
+ GLuint n, GLint x, GLint y,
+ CONST GLchan rgb[][3], const GLubyte mask[] );
+ /* Write a horizontal run of RGBA or RGB pixels.
+ * If mask is NULL, draw all pixels.
+ * If mask is not null, only draw pixel [i] when mask [i] is true.
+ */
+
+ void (*WriteMonoRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLchan color[4], const GLubyte mask[] );
+ /* Write a horizontal run of RGBA pixels all with the same color.
+ */
+
+ void (*WriteRGBAPixels)( const GLcontext *ctx,
+ GLuint n, const GLint x[], const GLint y[],
+ CONST GLchan rgba[][4], const GLubyte mask[] );
+ /* Write array of RGBA pixels at random locations.
+ */
+
+ void (*WriteMonoRGBAPixels)( const GLcontext *ctx,
+ GLuint n, const GLint x[], const GLint y[],
+ const GLchan color[4], const GLubyte mask[] );
+ /* Write an array of mono-RGBA pixels at random locations.
+ */
+
+ void (*WriteCI32Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLuint index[], const GLubyte mask[] );
+ void (*WriteCI8Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLubyte index[], const GLubyte mask[] );
+ /* Write a horizontal run of CI pixels. One function is for 32bpp
+ * indexes and the other for 8bpp pixels (the common case). You mus
+ * implement both for color index mode.
+ */
+
+ void (*WriteMonoCISpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
+ GLuint colorIndex, const GLubyte mask[] );
+ /* Write a horizontal run of color index pixels using the color index
+ * last specified by the Index() function.
+ */
+
+ void (*WriteCI32Pixels)( const GLcontext *ctx,
+ GLuint n, const GLint x[], const GLint y[],
+ const GLuint index[], const GLubyte mask[] );
+ /*
+ * Write a random array of CI pixels.
+ */
+
+ void (*WriteMonoCIPixels)( const GLcontext *ctx,
+ GLuint n, const GLint x[], const GLint y[],
+ GLuint colorIndex, const GLubyte mask[] );
+ /* Write a random array of color index pixels using the color index
+ * last specified by the Index() function.
+ */
+
+
+ /***
+ *** Functions to read pixels from frame buffer:
+ ***/
+
+ void (*ReadCI32Span)( const GLcontext *ctx,
+ GLuint n, GLint x, GLint y, GLuint index[] );
+ /* Read a horizontal run of color index pixels.
+ */
+
+ void (*ReadRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
+ GLchan rgba[][4] );
+ /* Read a horizontal run of RGBA pixels.
+ */
+
+ void (*ReadCI32Pixels)( const GLcontext *ctx,
+ GLuint n, const GLint x[], const GLint y[],
+ GLuint indx[], const GLubyte mask[] );
+ /* Read a random array of CI pixels.
+ */
+
+ void (*ReadRGBAPixels)( const GLcontext *ctx,
+ GLuint n, const GLint x[], const GLint y[],
+ GLchan rgba[][4], const GLubyte mask[] );
+ /* Read a random array of RGBA pixels.
+ */
+
+
+
+ /***
+ *** For supporting hardware Z buffers:
+ *** Either ALL or NONE of these functions must be implemented!
+ *** NOTE that Each depth value is a 32-bit GLuint. If the depth
+ *** buffer is less than 32 bits deep then the extra upperbits are zero.
+ ***/
+
+ void (*WriteDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLdepth depth[], const GLubyte mask[] );
+ /* Write a horizontal span of values into the depth buffer. Only write
+ * depth[i] value if mask[i] is nonzero.
+ */
+
+ void (*ReadDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ GLdepth depth[] );
+ /* Read a horizontal span of values from the depth buffer.
+ */
+
+
+ void (*WriteDepthPixels)( GLcontext *ctx, GLuint n,
+ const GLint x[], const GLint y[],
+ const GLdepth depth[], const GLubyte mask[] );
+ /* Write an array of randomly positioned depth values into the
+ * depth buffer. Only write depth[i] value if mask[i] is nonzero.
+ */
+
+ void (*ReadDepthPixels)( GLcontext *ctx, GLuint n,
+ const GLint x[], const GLint y[],
+ GLdepth depth[] );
+ /* Read an array of randomly positioned depth values from the depth buffer.
+ */
+
+
+
+ /***
+ *** For supporting hardware stencil buffers:
+ *** Either ALL or NONE of these functions must be implemented!
+ ***/
+
+ void (*WriteStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLstencil stencil[], const GLubyte mask[] );
+ /* Write a horizontal span of stencil values into the stencil buffer.
+ * If mask is NULL, write all stencil values.
+ * Else, only write stencil[i] if mask[i] is non-zero.
+ */
+
+ void (*ReadStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ GLstencil stencil[] );
+ /* Read a horizontal span of stencil values from the stencil buffer.
+ */
+
+ void (*WriteStencilPixels)( GLcontext *ctx, GLuint n,
+ const GLint x[], const GLint y[],
+ const GLstencil stencil[],
+ const GLubyte mask[] );
+ /* Write an array of stencil values into the stencil buffer.
+ * If mask is NULL, write all stencil values.
+ * Else, only write stencil[i] if mask[i] is non-zero.
+ */
+
+ void (*ReadStencilPixels)( GLcontext *ctx, GLuint n,
+ const GLint x[], const GLint y[],
+ GLstencil stencil[] );
+ /* Read an array of stencil values from the stencil buffer.
+ */
+};
+
+
+
#endif
diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h
index 31ad68d1bf..28ea6729de 100644
--- a/src/mesa/swrast_setup/ss_tritmp.h
+++ b/src/mesa/swrast_setup/ss_tritmp.h
@@ -1,4 +1,4 @@
-/* $Id: ss_tritmp.h,v 1.9 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: ss_tritmp.h,v 1.10 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -154,7 +154,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
-/* Need to do something with edgeflags:
+/* Need to fixup edgeflags when decomposing to triangles:
*/
static void TAG(quad)( GLcontext *ctx, GLuint v0,
GLuint v1, GLuint v2, GLuint v3 )
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index 916f14bc57..bea2e37650 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -1,4 +1,4 @@
-/* $Id: t_context.c,v 1.15 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_context.c,v 1.16 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -70,9 +70,6 @@ install_driver_callbacks( GLcontext *ctx )
ctx->Driver.MakeCurrent = _tnl_MakeCurrent;
ctx->Driver.BeginCallList = _tnl_BeginCallList;
ctx->Driver.EndCallList = _tnl_EndCallList;
-
- ctx->Driver.RenderTabElts = _tnl_render_tab_elts;
- ctx->Driver.RenderTabVerts = _tnl_render_tab_verts;
}
@@ -111,9 +108,9 @@ _tnl_CreateContext( GLcontext *ctx )
*/
_mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt );
_mesa_install_save_vtxfmt( ctx, &tnl->vtxfmt );
- ctx->Save->CallList = _mesa_save_CallList; /* fixme */
+ ctx->Save->CallList = _mesa_save_CallList;
ctx->Save->CallLists = _mesa_save_CallLists;
- ctx->Save->EvalMesh1 = _mesa_save_EvalMesh1; /* fixme */
+ ctx->Save->EvalMesh1 = _mesa_save_EvalMesh1;
ctx->Save->EvalMesh2 = _mesa_save_EvalMesh2;
ctx->Save->Begin = _tnl_save_Begin;
@@ -123,6 +120,9 @@ _tnl_CreateContext( GLcontext *ctx )
ctx->Driver.NeedFlush = FLUSH_UPDATE_CURRENT;
ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
+
+ tnl->Driver.RenderTabElts = _tnl_render_tab_elts;
+ tnl->Driver.RenderTabVerts = _tnl_render_tab_verts;
return GL_TRUE;
}
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index 22d0423d16..f7465d98a8 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -1,4 +1,4 @@
-/* $Id: t_context.h,v 1.17 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_context.h,v 1.18 2001/03/19 02:25:37 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -364,8 +364,107 @@ struct tnl_eval_store {
GLuint Elts[IMM_SIZE];
};
+
+typedef void (*points_func)( GLcontext *ctx, GLuint first, GLuint last );
+typedef void (*line_func)( GLcontext *ctx, GLuint v1, GLuint v2 );
+typedef void (*triangle_func)( GLcontext *ctx,
+ GLuint v1, GLuint v2, GLuint v3 );
+typedef void (*quad_func)( GLcontext *ctx, GLuint v1, GLuint v2,
+ GLuint v3, GLuint v4 );
+typedef void (*render_func)( GLcontext *ctx, GLuint start, GLuint count,
+ GLuint flags );
+typedef void (*interp_func)( GLcontext *ctx,
+ GLfloat t, GLuint dst, GLuint in, GLuint out,
+ GLboolean force_boundary );
+typedef void (*copy_pv_func)( GLcontext *ctx, GLuint dst, GLuint src );
+
+
+struct tnl_device_driver {
+ /***
+ *** TNL Pipeline
+ ***/
+
+ void (*PipelineStart)(GLcontext *ctx);
+ void (*PipelineFinish)(GLcontext *ctx);
+ /* Called before and after all pipeline stages.
+ * These are a suitable place for grabbing/releasing hardware locks.
+ */
+
+ /***
+ *** Rendering
+ ***/
+
+ void (*RenderStart)(GLcontext *ctx);
+ void (*RenderFinish)(GLcontext *ctx);
+ /* Called before and after all rendering operations, including DrawPixels,
+ * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands.
+ * These are a suitable place for grabbing/releasing hardware locks.
+ */
+
+ void (*RenderPrimitive)(GLcontext *ctx, GLenum mode);
+ /* Called between RednerStart() and RenderFinish() to indicate the
+ * type of primitive we're about to draw. Mode will be one of the
+ * modes accepted by glBegin().
+ */
+
+ interp_func RenderInterp;
+ copy_pv_func RenderCopyPV;
+ void (*RenderClippedPolygon)( GLcontext *ctx, const GLuint *elts, GLuint n );
+ void (*RenderClippedLine)( GLcontext *ctx, GLuint v0, GLuint v1 );
+ /* Functions to interpolate between prebuilt vertices, copy flat-shade
+ * provoking color, and to render clipped primitives.
+ */
+
+ points_func PointsFunc; /* must now respect vb->elts */
+ line_func LineFunc;
+ triangle_func TriangleFunc;
+ quad_func QuadFunc;
+ /* These functions are called in order to render points, lines,
+ * triangles and quads. These are only called via the T&L module.
+ */
+
+ render_func *RenderTabVerts;
+ render_func *RenderTabElts;
+ /* Render whole unclipped primitives (points, lines, linestrips,
+ * lineloops, etc). The tables are indexed by the GL enum of the
+ * primitive to be rendered.
+ */
+
+ void (*ResetLineStipple)( GLcontext *ctx );
+ /* Reset the hardware's line stipple counter.
+ */
+
+ void (*BuildProjectedVertices)( GLcontext *ctx,
+ GLuint start, GLuint end,
+ GLuint new_inputs);
+ /* This function is called whenever new vertices are required for
+ * rendering. The vertices in question are those n such that start
+ * <= n < end. The new_inputs parameter indicates those fields of
+ * the vertex which need to be updated, if only a partial repair of
+ * the vertex is required.
+ *
+ * This function is called only from _tnl_render_stage in tnl/t_render.c.
+ */
+
+
+ GLboolean (*MultipassFunc)( GLcontext *ctx, GLuint passno );
+ /* Driver may request additional render passes by returning GL_TRUE
+ * when this function is called. This function will be called
+ * after the first pass, and passes will be made until the function
+ * returns GL_FALSE. If no function is registered, only one pass
+ * is made.
+ *
+ * This function will be first invoked with passno == 1.
+ */
+};
+
+
typedef struct {
+ /* Driver interface.
+ */
+ struct tnl_device_driver Driver;
+
/* Track whether the module is active.
*/
GLboolean bound_exec;
@@ -386,7 +485,10 @@ typedef struct {
GLuint *tmp_primitive;
GLuint *tmp_primitive_length;
- /* Set when executing an internally generated immediate.
+ /* Set when executing an internally generated begin/end object. If
+ * such an object is encountered in a display list, it will be
+ * replayed only if the list is outside any existing begin/end
+ * objects.
*/
GLboolean ReplayHardBeginEnd;
GLenum CurrentPrimitive;
diff --git a/src/mesa/tnl/t_imm_api.c b/src/mesa/tnl/t_imm_api.c
index d6cc0ecb09..4a7ed8d94f 100644
--- a/src/mesa/tnl/t_imm_api.c
+++ b/src/mesa/tnl/t_imm_api.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_api.c,v 1.8 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_imm_api.c,v 1.9 2001/03/19 02:25:37 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -199,8 +199,6 @@ _tnl_hard_begin( GLcontext *ctx, GLenum p )
*/
ASSERT (IM->SavedBeginState == 0);
-/* ASSERT (ctx->Driver.CurrentSavePrimitive >= GL_POLYGON+1); */
-
/* Push current beginstate, to be restored later. Don't worry
* about raising errors.
*/
@@ -330,8 +328,6 @@ _tnl_end( GLcontext *ctx )
_tnl_translate_array_elts( ctx, IM, last, count );
IM->FlushElt = 0;
}
-
-/* ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; */
}
IM->BeginState = state;
diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c
index 0d43a1fbca..2cbbb4d6a4 100644
--- a/src/mesa/tnl/t_pipeline.c
+++ b/src/mesa/tnl/t_pipeline.c
@@ -1,4 +1,4 @@
-/* $Id: t_pipeline.c,v 1.14 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_pipeline.c,v 1.15 2001/03/19 02:25:37 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -132,8 +132,8 @@ void _tnl_run_pipeline( GLcontext *ctx )
ASSERT(pipe->build_state_changes == 0);
START_FAST_MATH(__tmp);
- if (ctx->Driver.PipelineStart)
- ctx->Driver.PipelineStart( ctx );
+ if (tnl->Driver.PipelineStart)
+ tnl->Driver.PipelineStart( ctx );
/* If something changes in the pipeline, tag all subsequent stages
* using this value for recalculation.
@@ -160,8 +160,8 @@ void _tnl_run_pipeline( GLcontext *ctx )
}
}
- if (ctx->Driver.PipelineFinish)
- ctx->Driver.PipelineFinish( ctx );
+ if (tnl->Driver.PipelineFinish)
+ tnl->Driver.PipelineFinish( ctx );
END_FAST_MATH(__tmp);
pipe->run_state_changes = 0;
diff --git a/src/mesa/tnl/t_vb_cliptmp.h b/src/mesa/tnl/t_vb_cliptmp.h
index 371563a6b0..6ecd1c3c60 100644
--- a/src/mesa/tnl/t_vb_cliptmp.h
+++ b/src/mesa/tnl/t_vb_cliptmp.h
@@ -1,4 +1,4 @@
-/* $Id: t_vb_cliptmp.h,v 1.9 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_vb_cliptmp.h,v 1.10 2001/03/19 02:25:37 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -122,8 +122,9 @@ static __inline void TAG(clip_line)( GLcontext *ctx,
GLuint i, GLuint j,
GLubyte mask )
{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- interp_func interp = ctx->Driver.RenderInterp;
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ struct vertex_buffer *VB = &tnl->vb;
+ interp_func interp = tnl->Driver.RenderInterp;
GLfloat (*coord)[4] = VB->ClipPtr->data;
GLuint ii = i, jj = j, p;
@@ -151,9 +152,9 @@ static __inline void TAG(clip_line)( GLcontext *ctx,
}
if ((ctx->_TriangleCaps & DD_FLATSHADE) && j != jj)
- ctx->Driver.RenderCopyPV( ctx, jj, j );
+ tnl->Driver.RenderCopyPV( ctx, jj, j );
- ctx->Driver.RenderClippedLine( ctx, ii, jj );
+ tnl->Driver.RenderClippedLine( ctx, ii, jj );
}
@@ -163,8 +164,9 @@ static __inline void TAG(clip_tri)( GLcontext *ctx,
GLuint v0, GLuint v1, GLuint v2,
GLubyte mask )
{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- interp_func interp = ctx->Driver.RenderInterp;
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ struct vertex_buffer *VB = &tnl->vb;
+ interp_func interp = tnl->Driver.RenderInterp;
GLfloat (*coord)[4] = VB->ClipPtr->data;
GLuint pv = v0;
GLuint vlist[2][MAX_CLIPPED_VERTICES];
@@ -201,11 +203,11 @@ static __inline void TAG(clip_tri)( GLcontext *ctx,
if (ctx->_TriangleCaps & DD_FLATSHADE) {
if (pv != inlist[0]) {
ASSERT( inlist[0] >= VB->FirstClipped );
- ctx->Driver.RenderCopyPV( ctx, inlist[0], pv );
+ tnl->Driver.RenderCopyPV( ctx, inlist[0], pv );
}
}
- ctx->Driver.RenderClippedPolygon( ctx, inlist, n );
+ tnl->Driver.RenderClippedPolygon( ctx, inlist, n );
}
@@ -215,8 +217,9 @@ static __inline void TAG(clip_quad)( GLcontext *ctx,
GLuint v0, GLuint v1, GLuint v2, GLuint v3,
GLubyte mask )
{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- interp_func interp = ctx->Driver.RenderInterp;
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ struct vertex_buffer *VB = &tnl->vb;
+ interp_func interp = tnl->Driver.RenderInterp;
GLfloat (*coord)[4] = VB->ClipPtr->data;
GLuint pv = v0;
GLuint vlist[2][MAX_CLIPPED_VERTICES];
@@ -253,11 +256,11 @@ static __inline void TAG(clip_quad)( GLcontext *ctx,
if (ctx->_TriangleCaps & DD_FLATSHADE) {
if (pv != inlist[0]) {
ASSERT( inlist[0] >= VB->FirstClipped );
- ctx->Driver.RenderCopyPV( ctx, inlist[0], pv );
+ tnl->Driver.RenderCopyPV( ctx, inlist[0], pv );
}
}
- ctx->Driver.RenderClippedPolygon( ctx, inlist, n );
+ tnl->Driver.RenderClippedPolygon( ctx, inlist, n );
}
#undef W
diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c
index 0cffbbb0d1..79d72e4567 100644
--- a/src/mesa/tnl/t_vb_fog.c
+++ b/src/mesa/tnl/t_vb_fog.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_fog.c,v 1.8 2001/03/12 00:48:44 gareth Exp $ */
+/* $Id: t_vb_fog.c,v 1.9 2001/03/19 02:25:37 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -135,12 +135,15 @@ static GLboolean run_fog_stage( GLcontext *ctx,
struct fog_stage_data *store = FOG_STAGE_DATA(stage);
GLvector1f *input;
- VB->FogCoordPtr = &store->fogcoord;
-
if (stage->changed_inputs == 0)
return GL_TRUE;
if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) {
+ /* fog computed from Z depth */
+ /* source = VB->ObjPtr or VB->EyePtr coords */
+ /* dest = VB->FogCoordPtr = fog stage private storage */
+ VB->FogCoordPtr = &store->fogcoord;
+
if (!ctx->_NeedEyeCoords) {
GLfloat *m = ctx->ModelView.m;
GLfloat plane[4];
@@ -174,8 +177,13 @@ static GLboolean run_fog_stage( GLcontext *ctx,
input->stride = VB->EyePtr->stride;
input->count = VB->EyePtr->count;
}
- } else
+ } else {
+ /* use glFogCoord() coordinates */
+ /* source = VB->FogCoordPtr */
input = VB->FogCoordPtr;
+ /* dest = fog stage private storage */
+ VB->FogCoordPtr = &store->fogcoord;
+ }
make_win_fog_coords( ctx, VB->FogCoordPtr, input );
return GL_TRUE;
diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c
index 03c8943de1..95bc403e70 100644
--- a/src/mesa/tnl/t_vb_render.c
+++ b/src/mesa/tnl/t_vb_render.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_render.c,v 1.15 2001/03/12 00:48:44 gareth Exp $ */
+/* $Id: t_vb_render.c,v 1.16 2001/03/19 02:25:37 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -123,7 +123,7 @@ do { \
/* Vertices, with the possibility of clipping.
*/
#define RENDER_POINTS( start, count ) \
- ctx->Driver.PointsFunc( ctx, start, count )
+ tnl->Driver.PointsFunc( ctx, start, count )
#define RENDER_LINE( v1, v2 ) \
do { \
@@ -157,21 +157,22 @@ do { \
} while (0)
-#define LOCAL_VARS \
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; \
- const GLuint * const elt = VB->Elts; \
- const GLubyte *mask = VB->ClipMask; \
- const GLuint sz = VB->ClipPtr->size; \
- const line_func LineFunc = ctx->Driver.LineFunc; \
- const triangle_func TriangleFunc = ctx->Driver.TriangleFunc; \
- const quad_func QuadFunc = ctx->Driver.QuadFunc; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) (LineFunc && TriangleFunc && QuadFunc); \
- (void) elt; (void) mask; (void) sz; (void) stipple;
+#define LOCAL_VARS \
+ TNLcontext *tnl = TNL_CONTEXT(ctx); \
+ struct vertex_buffer *VB = &tnl->vb; \
+ const GLuint * const elt = VB->Elts; \
+ const GLubyte *mask = VB->ClipMask; \
+ const GLuint sz = VB->ClipPtr->size; \
+ const line_func LineFunc = tnl->Driver.LineFunc; \
+ const triangle_func TriangleFunc = tnl->Driver.TriangleFunc; \
+ const quad_func QuadFunc = tnl->Driver.QuadFunc; \
+ const GLboolean stipple = ctx->Line.StippleFlag; \
+ (void) (LineFunc && TriangleFunc && QuadFunc); \
+ (void) elt; (void) mask; (void) sz; (void) stipple;
#define TAG(x) clip_##x##_verts
-#define INIT(x) ctx->Driver.RenderPrimitive( ctx, x )
-#define RESET_STIPPLE if (stipple) ctx->Driver.ResetLineStipple( ctx )
+#define INIT(x) tnl->Driver.RenderPrimitive( ctx, x )
+#define RESET_STIPPLE if (stipple) tnl->Driver.ResetLineStipple( ctx )
#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE
#define PRESERVE_VB_DEFS
#include "t_vb_rendertmp.h"
@@ -193,15 +194,16 @@ static void clip_elt_triangles( GLcontext *ctx,
GLuint count,
GLuint flags )
{
- GLuint j;
- GLuint last = count-2;
- render_func render_tris = ctx->Driver.RenderTabElts[GL_TRIANGLES];
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ render_func render_tris = tnl->Driver.RenderTabElts[GL_TRIANGLES];
+ struct vertex_buffer *VB = &tnl->vb;
const GLuint * const elt = VB->Elts;
GLubyte *mask = VB->ClipMask;
+ GLuint last = count-2;
+ GLuint j;
(void) flags;
- ctx->Driver.RenderPrimitive( ctx, GL_TRIANGLES );
+ tnl->Driver.RenderPrimitive( ctx, GL_TRIANGLES );
for (j=start; j < last; j+=3 ) {
GLubyte c1 = mask[elt[j]];
@@ -233,7 +235,7 @@ static void clip_elt_triangles( GLcontext *ctx,
/* Vertices, no clipping.
*/
#define RENDER_POINTS( start, count ) \
- ctx->Driver.PointsFunc( ctx, start, count )
+ tnl->Driver.PointsFunc( ctx, start, count )
#define RENDER_LINE( v1, v2 ) \
LineFunc( ctx, v1, v2 )
@@ -246,18 +248,19 @@ static void clip_elt_triangles( GLcontext *ctx,
#define TAG(x) _tnl_##x##_verts
-#define LOCAL_VARS \
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; \
- const GLuint * const elt = VB->Elts; \
- const line_func LineFunc = ctx->Driver.LineFunc; \
- const triangle_func TriangleFunc = ctx->Driver.TriangleFunc; \
- const quad_func QuadFunc = ctx->Driver.QuadFunc; \
- (void) (LineFunc && TriangleFunc && QuadFunc); \
- (void) elt;
-
-#define RESET_STIPPLE ctx->Driver.ResetLineStipple( ctx )
+#define LOCAL_VARS \
+ TNLcontext *tnl = TNL_CONTEXT(ctx); \
+ struct vertex_buffer *VB = &tnl->vb; \
+ const GLuint * const elt = VB->Elts; \
+ const line_func LineFunc = tnl->Driver.LineFunc; \
+ const triangle_func TriangleFunc = tnl->Driver.TriangleFunc; \
+ const quad_func QuadFunc = tnl->Driver.QuadFunc; \
+ (void) (LineFunc && TriangleFunc && QuadFunc); \
+ (void) elt;
+
+#define RESET_STIPPLE tnl->Driver.ResetLineStipple( ctx )
#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE
-#define INIT(x) ctx->Driver.RenderPrimitive( ctx, x )
+#define INIT(x) tnl->Driver.RenderPrimitive( ctx, x )
#define RENDER_TAB_QUALIFIER
#define PRESERVE_VB_DEFS
#include "t_vb_rendertmp.h"
@@ -292,28 +295,31 @@ static GLboolean run_render( GLcontext *ctx,
* that window coordinates are guarenteed not to change before
* rendering.
*/
- ctx->Driver.RenderStart( ctx );
-
- ASSERT(ctx->Driver.BuildProjectedVertices);
- ASSERT(ctx->Driver.RenderPrimitive);
- ASSERT(ctx->Driver.PointsFunc);
- ASSERT(ctx->Driver.LineFunc);
- ASSERT(ctx->Driver.TriangleFunc);
- ASSERT(ctx->Driver.QuadFunc);
- ASSERT(ctx->Driver.ResetLineStipple);
- ASSERT(ctx->Driver.RenderInterp);
- ASSERT(ctx->Driver.RenderCopyPV);
- ASSERT(ctx->Driver.RenderClippedLine);
- ASSERT(ctx->Driver.RenderClippedPolygon);
-
- ctx->Driver.BuildProjectedVertices( ctx, 0, VB->Count, new_inputs );
+ ASSERT(tnl->Driver.RenderStart);
+
+ tnl->Driver.RenderStart( ctx );
+
+ ASSERT(tnl->Driver.BuildProjectedVertices);
+ ASSERT(tnl->Driver.RenderPrimitive);
+ ASSERT(tnl->Driver.PointsFunc);
+ ASSERT(tnl->Driver.LineFunc);
+ ASSERT(tnl->Driver.TriangleFunc);
+ ASSERT(tnl->Driver.QuadFunc);
+ ASSERT(tnl->Driver.ResetLineStipple);
+ ASSERT(tnl->Driver.RenderInterp);
+ ASSERT(tnl->Driver.RenderCopyPV);
+ ASSERT(tnl->Driver.RenderClippedLine);
+ ASSERT(tnl->Driver.RenderClippedPolygon);
+ ASSERT(tnl->Driver.RenderFinish);
+
+ tnl->Driver.BuildProjectedVertices( ctx, 0, VB->Count, new_inputs );
if (VB->ClipOrMask) {
tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts;
clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles;
}
else {
- tab = VB->Elts ? ctx->Driver.RenderTabElts : ctx->Driver.RenderTabVerts;
+ tab = VB->Elts ? tnl->Driver.RenderTabElts : tnl->Driver.RenderTabVerts;
}
do
@@ -328,11 +334,11 @@ static GLboolean run_render( GLcontext *ctx,
if (length)
tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
}
- } while (ctx->Driver.MultipassFunc &&
- ctx->Driver.MultipassFunc( ctx, ++pass ));
+ } while (tnl->Driver.MultipassFunc &&
+ tnl->Driver.MultipassFunc( ctx, ++pass ));
- ctx->Driver.RenderFinish( ctx );
+ tnl->Driver.RenderFinish( ctx );
return GL_FALSE; /* finished the pipe */
}