summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2001-01-29 20:47:39 +0000
committerKeith Whitwell <[email protected]>2001-01-29 20:47:39 +0000
commit5c1e7fa6ee72f4403d9ec9d12830dd689b966e71 (patch)
tree8cb11c26af178632b05de9c5b2f53c32331475c5 /src/mesa/main
parent4b90e68ac6d0fe4ffca5e2cd51794bb4350cac28 (diff)
Removed knowledge of swrast Clear/Bitmap/Accum/Draw/Read/CopyPixels
functions from core mesa -- if drivers need these fallbacks they must now call them themselves. Introduced hooks for clip-vertex-interpolation and the rendering of clipped lines and polygons. Allows drivers to interpolate their hardware-format vertices directly. Used in dri drivers to replace fastpath code. Slight optimizations to pipeline build/run routines.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/Makefile.X1173
-rw-r--r--src/mesa/main/accum.c7
-rw-r--r--src/mesa/main/buffers.c26
-rw-r--r--src/mesa/main/dd.h71
-rw-r--r--src/mesa/main/drawpix.c14
-rw-r--r--src/mesa/main/mtypes.h6
-rw-r--r--src/mesa/main/texobj.c15
-rw-r--r--src/mesa/main/texstate.c3
8 files changed, 99 insertions, 116 deletions
diff --git a/src/mesa/main/Makefile.X11 b/src/mesa/main/Makefile.X11
index afcffbb6cc0..8c9146b0f27 100644
--- a/src/mesa/main/Makefile.X11
+++ b/src/mesa/main/Makefile.X11
@@ -1,4 +1,4 @@
-# $Id: Makefile.X11,v 1.40 2001/01/24 00:04:58 brianp Exp $
+# $Id: Makefile.X11,v 1.41 2001/01/29 20:47:39 keithw Exp $
# Mesa 3-D graphics library
# Version: 3.5
@@ -21,6 +21,32 @@ LIBDIR = ../lib
CORE_SOURCES = \
+ tnl/t_array_api.c \
+ tnl/t_array_import.c \
+ tnl/t_context.c \
+ tnl/t_eval_api.c \
+ tnl/t_imm_alloc.c \
+ tnl/t_imm_api.c \
+ tnl/t_imm_debug.c \
+ tnl/t_imm_dlist.c \
+ tnl/t_imm_elt.c \
+ tnl/t_imm_eval.c \
+ tnl/t_imm_exec.c \
+ tnl/t_imm_fixup.c \
+ tnl/t_pipeline.c \
+ tnl/t_vb_fog.c \
+ tnl/t_vb_light.c \
+ tnl/t_vb_material.c \
+ tnl/t_vb_normals.c \
+ tnl/t_vb_points.c \
+ tnl/t_vb_render.c \
+ tnl/t_vb_texgen.c \
+ tnl/t_vb_texmat.c \
+ tnl/t_vb_vertex.c \
+ swrast_setup/ss_context.c \
+ swrast_setup/ss_triangle.c \
+ swrast_setup/ss_vb.c \
+ swrast_setup/ss_interp.c \
api_loopback.c \
api_noop.c \
api_validate.c \
@@ -86,6 +112,15 @@ CORE_SOURCES = \
X86/common_x86.c \
X86/3dnow.c \
X86/katmai.c \
+ math/m_debug_xform.c \
+ math/m_eval.c \
+ math/m_matrix.c \
+ math/m_translate.c \
+ math/m_vector.c \
+ math/m_vertices.c \
+ math/m_xform.c \
+ array_cache/ac_context.c \
+ array_cache/ac_import.c \
swrast/s_aaline.c \
swrast/s_aatriangle.c \
swrast/s_accum.c \
@@ -114,41 +149,7 @@ CORE_SOURCES = \
swrast/s_stencil.c \
swrast/s_texture.c \
swrast/s_triangle.c \
- swrast/s_zoom.c \
- swrast_setup/ss_context.c \
- swrast_setup/ss_triangle.c \
- swrast_setup/ss_vb.c \
- math/m_debug_xform.c \
- math/m_eval.c \
- math/m_matrix.c \
- math/m_translate.c \
- math/m_vector.c \
- math/m_vertices.c \
- math/m_xform.c \
- array_cache/ac_context.c \
- array_cache/ac_import.c \
- tnl/t_array_api.c \
- tnl/t_array_import.c \
- tnl/t_context.c \
- tnl/t_eval_api.c \
- tnl/t_imm_alloc.c \
- tnl/t_imm_api.c \
- tnl/t_imm_debug.c \
- tnl/t_imm_dlist.c \
- tnl/t_imm_elt.c \
- tnl/t_imm_eval.c \
- tnl/t_imm_exec.c \
- tnl/t_imm_fixup.c \
- tnl/t_pipeline.c \
- tnl/t_vb_fog.c \
- tnl/t_vb_light.c \
- tnl/t_vb_material.c \
- tnl/t_vb_normals.c \
- tnl/t_vb_points.c \
- tnl/t_vb_render.c \
- tnl/t_vb_texgen.c \
- tnl/t_vb_texmat.c \
- tnl/t_vb_vertex.c
+ swrast/s_zoom.c
DRIVER_SOURCES = \
diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c
index 1d8d810a395..59d3d595271 100644
--- a/src/mesa/main/accum.c
+++ b/src/mesa/main/accum.c
@@ -1,4 +1,4 @@
-/* $Id: accum.c,v 1.34 2001/01/23 23:39:36 brianp Exp $ */
+/* $Id: accum.c,v 1.35 2001/01/29 20:47:39 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -35,7 +35,6 @@
#include "mem.h"
#include "state.h"
#include "mtypes.h"
-#include "swrast/swrast.h"
#endif
@@ -92,7 +91,5 @@ _mesa_Accum( GLenum op, GLfloat value )
height = ctx->DrawBuffer->Height;
}
- if (!ctx->Driver.Accum ||
- !ctx->Driver.Accum( ctx, op, value, xpos, ypos, width, height ))
- _swrast_Accum( ctx, op, value, xpos, ypos, width, height );
+ ctx->Driver.Accum( ctx, op, value, xpos, ypos, width, height );
}
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 0699e74b90d..b08804a7967 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -1,4 +1,4 @@
-/* $Id: buffers.c,v 1.24 2001/01/24 00:04:58 brianp Exp $ */
+/* $Id: buffers.c,v 1.25 2001/01/29 20:47:39 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -41,7 +41,6 @@
#include "stencil.h"
#include "state.h"
#include "mtypes.h"
-#include "swrast/swrast.h"
#endif
@@ -126,25 +125,8 @@ _mesa_Clear( GLbitfield mask )
}
ASSERT(ctx->Driver.Clear);
- newMask = (*ctx->Driver.Clear)( ctx, ddMask, !ctx->Scissor.Enabled,
- x, y, width, height );
-
-#ifdef DEBUG
- {
- GLbitfield legalBits = DD_FRONT_LEFT_BIT |
- DD_FRONT_RIGHT_BIT |
- DD_BACK_LEFT_BIT |
- DD_BACK_RIGHT_BIT |
- DD_DEPTH_BIT |
- DD_STENCIL_BIT |
- DD_ACCUM_BIT;
- assert((newMask & (~legalBits)) == 0);
- }
-#endif
-
- if (newMask)
- _swrast_Clear( ctx, newMask, !ctx->Scissor.Enabled,
- x, y, width, height );
+ ctx->Driver.Clear( ctx, ddMask, !ctx->Scissor.Enabled,
+ x, y, width, height );
}
}
@@ -387,5 +369,5 @@ _mesa_ResizeBuffersMESA( void )
ctx->DrawBuffer->Width = buf_width;
ctx->DrawBuffer->Height = buf_height;
- _swrast_alloc_buffers( ctx );
+ ctx->Driver.ResizeBuffersMESA( ctx );
}
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index e529cdde2ba..542f866ff67 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1,4 +1,4 @@
-/* $Id: dd.h,v 1.48 2001/01/24 00:04:58 brianp Exp $ */
+/* $Id: dd.h,v 1.49 2001/01/29 20:47:39 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -137,6 +137,12 @@ typedef void (*quad_func)( GLcontext *ctx, GLuint v1, GLuint v2,
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.
@@ -161,13 +167,11 @@ struct dd_function_table {
* LineFunc, or TriangleFunc).
*/
- GLbitfield (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint x, GLint y, GLint width, GLint height );
+ void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all,
+ GLint x, GLint y, GLint width, GLint height );
/* Clear the color/depth/stencil/accum buffer(s).
* 'mask' is a bitmask of the DD_*_BIT values defined above that indicates
- * which buffers need to be cleared. The driver should clear those
- * buffers then return a new bitmask indicating which buffers should be
- * cleared by software Mesa.
+ * which buffers need to be cleared.
* If 'all' is true then the clear the whole buffer, else clear only the
* region defined by (x,y,width,height).
* This function must obey the glColorMask, glIndexMask and glStencilMask
@@ -395,8 +399,8 @@ struct dd_function_table {
/***
*** For hardware accumulation buffer:
***/
- GLboolean (*Accum)( GLcontext *ctx, GLenum op, GLfloat value,
- GLint xpos, GLint ypos, GLint width, GLint height );
+ void (*Accum)( GLcontext *ctx, GLenum op, GLfloat value,
+ GLint xpos, GLint ypos, GLint width, GLint height );
/* Execute glAccum command within the given scissor region.
*/
@@ -405,48 +409,44 @@ struct dd_function_table {
*** glDraw/Read/CopyPixels and glBitmap functions:
***/
- GLboolean (*DrawPixels)( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels );
+ void (*DrawPixels)( GLcontext *ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const struct gl_pixelstore_attrib *unpack,
+ const GLvoid *pixels );
/* This is called by glDrawPixels.
* 'unpack' describes how to unpack the source image data.
- * Return GL_TRUE if the driver succeeds, return GL_FALSE if core Mesa
- * must do the job.
*/
- GLboolean (*ReadPixels)( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- GLvoid *dest );
+ void (*ReadPixels)( GLcontext *ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const struct gl_pixelstore_attrib *unpack,
+ GLvoid *dest );
/* Called by glReadPixels.
- * Return GL_TRUE if operation completed, else return GL_FALSE.
- * This function must respect all glPixelTransfer settings.
*/
- GLboolean (*CopyPixels)( GLcontext *ctx,
+ void (*CopyPixels)( GLcontext *ctx,
GLint srcx, GLint srcy,
GLsizei width, GLsizei height,
GLint dstx, GLint dsty, GLenum type );
- /* Do a glCopyPixels. Return GL_TRUE if operation completed, else
- * return GL_FALSE. This function must respect all rasterization
+ /* Do a glCopyPixels. This function must respect all rasterization
* state, glPixelTransfer, glPixelZoom, etc.
*/
- GLboolean (*Bitmap)( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap );
+ void (*Bitmap)( GLcontext *ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ const struct gl_pixelstore_attrib *unpack,
+ const GLubyte *bitmap );
/* This is called by glBitmap. Works the same as DrawPixels, above.
*/
+ void (*ResizeBuffersMESA)( GLcontext *ctx );
+
/***
*** Texture image functions:
***/
-
GLboolean (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing,
@@ -701,6 +701,10 @@ struct dd_function_table {
/* Called by glBindTexture().
*/
+ void (*CreateTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
+ /* Called when a texture object is created.
+ */
+
void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
/* Called when a texture object is about to be deallocated. Driver
* should free anything attached to the DriverData pointers.
@@ -836,6 +840,13 @@ struct dd_function_table {
* 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
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index 661a41bc2cf..618c41a5b47 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -1,4 +1,4 @@
-/* $Id: drawpix.c,v 1.47 2000/12/26 05:09:28 keithw Exp $ */
+/* $Id: drawpix.c,v 1.48 2001/01/29 20:47:39 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -38,7 +38,6 @@
#include "mmath.h"
#include "state.h"
#include "mtypes.h"
-#include "swrast/swrast.h"
#endif
@@ -72,15 +71,8 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
/* see if device driver can do the drawpix */
RENDER_START(ctx);
-
- if (ctx->Driver.DrawPixels
- && (*ctx->Driver.DrawPixels)(ctx, x, y, width, height, format, type,
- &ctx->Unpack, pixels)) {
- /* finished */
- } else
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- &ctx->Unpack, pixels );
-
+ ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type,
+ &ctx->Unpack, pixels);
RENDER_FINISH(ctx);
}
else if (ctx->RenderMode==GL_FEEDBACK) {
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index a4b7b3afab6..bc9eee71994 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.16 2001/01/24 04:56:20 brianp Exp $ */
+/* $Id: mtypes.h,v 1.17 2001/01/29 20:47:39 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -498,9 +498,9 @@ struct gl_light_attrib {
};
+#define LIGHT_SPOT 0x1
+#define LIGHT_LOCAL_VIEWER 0x2
#define LIGHT_POSITIONAL 0x4
-#define LIGHT_SPOT 0x10
-#define LIGHT_LOCAL_VIEWER 0x20
#define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER)
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 1204668dc35..0ce694ae1d7 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1,4 +1,4 @@
-/* $Id: texobj.c,v 1.37 2000/12/26 05:09:29 keithw Exp $ */
+/* $Id: texobj.c,v 1.38 2001/01/29 20:47:39 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -54,8 +54,8 @@
* Return: pointer to new texture object
*/
struct gl_texture_object *
-_mesa_alloc_texture_object( struct gl_shared_state *shared, GLuint name,
- GLuint dimensions)
+_mesa_alloc_texture_object( struct gl_shared_state *shared,
+ GLuint name, GLuint dimensions )
{
struct gl_texture_object *obj;
@@ -177,7 +177,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
struct gl_texture_object *t )
{
const GLint baseLevel = t->BaseLevel;
- GLint maxLog2;
+ GLint maxLog2 = 0;
t->Complete = GL_TRUE; /* be optimistic */
@@ -446,7 +446,7 @@ _mesa_GenTextures( GLsizei n, GLuint *texName )
for (i=0;i<n;i++) {
GLuint name = first + i;
GLuint dims = 0;
- (void) _mesa_alloc_texture_object(ctx->Shared, name, dims);
+ (void) _mesa_alloc_texture_object( ctx->Shared, name, dims);
}
_glthread_UNLOCK_MUTEX(GenTexturesLock);
@@ -522,7 +522,7 @@ _mesa_BindTexture( GLenum target, GLuint texName )
GLuint unit = ctx->Texture.CurrentUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
struct gl_texture_object *oldTexObj;
- struct gl_texture_object *newTexObj;
+ struct gl_texture_object *newTexObj = 0;
GLuint targetDim;
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -594,7 +594,8 @@ _mesa_BindTexture( GLenum target, GLuint texName )
}
else {
/* if this is a new texture id, allocate a texture object now */
- newTexObj = _mesa_alloc_texture_object(ctx->Shared, texName, targetDim);
+ newTexObj = _mesa_alloc_texture_object( ctx->Shared, texName,
+ targetDim);
if (!newTexObj) {
gl_error(ctx, GL_OUT_OF_MEMORY, "glBindTexture");
return;
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index ced3940b651..edd382a76f0 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -1,4 +1,4 @@
-/* $Id: texstate.c,v 1.28 2001/01/24 00:04:58 brianp Exp $ */
+/* $Id: texstate.c,v 1.29 2001/01/29 20:47:39 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -41,7 +41,6 @@
#include "mtypes.h"
#include "math/m_xform.h"
#include "math/m_matrix.h"
-#include "swrast/swrast.h"
#endif