aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/APIspec.xml2
-rw-r--r--mesalib/src/mesa/main/arrayobj.c11
-rw-r--r--mesalib/src/mesa/main/arrayobj.h12
-rw-r--r--mesalib/src/mesa/main/bufferobj.c11
-rw-r--r--mesalib/src/mesa/main/dd.h2
-rw-r--r--mesalib/src/mesa/main/enable.c11
-rw-r--r--mesalib/src/mesa/main/errors.c18
-rw-r--r--mesalib/src/mesa/main/ffvertex_prog.c2
-rw-r--r--mesalib/src/mesa/main/imports.h10
-rw-r--r--mesalib/src/mesa/main/light.c10
-rw-r--r--mesalib/src/mesa/main/mtypes.h138
-rw-r--r--mesalib/src/mesa/main/transformfeedback.c2
12 files changed, 136 insertions, 93 deletions
diff --git a/mesalib/src/mesa/main/APIspec.xml b/mesalib/src/mesa/main/APIspec.xml
index 64e666eff..f870cf7db 100644
--- a/mesalib/src/mesa/main/APIspec.xml
+++ b/mesalib/src/mesa/main/APIspec.xml
@@ -2946,7 +2946,7 @@
<return type="void"/>
<param name="shader" type="GLuint"/>
<param name="count" type="GLsizei"/>
- <param name="string" type="const GLchar **"/>
+ <param name="string" type="const GLchar * const *"/>
<param name="length" type="const int *"/>
</proto>
</template>
diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c
index 4c50066de..3439ab6b5 100644
--- a/mesalib/src/mesa/main/arrayobj.c
+++ b/mesalib/src/mesa/main/arrayobj.c
@@ -123,14 +123,15 @@ _mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj )
/**
* Set ptr to arrayObj w/ reference counting.
+ * Note: this should only be called from the _mesa_reference_array_object()
+ * inline function.
*/
void
-_mesa_reference_array_object(struct gl_context *ctx,
- struct gl_array_object **ptr,
- struct gl_array_object *arrayObj)
+_mesa_reference_array_object_(struct gl_context *ctx,
+ struct gl_array_object **ptr,
+ struct gl_array_object *arrayObj)
{
- if (*ptr == arrayObj)
- return;
+ assert(*ptr != arrayObj);
if (*ptr) {
/* Unreference the old array object */
diff --git a/mesalib/src/mesa/main/arrayobj.h b/mesalib/src/mesa/main/arrayobj.h
index 717c7916e..e5270fa2c 100644
--- a/mesalib/src/mesa/main/arrayobj.h
+++ b/mesalib/src/mesa/main/arrayobj.h
@@ -52,9 +52,19 @@ extern void
_mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj );
extern void
+_mesa_reference_array_object_(struct gl_context *ctx,
+ struct gl_array_object **ptr,
+ struct gl_array_object *arrayObj);
+
+static inline void
_mesa_reference_array_object(struct gl_context *ctx,
struct gl_array_object **ptr,
- struct gl_array_object *arrayObj);
+ struct gl_array_object *arrayObj)
+{
+ if (*ptr != arrayObj)
+ _mesa_reference_array_object_(ctx, ptr, arrayObj);
+}
+
extern void
_mesa_initialize_array_object( struct gl_context *ctx,
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 8b69ca3a1..d74b7d74f 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -2021,8 +2021,11 @@ set_ubo_binding(struct gl_context *ctx,
}
/**
- * Specify a buffer object to receive vertex shader results. Plus,
- * specify the starting offset to place the results, and max size.
+ * Bind a region of a buffer object to a uniform block binding point.
+ * \param index the uniform buffer binding point index
+ * \param bufObj the buffer object
+ * \param offset offset to the start of buffer object region
+ * \param size size of the buffer object region
*/
static void
bind_buffer_range_uniform_buffer(struct gl_context *ctx,
@@ -2054,8 +2057,8 @@ bind_buffer_range_uniform_buffer(struct gl_context *ctx,
/**
- * Specify a buffer object to receive vertex shader results.
- * As above, but start at offset = 0.
+ * Bind a buffer object to a uniform block binding point.
+ * As above, but offset = 0.
*/
static void
bind_buffer_base_uniform_buffer(struct gl_context *ctx,
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index 5bcf36bfa..687a38f44 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -1024,7 +1024,7 @@ typedef struct {
void (GLAPIENTRYP MultiDrawElementsBaseVertex)( GLenum mode,
const GLsizei *count,
GLenum type,
- const GLvoid **indices,
+ const GLvoid * const *indices,
GLsizei primcount,
const GLint *basevertex);
void (GLAPIENTRYP DrawArraysInstanced)(GLenum mode, GLint first,
diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c
index d0b462580..c811f2a9c 100644
--- a/mesalib/src/mesa/main/enable.c
+++ b/mesalib/src/mesa/main/enable.c
@@ -161,8 +161,8 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
return;
invalid_enum_error:
- _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(0x%x)",
- state ? "Enable" : "Disable", cap);
+ _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(%s)",
+ state ? "Enable" : "Disable", _mesa_lookup_enum_by_nr(cap));
}
@@ -937,8 +937,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
return;
invalid_enum_error:
- _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)",
- state ? "Enable" : "Disable", cap);
+ _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(%s)",
+ state ? "Enable" : "Disable", _mesa_lookup_enum_by_nr(cap));
}
@@ -1441,6 +1441,7 @@ _mesa_IsEnabled( GLenum cap )
return GL_FALSE;
invalid_enum_error:
- _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap);
+ _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(%s)",
+ _mesa_lookup_enum_by_nr(cap));
return GL_FALSE;
}
diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c
index 69dbb65cf..8b96319ce 100644
--- a/mesalib/src/mesa/main/errors.c
+++ b/mesalib/src/mesa/main/errors.c
@@ -718,11 +718,11 @@ _mesa_DebugMessageControlARB(GLenum source, GLenum type, GLenum severity,
}
static void GLAPIENTRY
-_mesa_DebugMessageCallbackARB(GLDEBUGPROCARB callback, GLvoid *userParam)
+_mesa_DebugMessageCallbackARB(GLDEBUGPROCARB callback, const GLvoid *userParam)
{
GET_CURRENT_CONTEXT(ctx);
ctx->Debug.Callback = callback;
- ctx->Debug.CallbackData = userParam;
+ ctx->Debug.CallbackData = (void *) userParam;
}
void
@@ -801,12 +801,21 @@ output_if_debug(const char *prefixString, const char *outputString,
GLboolean newline)
{
static int debug = -1;
+ static FILE *fout = NULL;
/* Init the local 'debug' var once.
* Note: the _mesa_init_debug() function should have been called
* by now so MESA_DEBUG_FLAGS will be initialized.
*/
if (debug == -1) {
+ /* If MESA_LOG_FILE env var is set, log Mesa errors, warnings,
+ * etc to the named file. Otherwise, output to stderr.
+ */
+ const char *logFile = _mesa_getenv("MESA_LOG_FILE");
+ if (logFile)
+ fout = fopen(logFile, "w");
+ if (!fout)
+ fout = stderr;
#ifdef DEBUG
/* in debug builds, print messages unless MESA_DEBUG="silent" */
if (MESA_DEBUG_FLAGS & DEBUG_SILENT)
@@ -821,9 +830,10 @@ output_if_debug(const char *prefixString, const char *outputString,
/* Now only print the string if we're required to do so. */
if (debug) {
- fprintf(stderr, "%s: %s", prefixString, outputString);
+ fprintf(fout, "%s: %s", prefixString, outputString);
if (newline)
- fprintf(stderr, "\n");
+ fprintf(fout, "\n");
+ fflush(fout);
#if defined(_WIN32) && !defined(_WIN32_WCE)
/* stderr from windows applications without console is not usually
diff --git a/mesalib/src/mesa/main/ffvertex_prog.c b/mesalib/src/mesa/main/ffvertex_prog.c
index f1ab75333..557768311 100644
--- a/mesalib/src/mesa/main/ffvertex_prog.c
+++ b/mesalib/src/mesa/main/ffvertex_prog.c
@@ -181,7 +181,7 @@ static void make_state_key( struct gl_context *ctx, struct state_key *key )
key->light_twoside = 1;
if (ctx->Light.ColorMaterialEnabled) {
- key->light_color_material_mask = ctx->Light.ColorMaterialBitmask;
+ key->light_color_material_mask = ctx->Light._ColorMaterialBitmask;
}
for (i = 0; i < MAX_LIGHTS; i++) {
diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h
index c0b6cecea..9fb6ae8f1 100644
--- a/mesalib/src/mesa/main/imports.h
+++ b/mesalib/src/mesa/main/imports.h
@@ -646,6 +646,16 @@ _mesa_vsnprintf(char *str, size_t size, const char *fmt, va_list arg);
#endif
+/**
+ * On Mingw32 we need to use __mingw_fprintf() to parse formats such
+ * as "0x%llx", and possibly others
+ */
+#ifdef __MINGW32__
+#define fprintf __mingw_fprintf
+#endif
+
+
+
#ifdef __cplusplus
}
#endif
diff --git a/mesalib/src/mesa/main/light.c b/mesalib/src/mesa/main/light.c
index 38ec1b6e8..d6fbcd9be 100644
--- a/mesalib/src/mesa/main/light.c
+++ b/mesalib/src/mesa/main/light.c
@@ -693,13 +693,13 @@ _mesa_update_material( struct gl_context *ctx, GLuint bitmask )
/*
* Update the current materials from the given rgba color
- * according to the bitmask in ColorMaterialBitmask, which is
+ * according to the bitmask in _ColorMaterialBitmask, which is
* set by glColorMaterial().
*/
void
_mesa_update_color_material( struct gl_context *ctx, const GLfloat color[4] )
{
- GLuint bitmask = ctx->Light.ColorMaterialBitmask;
+ const GLbitfield bitmask = ctx->Light._ColorMaterialBitmask;
struct gl_material *mat = &ctx->Light.Material;
int i;
@@ -731,13 +731,13 @@ _mesa_ColorMaterial( GLenum face, GLenum mode )
if (bitmask == 0)
return; /* error was recorded */
- if (ctx->Light.ColorMaterialBitmask == bitmask &&
+ if (ctx->Light._ColorMaterialBitmask == bitmask &&
ctx->Light.ColorMaterialFace == face &&
ctx->Light.ColorMaterialMode == mode)
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
- ctx->Light.ColorMaterialBitmask = bitmask;
+ ctx->Light._ColorMaterialBitmask = bitmask;
ctx->Light.ColorMaterialFace = face;
ctx->Light.ColorMaterialMode = mode;
@@ -1188,7 +1188,7 @@ _mesa_init_lighting( struct gl_context *ctx )
ctx->Light.Enabled = GL_FALSE;
ctx->Light.ColorMaterialFace = GL_FRONT_AND_BACK;
ctx->Light.ColorMaterialMode = GL_AMBIENT_AND_DIFFUSE;
- ctx->Light.ColorMaterialBitmask = _mesa_material_bitmask( ctx,
+ ctx->Light._ColorMaterialBitmask = _mesa_material_bitmask( ctx,
GL_FRONT_AND_BACK,
GL_AMBIENT_AND_DIFFUSE, ~0,
NULL );
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index def0db1aa..d37c1f3de 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -630,6 +630,26 @@ struct gl_config
/**
+ * Material state.
+ */
+struct gl_material
+{
+ GLfloat Attrib[MAT_ATTRIB_MAX][4];
+};
+
+
+/**
+ * Light state flags.
+ */
+/*@{*/
+#define LIGHT_SPOT 0x1
+#define LIGHT_LOCAL_VIEWER 0x2
+#define LIGHT_POSITIONAL 0x4
+#define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER)
+/*@}*/
+
+
+/**
* Light source state.
*/
struct gl_light
@@ -654,7 +674,7 @@ struct gl_light
* \name Derived fields
*/
/*@{*/
- GLbitfield _Flags; /**< State */
+ GLbitfield _Flags; /**< Mask of LIGHT_x bits defined above */
GLfloat _Position[4]; /**< position in eye/obj coordinates */
GLfloat _VP_inf_norm[3]; /**< Norm direction to infinite light */
@@ -683,15 +703,6 @@ struct gl_lightmodel
/**
- * Material state.
- */
-struct gl_material
-{
- GLfloat Attrib[MAT_ATTRIB_MAX][4];
-};
-
-
-/**
* Accumulation buffer attribute group (GL_ACCUM_BUFFER_BIT)
*/
struct gl_accum_attrib
@@ -912,16 +923,6 @@ struct gl_hint_attrib
GLenum FragmentShaderDerivative; /**< GL_ARB_fragment_shader */
};
-/**
- * Light state flags.
- */
-/*@{*/
-#define LIGHT_SPOT 0x1
-#define LIGHT_LOCAL_VIEWER 0x2
-#define LIGHT_POSITIONAL 0x4
-#define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER)
-/*@}*/
-
/**
* Lighting attribute group (GL_LIGHT_BIT).
@@ -932,20 +933,19 @@ struct gl_light_attrib
struct gl_lightmodel Model; /**< Lighting model */
/**
- * Must flush FLUSH_VERTICES before referencing:
+ * Front and back material values.
+ * Note: must call FLUSH_VERTICES() before using.
*/
- /*@{*/
- struct gl_material Material; /**< Includes front & back values */
- /*@}*/
+ struct gl_material Material;
GLboolean Enabled; /**< Lighting enabled flag */
GLenum ShadeModel; /**< GL_FLAT or GL_SMOOTH */
GLenum ProvokingVertex; /**< GL_EXT_provoking_vertex */
GLenum ColorMaterialFace; /**< GL_FRONT, BACK or FRONT_AND_BACK */
GLenum ColorMaterialMode; /**< GL_AMBIENT, GL_DIFFUSE, etc */
- GLbitfield ColorMaterialBitmask; /**< bitmask formed from Face and Mode */
+ GLbitfield _ColorMaterialBitmask; /**< bitmask formed from Face and Mode */
GLboolean ColorMaterialEnabled;
- GLenum ClampVertexColor;
+ GLenum ClampVertexColor; /**< GL_TRUE, GL_FALSE, GL_FIXED_ONLY */
GLboolean _ClampVertexColor;
struct gl_light EnabledList; /**< List sentinel */
@@ -1181,46 +1181,6 @@ typedef enum
/**
- * TexGenEnabled flags.
- */
-/*@{*/
-#define S_BIT 1
-#define T_BIT 2
-#define R_BIT 4
-#define Q_BIT 8
-#define STR_BITS (S_BIT | T_BIT | R_BIT)
-/*@}*/
-
-
-/**
- * Bit flag versions of the corresponding GL_ constants.
- */
-/*@{*/
-#define TEXGEN_SPHERE_MAP 0x1
-#define TEXGEN_OBJ_LINEAR 0x2
-#define TEXGEN_EYE_LINEAR 0x4
-#define TEXGEN_REFLECTION_MAP_NV 0x8
-#define TEXGEN_NORMAL_MAP_NV 0x10
-
-#define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \
- TEXGEN_REFLECTION_MAP_NV | \
- TEXGEN_NORMAL_MAP_NV)
-#define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \
- TEXGEN_REFLECTION_MAP_NV | \
- TEXGEN_NORMAL_MAP_NV | \
- TEXGEN_EYE_LINEAR)
-/*@}*/
-
-
-
-/** Tex-gen enabled for texture unit? */
-#define ENABLE_TEXGEN(unit) (1 << (unit))
-
-/** Non-identity texture matrix for texture unit? */
-#define ENABLE_TEXMAT(unit) (1 << (unit))
-
-
-/**
* Texture image state. Drivers will typically create a subclass of this
* with extra fields for memory buffers, etc.
*/
@@ -1367,6 +1327,46 @@ struct gl_tex_env_combine_state
/**
+ * TexGenEnabled flags.
+ */
+/*@{*/
+#define S_BIT 1
+#define T_BIT 2
+#define R_BIT 4
+#define Q_BIT 8
+#define STR_BITS (S_BIT | T_BIT | R_BIT)
+/*@}*/
+
+
+/**
+ * Bit flag versions of the corresponding GL_ constants.
+ */
+/*@{*/
+#define TEXGEN_SPHERE_MAP 0x1
+#define TEXGEN_OBJ_LINEAR 0x2
+#define TEXGEN_EYE_LINEAR 0x4
+#define TEXGEN_REFLECTION_MAP_NV 0x8
+#define TEXGEN_NORMAL_MAP_NV 0x10
+
+#define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \
+ TEXGEN_REFLECTION_MAP_NV | \
+ TEXGEN_NORMAL_MAP_NV)
+#define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \
+ TEXGEN_REFLECTION_MAP_NV | \
+ TEXGEN_NORMAL_MAP_NV | \
+ TEXGEN_EYE_LINEAR)
+/*@}*/
+
+
+
+/** Tex-gen enabled for texture unit? */
+#define ENABLE_TEXGEN(unit) (1 << (unit))
+
+/** Non-identity texture matrix for texture unit? */
+#define ENABLE_TEXMAT(unit) (1 << (unit))
+
+
+/**
* Texture coord generation state.
*/
struct gl_texgen
@@ -2021,6 +2021,12 @@ struct gl_fragment_program
* GLSL, the value is INTERP_QUALIFIER_NONE.
*/
enum glsl_interp_qualifier InterpQualifier[FRAG_ATTRIB_MAX];
+
+ /**
+ * Bitfield indicating, for each fragment shader input, 1 if that input
+ * uses centroid interpolation, 0 otherwise. Unused inputs are 0.
+ */
+ GLbitfield64 IsCentroid;
};
diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c
index 84c409185..d02b6a056 100644
--- a/mesalib/src/mesa/main/transformfeedback.c
+++ b/mesalib/src/mesa/main/transformfeedback.c
@@ -428,6 +428,7 @@ bind_buffer_range(struct gl_context *ctx, GLuint index,
/**
* Specify a buffer object to receive vertex shader results. Plus,
* specify the starting offset to place the results, and max size.
+ * Called from the glBindBufferRange() function.
*/
void
_mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx,
@@ -471,6 +472,7 @@ _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx,
/**
* Specify a buffer object to receive vertex shader results.
* As above, but start at offset = 0.
+ * Called from the glBindBufferBase() function.
*/
void
_mesa_bind_buffer_base_transform_feedback(struct gl_context *ctx,