summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/api_arrayelt.c4
-rw-r--r--src/mesa/main/api_loopback.c8
-rw-r--r--src/mesa/main/api_noop.c2
-rw-r--r--src/mesa/main/api_validate.c19
-rw-r--r--src/mesa/main/arrayobj.c2
-rw-r--r--src/mesa/main/context.c14
-rw-r--r--src/mesa/main/context.h2
-rw-r--r--src/mesa/main/dlist.c18
-rw-r--r--src/mesa/main/execmem.c2
-rw-r--r--src/mesa/main/framebuffer.c4
-rw-r--r--src/mesa/main/glheader.h2
-rw-r--r--src/mesa/main/hash.c2
-rw-r--r--src/mesa/main/image.c54
-rw-r--r--src/mesa/main/image.h6
-rw-r--r--src/mesa/main/imports.c4
-rw-r--r--src/mesa/main/imports.h4
-rw-r--r--src/mesa/main/lines.c8
-rw-r--r--src/mesa/main/mtypes.h49
-rw-r--r--src/mesa/main/points.c5
-rw-r--r--src/mesa/main/queryobj.c15
-rw-r--r--src/mesa/main/renderbuffer.c28
-rw-r--r--src/mesa/main/shaders.c8
-rw-r--r--src/mesa/main/state.c16
-rw-r--r--src/mesa/main/texcompress_fxt1.c5
-rw-r--r--src/mesa/main/texenvprogram.c8
-rw-r--r--src/mesa/main/teximage.c32
-rw-r--r--src/mesa/main/texstore.c8
-rw-r--r--src/mesa/main/varray.c2
-rw-r--r--src/mesa/main/vtxfmt_tmp.h4
29 files changed, 206 insertions, 129 deletions
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index 1899975213..72091b0789 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -31,8 +31,8 @@
#include "context.h"
#include "imports.h"
#include "macros.h"
-#include "glapioffsets.h"
-#include "dispatch.h"
+#include "glapi/glapioffsets.h"
+#include "glapi/dispatch.h"
typedef void (GLAPIENTRY *array_func)( const void * );
diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c
index efe5a77d58..924d7134a2 100644
--- a/src/mesa/main/api_loopback.c
+++ b/src/mesa/main/api_loopback.c
@@ -30,14 +30,14 @@
#include "glheader.h"
-#include "glapi.h"
-#include "glapitable.h"
#include "macros.h"
#include "colormac.h"
#include "api_loopback.h"
-#include "glthread.h"
#include "mtypes.h"
-#include "dispatch.h"
+#include "glapi/glapi.h"
+#include "glapi/glapitable.h"
+#include "glapi/glthread.h"
+#include "glapi/dispatch.h"
/* KW: A set of functions to convert unusual Color/Normal/Vertex/etc
* calls to a smaller set of driver-provided formats. Currently just
diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c
index 0c1a35361f..3df64362ea 100644
--- a/src/mesa/main/api_noop.c
+++ b/src/mesa/main/api_noop.c
@@ -31,7 +31,7 @@
#include "light.h"
#include "macros.h"
#include "dlist.h"
-#include "dispatch.h"
+#include "glapi/dispatch.h"
/**
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 3d20ba7d14..841c6a5302 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 7.0.1
*
- * Copyright (C) 1999-2003 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"),
@@ -100,6 +100,11 @@ _mesa_validate_DrawElements(GLcontext *ctx,
(const GLubyte *) indices);
}
}
+ else {
+ /* not using a VBO */
+ if (!indices)
+ return GL_FALSE;
+ }
if (ctx->Const.CheckArrayBounds) {
/* find max array index */
@@ -170,6 +175,16 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
&& !(ctx->VertexProgram._Enabled && ctx->Array.ArrayObj->VertexAttrib[0].Enabled))
return GL_FALSE;
+ /* Vertex buffer object tests */
+ if (ctx->Array.ElementArrayBufferObj->Name) {
+ /* XXX re-use code from above? */
+ }
+ else {
+ /* not using VBO */
+ if (!indices)
+ return GL_FALSE;
+ }
+
if (ctx->Const.CheckArrayBounds) {
/* Find max array index.
* We don't trust the user's start and end values.
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index d601ee461e..f08f99d8e1 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -46,7 +46,7 @@
#include "bufferobj.h"
#endif
#include "arrayobj.h"
-#include "dispatch.h"
+#include "glapi/dispatch.h"
/**
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 92d8ceda29..00e4c8328e 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -97,12 +97,9 @@
#include "fog.h"
#include "framebuffer.h"
#include "get.h"
-#include "glthread.h"
-#include "glapioffsets.h"
#include "histogram.h"
#include "hint.h"
#include "hash.h"
-#include "atifragshader.h"
#include "light.h"
#include "lines.h"
#include "macros.h"
@@ -110,9 +107,6 @@
#include "pixel.h"
#include "points.h"
#include "polygon.h"
-#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
-#include "program.h"
-#endif
#include "queryobj.h"
#include "rastpos.h"
#include "simple_list.h"
@@ -126,13 +120,19 @@
#include "varray.h"
#include "version.h"
#include "vtxfmt.h"
+#include "glapi/glthread.h"
+#include "glapi/glapioffsets.h"
+#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
+#include "shader/program.h"
+#endif
+#include "shader/shader_api.h"
+#include "shader/atifragshader.h"
#if _HAVE_FULL_GL
#include "math/m_translate.h"
#include "math/m_matrix.h"
#include "math/m_xform.h"
#include "math/mathmod.h"
#endif
-#include "shader_api.h"
#ifdef USE_SPARC_ASM
#include "sparc/sparc.h"
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index b6a9d13149..099912aa15 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -49,7 +49,7 @@
#define CONTEXT_H
-#include "glapi.h"
+#include "glapi/glapi.h"
#include "imports.h"
#include "mtypes.h"
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 91ddcbf9ed..293ee5fa34 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -33,10 +33,6 @@
#include "api_arrayelt.h"
#include "api_loopback.h"
#include "config.h"
-#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
-#include "arbprogram.h"
-#include "program.h"
-#endif
#include "attrib.h"
#include "blend.h"
#include "buffers.h"
@@ -57,7 +53,7 @@
#include "extensions.h"
#include "feedback.h"
#include "get.h"
-#include "glapi.h"
+#include "glapi/glapi.h"
#include "hash.h"
#include "histogram.h"
#include "image.h"
@@ -76,18 +72,22 @@
#include "texstate.h"
#include "mtypes.h"
#include "varray.h"
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+#include "shader/arbprogram.h"
+#include "shader/program.h"
+#endif
#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
-#include "nvprogram.h"
-#include "program.h"
+#include "shader/nvprogram.h"
+#include "shader/program.h"
#endif
#if FEATURE_ATI_fragment_shader
-#include "atifragshader.h"
+#include "shader/atifragshader.h"
#endif
#include "math/m_matrix.h"
#include "math/m_xform.h"
-#include "dispatch.h"
+#include "glapi/dispatch.h"
/**
diff --git a/src/mesa/main/execmem.c b/src/mesa/main/execmem.c
index df3095232d..40f66d7da2 100644
--- a/src/mesa/main/execmem.c
+++ b/src/mesa/main/execmem.c
@@ -32,7 +32,7 @@
#include "imports.h"
-#include "glthread.h"
+#include "glapi/glthread.h"
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index f737c74f35..c9b30d3252 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -65,7 +65,9 @@ compute_depth_max(struct gl_framebuffer *fb)
fb->_DepthMax = 0xffffffff;
}
fb->_DepthMaxF = (GLfloat) fb->_DepthMax;
- fb->_MRD = 1.0; /* Minimum resolvable depth value, for polygon offset */
+
+ /* Minimum resolvable depth value, for polygon offset */
+ fb->_MRD = 1.0 / fb->_DepthMaxF;
}
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index 63dd002a41..fd4127558a 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -92,7 +92,7 @@
#endif
#ifdef WGLAPI
-#undef WGLAPI
+# undef WGLAPI
#endif
#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP)
diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index 2d5bcc3e01..ffb2c4d946 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -37,7 +37,7 @@
#include "glheader.h"
#include "imports.h"
-#include "glthread.h"
+#include "glapi/glthread.h"
#include "hash.h"
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index e2e7f806ab..ba46cdc1b1 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -3648,11 +3648,13 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
* Try simple cases first
*/
if (transferOps == 0 &&
+ !ctx->Pixel.MapStencilFlag &&
srcType == GL_UNSIGNED_BYTE &&
dstType == GL_UNSIGNED_BYTE) {
_mesa_memcpy(dest, source, n * sizeof(GLubyte));
}
else if (transferOps == 0 &&
+ !ctx->Pixel.MapStencilFlag &&
srcType == GL_UNSIGNED_INT &&
dstType == GL_UNSIGNED_INT &&
!srcPacking->SwapBytes) {
@@ -3668,19 +3670,17 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
extract_uint_indexes(n, indexes, GL_STENCIL_INDEX, srcType, source,
srcPacking);
- if (transferOps) {
- if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
- /* shift and offset indexes */
- shift_and_offset_ci(ctx, n, indexes);
- }
+ if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
+ /* shift and offset indexes */
+ shift_and_offset_ci(ctx, n, indexes);
+ }
- if (ctx->Pixel.MapStencilFlag) {
- /* Apply stencil lookup table */
- GLuint mask = ctx->PixelMaps.StoS.Size - 1;
- GLuint i;
- for (i=0;i<n;i++) {
- indexes[i] = ctx->PixelMaps.StoS.Map[ indexes[i] & mask ];
- }
+ if (ctx->Pixel.MapStencilFlag) {
+ /* Apply stencil lookup table */
+ const GLuint mask = ctx->PixelMaps.StoS.Size - 1;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ indexes[i] = ctx->PixelMaps.StoS.Map[ indexes[i] & mask ];
}
}
@@ -3882,9 +3882,19 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
} \
} while (0)
+
+/**
+ * Unpack a row of depth/z values from memory, returning GLushort, GLuint
+ * or GLfloat values.
+ * The glPixelTransfer (scale/bias) params will be applied.
+ *
+ * \param dstType one of GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, GL_FLOAT
+ * \param depthMax max value for returned GLushort or GLuint values
+ * (ignored for GLfloat).
+ */
void
_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
- GLenum dstType, GLvoid *dest, GLfloat depthScale,
+ GLenum dstType, GLvoid *dest, GLuint depthMax,
GLenum srcType, const GLvoid *source,
const struct gl_pixelstore_attrib *srcPacking )
{
@@ -3907,7 +3917,9 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
}
return;
}
- if (srcType == GL_UNSIGNED_SHORT && dstType == GL_UNSIGNED_INT) {
+ if (srcType == GL_UNSIGNED_SHORT
+ && dstType == GL_UNSIGNED_INT
+ && depthMax == 0xffffffff) {
const GLushort *src = (const GLushort *) source;
GLuint *dst = (GLuint *) dest;
GLuint i;
@@ -3955,7 +3967,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
break;
case GL_UNSIGNED_INT_24_8_EXT: /* GL_EXT_packed_depth_stencil */
if (dstType == GL_UNSIGNED_INT &&
- depthScale == (GLfloat) 0xffffff &&
+ depthMax == 0xffffff &&
ctx->Pixel.DepthScale == 1.0 &&
ctx->Pixel.DepthBias == 0.0) {
const GLuint *src = (const GLuint *) source;
@@ -4033,16 +4045,16 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
if (dstType == GL_UNSIGNED_INT) {
GLuint *zValues = (GLuint *) dest;
GLuint i;
- if (depthScale <= (GLfloat) 0xffffff) {
+ if (depthMax <= 0xffffff) {
/* no overflow worries */
for (i = 0; i < n; i++) {
- zValues[i] = (GLuint) (depthValues[i] * depthScale);
+ zValues[i] = (GLuint) (depthValues[i] * (GLfloat) depthMax);
}
}
else {
/* need to use double precision to prevent overflow problems */
for (i = 0; i < n; i++) {
- GLdouble z = depthValues[i] * depthScale;
+ GLdouble z = depthValues[i] * (GLfloat) depthMax;
if (z >= (GLdouble) 0xffffffff)
zValues[i] = 0xffffffff;
else
@@ -4053,14 +4065,14 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
else if (dstType == GL_UNSIGNED_SHORT) {
GLushort *zValues = (GLushort *) dest;
GLuint i;
- ASSERT(depthScale <= 65535.0);
+ ASSERT(depthMax <= 0xffff);
for (i = 0; i < n; i++) {
- zValues[i] = (GLushort) (depthValues[i] * depthScale);
+ zValues[i] = (GLushort) (depthValues[i] * (GLfloat) depthMax);
}
}
else {
ASSERT(dstType == GL_FLOAT);
- ASSERT(depthScale == 1.0F);
+ /*ASSERT(depthMax == 1.0F);*/
}
}
diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h
index 990398a7c4..2a16989fa7 100644
--- a/src/mesa/main/image.h
+++ b/src/mesa/main/image.h
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5.2
+ * Version: 7.1
*
- * 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"),
@@ -181,7 +181,7 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
extern void
_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
- GLenum dstType, GLvoid *dest, GLfloat depthScale,
+ GLenum dstType, GLvoid *dest, GLuint depthMax,
GLenum srcType, const GLvoid *source,
const struct gl_pixelstore_attrib *srcPacking );
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 8a5dfdb4b8..3ae56c8b0b 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -575,7 +575,11 @@ _mesa_ffs(int i)
* if no bits set.
*/
int
+#ifdef __MINGW32__
+_mesa_ffsll(long val)
+#else
_mesa_ffsll(long long val)
+#endif
{
#ifdef ffsll
return ffsll(val);
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 9be8014a13..ebdfc452a7 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -700,7 +700,11 @@ extern int
_mesa_ffs(int i);
extern int
+#ifdef __MINGW32__
+_mesa_ffsll(long i);
+#else
_mesa_ffsll(long long i);
+#endif
extern unsigned int
_mesa_bitcount(unsigned int n);
diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c
index dc7195d4eb..0c2dbf915a 100644
--- a/src/mesa/main/lines.c
+++ b/src/mesa/main/lines.c
@@ -55,9 +55,6 @@ _mesa_LineWidth( GLfloat width )
FLUSH_VERTICES(ctx, _NEW_LINE);
ctx->Line.Width = width;
- ctx->Line._Width = CLAMP(width,
- ctx->Const.MinLineWidth,
- ctx->Const.MaxLineWidth);
if (ctx->Driver.LineWidth)
ctx->Driver.LineWidth(ctx, width);
@@ -105,13 +102,12 @@ _mesa_LineStipple( GLint factor, GLushort pattern )
* Initializes __GLcontextRec::Line and line related constants in
* __GLcontextRec::Const.
*/
-void GLAPIENTRY _mesa_init_line( GLcontext * ctx )
+void GLAPIENTRY
+_mesa_init_line( GLcontext * ctx )
{
- /* Line group */
ctx->Line.SmoothFlag = GL_FALSE;
ctx->Line.StippleFlag = GL_FALSE;
ctx->Line.Width = 1.0;
- ctx->Line._Width = 1.0;
ctx->Line.StipplePattern = 0xffff;
ctx->Line.StippleFactor = 1;
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 05c08c19fe..d70df5d945 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -38,8 +38,8 @@
#include "glheader.h"
#include <GL/internal/glcore.h> /* __GLcontextModes (GLvisual) */
#include "config.h" /* Hardwired parameters */
-#include "glapitable.h"
-#include "glthread.h"
+#include "glapi/glapitable.h"
+#include "glapi/glthread.h"
#include "math/m_matrix.h" /* GLmatrix */
#include "bitset.h"
@@ -126,6 +126,8 @@ struct gl_pixelstore_attrib;
struct gl_texture_format;
struct gl_texture_image;
struct gl_texture_object;
+struct st_context;
+struct pipe_surface;
typedef struct __GLcontextRec GLcontext;
typedef struct __GLcontextModesRec GLvisual;
typedef struct gl_framebuffer GLframebuffer;
@@ -917,7 +919,6 @@ struct gl_line_attrib
GLushort StipplePattern; /**< Stipple pattern */
GLint StippleFactor; /**< Stipple repeat factor */
GLfloat Width; /**< Line width */
- GLfloat _Width; /**< Clamped Line width */
};
@@ -1063,7 +1064,6 @@ struct gl_point_attrib
{
GLboolean SmoothFlag; /**< True if GL_POINT_SMOOTH is enabled */
GLfloat Size; /**< User-specified point size */
- GLfloat _Size; /**< Size clamped to Const.Min/MaxPointSize */
GLfloat Params[3]; /**< GL_EXT_point_parameters */
GLfloat MinSize, MaxSize; /**< GL_EXT_point_parameters */
GLfloat Threshold; /**< GL_EXT_point_parameters */
@@ -1133,13 +1133,13 @@ struct gl_stencil_attrib
* An index for each type of texture object
*/
/*@{*/
-#define TEXTURE_1D_INDEX 0
-#define TEXTURE_2D_INDEX 1
-#define TEXTURE_3D_INDEX 2
-#define TEXTURE_CUBE_INDEX 3
-#define TEXTURE_RECT_INDEX 4
-#define TEXTURE_1D_ARRAY_INDEX 5
-#define TEXTURE_2D_ARRAY_INDEX 6
+#define TEXTURE_1D_INDEX 0
+#define TEXTURE_2D_INDEX 1
+#define TEXTURE_3D_INDEX 2
+#define TEXTURE_CUBE_INDEX 3
+#define TEXTURE_RECT_INDEX 4
+#define TEXTURE_1D_ARRAY_INDEX 5
+#define TEXTURE_2D_ARRAY_INDEX 6
/*@}*/
/**
@@ -1147,13 +1147,13 @@ struct gl_stencil_attrib
* Used for Texture.Unit[]._ReallyEnabled flags.
*/
/*@{*/
-#define TEXTURE_1D_BIT (1 << TEXTURE_1D_INDEX)
-#define TEXTURE_2D_BIT (1 << TEXTURE_2D_INDEX)
-#define TEXTURE_3D_BIT (1 << TEXTURE_3D_INDEX)
-#define TEXTURE_CUBE_BIT (1 << TEXTURE_CUBE_INDEX)
-#define TEXTURE_RECT_BIT (1 << TEXTURE_RECT_INDEX)
-#define TEXTURE_1D_ARRAY_BIT (1 << TEXTURE_1D_ARRAY_INDEX)
-#define TEXTURE_2D_ARRAY_BIT (1 << TEXTURE_2D_ARRAY_INDEX)
+#define TEXTURE_1D_BIT (1 << TEXTURE_1D_INDEX)
+#define TEXTURE_2D_BIT (1 << TEXTURE_2D_INDEX)
+#define TEXTURE_3D_BIT (1 << TEXTURE_3D_INDEX)
+#define TEXTURE_CUBE_BIT (1 << TEXTURE_CUBE_INDEX)
+#define TEXTURE_RECT_BIT (1 << TEXTURE_RECT_INDEX)
+#define TEXTURE_1D_ARRAY_BIT (1 << TEXTURE_1D_ARRAY_INDEX)
+#define TEXTURE_2D_ARRAY_BIT (1 << TEXTURE_2D_ARRAY_INDEX)
/*@}*/
@@ -1327,8 +1327,6 @@ struct gl_texture_format
};
-#define MAX_3D_TEXTURE_SIZE (1 << (MAX_3D_TEXTURE_LEVELS - 1))
-
/**
* Texture image state. Describes the dimensions of a texture image,
* the texel format and pointers to Texel Fetch functions.
@@ -1393,7 +1391,7 @@ struct gl_texture_image
#define FACE_NEG_Y 3
#define FACE_POS_Z 4
#define FACE_NEG_Z 5
-#define MAX_FACES 6
+#define MAX_FACES 6
/*@}*/
@@ -2193,12 +2191,11 @@ struct gl_shared_state
* \todo Improve the granularity of locking.
*/
/*@{*/
- _glthread_Mutex TexMutex; /**< texobj thread safety */
- GLuint TextureStateStamp; /**< state notification for shared tex */
+ _glthread_Mutex TexMutex; /**< texobj thread safety */
+ GLuint TextureStateStamp; /**< state notification for shared tex */
/*@}*/
-
/**
* \name Vertex/fragment programs
*/
@@ -2272,6 +2269,8 @@ struct gl_renderbuffer
GLubyte StencilBits;
GLvoid *Data; /**< This may not be used by some kinds of RBs */
+ struct pipe_surface *surface;
+
/* Used to wrap one renderbuffer around another: */
struct gl_renderbuffer *Wrapped;
@@ -3107,7 +3106,7 @@ struct __GLcontextRec
void *swsetup_context;
void *swtnl_context;
void *swtnl_im;
- void *acache_context;
+ struct st_context *st;
void *aelt_context;
/*@}*/
};
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index 0f562420b0..e83db5de78 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -57,10 +57,6 @@ _mesa_PointSize( GLfloat size )
FLUSH_VERTICES(ctx, _NEW_POINT);
ctx->Point.Size = size;
- /* XXX correct clamp limits? */
- ctx->Point._Size = CLAMP(ctx->Point.Size,
- ctx->Point.MinSize,
- ctx->Point.MaxSize);
if (ctx->Driver.PointSize)
ctx->Driver.PointSize(ctx, size);
@@ -253,7 +249,6 @@ _mesa_init_point(GLcontext *ctx)
ctx->Point.SmoothFlag = GL_FALSE;
ctx->Point.Size = 1.0;
- ctx->Point._Size = 1.0;
ctx->Point.Params[0] = 1.0;
ctx->Point.Params[1] = 0.0;
ctx->Point.Params[2] = 0.0;
diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index 0e59ba615a..fc04dde3f4 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -30,6 +30,11 @@
#include "queryobj.h"
#include "mtypes.h"
+#if 1 /*PIPE*/
+#include "pipe/p_context.h"
+#include "state_tracker/st_context.h"
+#endif
+
/**
* Allocate a new query object. This is a fallback routine called via
@@ -220,6 +225,10 @@ _mesa_BeginQueryARB(GLenum target, GLuint id)
q->Result = 0;
q->Ready = GL_FALSE;
+#if 1 /*PIPE*/
+ ctx->st->pipe->reset_occlusion_counter(ctx->st->pipe);
+#endif
+
if (target == GL_SAMPLES_PASSED_ARB) {
ctx->Query.CurrentOcclusionObject = q;
}
@@ -282,6 +291,12 @@ _mesa_EndQueryARB(GLenum target)
/* if we're using software rendering/querying */
q->Ready = GL_TRUE;
}
+
+#if 1 /*PIPE*/
+ if (target == GL_SAMPLES_PASSED_ARB) {
+ q->Result = ctx->st->pipe->get_occlusion_counter(ctx->st->pipe);
+ }
+#endif
}
diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index 6f1d7c3960..a900de169e 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -49,6 +49,10 @@
#include "rbadaptors.h"
+#include "pipe/softpipe/sp_z_surface.h"
+#include "pipe/p_state.h"
+#include "pipe/p_defines.h"
+
/* 32-bit color index format. Not a public format. */
#define COLOR_INDEX32 0x424243
@@ -1091,6 +1095,8 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
rb->PutValues = put_values_ushort;
rb->PutMonoValues = put_mono_values_ushort;
rb->DepthBits = 8 * sizeof(GLushort);
+ rb->surface
+ = (struct pipe_surface *) softpipe_new_z_surface(PIPE_FORMAT_U_Z16);
pixelSize = sizeof(GLushort);
break;
case GL_DEPTH_COMPONENT24:
@@ -1113,6 +1119,8 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
rb->_ActualFormat = GL_DEPTH_COMPONENT32;
rb->DepthBits = 32;
}
+ rb->surface
+ = (struct pipe_surface *) softpipe_new_z_surface(PIPE_FORMAT_U_Z32);
pixelSize = sizeof(GLuint);
break;
case GL_DEPTH_STENCIL_EXT:
@@ -1130,6 +1138,8 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
rb->PutMonoValues = put_mono_values_uint;
rb->DepthBits = 24;
rb->StencilBits = 8;
+ rb->surface
+ = (struct pipe_surface *) softpipe_new_z_surface(PIPE_FORMAT_Z24_S8);
pixelSize = sizeof(GLuint);
break;
case GL_COLOR_INDEX8_EXT:
@@ -1193,13 +1203,27 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
/* free old buffer storage */
if (rb->Data) {
- _mesa_free(rb->Data);
+ if (rb->surface) {
+ /* pipe surface */
+ }
+ else {
+ /* legacy renderbuffer */
+ _mesa_free(rb->Data);
+ }
rb->Data = NULL;
}
if (width > 0 && height > 0) {
/* allocate new buffer storage */
- rb->Data = _mesa_malloc(width * height * pixelSize);
+ if (rb->surface) {
+ /* pipe surface */
+ rb->surface->resize(rb->surface, width, height);
+ rb->Data = rb->surface->buffer.ptr;
+ }
+ else {
+ /* legacy renderbuffer */
+ rb->Data = _mesa_malloc(width * height * pixelSize);
+ }
if (rb->Data == NULL) {
rb->Width = 0;
rb->Height = 0;
diff --git a/src/mesa/main/shaders.c b/src/mesa/main/shaders.c
index 58be1f46e5..7bf8808767 100644
--- a/src/mesa/main/shaders.c
+++ b/src/mesa/main/shaders.c
@@ -83,7 +83,7 @@ _mesa_CreateShader(GLenum type)
}
-GLhandleARB APIENTRY
+GLhandleARB GLAPIENTRY
_mesa_CreateShaderObjectARB(GLenum type)
{
GET_CURRENT_CONTEXT(ctx);
@@ -99,7 +99,7 @@ _mesa_CreateProgram(void)
}
-GLhandleARB APIENTRY
+GLhandleARB GLAPIENTRY
_mesa_CreateProgramObjectARB(void)
{
GET_CURRENT_CONTEXT(ctx);
@@ -319,7 +319,7 @@ _mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint * params)
#if 0
-GLint APIENTRY
+GLint GLAPIENTRY
_mesa_GetUniformLocation(GLuint program, const GLcharARB *name)
{
GET_CURRENT_CONTEXT(ctx);
@@ -336,7 +336,7 @@ _mesa_GetHandleARB(GLenum pname)
}
-GLint APIENTRY
+GLint GLAPIENTRY
_mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB *name)
{
GET_CURRENT_CONTEXT(ctx);
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 0a83abc7dd..444f227760 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -35,10 +35,10 @@
#include "accum.h"
#include "api_loopback.h"
#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
-#include "arbprogram.h"
+#include "shader/arbprogram.h"
#endif
#if FEATURE_ATI_fragment_shader
-#include "atifragshader.h"
+#include "shader/atifragshader.h"
#endif
#include "attrib.h"
#include "blend.h"
@@ -85,18 +85,18 @@
#include "mtypes.h"
#include "varray.h"
#if FEATURE_NV_vertex_program
-#include "nvprogram.h"
+#include "shader/nvprogram.h"
#endif
#if FEATURE_NV_fragment_program
-#include "nvprogram.h"
-#include "program.h"
+#include "shader/nvprogram.h"
+#include "shader/program.h"
#include "texenvprogram.h"
#endif
#if FEATURE_ARB_shader_objects
#include "shaders.h"
#endif
#include "debug.h"
-#include "dispatch.h"
+#include "glapi/dispatch.h"
@@ -1068,7 +1068,7 @@ update_tricaps(GLcontext *ctx, GLbitfield new_state)
if (1/*new_state & _NEW_POINT*/) {
if (ctx->Point.SmoothFlag)
ctx->_TriangleCaps |= DD_POINT_SMOOTH;
- if (ctx->Point._Size != 1.0F)
+ if (ctx->Point.Size != 1.0F)
ctx->_TriangleCaps |= DD_POINT_SIZE;
if (ctx->Point._Attenuated)
ctx->_TriangleCaps |= DD_POINT_ATTEN;
@@ -1082,7 +1082,7 @@ update_tricaps(GLcontext *ctx, GLbitfield new_state)
ctx->_TriangleCaps |= DD_LINE_SMOOTH;
if (ctx->Line.StippleFlag)
ctx->_TriangleCaps |= DD_LINE_STIPPLE;
- if (ctx->Line._Width != 1.0)
+ if (ctx->Line.Width != 1.0)
ctx->_TriangleCaps |= DD_LINE_WIDTH;
}
diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c
index 411d51cfcc..b6991f45ed 100644
--- a/src/mesa/main/texcompress_fxt1.c
+++ b/src/mesa/main/texcompress_fxt1.c
@@ -302,7 +302,12 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
#define FX64_NATIVE 1
+#ifdef __MINGW32__
+typedef unsigned long Fx64;
+#else
typedef unsigned long long Fx64;
+#endif
+
#define FX64_MOV32(a, b) a = b
#define FX64_OR32(a, b) a |= b
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 1a46c10ffa..72b54b27d9 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -28,10 +28,10 @@
#include "glheader.h"
#include "macros.h"
#include "enums.h"
-#include "prog_parameter.h"
-#include "prog_instruction.h"
-#include "prog_print.h"
-#include "prog_statevars.h"
+#include "shader/prog_parameter.h"
+#include "shader/prog_instruction.h"
+#include "shader/prog_print.h"
+#include "shader/prog_statevars.h"
#include "texenvprogram.h"
/**
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index f902365b9b..3420d8e2ba 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1264,6 +1264,10 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
* A hardware driver might override this function if, for example, the
* max 3D texture size is 512x512x64 (i.e. not a cube).
*
+ * Note that width, height, depth == 0 is not an error. However, a
+ * texture with zero width/height/depth will be considered "incomplete"
+ * and texturing will effectively be disabled.
+ *
* \param target one of GL_PROXY_TEXTURE_1D, GL_PROXY_TEXTURE_2D,
* GL_PROXY_TEXTURE_3D, GL_PROXY_TEXTURE_RECTANGLE_NV,
* GL_PROXY_TEXTURE_CUBE_MAP_ARB.
@@ -1293,7 +1297,7 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
if (width < 2 * border || width > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(width - 2 * border) != 1) ||
+ width >0 && _mesa_bitcount(width - 2 * border) != 1) ||
level >= ctx->Const.MaxTextureLevels) {
/* bad width or level */
return GL_FALSE;
@@ -1303,10 +1307,10 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
if (width < 2 * border || width > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(width - 2 * border) != 1) ||
+ width > 0 && _mesa_bitcount(width - 2 * border) != 1) ||
height < 2 * border || height > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(height - 2 * border) != 1) ||
+ height > 0 && _mesa_bitcount(height - 2 * border) != 1) ||
level >= ctx->Const.MaxTextureLevels) {
/* bad width or height or level */
return GL_FALSE;
@@ -1316,21 +1320,21 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
if (width < 2 * border || width > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(width - 2 * border) != 1) ||
+ width > 0 && _mesa_bitcount(width - 2 * border) != 1) ||
height < 2 * border || height > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(height - 2 * border) != 1) ||
+ height > 0 && _mesa_bitcount(height - 2 * border) != 1) ||
depth < 2 * border || depth > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(depth - 2 * border) != 1) ||
+ depth > 0 && _mesa_bitcount(depth - 2 * border) != 1) ||
level >= ctx->Const.Max3DTextureLevels) {
/* bad width or height or depth or level */
return GL_FALSE;
}
return GL_TRUE;
case GL_PROXY_TEXTURE_RECTANGLE_NV:
- if (width < 1 || width > ctx->Const.MaxTextureRectSize ||
- height < 1 || height > ctx->Const.MaxTextureRectSize ||
+ if (width < 0 || width > ctx->Const.MaxTextureRectSize ||
+ height < 0 || height > ctx->Const.MaxTextureRectSize ||
level != 0) {
/* bad width or height or level */
return GL_FALSE;
@@ -1340,10 +1344,10 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1);
if (width < 2 * border || width > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(width - 2 * border) != 1) ||
+ width > 0 && _mesa_bitcount(width - 2 * border) != 1) ||
height < 2 * border || height > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(height - 2 * border) != 1) ||
+ height > 0 && _mesa_bitcount(height - 2 * border) != 1) ||
level >= ctx->Const.MaxCubeTextureLevels) {
/* bad width or height */
return GL_FALSE;
@@ -1353,7 +1357,7 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
if (width < 2 * border || width > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(width - 2 * border) != 1) ||
+ width > 0 && _mesa_bitcount(width - 2 * border) != 1) ||
level >= ctx->Const.MaxTextureLevels) {
/* bad width or level */
return GL_FALSE;
@@ -1367,10 +1371,10 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
if (width < 2 * border || width > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(width - 2 * border) != 1) ||
+ width > 0 && _mesa_bitcount(width - 2 * border) != 1) ||
height < 2 * border || height > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(height - 2 * border) != 1) ||
+ height > 0 && _mesa_bitcount(height - 2 * border) != 1) ||
level >= ctx->Const.MaxTextureLevels) {
/* bad width or height or level */
return GL_FALSE;
@@ -1472,7 +1476,7 @@ texture_error_check( GLcontext *ctx, GLenum target,
if (target == GL_PROXY_TEXTURE_1D || target == GL_TEXTURE_1D) {
proxy_target = GL_PROXY_TEXTURE_1D;
height = 1;
- width = 1;
+ depth = 1;
}
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" );
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 9b8a06df14..3b5151ed17 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -1077,7 +1077,7 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS)
GLboolean
_mesa_texstore_z32(TEXSTORE_PARAMS)
{
- const GLfloat depthScale = (GLfloat) 0xffffffff;
+ const GLuint depthScale = 0xffffffff;
(void) dims;
ASSERT(dstFormat == &_mesa_texformat_z32);
ASSERT(dstFormat->TexelBytes == sizeof(GLuint));
@@ -1124,7 +1124,7 @@ _mesa_texstore_z32(TEXSTORE_PARAMS)
GLboolean
_mesa_texstore_z16(TEXSTORE_PARAMS)
{
- const GLfloat depthScale = 65535.0f;
+ const GLuint depthScale = 0xffff;
(void) dims;
ASSERT(dstFormat == &_mesa_texformat_z16);
ASSERT(dstFormat->TexelBytes == sizeof(GLushort));
@@ -2319,6 +2319,8 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS)
GLboolean
_mesa_texstore_z24_s8(TEXSTORE_PARAMS)
{
+ const GLuint depthScale = 0xffffff;
+
ASSERT(dstFormat == &_mesa_texformat_z24_s8);
ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT);
ASSERT(srcType == GL_UNSIGNED_INT_24_8_EXT);
@@ -2357,7 +2359,7 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
_mesa_unpack_depth_span(ctx, srcWidth,
GL_UNSIGNED_INT, /* dst type */
dstRow, /* dst addr */
- (GLfloat) 0xffffff, /* depthScale */
+ depthScale,
srcType, src, srcPacking);
/* get the 8-bit stencil values */
_mesa_unpack_stencil_span(ctx, srcWidth,
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index bf1ad0165e..fe4a7c684f 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -32,7 +32,7 @@
#include "mtypes.h"
#include "varray.h"
#include "arrayobj.h"
-#include "dispatch.h"
+#include "glapi/dispatch.h"
/**
diff --git a/src/mesa/main/vtxfmt_tmp.h b/src/mesa/main/vtxfmt_tmp.h
index 783b06558d..6f5d01e40f 100644
--- a/src/mesa/main/vtxfmt_tmp.h
+++ b/src/mesa/main/vtxfmt_tmp.h
@@ -29,8 +29,8 @@
#define PRE_LOOPBACK( FUNC )
#endif
-#include "dispatch.h"
-#include "glapioffsets.h"
+#include "glapi/dispatch.h"
+#include "glapi/glapioffsets.h"
static void GLAPIENTRY TAG(ArrayElement)( GLint i )
{