summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/api_noop.c2
-rw-r--r--src/mesa/main/arrayobj.c9
-rw-r--r--src/mesa/main/attrib.c17
-rw-r--r--src/mesa/main/bufferobj.c4
-rw-r--r--src/mesa/main/colortab.c4
-rw-r--r--src/mesa/main/context.c20
-rw-r--r--src/mesa/main/dlist.c53
-rw-r--r--src/mesa/main/enable.c93
-rw-r--r--src/mesa/main/enums.c2
-rw-r--r--src/mesa/main/extensions.c2
-rw-r--r--src/mesa/main/get.c6
-rw-r--r--src/mesa/main/get_gen.py2
-rw-r--r--src/mesa/main/glheader.h12
-rw-r--r--src/mesa/main/image.c8
-rw-r--r--src/mesa/main/imports.c264
-rw-r--r--src/mesa/main/imports.h30
-rw-r--r--src/mesa/main/light.c14
-rw-r--r--src/mesa/main/light.h3
-rw-r--r--src/mesa/main/lines.c23
-rw-r--r--src/mesa/main/matrix.c2
-rw-r--r--src/mesa/main/mipmap.c3
-rw-r--r--src/mesa/main/mtypes.h21
-rw-r--r--src/mesa/main/points.c41
-rw-r--r--src/mesa/main/points.h3
-rw-r--r--src/mesa/main/polygon.c39
-rw-r--r--src/mesa/main/polygon.h7
-rw-r--r--src/mesa/main/state.c102
-rw-r--r--src/mesa/main/stencil.c90
-rw-r--r--src/mesa/main/texcompress_s3tc.c2
-rw-r--r--src/mesa/main/texobj.c6
-rw-r--r--src/mesa/main/texstore.c3
-rw-r--r--src/mesa/main/version.h14
32 files changed, 334 insertions, 567 deletions
diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c
index 33d44e43296..0c1a35361f1 100644
--- a/src/mesa/main/api_noop.c
+++ b/src/mesa/main/api_noop.c
@@ -45,7 +45,7 @@
static void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b )
{
GET_CURRENT_CONTEXT(ctx);
- ctx->Current.EdgeFlag = b;
+ ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] = (GLfloat)b;
}
static void GLAPIENTRY _mesa_noop_Indexf( GLfloat f )
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 852b9aaee98..d601ee461e6 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -114,40 +114,34 @@ _mesa_initialize_array_object( GLcontext *ctx,
obj->Vertex.StrideB = 0;
obj->Vertex.Ptr = NULL;
obj->Vertex.Enabled = GL_FALSE;
- obj->Vertex.Flags = CA_CLIENT_DATA;
obj->Normal.Type = GL_FLOAT;
obj->Normal.Stride = 0;
obj->Normal.StrideB = 0;
obj->Normal.Ptr = NULL;
obj->Normal.Enabled = GL_FALSE;
- obj->Normal.Flags = CA_CLIENT_DATA;
obj->Color.Size = 4;
obj->Color.Type = GL_FLOAT;
obj->Color.Stride = 0;
obj->Color.StrideB = 0;
obj->Color.Ptr = NULL;
obj->Color.Enabled = GL_FALSE;
- obj->Color.Flags = CA_CLIENT_DATA;
obj->SecondaryColor.Size = 4;
obj->SecondaryColor.Type = GL_FLOAT;
obj->SecondaryColor.Stride = 0;
obj->SecondaryColor.StrideB = 0;
obj->SecondaryColor.Ptr = NULL;
obj->SecondaryColor.Enabled = GL_FALSE;
- obj->SecondaryColor.Flags = CA_CLIENT_DATA;
obj->FogCoord.Size = 1;
obj->FogCoord.Type = GL_FLOAT;
obj->FogCoord.Stride = 0;
obj->FogCoord.StrideB = 0;
obj->FogCoord.Ptr = NULL;
obj->FogCoord.Enabled = GL_FALSE;
- obj->FogCoord.Flags = CA_CLIENT_DATA;
obj->Index.Type = GL_FLOAT;
obj->Index.Stride = 0;
obj->Index.StrideB = 0;
obj->Index.Ptr = NULL;
obj->Index.Enabled = GL_FALSE;
- obj->Index.Flags = CA_CLIENT_DATA;
for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
obj->TexCoord[i].Size = 4;
obj->TexCoord[i].Type = GL_FLOAT;
@@ -155,13 +149,11 @@ _mesa_initialize_array_object( GLcontext *ctx,
obj->TexCoord[i].StrideB = 0;
obj->TexCoord[i].Ptr = NULL;
obj->TexCoord[i].Enabled = GL_FALSE;
- obj->TexCoord[i].Flags = CA_CLIENT_DATA;
}
obj->EdgeFlag.Stride = 0;
obj->EdgeFlag.StrideB = 0;
obj->EdgeFlag.Ptr = NULL;
obj->EdgeFlag.Enabled = GL_FALSE;
- obj->EdgeFlag.Flags = CA_CLIENT_DATA;
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
obj->VertexAttrib[i].Size = 4;
obj->VertexAttrib[i].Type = GL_FLOAT;
@@ -170,7 +162,6 @@ _mesa_initialize_array_object( GLcontext *ctx,
obj->VertexAttrib[i].Ptr = NULL;
obj->VertexAttrib[i].Enabled = GL_FALSE;
obj->VertexAttrib[i].Normalized = GL_FALSE;
- obj->VertexAttrib[i].Flags = CA_CLIENT_DATA;
}
#if FEATURE_ARB_vertex_buffer_object
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 9993a0021bc..2b1a35f3de3 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5.2
+ * Version: 6.5.3
*
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -1285,6 +1285,12 @@ _mesa_PushClientAttrib(GLbitfield mask)
attr = MALLOC_STRUCT( gl_array_attrib );
obj = MALLOC_STRUCT( gl_array_object );
+#if FEATURE_ARB_vertex_buffer_object
+ /* increment ref counts since we're copying pointers to these objects */
+ ctx->Array.ArrayBufferObj->RefCount++;
+ ctx->Array.ElementArrayBufferObj->RefCount++;
+#endif
+
MEMCPY( attr, &ctx->Array, sizeof(struct gl_array_attrib) );
MEMCPY( obj, ctx->Array.ArrayObj, sizeof(struct gl_array_object) );
@@ -1359,6 +1365,13 @@ _mesa_PopClientAttrib(void)
_mesa_BindVertexArrayAPPLE( data->ArrayObj->Name );
+#if FEATURE_ARB_vertex_buffer_object
+ _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB,
+ data->ArrayBufferObj->Name);
+ _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
+ data->ElementArrayBufferObj->Name);
+#endif
+
MEMCPY( ctx->Array.ArrayObj, data->ArrayObj,
sizeof( struct gl_array_object ) );
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 3f9f7985465..009055a6ab6 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -119,7 +119,7 @@ buffer_object_subdata_range_good( GLcontext * ctx, GLenum target,
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller);
return NULL;
}
- if ((GLuint) (offset + size) > bufObj->Size) {
+ if (offset + size > bufObj->Size) {
_mesa_error(ctx, GL_INVALID_VALUE,
"%s(size + offset > buffer size)", caller);
return NULL;
@@ -297,7 +297,7 @@ _mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
(void) ctx; (void) target;
/* this should have been caught in _mesa_BufferSubData() */
- ASSERT((GLuint) (size + offset) <= bufObj->Size);
+ ASSERT(size + offset <= bufObj->Size);
if (bufObj->Data) {
_mesa_memcpy( (GLubyte *) bufObj->Data + offset, data, size );
diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c
index e9349516eb8..9fb0baf4a7c 100644
--- a/src/mesa/main/colortab.c
+++ b/src/mesa/main/colortab.c
@@ -472,8 +472,8 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
_mesa_free_colortable_data(table);
if (width > 0) {
- table->TableF = _mesa_malloc(comps * width * sizeof(GLfloat));
- table->TableUB = _mesa_malloc(comps * width * sizeof(GLubyte));
+ table->TableF = (GLfloat *) _mesa_malloc(comps * width * sizeof(GLfloat));
+ table->TableUB = (GLubyte *) _mesa_malloc(comps * width * sizeof(GLubyte));
if (!table->TableF || !table->TableUB) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glColorTable");
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index eb5a0318dea..9b043488068 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -292,13 +292,8 @@ _mesa_forceCurrent(__GLcontext *gc)
GLboolean
_mesa_notifyResize(__GLcontext *gc)
{
- GLint x, y;
- GLuint width, height;
- __GLdrawablePrivate *d = gc->imports.getDrawablePrivate(gc);
- if (!d || !d->getDrawableSize)
- return GL_FALSE;
- d->getDrawableSize( d, &x, &y, &width, &height );
/* update viewport, resize software buffers, etc. */
+ (void) gc;
return GL_TRUE;
}
@@ -990,9 +985,8 @@ _mesa_init_current(GLcontext *ctx)
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], 0.0, 0.0, 1.0, 1.0 );
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], 1.0, 1.0, 1.0, 1.0 );
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR1], 0.0, 0.0, 0.0, 1.0 );
- ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_FOG], 0.0, 0.0, 0.0, 0.0 );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0] = 1.0;
- ctx->Current.EdgeFlag = GL_TRUE;
+ ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX], 1.0, 0.0, 0.0, 1.0 );
+ ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG], 1.0, 0.0, 0.0, 1.0 );
}
@@ -1093,14 +1087,8 @@ _mesa_init_constants(GLcontext *ctx)
ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES;
ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH;
- /* If we're running in the X server, do bounds checking to prevent
- * segfaults and server crashes!
- */
-#if defined(XFree86Server)
- ctx->Const.CheckArrayBounds = GL_TRUE;
-#else
+ /* CheckArrayBounds is overriden by drivers/x11 for X server */
ctx->Const.CheckArrayBounds = GL_FALSE;
-#endif
/* GL_ARB_draw_buffers */
ctx->Const.MaxDrawBuffers = MAX_DRAW_BUFFERS;
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index dca6ede6cb3..49bc2933bf5 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -343,8 +343,6 @@ typedef enum
OPCODE_ATTR_3F_ARB,
OPCODE_ATTR_4F_ARB,
OPCODE_MATERIAL,
- OPCODE_INDEX,
- OPCODE_EDGEFLAG,
OPCODE_BEGIN,
OPCODE_END,
OPCODE_RECTF,
@@ -4476,7 +4474,7 @@ save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
if (count > 0) {
- unsigned i;
+ GLint i;
const GLfloat * p = params;
for (i = 0 ; i < count ; i++) {
@@ -4710,7 +4708,7 @@ save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
if (count > 0) {
- unsigned i;
+ GLint i;
const GLfloat * p = params;
for (i = 0 ; i < count ; i++) {
@@ -5110,45 +5108,19 @@ save_EvalPoint2(GLint x, GLint y)
static void GLAPIENTRY
save_Indexf(GLfloat x)
{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- SAVE_FLUSH_VERTICES(ctx);
- n = ALLOC_INSTRUCTION(ctx, OPCODE_INDEX, 1);
- if (n) {
- n[1].f = x;
- }
-
- ctx->ListState.ActiveIndex = 1;
- ctx->ListState.CurrentIndex = x;
-
- if (ctx->ExecuteFlag) {
- CALL_Indexf(ctx->Exec, (x));
- }
+ save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, x);
}
static void GLAPIENTRY
save_Indexfv(const GLfloat * v)
{
- save_Indexf(v[0]);
+ save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, v[0]);
}
static void GLAPIENTRY
save_EdgeFlag(GLboolean x)
{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- SAVE_FLUSH_VERTICES(ctx);
- n = ALLOC_INSTRUCTION(ctx, OPCODE_EDGEFLAG, 1);
- if (n) {
- n[1].b = x;
- }
-
- ctx->ListState.ActiveEdgeFlag = 1;
- ctx->ListState.CurrentEdgeFlag = x;
-
- if (ctx->ExecuteFlag) {
- CALL_EdgeFlag(ctx->Exec, (x));
- }
+ save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? 1.0 : 0.0);
}
static void GLAPIENTRY
@@ -6602,12 +6574,6 @@ execute_list(GLcontext *ctx, GLuint list)
CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, f));
}
break;
- case OPCODE_INDEX:
- CALL_Indexf(ctx->Exec, (n[1].f));
- break;
- case OPCODE_EDGEFLAG:
- CALL_EdgeFlag(ctx->Exec, (n[1].b));
- break;
case OPCODE_BEGIN:
CALL_Begin(ctx->Exec, (n[1].e));
break;
@@ -6793,9 +6759,6 @@ _mesa_NewList(GLuint list, GLenum mode)
for (i = 0; i < MAT_ATTRIB_MAX; i++)
ctx->ListState.ActiveMaterialSize[i] = 0;
- ctx->ListState.ActiveIndex = 0;
- ctx->ListState.ActiveEdgeFlag = 0;
-
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
ctx->Driver.NewList(ctx, list, mode);
@@ -8421,12 +8384,6 @@ print_list(GLcontext *ctx, GLuint list)
_mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
break;
- case OPCODE_INDEX:
- _mesa_printf("INDEX: %f\n", n[1].f);
- break;
- case OPCODE_EDGEFLAG:
- _mesa_printf("EDGEFLAG: %d\n", n[1].i);
- break;
case OPCODE_BEGIN:
_mesa_printf("BEGIN %x\n", n[1].i);
break;
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 91268b596d2..0d54c29949b 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -49,11 +49,14 @@
}
+/**
+ * Helper to enable/disable client-side state.
+ */
static void
-client_state( GLcontext *ctx, GLenum cap, GLboolean state )
+client_state(GLcontext *ctx, GLenum cap, GLboolean state)
{
GLuint flag;
- GLuint *var;
+ GLboolean *var;
switch (cap) {
case GL_VERTEX_ARRAY:
@@ -134,17 +137,14 @@ client_state( GLcontext *ctx, GLenum cap, GLboolean state )
ctx->Array.ArrayObj->_Enabled &= ~flag;
if (ctx->Driver.Enable) {
- (*ctx->Driver.Enable)( ctx, cap, state );
+ ctx->Driver.Enable( ctx, cap, state );
}
}
/**
* Enable GL capability.
- *
- * \param cap capability.
- *
- * \sa glEnable().
+ * \param cap state to enable/disable.
*
* Get's the current context, assures that we're outside glBegin()/glEnd() and
* calls client_state().
@@ -160,10 +160,7 @@ _mesa_EnableClientState( GLenum cap )
/**
* Disable GL capability.
- *
- * \param cap capability.
- *
- * \sa glDisable().
+ * \param cap state to enable/disable.
*
* Get's the current context, assures that we're outside glBegin()/glEnd() and
* calls client_state().
@@ -195,10 +192,10 @@ _mesa_DisableClientState( GLenum cap )
/**
- * Perform glEnable() and glDisable() calls.
+ * Helper function to enable or disable state.
*
* \param ctx GL context.
- * \param cap capability.
+ * \param cap the state to enable/disable
* \param state whether to enable or disable the specified capability.
*
* Updates the current context and flushes the vertices as needed. For
@@ -206,7 +203,8 @@ _mesa_DisableClientState( GLenum cap )
* are effectivly present before updating. Notifies the driver via
* dd_function_table::Enable.
*/
-void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
+void
+_mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
{
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "%s %s (newstate is %x)\n",
@@ -285,7 +283,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.CullFlag = state;
break;
-
case GL_CULL_VERTEX_EXT:
CHECK_EXTENSION(EXT_cull_vertex, cap);
if (ctx->Transform.CullVertexFlag == state)
@@ -293,13 +290,12 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
ctx->Transform.CullVertexFlag = state;
break;
-
case GL_DEPTH_TEST:
if (state && ctx->DrawBuffer->Visual.depthBits == 0) {
_mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer");
return;
}
- if (ctx->Depth.Test==state)
+ if (ctx->Depth.Test == state)
return;
FLUSH_VERTICES(ctx, _NEW_DEPTH);
ctx->Depth.Test = state;
@@ -308,13 +304,13 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
if (ctx->NoDither) {
state = GL_FALSE; /* MESA_NO_DITHER env var */
}
- if (ctx->Color.DitherFlag==state)
+ if (ctx->Color.DitherFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.DitherFlag = state;
break;
case GL_FOG:
- if (ctx->Fog.Enabled==state)
+ if (ctx->Fog.Enabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_FOG);
ctx->Fog.Enabled = state;
@@ -351,26 +347,18 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
ctx->Light.Enabled = state;
-
- if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
- ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
- else
- ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
-
break;
case GL_LINE_SMOOTH:
if (ctx->Line.SmoothFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_LINE);
ctx->Line.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_LINE_SMOOTH;
break;
case GL_LINE_STIPPLE:
if (ctx->Line.StippleFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_LINE);
ctx->Line.StippleFlag = state;
- ctx->_TriangleCaps ^= DD_LINE_STIPPLE;
break;
case GL_INDEX_LOGIC_OP:
if (ctx->Color.IndexLogicOpEnabled == state)
@@ -505,41 +493,38 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
ctx->Transform.Normalize = state;
break;
case GL_POINT_SMOOTH:
- if (ctx->Point.SmoothFlag==state)
+ if (ctx->Point.SmoothFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_POINT);
ctx->Point.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_POINT_SMOOTH;
break;
case GL_POLYGON_SMOOTH:
- if (ctx->Polygon.SmoothFlag==state)
+ if (ctx->Polygon.SmoothFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_TRI_SMOOTH;
break;
case GL_POLYGON_STIPPLE:
- if (ctx->Polygon.StippleFlag==state)
+ if (ctx->Polygon.StippleFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.StippleFlag = state;
- ctx->_TriangleCaps ^= DD_TRI_STIPPLE;
break;
case GL_POLYGON_OFFSET_POINT:
- if (ctx->Polygon.OffsetPoint==state)
+ if (ctx->Polygon.OffsetPoint == state)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.OffsetPoint = state;
break;
case GL_POLYGON_OFFSET_LINE:
- if (ctx->Polygon.OffsetLine==state)
+ if (ctx->Polygon.OffsetLine == state)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.OffsetLine = state;
break;
case GL_POLYGON_OFFSET_FILL:
/*case GL_POLYGON_OFFSET_EXT:*/
- if (ctx->Polygon.OffsetFill==state)
+ if (ctx->Polygon.OffsetFill == state)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.OffsetFill = state;
@@ -551,7 +536,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
ctx->Transform.RescaleNormals = state;
break;
case GL_SCISSOR_TEST:
- if (ctx->Scissor.Enabled==state)
+ if (ctx->Scissor.Enabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_SCISSOR);
ctx->Scissor.Enabled = state;
@@ -568,7 +553,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
"glEnable(GL_STENCIL_TEST) but no stencil buffer");
return;
}
- if (ctx->Stencil.Enabled==state)
+ if (ctx->Stencil.Enabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_STENCIL);
ctx->Stencil.Enabled = state;
@@ -916,11 +901,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
return;
FLUSH_VERTICES(ctx, _NEW_STENCIL);
ctx->Stencil.TestTwoSide = state;
- if (state) {
- ctx->_TriangleCaps |= DD_TRI_TWOSTENCIL;
- } else {
- ctx->_TriangleCaps &= ~DD_TRI_TWOSTENCIL;
- }
break;
#if FEATURE_ARB_fragment_program
@@ -973,20 +953,14 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
}
if (ctx->Driver.Enable) {
- (*ctx->Driver.Enable)( ctx, cap, state );
+ ctx->Driver.Enable( ctx, cap, state );
}
}
/**
- * Enable GL capability.
- *
- * \param cap capability.
- *
- * \sa glEnable().
- *
- * Get's the current context, assures that we're outside glBegin()/glEnd() and
- * calls _mesa_set_enable().
+ * Enable GL capability. Called by glEnable()
+ * \param cap state to enable.
*/
void GLAPIENTRY
_mesa_Enable( GLenum cap )
@@ -999,14 +973,8 @@ _mesa_Enable( GLenum cap )
/**
- * Disable GL capability.
- *
- * \param cap capability.
- *
- * \sa glDisable().
- *
- * Get's the current context, assures that we're outside glBegin()/glEnd() and
- * calls _mesa_set_enable().
+ * Disable GL capability. Called by glDisable()
+ * \param cap state to disable.
*/
void GLAPIENTRY
_mesa_Disable( GLenum cap )
@@ -1032,10 +1000,11 @@ _mesa_Disable( GLenum cap )
return GL_FALSE; \
}
+
/**
- * Test whether a capability is enabled.
+ * Return simple enable/disable state.
*
- * \param cap capability.
+ * \param cap state variable to query.
*
* Returns the state of the specified capability from the current GL context.
* For the capabilities associated with extensions verifies that those
diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c
index fc56809e978..8c1b785aab3 100644
--- a/src/mesa/main/enums.c
+++ b/src/mesa/main/enums.c
@@ -3517,7 +3517,6 @@ static const enum_elt all_enums[1737] =
static const unsigned reduced_enums[1277] =
{
- 30, /* GL_ALL_CLIENT_ATTRIB_BITS */
435, /* GL_FALSE */
643, /* GL_LINES */
645, /* GL_LINE_LOOP */
@@ -4794,6 +4793,7 @@ static const unsigned reduced_enums[1277] =
1314, /* GL_SCISSOR_BIT */
29, /* GL_ALL_ATTRIB_BITS */
938, /* GL_MULTISAMPLE_BIT */
+ 30, /* GL_ALL_CLIENT_ATTRIB_BITS */
};
#define Elements(x) sizeof(x)/sizeof(*x)
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 7845ea018ef..b61cb821f7d 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -136,6 +136,7 @@ static const struct {
{ OFF, "GL_ATI_texture_env_combine3", F(ATI_texture_env_combine3)},
{ OFF, "GL_ATI_texture_mirror_once", F(ATI_texture_mirror_once)},
{ OFF, "GL_ATI_fragment_shader", F(ATI_fragment_shader)},
+ { OFF, "GL_ATI_separate_stencil", F(ATI_separate_stencil)},
{ OFF, "GL_IBM_multimode_draw_arrays", F(IBM_multimode_draw_arrays) },
{ ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) },
{ OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)},
@@ -223,6 +224,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
#endif
ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE;
ctx->Extensions.ATI_texture_mirror_once = GL_TRUE;
+ ctx->Extensions.ATI_separate_stencil = GL_TRUE;
ctx->Extensions.EXT_blend_color = GL_TRUE;
ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 335443ef4f2..4cd07cb7b11 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -323,7 +323,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
case GL_EDGE_FLAG:
{
FLUSH_CURRENT(ctx, 0);
- params[0] = ctx->Current.EdgeFlag;
+ params[0] = (ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0);
}
break;
case GL_FEEDBACK_BUFFER_SIZE:
@@ -2150,7 +2150,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
case GL_EDGE_FLAG:
{
FLUSH_CURRENT(ctx, 0);
- params[0] = BOOLEAN_TO_FLOAT(ctx->Current.EdgeFlag);
+ params[0] = BOOLEAN_TO_FLOAT((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0));
}
break;
case GL_FEEDBACK_BUFFER_SIZE:
@@ -3977,7 +3977,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
case GL_EDGE_FLAG:
{
FLUSH_CURRENT(ctx, 0);
- params[0] = BOOLEAN_TO_INT(ctx->Current.EdgeFlag);
+ params[0] = BOOLEAN_TO_INT((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0));
}
break;
case GL_FEEDBACK_BUFFER_SIZE:
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index 5a9ca0720e3..2f07cc51926 100644
--- a/src/mesa/main/get_gen.py
+++ b/src/mesa/main/get_gen.py
@@ -190,7 +190,7 @@ StateVars = [
( "GL_DOUBLEBUFFER", GLboolean,
["ctx->DrawBuffer->Visual.doubleBufferMode"], "", None ),
( "GL_DRAW_BUFFER", GLenum, ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", None ),
- ( "GL_EDGE_FLAG", GLboolean, ["ctx->Current.EdgeFlag"],
+ ( "GL_EDGE_FLAG", GLboolean, ["(ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)"],
"FLUSH_CURRENT(ctx, 0);", None ),
( "GL_FEEDBACK_BUFFER_SIZE", GLint, ["ctx->Feedback.BufferSize"], "", None ),
( "GL_FEEDBACK_BUFFER_TYPE", GLenum, ["ctx->Feedback.Type"], "", None ),
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index e37499e4be7..5abea137d74 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -5,8 +5,8 @@
* This is the top-most include file of the Mesa sources.
* It includes gl.h and all system headers which are needed.
* Other Mesa source files should \e not directly include any system
- * headers. This allows Mesa to be integrated into XFree86 and
- * allows system-dependent hacks/workarounds to be collected in one place.
+ * headers. This allows system-dependent hacks/workarounds to be
+ * collected in one place.
*
* \note Actually, a lot of system-dependent stuff is now in imports.[ch].
*
@@ -46,18 +46,15 @@
#ifndef GLHEADER_H
#define GLHEADER_H
+/* This allows Mesa to be integrated into XFree86 */
#ifdef HAVE_DIX_CONFIG_H
#include "dix-config.h"
#endif
-#if defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER)
-#include "xf86_ansic.h"
-#else
#include <assert.h>
#include <ctype.h>
-/* If we can use Compaq's Fast Math Library on Alpha */
#if defined(__alpha__) && defined(CCPML)
-#include <cpml.h>
+#include <cpml.h> /* use Compaq's Fast Math Library on Alpha */
#else
#include <math.h>
#endif
@@ -68,7 +65,6 @@
#if defined(__linux__) && defined(__i386__)
#include <fpu_control.h>
#endif
-#endif
#include <float.h>
#include <stdarg.h>
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 6ff4089f0ea..fc8e1f0f574 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1331,6 +1331,7 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
}
+ break;
case GL_ABGR_EXT:
for (i=0;i<n;i++) {
dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
@@ -1479,6 +1480,7 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
}
+ break;
case GL_ABGR_EXT:
for (i=0;i<n;i++) {
dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
@@ -1815,7 +1817,7 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
for (i=0;i<n;i++) {
dst[i] = (((GLint) (rgba[i][RCOMP] * 7.0F)) )
| (((GLint) (rgba[i][GCOMP] * 7.0F)) << 3)
- | (((GLint) (rgba[i][BCOMP] * 3.0F)) << 5);
+ | (((GLint) (rgba[i][BCOMP] * 3.0F)) << 6);
}
}
break;
@@ -1861,9 +1863,9 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
else if (dstFormat == GL_ABGR_EXT) {
GLushort *dst = (GLushort *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (((GLint) (rgba[i][ACOMP] * 15.0F)) << 4)
+ dst[i] = (((GLint) (rgba[i][ACOMP] * 15.0F)) << 12)
| (((GLint) (rgba[i][BCOMP] * 15.0F)) << 8)
- | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 12)
+ | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 4)
| (((GLint) (rgba[i][RCOMP] * 15.0F)) );
}
}
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 9c7ebf9287d..e2d44fa07c4 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -24,9 +24,6 @@
* - scanf
* - qsort
* - rand and RAND_MAX
- *
- * \note When compiled into a XFree86 module these functions wrap around
- * XFree86 own wrappers.
*/
/*
@@ -71,50 +68,29 @@ extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg);
#endif
#endif
-/* If we don't actually want to use the libcwrapper junk (even though we're
- * building an Xorg server module), then just undef IN_MODULE to signal that to
- * the following code. It's left around for now to allow compiling of newish
- * Mesa with older servers, but this whole mess should go away at some point.
- */
-#ifdef NO_LIBCWRAPPER
-#undef IN_MODULE
-#endif
-
/**********************************************************************/
/** \name Memory */
/*@{*/
-/** Wrapper around either malloc() or xf86malloc() */
+/** Wrapper around malloc() */
void *
_mesa_malloc(size_t bytes)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86malloc(bytes);
-#else
return malloc(bytes);
-#endif
}
-/** Wrapper around either calloc() or xf86calloc() */
+/** Wrapper around calloc() */
void *
_mesa_calloc(size_t bytes)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86calloc(1, bytes);
-#else
return calloc(1, bytes);
-#endif
}
-/** Wrapper around either free() or xf86free() */
+/** Wrapper around free() */
void
_mesa_free(void *ptr)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86free(ptr);
-#else
free(ptr);
-#endif
}
/**
@@ -131,7 +107,7 @@ _mesa_free(void *ptr)
void *
_mesa_align_malloc(size_t bytes, unsigned long alignment)
{
-#if defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE))
+#if defined(HAVE_POSIX_MEMALIGN)
void *mem;
(void) posix_memalign(& mem, alignment, bytes);
@@ -157,7 +133,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment)
#endif
return (void *) buf;
-#endif /* defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) */
+#endif /* defined(HAVE_POSIX_MEMALIGN) */
}
/**
@@ -167,7 +143,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment)
void *
_mesa_align_calloc(size_t bytes, unsigned long alignment)
{
-#if defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE))
+#if defined(HAVE_POSIX_MEMALIGN)
void *mem;
mem = _mesa_align_malloc(bytes, alignment);
@@ -197,7 +173,7 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment)
#endif
return (void *)buf;
-#endif /* defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) */
+#endif /* defined(HAVE_POSIX_MEMALIGN) */
}
/**
@@ -210,13 +186,13 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment)
void
_mesa_align_free(void *ptr)
{
-#if defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE))
+#if defined(HAVE_POSIX_MEMALIGN)
free(ptr);
#else
void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));
void *realAddr = *cubbyHole;
_mesa_free(realAddr);
-#endif /* defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) */
+#endif /* defined(HAVE_POSIX_MEMALIGN) */
}
/**
@@ -255,22 +231,18 @@ _mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize)
void *
_mesa_memcpy(void *dest, const void *src, size_t n)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86memcpy(dest, src, n);
-#elif defined(SUNOS4)
+#if defined(SUNOS4)
return memcpy((char *) dest, (char *) src, (int) n);
#else
return memcpy(dest, src, n);
#endif
}
-/** Wrapper around either memset() or xf86memset() */
+/** Wrapper around memset() */
void
_mesa_memset( void *dst, int val, size_t n )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86memset( dst, val, n );
-#elif defined(SUNOS4)
+#if defined(SUNOS4)
memset( (char *) dst, (int) val, (int) n );
#else
memset(dst, val, n);
@@ -290,26 +262,22 @@ _mesa_memset16( unsigned short *dst, unsigned short val, size_t n )
*dst++ = val;
}
-/** Wrapper around either memcpy() or xf86memcpy() or bzero() */
+/** Wrapper around either memcpy() or bzero() */
void
_mesa_bzero( void *dst, size_t n )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86memset( dst, 0, n );
-#elif defined(__FreeBSD__)
+#if defined(__FreeBSD__)
bzero( dst, n );
#else
memset( dst, 0, n );
#endif
}
-/** Wrapper around either memcmp() or xf86memcmp() */
+/** Wrapper around memcmp() */
int
_mesa_memcmp( const void *s1, const void *s2, size_t n )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86memcmp( s1, s2, n );
-#elif defined(SUNOS4)
+#if defined(SUNOS4)
return memcmp( (char *) s1, (char *) s2, (int) n );
#else
return memcmp(s1, s2, n);
@@ -323,70 +291,46 @@ _mesa_memcmp( const void *s1, const void *s2, size_t n )
/** \name Math */
/*@{*/
-/** Wrapper around either sin() or xf86sin() */
+/** Wrapper around sin() */
double
_mesa_sin(double a)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86sin(a);
-#else
return sin(a);
-#endif
}
-/** Single precision wrapper around either sin() or xf86sin() */
+/** Single precision wrapper around sin() */
float
_mesa_sinf(float a)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return (float) xf86sin((double) a);
-#else
return (float) sin((double) a);
-#endif
}
-/** Wrapper around either cos() or xf86cos() */
+/** Wrapper around cos() */
double
_mesa_cos(double a)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86cos(a);
-#else
return cos(a);
-#endif
}
-/** Single precision wrapper around either asin() or xf86asin() */
+/** Single precision wrapper around asin() */
float
_mesa_asinf(float x)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return (float) xf86asin((double) x);
-#else
return (float) asin((double) x);
-#endif
}
-/** Single precision wrapper around either atan() or xf86atan() */
+/** Single precision wrapper around atan() */
float
_mesa_atanf(float x)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return (float) xf86atan((double) x);
-#else
return (float) atan((double) x);
-#endif
}
-/** Wrapper around either sqrt() or xf86sqrt() */
+/** Wrapper around sqrt() */
double
_mesa_sqrtd(double x)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86sqrt(x);
-#else
return sqrt(x);
-#endif
}
@@ -584,25 +528,17 @@ _mesa_inv_sqrtf(float n)
return x3 * r3;
#endif
-#elif defined(XFree86LOADER) && defined(IN_MODULE)
- return 1.0F / xf86sqrt(n);
#else
return (float) (1.0 / sqrt(n));
#endif
}
-/**
- * Wrapper around either pow() or xf86pow().
- */
+/** Wrapper around pow() */
double
_mesa_pow(double x, double y)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86pow(x, y);
-#else
return pow(x, y);
-#endif
}
@@ -633,8 +569,6 @@ _mesa_ffs(int i)
}
}
return bit;
-#elif defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86ffs(i);
#else
return ffs(i);
#endif
@@ -642,6 +576,35 @@ _mesa_ffs(int i)
/**
+ * Find position of first bit set in given value.
+ * XXX Warning: this function can only be used on 64-bit systems!
+ * \return position of least-significant bit set, starting at 1, return zero
+ * if no bits set.
+ */
+int
+_mesa_ffsll(long long val)
+{
+#ifdef ffsll
+ return ffsll(val);
+#else
+ int bit;
+
+ assert(sizeof(val) == 8);
+
+ bit = ffs(val);
+ if (bit != 0)
+ return bit;
+
+ bit = ffs(val >> 32);
+ if (bit != 0)
+ return 32 + bit;
+
+ return 0;
+#endif
+}
+
+
+/**
* Return number of bits set in given GLuint.
*/
unsigned int
@@ -807,11 +770,7 @@ void *
_mesa_bsearch( const void *key, const void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *) )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86bsearch(key, base, nmemb, size, compar);
-#else
return bsearch(key, base, nmemb, size, compar);
-#endif
}
/*@}*/
@@ -827,9 +786,7 @@ _mesa_bsearch( const void *key, const void *base, size_t nmemb, size_t size,
char *
_mesa_getenv( const char *var )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86getenv(var);
-#elif defined(_XBOX)
+#if defined(_XBOX)
return NULL;
#else
return getenv(var);
@@ -843,81 +800,53 @@ _mesa_getenv( const char *var )
/** \name String */
/*@{*/
-/** Wrapper around either strstr() or xf86strstr() */
+/** Wrapper around strstr() */
char *
_mesa_strstr( const char *haystack, const char *needle )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86strstr(haystack, needle);
-#else
return strstr(haystack, needle);
-#endif
}
-/** Wrapper around either strncat() or xf86strncat() */
+/** Wrapper around strncat() */
char *
_mesa_strncat( char *dest, const char *src, size_t n )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86strncat(dest, src, n);
-#else
return strncat(dest, src, n);
-#endif
}
-/** Wrapper around either strcpy() or xf86strcpy() */
+/** Wrapper around strcpy() */
char *
_mesa_strcpy( char *dest, const char *src )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86strcpy(dest, src);
-#else
return strcpy(dest, src);
-#endif
}
-/** Wrapper around either strncpy() or xf86strncpy() */
+/** Wrapper around strncpy() */
char *
_mesa_strncpy( char *dest, const char *src, size_t n )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86strncpy(dest, src, n);
-#else
return strncpy(dest, src, n);
-#endif
}
-/** Wrapper around either strlen() or xf86strlen() */
+/** Wrapper around strlen() */
size_t
_mesa_strlen( const char *s )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86strlen(s);
-#else
return strlen(s);
-#endif
}
-/** Wrapper around either strcmp() or xf86strcmp() */
+/** Wrapper around strcmp() */
int
_mesa_strcmp( const char *s1, const char *s2 )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86strcmp(s1, s2);
-#else
return strcmp(s1, s2);
-#endif
}
-/** Wrapper around either strncmp() or xf86strncmp() */
+/** Wrapper around strncmp() */
int
_mesa_strncmp( const char *s1, const char *s2, size_t n )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86strncmp(s1, s2, n);
-#else
return strncmp(s1, s2, n);
-#endif
}
/**
@@ -939,26 +868,18 @@ _mesa_strdup( const char *s )
}
}
-/** Wrapper around either atoi() or xf86atoi() */
+/** Wrapper around atoi() */
int
_mesa_atoi(const char *s)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86atoi(s);
-#else
return atoi(s);
-#endif
}
-/** Wrapper around either strtod() or xf86strtod() */
+/** Wrapper around strtod() */
double
_mesa_strtod( const char *s, char **end )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86strtod(s, end);
-#else
return strtod(s, end);
-#endif
}
/*@}*/
@@ -968,24 +889,19 @@ _mesa_strtod( const char *s, char **end )
/** \name I/O */
/*@{*/
-/** Wrapper around either vsprintf() or xf86vsprintf() */
+/** Wrapper around vsprintf() */
int
_mesa_sprintf( char *str, const char *fmt, ... )
{
int r;
va_list args;
va_start( args, fmt );
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- r = xf86vsprintf( str, fmt, args );
-#else
r = vsprintf( str, fmt, args );
-#endif
va_end( args );
return r;
}
-/** Wrapper around either printf() or xf86printf(), using vsprintf() for
- * the formatting. */
+/** Wrapper around printf(), using vsprintf() for the formatting. */
void
_mesa_printf( const char *fmtString, ... )
{
@@ -994,22 +910,14 @@ _mesa_printf( const char *fmtString, ... )
va_start( args, fmtString );
vsnprintf(s, MAXSTRING, fmtString, args);
va_end( args );
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86printf("%s", s);
-#else
fprintf(stderr,"%s", s);
-#endif
}
-/** Wrapper around either vsprintf() or xf86vsprintf() */
+/** Wrapper around vsprintf() */
int
_mesa_vsprintf( char *str, const char *fmt, va_list args )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86vsprintf( str, fmt, args );
-#else
return vsprintf( str, fmt, args );
-#endif
}
/*@}*/
@@ -1027,7 +935,7 @@ _mesa_vsprintf( char *str, const char *fmt, va_list args )
*
* If debugging is enabled (either at compile-time via the DEBUG macro, or
* run-time via the MESA_DEBUG environment variable), prints the warning to
- * stderr, either via fprintf() or xf86printf().
+ * stderr via fprintf().
*/
void
_mesa_warning( GLcontext *ctx, const char *fmtString, ... )
@@ -1045,11 +953,7 @@ _mesa_warning( GLcontext *ctx, const char *fmtString, ... )
debug = _mesa_getenv("MESA_DEBUG") ? GL_TRUE : GL_FALSE;
#endif
if (debug) {
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86fprintf(stderr, "Mesa warning: %s\n", str);
-#else
fprintf(stderr, "Mesa warning: %s\n", str);
-#endif
}
}
@@ -1060,7 +964,7 @@ _mesa_warning( GLcontext *ctx, const char *fmtString, ... )
* \param ctx GL context.
* \param s problem description string.
*
- * Prints the message to stderr, either via fprintf() or xf86fprintf().
+ * Prints the message to stderr via fprintf().
*/
void
_mesa_problem( const GLcontext *ctx, const char *fmtString, ... )
@@ -1073,13 +977,8 @@ _mesa_problem( const GLcontext *ctx, const char *fmtString, ... )
vsnprintf( str, MAXSTRING, fmtString, args );
va_end( args );
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86fprintf(stderr, "Mesa %s implementation error: %s\n", MESA_VERSION_STRING, str);
- xf86fprintf(stderr, "Please report at bugzilla.freedesktop.org\n");
-#else
fprintf(stderr, "Mesa %s implementation error: %s\n", MESA_VERSION_STRING, str);
fprintf(stderr, "Please report at bugzilla.freedesktop.org\n");
-#endif
}
/**
@@ -1169,7 +1068,7 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... )
* \param ctx GL context.
* \param fmtString printf() alike format string.
*
- * Prints the message to stderr, either via fprintf() or xf86printf().
+ * Prints the message to stderr via fprintf().
*/
void
_mesa_debug( const GLcontext *ctx, const char *fmtString, ... )
@@ -1180,11 +1079,7 @@ _mesa_debug( const GLcontext *ctx, const char *fmtString, ... )
va_start(args, fmtString);
vsnprintf(s, MAXSTRING, fmtString, args);
va_end(args);
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86fprintf(stderr, "Mesa: %s", s);
-#else
fprintf(stderr, "Mesa: %s", s);
-#endif
#endif /* DEBUG */
(void) ctx;
(void) fmtString;
@@ -1203,11 +1098,7 @@ _mesa_debug( const GLcontext *ctx, const char *fmtString, ... )
void
_mesa_exit( int status )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86exit(status);
-#else
exit(status);
-#endif
}
/*@}*/
@@ -1233,16 +1124,12 @@ default_calloc(__GLcontext *gc, size_t numElem, size_t elemSize)
return _mesa_calloc(numElem * elemSize);
}
-/** Wrapper around either realloc() or xf86realloc() */
+/** Wrapper around realloc() */
static void *
default_realloc(__GLcontext *gc, void *oldAddr, size_t newSize)
{
(void) gc;
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86realloc(oldAddr, newSize);
-#else
return realloc(oldAddr, newSize);
-#endif
}
/** Wrapper around _mesa_free() */
@@ -1326,16 +1213,6 @@ default_fprintf(__GLcontext *gc, void *stream, const char *fmt, ...)
return r;
}
-/**
- * \todo this really is driver-specific and can't be here
- */
-static __GLdrawablePrivate *
-default_GetDrawablePrivate(__GLcontext *gc)
-{
- (void) gc;
- return NULL;
-}
-
/*@}*/
@@ -1372,6 +1249,7 @@ _mesa_init_default_imports(__GLimports *imports, void *driverCtx)
imports->fopen = default_fopen;
imports->fclose = default_fclose;
imports->fprintf = default_fprintf;
- imports->getDrawablePrivate = default_GetDrawablePrivate;
+ imports->getDrawablePrivate = NULL; /* driver-specific */
+ imports->getReadablePrivate = NULL; /* driver-specific */
imports->other = driverCtx;
}
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index dad2767e72d..0633b3b8bf7 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -138,13 +138,16 @@ typedef union { GLfloat f; GLint i; } fi_type;
#define M_E (2.7182818284590452354)
#endif
-#ifndef FLT_MAX_EXP
-#define FLT_MAX_EXP 128
+#ifndef ONE_DIV_LN2
+#define ONE_DIV_LN2 (1.442695040888963456)
+#endif
+
+#ifndef ONE_DIV_SQRT_LN2
+#define ONE_DIV_SQRT_LN2 (1.201122408786449815)
#endif
-/* XXX this is a bit of a hack needed for compilation within XFree86 */
-#ifndef FLT_MIN
-#define FLT_MIN (1.0e-37)
+#ifndef FLT_MAX_EXP
+#define FLT_MAX_EXP 128
#endif
/* Degrees to radians conversion: */
@@ -173,8 +176,6 @@ typedef union { GLfloat f; GLint i; } fi_type;
***/
#if 0 /* _mesa_sqrtf() not accurate enough - temporarily disabled */
# define SQRTF(X) _mesa_sqrtf(X)
-#elif defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER)
-# define SQRTF(X) (float) xf86sqrt((float) (X))
#else
# define SQRTF(X) (float) sqrt((float) (X))
#endif
@@ -221,8 +222,6 @@ static INLINE GLfloat LOG2(GLfloat val)
num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3;
return num.f + log_2;
}
-#elif defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER)
-#define LOG2(x) ((GLfloat) (xf86log(x) * 1.442695))
#else
/*
* NOTE: log_base_2(x) = log(x) / log(2)
@@ -293,15 +292,7 @@ static INLINE int GET_FLOAT_BITS( float x )
*** LDEXPF: multiply value by an integral power of two
*** FREXPF: extract mantissa and exponent from value
***/
-#if defined(XFree86LOADER) && defined(IN_MODULE) && !defined(NO_LIBCWRAPPER)
-#define CEILF(x) ((GLfloat) xf86ceil(x))
-#define FLOORF(x) ((GLfloat) xf86floor(x))
-#define FABSF(x) ((GLfloat) xf86fabs(x))
-#define LOGF(x) ((GLfloat) xf86log(x))
-#define EXPF(x) ((GLfloat) xf86exp(x))
-#define LDEXPF(x,y) ((GLfloat) xf86ldexp(x,y))
-#define FREXPF(x,y) ((GLfloat) xf86frexp(x,y))
-#elif defined(__gnu_linux__)
+#if defined(__gnu_linux__)
/* C99 functions */
#define CEILF(x) ceilf(x)
#define FLOORF(x) floorf(x)
@@ -705,6 +696,9 @@ _mesa_pow(double x, double y);
extern int
_mesa_ffs(int i);
+extern int
+_mesa_ffsll(long long i);
+
extern unsigned int
_mesa_bitcount(unsigned int n);
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 984f7b2abc4..92d8a0ae0d4 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.3
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
@@ -44,7 +44,7 @@ _mesa_ShadeModel( GLenum mode )
_mesa_debug(ctx, "glShadeModel %s\n", _mesa_lookup_enum_by_nr(mode));
if (mode != GL_FLAT && mode != GL_SMOOTH) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glShadeModel" );
+ _mesa_error(ctx, GL_INVALID_ENUM, "glShadeModel");
return;
}
@@ -53,9 +53,8 @@ _mesa_ShadeModel( GLenum mode )
FLUSH_VERTICES(ctx, _NEW_LIGHT);
ctx->Light.ShadeModel = mode;
- ctx->_TriangleCaps ^= DD_FLATSHADE;
if (ctx->Driver.ShadeModel)
- (*ctx->Driver.ShadeModel)( ctx, mode );
+ ctx->Driver.ShadeModel( ctx, mode );
}
@@ -442,11 +441,6 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
ctx->Light.Model.TwoSide = newbool;
-
- if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
- ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
- else
- ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
break;
case GL_LIGHT_MODEL_COLOR_CONTROL:
if (params[0] == (GLfloat) GL_SINGLE_COLOR)
@@ -728,7 +722,7 @@ _mesa_ColorMaterial( GLenum face, GLenum mode )
}
if (ctx->Driver.ColorMaterial)
- (*ctx->Driver.ColorMaterial)( ctx, face, mode );
+ ctx->Driver.ColorMaterial( ctx, face, mode );
}
diff --git a/src/mesa/main/light.h b/src/mesa/main/light.h
index f47fe58a839..b97e17b5be4 100644
--- a/src/mesa/main/light.h
+++ b/src/mesa/main/light.h
@@ -92,7 +92,8 @@ do { \
struct gl_shine_tab *_tab = table; \
float f = (dp * (SHINE_TABLE_SIZE-1)); \
int k = (int) f; \
- if (k > SHINE_TABLE_SIZE-2) \
+ if (k < 0 /* gcc may cast an overflow float value to negative int value*/ \
+ || k > SHINE_TABLE_SIZE-2) \
result = (GLfloat) _mesa_pow( dp, _tab->shininess ); \
else \
result = _tab->tab[k] + (f-k)*(_tab->tab[k+1]-_tab->tab[k]); \
diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c
index c30d9ac109e..dc7195d4ebf 100644
--- a/src/mesa/main/lines.c
+++ b/src/mesa/main/lines.c
@@ -1,13 +1,8 @@
-/**
- * \file lines.c
- * Line operations.
- */
-
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.5.3
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -43,12 +38,6 @@
* \param width line width in pixels.
*
* \sa glLineWidth().
- *
- * Verifies the parameter and updates gl_line_attrib::Width. On a change,
- * flushes the vertices, updates the clamped line width and marks the
- * DD_LINE_WIDTH flag in __GLcontextRec::_TriangleCaps for the drivers if the
- * width is different from one. Notifies the driver via the
- * dd_function_table::LineWidth callback.
*/
void GLAPIENTRY
_mesa_LineWidth( GLfloat width )
@@ -70,14 +59,8 @@ _mesa_LineWidth( GLfloat width )
ctx->Const.MinLineWidth,
ctx->Const.MaxLineWidth);
-
- if (width != 1.0)
- ctx->_TriangleCaps |= DD_LINE_WIDTH;
- else
- ctx->_TriangleCaps &= ~DD_LINE_WIDTH;
-
if (ctx->Driver.LineWidth)
- (*ctx->Driver.LineWidth)(ctx, width);
+ ctx->Driver.LineWidth(ctx, width);
}
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index 7339b0ce409..b2aa83e1890 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -427,7 +427,7 @@ _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z )
/**
- * Multiply the current matrix with a general scaling matrix.
+ * Multiply the current matrix with a translation matrix.
*
* \param x translation vector x coordinate.
* \param y translation vector y coordinate.
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index f154bd46513..cc1fb97eedd 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -928,6 +928,9 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
return;
}
+ if (dstImage->ImageOffsets)
+ _mesa_free(dstImage->ImageOffsets);
+
/* Free old image data */
if (dstImage->Data)
ctx->Driver.FreeTexImageData(ctx, dstImage);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 76b36d60f1b..ce58154a0af 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -149,7 +149,7 @@ enum
VERT_ATTRIB_COLOR1 = 4,
VERT_ATTRIB_FOG = 5,
VERT_ATTRIB_COLOR_INDEX = 6,
- VERT_ATTRIB_SEVEN = 7,
+ VERT_ATTRIB_EDGEFLAG = 7,
VERT_ATTRIB_TEX0 = 8,
VERT_ATTRIB_TEX1 = 9,
VERT_ATTRIB_TEX2 = 10,
@@ -189,7 +189,7 @@ enum
#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1)
#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG)
#define VERT_BIT_COLOR_INDEX (1 << VERT_ATTRIB_COLOR_INDEX)
-#define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN)
+#define VERT_BIT_EDGEFLAG (1 << VERT_ATTRIB_EDGEFLAG)
#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0)
#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1)
#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2)
@@ -613,11 +613,11 @@ struct gl_current_attrib
/**
* \name Current vertex attributes.
* \note Values are valid only after FLUSH_VERTICES has been called.
+ * \note Index and Edgeflag current values are stored as floats in the
+ * SIX and SEVEN attribute slots.
*/
/*@{*/
GLfloat Attrib[VERT_ATTRIB_MAX][4]; /**< Position, color, texcoords, etc */
- GLfloat Index; /**< Current color index */
- GLboolean EdgeFlag; /**< Current edge flag */
/*@}*/
/**
@@ -1637,8 +1637,6 @@ struct gl_pixelstore_attrib
};
-#define CA_CLIENT_DATA 0x1 /**< Data not allocated by mesa */
-
/**
* Client vertex array attributes
@@ -1650,14 +1648,12 @@ struct gl_client_array
GLsizei Stride; /**< user-specified stride */
GLsizei StrideB; /**< actual stride in bytes */
const GLubyte *Ptr; /**< Points to array data */
- GLbitfield Enabled; /**< one of the _NEW_ARRAY_ bits */
+ GLboolean Enabled; /**< Enabled flag is a boolean */
GLboolean Normalized; /**< GL_ARB_vertex_program */
/**< GL_ARB_vertex_buffer_object */
struct gl_buffer_object *BufferObj;
GLuint _MaxElement;
-
- GLbitfield Flags;
};
@@ -1678,8 +1674,8 @@ struct gl_array_object
struct gl_client_array SecondaryColor;
struct gl_client_array FogCoord;
struct gl_client_array Index;
- struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS];
struct gl_client_array EdgeFlag;
+ struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS];
/*@}*/
/** Generic arrays for vertex programs/shaders */
@@ -2547,6 +2543,7 @@ struct gl_extensions
GLboolean ATI_texture_mirror_once;
GLboolean ATI_texture_env_combine3;
GLboolean ATI_fragment_shader;
+ GLboolean ATI_separate_stencil;
GLboolean IBM_rasterpos_clip;
GLboolean IBM_multimode_draw_arrays;
GLboolean MESA_pack_invert;
@@ -2680,7 +2677,7 @@ struct matrix_stack
#define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1
#define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG
#define _NEW_ARRAY_INDEX VERT_BIT_COLOR_INDEX
-#define _NEW_ARRAY_EDGEFLAG VERT_BIT_SEVEN
+#define _NEW_ARRAY_EDGEFLAG VERT_BIT_EDGEFLAG
#define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0
#define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1
#define _NEW_ARRAY_TEXCOORD_2 VERT_BIT_TEX2
@@ -2689,7 +2686,7 @@ struct matrix_stack
#define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5
#define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6
#define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7
-#define _NEW_ARRAY_ATTRIB_0 0x10000 /* start at bit 16 */
+#define _NEW_ARRAY_ATTRIB_0 VERT_BIT_GENERIC0 /* start at bit 16 */
#define _NEW_ARRAY_ALL 0xffffffff
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index aa36fb62877..9caa9ab3ab2 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -5,9 +5,9 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -57,6 +57,13 @@ _mesa_PointSize( GLfloat size )
FLUSH_VERTICES(ctx, _NEW_POINT);
ctx->Point.Size = size;
+ ctx->Point._Size = CLAMP(ctx->Point.Size,
+ ctx->Point.MinSize,
+ ctx->Point.MaxSize);
+
+ ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||
+ ctx->Point.Params[1] != 0.0 ||
+ ctx->Point.Params[2] != 0.0);
if (ctx->Driver.PointSize)
ctx->Driver.PointSize(ctx, size);
@@ -232,36 +239,6 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
/**
- * Update derived point-related state.
- */
-void
-_mesa_update_point(GLcontext *ctx)
-{
- /* clamp to user-specified limits now, clamp to ctx->Const.Min/Max
- * limits during rasterization.
- */
- ctx->Point._Size = CLAMP(ctx->Point.Size,
- ctx->Point.MinSize,
- ctx->Point.MaxSize);
-
- if (ctx->Point._Size == 1.0F)
- ctx->_TriangleCaps &= ~DD_POINT_SIZE;
- else
- ctx->_TriangleCaps |= DD_POINT_SIZE;
-
- ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||
- ctx->Point.Params[1] != 0.0 ||
- ctx->Point.Params[2] != 0.0);
-
- if (ctx->Point._Attenuated)
- ctx->_TriangleCaps |= DD_POINT_ATTEN;
- else
- ctx->_TriangleCaps &= ~DD_POINT_ATTEN;
-}
-
-
-
-/**
* Initialize the context point state.
*
* \param ctx GL context.
diff --git a/src/mesa/main/points.h b/src/mesa/main/points.h
index 56acd9ee574..951ff677db4 100644
--- a/src/mesa/main/points.h
+++ b/src/mesa/main/points.h
@@ -50,9 +50,6 @@ _mesa_PointParameterfEXT( GLenum pname, GLfloat param );
extern void GLAPIENTRY
_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params );
-extern void
-_mesa_update_point(GLcontext *ctx);
-
extern void
_mesa_init_point( GLcontext * ctx );
diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c
index b771408cf36..fd02e5a652d 100644
--- a/src/mesa/main/polygon.c
+++ b/src/mesa/main/polygon.c
@@ -5,9 +5,9 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -167,13 +167,8 @@ _mesa_PolygonMode( GLenum face, GLenum mode )
return;
}
- ctx->_TriangleCaps &= ~DD_TRI_UNFILLED;
- if (ctx->Polygon.FrontMode!=GL_FILL || ctx->Polygon.BackMode!=GL_FILL)
- ctx->_TriangleCaps |= DD_TRI_UNFILLED;
-
- if (ctx->Driver.PolygonMode) {
- (*ctx->Driver.PolygonMode)( ctx, face, mode );
- }
+ if (ctx->Driver.PolygonMode)
+ ctx->Driver.PolygonMode(ctx, face, mode);
}
#if _HAVE_FULL_GL
@@ -321,32 +316,6 @@ _mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias )
/**********************************************************************/
-/** \name State Management */
-/*@{*/
-
-/*
- * Check polygon state and set DD_TRI_CULL_FRONT_BACK and/or DD_TRI_OFFSET
- * in ctx->_TriangleCaps if needed.
- */
-void _mesa_update_polygon( GLcontext *ctx )
-{
- ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET);
-
- if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
- ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
-
- /* Any Polygon offsets enabled? */
- if (ctx->Polygon.OffsetPoint ||
- ctx->Polygon.OffsetLine ||
- ctx->Polygon.OffsetFill) {
- ctx->_TriangleCaps |= DD_TRI_OFFSET;
- }
-}
-
-/*@}*/
-
-
-/**********************************************************************/
/** \name Initialization */
/*@{*/
diff --git a/src/mesa/main/polygon.h b/src/mesa/main/polygon.h
index 2550ed16877..78e8394d053 100644
--- a/src/mesa/main/polygon.h
+++ b/src/mesa/main/polygon.h
@@ -5,9 +5,9 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -60,9 +60,6 @@ _mesa_PolygonStipple( const GLubyte *mask );
extern void GLAPIENTRY
_mesa_GetPolygonStipple( GLubyte *mask );
-extern void
-_mesa_update_polygon( GLcontext *ctx );
-
extern void
_mesa_init_polygon( GLcontext * ctx );
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 947d3136d5b..6ed7ae6c7dd 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -821,16 +821,6 @@ _mesa_init_exec_table(struct _glapi_table *exec)
/*@{*/
-static void
-update_separate_specular( GLcontext *ctx )
-{
- if (NEED_SECONDARY_COLOR(ctx))
- ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
- else
- ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
-}
-
-
/**
* Update state dependent on vertex arrays.
*/
@@ -909,8 +899,8 @@ update_arrays( GLcontext *ctx )
/* 7 */
if (ctx->VertexProgram._Enabled
- && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_SEVEN].Enabled) {
- min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_SEVEN]._MaxElement);
+ && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
+ min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG]._MaxElement);
}
/* 8..15 */
@@ -1047,6 +1037,79 @@ update_color(GLcontext *ctx)
/**
+ * Update the ctx->_TriangleCaps bitfield.
+ * XXX that bitfield should really go away someday!
+ * This function must be called after other update_*() functions since
+ * there are dependencies on some other derived values.
+ */
+static void
+update_tricaps(GLcontext *ctx, GLbitfield new_state)
+{
+ ctx->_TriangleCaps = 0;
+
+ /*
+ * Points
+ */
+ if (new_state & _NEW_POINT) {
+ if (ctx->Point.SmoothFlag)
+ ctx->_TriangleCaps |= DD_POINT_SMOOTH;
+ if (ctx->Point._Size != 1.0F)
+ ctx->_TriangleCaps |= DD_POINT_SIZE;
+ if (ctx->Point._Attenuated)
+ ctx->_TriangleCaps |= DD_POINT_ATTEN;
+ }
+
+ /*
+ * Lines
+ */
+ if (new_state & _NEW_LINE) {
+ if (ctx->Line.SmoothFlag)
+ ctx->_TriangleCaps |= DD_LINE_SMOOTH;
+ if (ctx->Line.StippleFlag)
+ ctx->_TriangleCaps |= DD_LINE_STIPPLE;
+ if (ctx->Line._Width != 1.0)
+ ctx->_TriangleCaps |= DD_LINE_WIDTH;
+ }
+
+ /*
+ * Polygons
+ */
+ if (new_state & _NEW_POLYGON) {
+ if (ctx->Polygon.SmoothFlag)
+ ctx->_TriangleCaps |= DD_TRI_SMOOTH;
+ if (ctx->Polygon.StippleFlag)
+ ctx->_TriangleCaps |= DD_TRI_STIPPLE;
+ if (ctx->Polygon.FrontMode != GL_FILL
+ || ctx->Polygon.BackMode != GL_FILL)
+ ctx->_TriangleCaps |= DD_TRI_UNFILLED;
+ if (ctx->Polygon.CullFlag
+ && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
+ ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
+ if (ctx->Polygon.OffsetPoint ||
+ ctx->Polygon.OffsetLine ||
+ ctx->Polygon.OffsetFill)
+ ctx->_TriangleCaps |= DD_TRI_OFFSET;
+ }
+
+ /*
+ * Lighting and shading
+ */
+ if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
+ ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
+ if (ctx->Light.ShadeModel == GL_FLAT)
+ ctx->_TriangleCaps |= DD_FLATSHADE;
+ if (NEED_SECONDARY_COLOR(ctx))
+ ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
+
+ /*
+ * Stencil
+ */
+ if (ctx->Stencil._TestTwoSide)
+ ctx->_TriangleCaps |= DD_TRI_TWOSTENCIL;
+}
+
+
+/**
* Compute derived GL state.
* If __GLcontextRec::NewState is non-zero then this function \b must
* be called before rendering anything.
@@ -1055,7 +1118,7 @@ update_color(GLcontext *ctx)
* management necessary.
*
* \sa _mesa_update_modelview_project(), _mesa_update_texture(),
- * _mesa_update_buffer_bounds(), _mesa_update_polygon(),
+ * _mesa_update_buffer_bounds(),
* _mesa_update_lighting() and _mesa_update_tnl_spaces().
*/
void
@@ -1081,12 +1144,6 @@ _mesa_update_state_locked( GLcontext *ctx )
if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT))
_mesa_update_draw_buffer_bounds( ctx );
- if (new_state & _NEW_POINT)
- _mesa_update_point( ctx );
-
- if (new_state & _NEW_POLYGON)
- _mesa_update_polygon( ctx );
-
if (new_state & _NEW_LIGHT)
_mesa_update_lighting( ctx );
@@ -1096,9 +1153,6 @@ _mesa_update_state_locked( GLcontext *ctx )
if (new_state & _IMAGE_NEW_TRANSFER_STATE)
_mesa_update_pixel( ctx, new_state );
- if (new_state & _DD_NEW_SEPARATE_SPECULAR)
- update_separate_specular( ctx );
-
if (new_state & (_NEW_ARRAY | _NEW_PROGRAM))
update_arrays( ctx );
@@ -1108,6 +1162,10 @@ _mesa_update_state_locked( GLcontext *ctx )
if (new_state & _NEW_COLOR)
update_color( ctx );
+ if (new_state & (_NEW_POINT | _NEW_LINE | _NEW_POLYGON | _NEW_LIGHT
+ | _NEW_STENCIL | _DD_NEW_SEPARATE_SPECULAR))
+ update_tricaps( ctx, new_state );
+
if (ctx->FragmentProgram._MaintainTexEnvProgram) {
if (new_state & (_NEW_TEXTURE | _DD_NEW_SEPARATE_SPECULAR | _NEW_FOG))
_mesa_UpdateTexEnvProgram(ctx);
diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c
index ad71a81f6e0..e61eb0030c0 100644
--- a/src/mesa/main/stencil.c
+++ b/src/mesa/main/stencil.c
@@ -119,23 +119,7 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
ref = CLAMP( ref, 0, stencilMax );
- if (ctx->Extensions.EXT_stencil_two_side) {
- /* only set active face state */
- const GLint face = ctx->Stencil.ActiveFace;
- if (ctx->Stencil.Function[face] == func &&
- ctx->Stencil.ValueMask[face] == mask &&
- ctx->Stencil.Ref[face] == ref)
- return;
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.Function[face] = func;
- ctx->Stencil.Ref[face] = ref;
- ctx->Stencil.ValueMask[face] = mask;
- if (ctx->Driver.StencilFuncSeparate) {
- ctx->Driver.StencilFuncSeparate(ctx, face ? GL_BACK : GL_FRONT,
- func, ref, mask);
- }
- }
- else {
+ if (ctx->Extensions.ATI_separate_stencil) {
/* set both front and back state */
if (ctx->Stencil.Function[0] == func &&
ctx->Stencil.Function[1] == func &&
@@ -153,6 +137,22 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
func, ref, mask);
}
}
+ else {
+ /* only set active face state */
+ const GLint face = ctx->Stencil.ActiveFace;
+ if (ctx->Stencil.Function[face] == func &&
+ ctx->Stencil.ValueMask[face] == mask &&
+ ctx->Stencil.Ref[face] == ref)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_STENCIL);
+ ctx->Stencil.Function[face] = func;
+ ctx->Stencil.Ref[face] = ref;
+ ctx->Stencil.ValueMask[face] = mask;
+ if (ctx->Driver.StencilFuncSeparate) {
+ ctx->Driver.StencilFuncSeparate(ctx, face ? GL_BACK : GL_FRONT,
+ func, ref, mask);
+ }
+ }
}
@@ -173,26 +173,26 @@ _mesa_StencilMask( GLuint mask )
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (ctx->Extensions.EXT_stencil_two_side) {
- /* only set active face state */
- const GLint face = ctx->Stencil.ActiveFace;
- if (ctx->Stencil.WriteMask[face] == mask)
+ if (ctx->Extensions.ATI_separate_stencil) {
+ /* set both front and back state */
+ if (ctx->Stencil.WriteMask[0] == mask &&
+ ctx->Stencil.WriteMask[1] == mask)
return;
FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.WriteMask[face] = mask;
+ ctx->Stencil.WriteMask[0] = ctx->Stencil.WriteMask[1] = mask;
if (ctx->Driver.StencilMaskSeparate) {
- ctx->Driver.StencilMaskSeparate(ctx, face ? GL_BACK : GL_FRONT, mask);
+ ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT_AND_BACK, mask);
}
}
else {
- /* set both front and back state */
- if (ctx->Stencil.WriteMask[0] == mask &&
- ctx->Stencil.WriteMask[1] == mask)
+ /* only set active face state */
+ const GLint face = ctx->Stencil.ActiveFace;
+ if (ctx->Stencil.WriteMask[face] == mask)
return;
FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.WriteMask[0] = ctx->Stencil.WriteMask[1] = mask;
+ ctx->Stencil.WriteMask[face] = mask;
if (ctx->Driver.StencilMaskSeparate) {
- ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT_AND_BACK, mask);
+ ctx->Driver.StencilMaskSeparate(ctx, face ? GL_BACK : GL_FRONT, mask);
}
}
}
@@ -273,23 +273,7 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
return;
}
- if (ctx->Extensions.EXT_stencil_two_side) {
- /* only set active face state */
- const GLint face = ctx->Stencil.ActiveFace;
- if (ctx->Stencil.ZFailFunc[face] == zfail &&
- ctx->Stencil.ZPassFunc[face] == zpass &&
- ctx->Stencil.FailFunc[face] == fail)
- return;
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.ZFailFunc[face] = zfail;
- ctx->Stencil.ZPassFunc[face] = zpass;
- ctx->Stencil.FailFunc[face] = fail;
- if (ctx->Driver.StencilOpSeparate) {
- ctx->Driver.StencilOpSeparate(ctx, face ? GL_BACK : GL_FRONT,
- fail, zfail, zpass);
- }
- }
- else {
+ if (ctx->Extensions.ATI_separate_stencil) {
/* set both front and back state */
if (ctx->Stencil.ZFailFunc[0] == zfail &&
ctx->Stencil.ZFailFunc[1] == zfail &&
@@ -307,6 +291,22 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
fail, zfail, zpass);
}
}
+ else {
+ /* only set active face state */
+ const GLint face = ctx->Stencil.ActiveFace;
+ if (ctx->Stencil.ZFailFunc[face] == zfail &&
+ ctx->Stencil.ZPassFunc[face] == zpass &&
+ ctx->Stencil.FailFunc[face] == fail)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_STENCIL);
+ ctx->Stencil.ZFailFunc[face] = zfail;
+ ctx->Stencil.ZPassFunc[face] = zpass;
+ ctx->Stencil.FailFunc[face] = fail;
+ if (ctx->Driver.StencilOpSeparate) {
+ ctx->Driver.StencilOpSeparate(ctx, face ? GL_BACK : GL_FRONT,
+ fail, zfail, zpass);
+ }
+ }
}
diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c
index 99b703de4a5..c823967b7a0 100644
--- a/src/mesa/main/texcompress_s3tc.c
+++ b/src/mesa/main/texcompress_s3tc.c
@@ -91,7 +91,7 @@ _mesa_dlopen(const char *libname, int flags)
return dlopen(libname, flags);
#endif
#else
- return (GenericFunc) NULL;
+ return NULL;
#endif /* USE_EXTERNAL_DXTN_LIB */
}
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 1d27cd3f7c6..3cfbfa5eb54 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -699,7 +699,7 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures)
= _mesa_lookup_texture(ctx, textures[i]);
if (delObj) {
- GLboolean delete;
+ GLboolean deleted;
_mesa_lock_texture(ctx, delObj);
@@ -728,14 +728,14 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures)
* XXX all RefCount accesses should be protected by a mutex.
*/
delObj->RefCount--;
- delete = (delObj->RefCount == 0);
+ deleted = (delObj->RefCount == 0);
_mesa_unlock_texture(ctx, delObj);
/* We know that refcount went to zero above, so this is
* the only pointer left to delObj, so we don't have to
* worry about locking any more:
*/
- if (delete) {
+ if (deleted) {
ASSERT(delObj->Name != 0); /* Never delete default tex objs */
ASSERT(ctx->Driver.DeleteTexture);
(*ctx->Driver.DeleteTexture)(ctx, delObj);
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 89563842c25..87f8fa7a0d4 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -808,7 +808,8 @@ _mesa_swizzle_ubyte_image(GLcontext *ctx,
/* _mesa_printf("map %d %d %d %d\n", map[0], map[1], map[2], map[3]); */
- if (srcRowStride == srcWidth * srcComponents &&
+ if (srcRowStride == dstRowStride &&
+ srcRowStride == srcWidth * srcComponents &&
dimensions < 3) {
/* 1 and 2D images only */
GLubyte *dstImage = (GLubyte *) dstAddr
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index e6196050b9e..e4a74cb0d41 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5.2
+ * Version: 6.5.3
*
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -30,8 +30,8 @@
/* Mesa version */
#define MESA_MAJOR 6
#define MESA_MINOR 5
-#define MESA_PATCH 2
-#define MESA_VERSION_STRING "6.5.2"
+#define MESA_PATCH 3
+#define MESA_VERSION_STRING "6.5.3"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
@@ -39,10 +39,10 @@
/* OpenGL API version */
-#define OPENGL_MAJOR 1
-#define OPENGL_MINOR 5
+#define OPENGL_MAJOR 2
+#define OPENGL_MINOR 0
#define OPENGL_PATCH 0
-#define OPENGL_VERSION_STRING "1.5"
+#define OPENGL_VERSION_STRING "2.0"
/* To make version comparison easy */
#define OPENGL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))