aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-09-03 09:54:39 +0200
committermarha <marha@users.sourceforge.net>2012-09-04 14:23:32 +0200
commitc18d12d1e36354ff32724c86ae25374d1a78607f (patch)
tree3db58d40725863f1d1145002f998a6cf0662fbf9 /mesalib/src/mesa
parent77f54d0b20cc194e708bc664740e4c0b0e13c3dd (diff)
downloadvcxsrv-c18d12d1e36354ff32724c86ae25374d1a78607f.tar.gz
vcxsrv-c18d12d1e36354ff32724c86ae25374d1a78607f.tar.bz2
vcxsrv-c18d12d1e36354ff32724c86ae25374d1a78607f.zip
mesa xkeyboard-config git update 3 sep 2012
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/drivers/dri/common/drisw_util.c12
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlconfig.c30
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast.c6
-rw-r--r--mesalib/src/mesa/main/api_arrayelt.c4
-rw-r--r--mesalib/src/mesa/main/attrib.c10
-rw-r--r--mesalib/src/mesa/main/errors.c6
-rw-r--r--mesalib/src/mesa/main/eval.c60
-rw-r--r--mesalib/src/mesa/main/imports.h153
-rw-r--r--mesalib/src/mesa/main/macros.h32
-rw-r--r--mesalib/src/mesa/main/matrix.c4
-rw-r--r--mesalib/src/mesa/main/renderbuffer.c6
-rw-r--r--mesalib/src/mesa/main/samplerobj.c2
-rw-r--r--mesalib/src/mesa/main/syncobj.c8
-rw-r--r--mesalib/src/mesa/main/teximage.c2
-rw-r--r--mesalib/src/mesa/program/nvfragparse.c4
-rw-r--r--mesalib/src/mesa/program/nvvertparse.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_syncobj.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp16
-rw-r--r--mesalib/src/mesa/state_tracker/st_manager.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c10
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.c12
-rw-r--r--mesalib/src/mesa/swrast/s_context.c14
-rw-r--r--mesalib/src/mesa/swrast/s_renderbuffer.c2
-rw-r--r--mesalib/src/mesa/swrast/s_texcombine.c2
-rw-r--r--mesalib/src/mesa/swrast/s_zoom.c2
-rw-r--r--mesalib/src/mesa/swrast_setup/ss_context.c4
-rw-r--r--mesalib/src/mesa/tnl/t_context.c4
-rw-r--r--mesalib/src/mesa/tnl/t_vb_fog.c4
-rw-r--r--mesalib/src/mesa/tnl/t_vb_light.c4
-rw-r--r--mesalib/src/mesa/tnl/t_vb_program.c4
-rw-r--r--mesalib/src/mesa/tnl/t_vb_texgen.c12
-rw-r--r--mesalib/src/mesa/tnl/t_vb_texmat.c4
-rw-r--r--mesalib/src/mesa/tnl/t_vb_vertex.c4
-rw-r--r--mesalib/src/mesa/tnl/t_vertex.c4
-rw-r--r--mesalib/src/mesa/vbo/vbo_context.c2
-rw-r--r--mesalib/src/mesa/vbo/vbo_save.c4
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_api.c8
38 files changed, 222 insertions, 241 deletions
diff --git a/mesalib/src/mesa/drivers/dri/common/drisw_util.c b/mesalib/src/mesa/drivers/dri/common/drisw_util.c
index ed30e135f..a5bdf8988 100644
--- a/mesalib/src/mesa/drivers/dri/common/drisw_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/drisw_util.c
@@ -68,7 +68,7 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions,
*driver_configs = driDriverAPI.InitScreen(psp);
if (*driver_configs == NULL) {
- FREE(psp);
+ free(psp);
return NULL;
}
@@ -79,7 +79,7 @@ static void driDestroyScreen(__DRIscreen *psp)
{
if (psp) {
driDriverAPI.DestroyScreen(psp);
- FREE(psp);
+ free(psp);
}
}
@@ -179,7 +179,7 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
if (!driDriverAPI.CreateContext(mesa_api, modes, pcp,
major_version, minor_version,
flags, error, shareCtx)) {
- FREE(pcp);
+ free(pcp);
return NULL;
}
@@ -210,7 +210,7 @@ driDestroyContext(__DRIcontext *pcp)
{
if (pcp) {
driDriverAPI.DestroyContext(pcp);
- FREE(pcp);
+ free(pcp);
}
}
@@ -290,7 +290,7 @@ static void dri_put_drawable(__DRIdrawable *pdp)
return;
driDriverAPI.DestroyBuffer(pdp);
- FREE(pdp);
+ free(pdp);
}
}
@@ -312,7 +312,7 @@ driCreateNewDrawable(__DRIscreen *psp,
dri_get_drawable(pdp);
if (!driDriverAPI.CreateBuffer(psp, pdp, &config->modes, GL_FALSE)) {
- FREE(pdp);
+ free(pdp);
return NULL;
}
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
index 6d1d5ec61..929748400 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
@@ -86,7 +86,7 @@ static const char *__getProgramName () {
#endif
#if !defined(GET_PROGRAM_NAME)
-# if defined(__OpenBSD__) || defined(NetBSD) || defined(__UCLIBC__)
+# if defined(__OpenBSD__) || defined(NetBSD) || defined(__UCLIBC__) || defined(ANDROID)
/* This is a hack. It's said to work on OpenBSD, NetBSD and GNU.
* Rogelio M.Serrano Jr. reported it's also working with UCLIBC. It's
* used as a last resort, if there is no documented facility available. */
@@ -142,10 +142,10 @@ static GLuint countOptions (const driOptionCache *cache) {
return count;
}
-/** \brief Like strdup but using MALLOC and with error checking. */
+/** \brief Like strdup but using malloc and with error checking. */
#define XSTRDUP(dest,source) do { \
GLuint len = strlen (source); \
- if (!(dest = MALLOC (len+1))) { \
+ if (!(dest = malloc(len+1))) { \
fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__); \
abort(); \
} \
@@ -347,7 +347,7 @@ static GLboolean parseRanges (driOptionInfo *info, const XML_Char *string) {
if (*range == ',')
++nRanges;
- if ((ranges = MALLOC (nRanges*sizeof(driOptionRange))) == NULL) {
+ if ((ranges = malloc(nRanges*sizeof(driOptionRange))) == NULL) {
fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__);
abort();
}
@@ -382,9 +382,9 @@ static GLboolean parseRanges (driOptionInfo *info, const XML_Char *string) {
else
range = NULL;
}
- FREE (cp);
+ free(cp);
if (i < nRanges) {
- FREE (ranges);
+ free(ranges);
return GL_FALSE;
} else
assert (range == NULL);
@@ -702,8 +702,8 @@ void driParseOptionInfo (driOptionCache *info,
GLuint size, log2size;
for (size = 1, log2size = 0; size < minSize; size <<= 1, ++log2size);
info->tableSize = log2size;
- info->info = CALLOC (size * sizeof (driOptionInfo));
- info->values = CALLOC (size * sizeof (driOptionValue));
+ info->info = calloc(size, sizeof (driOptionInfo));
+ info->values = calloc(size, sizeof (driOptionValue));
if (info->info == NULL || info->values == NULL) {
fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__);
abort();
@@ -895,7 +895,7 @@ static void optConfEndElem (void *userData, const XML_Char *name) {
static void initOptionCache (driOptionCache *cache, const driOptionCache *info) {
cache->info = info->info;
cache->tableSize = info->tableSize;
- cache->values = MALLOC ((1<<info->tableSize) * sizeof (driOptionValue));
+ cache->values = malloc((1<<info->tableSize) * sizeof (driOptionValue));
if (cache->values == NULL) {
fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__);
abort();
@@ -959,7 +959,7 @@ void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
if ((home = getenv ("HOME"))) {
GLuint len = strlen (home);
- filenames[1] = MALLOC (len + 7+1);
+ filenames[1] = malloc(len + 7+1);
if (filenames[1] == NULL)
__driUtilMessage ("Can't allocate memory for %s/.drirc.", home);
else {
@@ -990,7 +990,7 @@ void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
}
if (filenames[1])
- FREE (filenames[1]);
+ free(filenames[1]);
}
void driDestroyOptionInfo (driOptionCache *info) {
@@ -999,18 +999,18 @@ void driDestroyOptionInfo (driOptionCache *info) {
GLuint i, size = 1 << info->tableSize;
for (i = 0; i < size; ++i) {
if (info->info[i].name) {
- FREE (info->info[i].name);
+ free(info->info[i].name);
if (info->info[i].ranges)
- FREE (info->info[i].ranges);
+ free(info->info[i].ranges);
}
}
- FREE (info->info);
+ free(info->info);
}
}
void driDestroyOptionCache (driOptionCache *cache) {
if (cache->values)
- FREE (cache->values);
+ free(cache->values);
}
GLboolean driCheckOption (const driOptionCache *cache, const char *name,
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index d528804b4..dbd339bd8 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -273,7 +273,7 @@ swrast_delete_renderbuffer(struct gl_renderbuffer *rb)
TRACE;
free(xrb->Base.Buffer);
- free(xrb);
+ _mesa_delete_renderbuffer(rb);
}
/* see bytes_per_line in libGL */
@@ -509,7 +509,7 @@ drawable_fail:
if (drawable)
free(drawable->row);
- FREE(drawable);
+ free(drawable);
return GL_FALSE;
}
@@ -811,7 +811,7 @@ dri_create_context(gl_api api,
context_fail:
- FREE(ctx);
+ free(ctx);
return GL_FALSE;
}
diff --git a/mesalib/src/mesa/main/api_arrayelt.c b/mesalib/src/mesa/main/api_arrayelt.c
index 6de6de2b7..152340b5f 100644
--- a/mesalib/src/mesa/main/api_arrayelt.c
+++ b/mesalib/src/mesa/main/api_arrayelt.c
@@ -1426,7 +1426,7 @@ GLboolean _ae_create_context( struct gl_context *ctx )
FogCoordFuncs[6] = _gloffset_FogCoordfvEXT;
FogCoordFuncs[7] = _gloffset_FogCoorddvEXT;
- ctx->aelt_context = CALLOC( sizeof(AEcontext) );
+ ctx->aelt_context = calloc(1, sizeof(AEcontext));
if (!ctx->aelt_context)
return GL_FALSE;
@@ -1438,7 +1438,7 @@ GLboolean _ae_create_context( struct gl_context *ctx )
void _ae_destroy_context( struct gl_context *ctx )
{
if ( AE_CONTEXT( ctx ) ) {
- FREE( ctx->aelt_context );
+ free(ctx->aelt_context);
ctx->aelt_context = NULL;
}
}
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index 8cb2a689b..b3d10d31e 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -398,7 +398,7 @@ _mesa_PushAttrib(GLbitfield mask)
if (mask & GL_POLYGON_STIPPLE_BIT) {
GLuint *stipple;
- stipple = (GLuint *) MALLOC( 32*sizeof(GLuint) );
+ stipple = (GLuint *) malloc( 32*sizeof(GLuint) );
memcpy( stipple, ctx->PolygonStipple, 32*sizeof(GLuint) );
save_attrib_data(&head, GL_POLYGON_STIPPLE_BIT, stipple);
}
@@ -1314,8 +1314,8 @@ _mesa_PopAttrib(void)
}
next = attr->next;
- FREE( attr->data );
- FREE( attr );
+ free(attr->data);
+ free(attr);
attr = next;
}
}
@@ -1592,8 +1592,8 @@ _mesa_PopClientAttrib(void)
}
next = node->next;
- FREE( node->data );
- FREE( node );
+ free(node->data);
+ free(node);
node = next;
}
}
diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c
index 8b96319ce..796b6beff 100644
--- a/mesalib/src/mesa/main/errors.c
+++ b/mesalib/src/mesa/main/errors.c
@@ -322,7 +322,7 @@ _mesa_log_msg(struct gl_context *ctx, GLenum source, GLenum type,
assert(!emptySlot->message && !emptySlot->length);
- emptySlot->message = MALLOC(len+1);
+ emptySlot->message = malloc(len+1);
if (emptySlot->message) {
(void) strncpy(emptySlot->message, buf, (size_t)len);
emptySlot->message[len] = '\0';
@@ -391,7 +391,7 @@ _mesa_get_msg(struct gl_context *ctx, GLenum *source, GLenum *type,
}
if (msg->message != (char*)out_of_memory)
- FREE(msg->message);
+ free(msg->message);
msg->message = NULL;
msg->length = 0;
@@ -786,7 +786,7 @@ _mesa_free_errors_data(struct gl_context *ctx)
foreach_s(node, tmp, &ClientIDs->Namespaces[s][t].Severity[sev]) {
entry = (struct gl_client_severity *)node;
- FREE(entry);
+ free(entry);
}
}
}
diff --git a/mesalib/src/mesa/main/eval.c b/mesalib/src/mesa/main/eval.c
index e651715f7..0ae349f2d 100644
--- a/mesalib/src/mesa/main/eval.c
+++ b/mesalib/src/mesa/main/eval.c
@@ -218,7 +218,7 @@ GLfloat *_mesa_copy_map_points1f( GLenum target, GLint ustride, GLint uorder,
if (!points || !size)
return NULL;
- buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat));
+ buffer = (GLfloat *) malloc(uorder * size * sizeof(GLfloat));
if (buffer)
for (i = 0, p = buffer; i < uorder; i++, points += ustride)
@@ -242,7 +242,7 @@ GLfloat *_mesa_copy_map_points1d( GLenum target, GLint ustride, GLint uorder,
if (!points || !size)
return NULL;
- buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat));
+ buffer = (GLfloat *) malloc(uorder * size * sizeof(GLfloat));
if (buffer)
for (i = 0, p = buffer; i < uorder; i++, points += ustride)
@@ -286,9 +286,9 @@ GLfloat *_mesa_copy_map_points2f( GLenum target,
hsize = (uorder > vorder ? uorder : vorder)*size;
if(hsize>dsize)
- buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat));
+ buffer = (GLfloat *) malloc((uorder*vorder*size+hsize)*sizeof(GLfloat));
else
- buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat));
+ buffer = (GLfloat *) malloc((uorder*vorder*size+dsize)*sizeof(GLfloat));
/* compute the increment value for the u-loop */
uinc = ustride - vorder*vstride;
@@ -329,9 +329,9 @@ GLfloat *_mesa_copy_map_points2d(GLenum target,
hsize = (uorder > vorder ? uorder : vorder)*size;
if(hsize>dsize)
- buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat));
+ buffer = (GLfloat *) malloc((uorder*vorder*size+hsize)*sizeof(GLfloat));
else
- buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat));
+ buffer = (GLfloat *) malloc((uorder*vorder*size+dsize)*sizeof(GLfloat));
/* compute the increment value for the u-loop */
uinc = ustride - vorder*vstride;
@@ -416,7 +416,7 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
map->u2 = u2;
map->du = 1.0F / (u2 - u1);
if (map->Points)
- FREE( map->Points );
+ free( map->Points );
map->Points = pnts;
}
@@ -516,7 +516,7 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
map->v2 = v2;
map->dv = 1.0F / (v2 - v1);
if (map->Points)
- FREE( map->Points );
+ free( map->Points );
map->Points = pnts;
}
@@ -940,7 +940,7 @@ init_1d_map( struct gl_1d_map *map, int n, const float *initial )
map->Order = 1;
map->u1 = 0.0;
map->u2 = 1.0;
- map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat));
+ map->Points = (GLfloat *) malloc(n * sizeof(GLfloat));
if (map->Points) {
GLint i;
for (i=0;i<n;i++)
@@ -961,7 +961,7 @@ init_2d_map( struct gl_2d_map *map, int n, const float *initial )
map->u2 = 1.0;
map->v1 = 0.0;
map->v2 = 1.0;
- map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat));
+ map->Points = (GLfloat *) malloc(n * sizeof(GLfloat));
if (map->Points) {
GLint i;
for (i=0;i<n;i++)
@@ -1048,44 +1048,44 @@ void _mesa_free_eval_data( struct gl_context *ctx )
/* Free evaluator data */
if (ctx->EvalMap.Map1Vertex3.Points)
- FREE( ctx->EvalMap.Map1Vertex3.Points );
+ free( ctx->EvalMap.Map1Vertex3.Points );
if (ctx->EvalMap.Map1Vertex4.Points)
- FREE( ctx->EvalMap.Map1Vertex4.Points );
+ free( ctx->EvalMap.Map1Vertex4.Points );
if (ctx->EvalMap.Map1Index.Points)
- FREE( ctx->EvalMap.Map1Index.Points );
+ free( ctx->EvalMap.Map1Index.Points );
if (ctx->EvalMap.Map1Color4.Points)
- FREE( ctx->EvalMap.Map1Color4.Points );
+ free( ctx->EvalMap.Map1Color4.Points );
if (ctx->EvalMap.Map1Normal.Points)
- FREE( ctx->EvalMap.Map1Normal.Points );
+ free( ctx->EvalMap.Map1Normal.Points );
if (ctx->EvalMap.Map1Texture1.Points)
- FREE( ctx->EvalMap.Map1Texture1.Points );
+ free( ctx->EvalMap.Map1Texture1.Points );
if (ctx->EvalMap.Map1Texture2.Points)
- FREE( ctx->EvalMap.Map1Texture2.Points );
+ free( ctx->EvalMap.Map1Texture2.Points );
if (ctx->EvalMap.Map1Texture3.Points)
- FREE( ctx->EvalMap.Map1Texture3.Points );
+ free( ctx->EvalMap.Map1Texture3.Points );
if (ctx->EvalMap.Map1Texture4.Points)
- FREE( ctx->EvalMap.Map1Texture4.Points );
+ free( ctx->EvalMap.Map1Texture4.Points );
for (i = 0; i < 16; i++)
- FREE((ctx->EvalMap.Map1Attrib[i].Points));
+ free((ctx->EvalMap.Map1Attrib[i].Points));
if (ctx->EvalMap.Map2Vertex3.Points)
- FREE( ctx->EvalMap.Map2Vertex3.Points );
+ free( ctx->EvalMap.Map2Vertex3.Points );
if (ctx->EvalMap.Map2Vertex4.Points)
- FREE( ctx->EvalMap.Map2Vertex4.Points );
+ free( ctx->EvalMap.Map2Vertex4.Points );
if (ctx->EvalMap.Map2Index.Points)
- FREE( ctx->EvalMap.Map2Index.Points );
+ free( ctx->EvalMap.Map2Index.Points );
if (ctx->EvalMap.Map2Color4.Points)
- FREE( ctx->EvalMap.Map2Color4.Points );
+ free( ctx->EvalMap.Map2Color4.Points );
if (ctx->EvalMap.Map2Normal.Points)
- FREE( ctx->EvalMap.Map2Normal.Points );
+ free( ctx->EvalMap.Map2Normal.Points );
if (ctx->EvalMap.Map2Texture1.Points)
- FREE( ctx->EvalMap.Map2Texture1.Points );
+ free( ctx->EvalMap.Map2Texture1.Points );
if (ctx->EvalMap.Map2Texture2.Points)
- FREE( ctx->EvalMap.Map2Texture2.Points );
+ free( ctx->EvalMap.Map2Texture2.Points );
if (ctx->EvalMap.Map2Texture3.Points)
- FREE( ctx->EvalMap.Map2Texture3.Points );
+ free( ctx->EvalMap.Map2Texture3.Points );
if (ctx->EvalMap.Map2Texture4.Points)
- FREE( ctx->EvalMap.Map2Texture4.Points );
+ free( ctx->EvalMap.Map2Texture4.Points );
for (i = 0; i < 16; i++)
- FREE((ctx->EvalMap.Map2Attrib[i].Points));
+ free((ctx->EvalMap.Map2Attrib[i].Points));
}
diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h
index 73913b5ab..2f854e574 100644
--- a/mesalib/src/mesa/main/imports.h
+++ b/mesalib/src/mesa/main/imports.h
@@ -156,44 +156,47 @@ static inline int isblank(int ch) { return ch == ' ' || ch == '\t'; }
#endif
/*@}*/
+#if defined(__SUNPRO_C)
+#define sqrtf(f) ((float) sqrt(f))
+#endif
+
+
/***
*** LOG2: Log base 2 of float
***/
-#ifdef USE_IEEE
-#if 0
-/* This is pretty fast, but not accurate enough (only 2 fractional bits).
- * Based on code from http://www.stereopsis.com/log2.html
- */
static inline GLfloat LOG2(GLfloat x)
{
+#ifdef USE_IEEE
+#if 0
+ /* This is pretty fast, but not accurate enough (only 2 fractional bits).
+ * Based on code from http://www.stereopsis.com/log2.html
+ */
const GLfloat y = x * x * x * x;
const GLuint ix = *((GLuint *) &y);
const GLuint exp = (ix >> 23) & 0xFF;
const GLint log2 = ((GLint) exp) - 127;
return (GLfloat) log2 * (1.0 / 4.0); /* 4, because of x^4 above */
-}
#endif
-/* Pretty fast, and accurate.
- * Based on code from http://www.flipcode.com/totd/
- */
-static inline GLfloat LOG2(GLfloat val)
-{
+ /* Pretty fast, and accurate.
+ * Based on code from http://www.flipcode.com/totd/
+ */
fi_type num;
GLint log_2;
- num.f = val;
+ num.f = x;
log_2 = ((num.i >> 23) & 255) - 128;
num.i &= ~(255 << 23);
num.i += 127 << 23;
num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3;
return num.f + log_2;
-}
#else
-/*
- * NOTE: log_base_2(x) = log(x) / log(2)
- * NOTE: 1.442695 = 1/log(2).
- */
-#define LOG2(x) ((GLfloat) (log(x) * 1.442695F))
+ /*
+ * NOTE: log_base_2(x) = log(x) / log(2)
+ * NOTE: 1.442695 = 1/log(2).
+ */
+ return (GLfloat) (log(x) * 1.442695F);
#endif
+}
+
/***
@@ -220,35 +223,6 @@ static inline int IS_INF_OR_NAN( float x )
/***
- *** IS_NEGATIVE: test if float is negative
- ***/
-#if defined(USE_IEEE)
-static inline int GET_FLOAT_BITS( float x )
-{
- fi_type fi;
- fi.f = x;
- return fi.i;
-}
-#define IS_NEGATIVE(x) (GET_FLOAT_BITS(x) < 0)
-#else
-#define IS_NEGATIVE(x) (x < 0.0F)
-#endif
-
-
-/***
- *** DIFFERENT_SIGNS: test if two floats have opposite signs
- ***/
-#if defined(USE_IEEE)
-#define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31))
-#else
-/* Could just use (x*y<0) except for the flatshading requirements.
- * Maybe there's a better way?
- */
-#define DIFFERENT_SIGNS(x,y) ((x) * (y) <= 0.0F && (x) - (y) != 0.0F)
-#endif
-
-
-/***
*** CEILF: ceiling of float
*** FLOORF: floor of float
*** FABSF: absolute value of float
@@ -309,50 +283,36 @@ static inline int IROUND_POS(float f)
* Convert float to int using a fast method. The rounding mode may vary.
* XXX We could use an x86-64/SSE2 version here.
*/
-#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__)
static inline int F_TO_I(float f)
{
+#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__)
int r;
__asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st");
return r;
-}
#elif defined(USE_X86_ASM) && defined(_MSC_VER)
-static inline int F_TO_I(float f)
-{
int r;
_asm {
fld f
fistp r
}
return r;
-}
-#elif defined(__WATCOMC__) && defined(__386__)
-long F_TO_I(float f);
-#pragma aux iround = \
- "push eax" \
- "fistp dword ptr [esp]" \
- "pop eax" \
- parm [8087] \
- value [eax] \
- modify exact [eax];
#else
-#define F_TO_I(f) IROUND(f)
+ return IROUND(f);
#endif
+}
-/***
- *** IFLOOR: return (as an integer) floor of float
- ***/
-#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__)
-/*
- * IEEE floor for computers that round to nearest or even.
- * 'f' must be between -4194304 and 4194303.
- * This floor operation is done by "(iround(f + .5) + iround(f - .5)) >> 1",
- * but uses some IEEE specific tricks for better speed.
- * Contributed by Josh Vanderhoof
- */
-static inline int ifloor(float f)
+/** Return (as an integer) floor of float */
+static inline int IFLOOR(float f)
{
+#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__)
+ /*
+ * IEEE floor for computers that round to nearest or even.
+ * 'f' must be between -4194304 and 4194303.
+ * This floor operation is done by "(iround(f + .5) + iround(f - .5)) >> 1",
+ * but uses some IEEE specific tricks for better speed.
+ * Contributed by Josh Vanderhoof
+ */
int ai, bi;
double af, bf;
af = (3 << 22) + 0.5 + (double)f;
@@ -361,45 +321,33 @@ static inline int ifloor(float f)
__asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st");
__asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st");
return (ai - bi) >> 1;
-}
-#define IFLOOR(x) ifloor(x)
#elif defined(USE_IEEE)
-static inline int ifloor(float f)
-{
int ai, bi;
double af, bf;
fi_type u;
-
af = (3 << 22) + 0.5 + (double)f;
bf = (3 << 22) + 0.5 - (double)f;
u.f = (float) af; ai = u.i;
u.f = (float) bf; bi = u.i;
return (ai - bi) >> 1;
-}
-#define IFLOOR(x) ifloor(x)
#else
-static inline int ifloor(float f)
-{
int i = IROUND(f);
return (i > f) ? i - 1 : i;
-}
-#define IFLOOR(x) ifloor(x)
#endif
+}
-/***
- *** ICEIL: return (as an integer) ceiling of float
- ***/
-#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__)
-/*
- * IEEE ceil for computers that round to nearest or even.
- * 'f' must be between -4194304 and 4194303.
- * This ceil operation is done by "(iround(f + .5) + iround(f - .5) + 1) >> 1",
- * but uses some IEEE specific tricks for better speed.
- * Contributed by Josh Vanderhoof
- */
-static inline int iceil(float f)
+/** Return (as an integer) ceiling of float */
+static inline int ICEIL(float f)
{
+#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__)
+ /*
+ * IEEE ceil for computers that round to nearest or even.
+ * 'f' must be between -4194304 and 4194303.
+ * This ceil operation is done by "(iround(f + .5) + iround(f - .5) + 1) >> 1",
+ * but uses some IEEE specific tricks for better speed.
+ * Contributed by Josh Vanderhoof
+ */
int ai, bi;
double af, bf;
af = (3 << 22) + 0.5 + (double)f;
@@ -408,11 +356,7 @@ static inline int iceil(float f)
__asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st");
__asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st");
return (ai - bi + 1) >> 1;
-}
-#define ICEIL(x) iceil(x)
#elif defined(USE_IEEE)
-static inline int iceil(float f)
-{
int ai, bi;
double af, bf;
fi_type u;
@@ -421,16 +365,11 @@ static inline int iceil(float f)
u.f = (float) af; ai = u.i;
u.f = (float) bf; bi = u.i;
return (ai - bi + 1) >> 1;
-}
-#define ICEIL(x) iceil(x)
#else
-static inline int iceil(float f)
-{
int i = IROUND(f);
return (i < f) ? i + 1 : i;
-}
-#define ICEIL(x) iceil(x)
#endif
+}
/**
diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h
index 5af9487cb..7d0a375d1 100644
--- a/mesalib/src/mesa/main/macros.h
+++ b/mesalib/src/mesa/main/macros.h
@@ -689,6 +689,38 @@ NORMALIZE_3FV(GLfloat v[3])
}
+/** Is float value negative? */
+static inline GLboolean
+IS_NEGATIVE(float x)
+{
+#if defined(USE_IEEE)
+ fi_type fi;
+ fi.f = x;
+ return fi.i < 0;
+#else
+ return x < 0.0F;
+#endif
+}
+
+
+/** Test two floats have opposite signs */
+static inline GLboolean
+DIFFERENT_SIGNS(GLfloat x, GLfloat y)
+{
+#if defined(USE_IEEE)
+ fi_type xfi, yfi;
+ xfi.f = x;
+ yfi.f = y;
+ return (xfi.i ^ yfi.i) & (1u << 31);
+#else
+ /* Could just use (x*y<0) except for the flatshading requirements.
+ * Maybe there's a better way?
+ */
+ return ((x) * (y) <= 0.0F && (x) - (y) != 0.0F);
+#endif
+}
+
+
/** Compute ceiling of integer quotient of A divided by B. */
#define CEILING( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
diff --git a/mesalib/src/mesa/main/matrix.c b/mesalib/src/mesa/main/matrix.c
index 7157433de..a6193071d 100644
--- a/mesalib/src/mesa/main/matrix.c
+++ b/mesalib/src/mesa/main/matrix.c
@@ -671,7 +671,7 @@ init_matrix_stack( struct gl_matrix_stack *stack,
stack->MaxDepth = maxDepth;
stack->DirtyFlag = dirtyFlag;
/* The stack */
- stack->Stack = (GLmatrix *) CALLOC(maxDepth * sizeof(GLmatrix));
+ stack->Stack = (GLmatrix *) calloc(maxDepth, sizeof(GLmatrix));
for (i = 0; i < maxDepth; i++) {
_math_matrix_ctr(&stack->Stack[i]);
}
@@ -693,7 +693,7 @@ free_matrix_stack( struct gl_matrix_stack *stack )
for (i = 0; i < stack->MaxDepth; i++) {
_math_matrix_dtr(&stack->Stack[i]);
}
- FREE(stack->Stack);
+ free(stack->Stack);
stack->Stack = stack->Top = NULL;
}
diff --git a/mesalib/src/mesa/main/renderbuffer.c b/mesalib/src/mesa/main/renderbuffer.c
index 1bb09bfe6..26f53d100 100644
--- a/mesalib/src/mesa/main/renderbuffer.c
+++ b/mesalib/src/mesa/main/renderbuffer.c
@@ -75,11 +75,15 @@ _mesa_new_renderbuffer(struct gl_context *ctx, GLuint name)
/**
* Delete a gl_framebuffer.
* This is the default function for renderbuffer->Delete().
+ * Drivers which subclass gl_renderbuffer should probably implement their
+ * own delete function. But the driver might also call this function to
+ * free the object in the end.
*/
void
_mesa_delete_renderbuffer(struct gl_renderbuffer *rb)
{
- /* no-op */
+ _glthread_DESTROY_MUTEX(rb->Mutex);
+ free(rb);
}
diff --git a/mesalib/src/mesa/main/samplerobj.c b/mesalib/src/mesa/main/samplerobj.c
index 8bf5f490a..4514b1224 100644
--- a/mesalib/src/mesa/main/samplerobj.c
+++ b/mesalib/src/mesa/main/samplerobj.c
@@ -155,7 +155,7 @@ void
_mesa_delete_sampler_object(struct gl_context *ctx,
struct gl_sampler_object *sampObj)
{
- FREE(sampObj);
+ free(sampObj);
}
diff --git a/mesalib/src/mesa/main/syncobj.c b/mesalib/src/mesa/main/syncobj.c
index 85dd41aac..1c09e421c 100644
--- a/mesalib/src/mesa/main/syncobj.c
+++ b/mesalib/src/mesa/main/syncobj.c
@@ -326,9 +326,13 @@ _mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
if (syncObj->StatusFlag) {
ret = GL_ALREADY_SIGNALED;
} else {
- ctx->Driver.ClientWaitSync(ctx, syncObj, flags, timeout);
+ if (timeout == 0) {
+ ret = GL_TIMEOUT_EXPIRED;
+ } else {
+ ctx->Driver.ClientWaitSync(ctx, syncObj, flags, timeout);
- ret = syncObj->StatusFlag ? GL_CONDITION_SATISFIED : GL_TIMEOUT_EXPIRED;
+ ret = syncObj->StatusFlag ? GL_CONDITION_SATISFIED : GL_TIMEOUT_EXPIRED;
+ }
}
_mesa_unref_sync_object(ctx, syncObj);
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 11b1b3043..cdb090542 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1015,7 +1015,7 @@ make_null_texture(GLint width, GLint height, GLint depth, GLenum format)
{
const GLint components = _mesa_components_in_format(format);
const GLint numPixels = width * height * depth;
- GLubyte *data = (GLubyte *) MALLOC(numPixels * components * sizeof(GLubyte));
+ GLubyte *data = (GLubyte *) malloc(numPixels * components * sizeof(GLubyte));
#ifdef DEBUG
/*
diff --git a/mesalib/src/mesa/program/nvfragparse.c b/mesalib/src/mesa/program/nvfragparse.c
index 20c8579b0..f61221c11 100644
--- a/mesalib/src/mesa/program/nvfragparse.c
+++ b/mesalib/src/mesa/program/nvfragparse.c
@@ -1481,7 +1481,7 @@ _mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum dstTarget,
GLubyte *programString;
/* Make a null-terminated copy of the program string */
- programString = (GLubyte *) MALLOC(len + 1);
+ programString = (GLubyte *) malloc(len + 1);
if (!programString) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
return;
@@ -1550,7 +1550,7 @@ _mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum dstTarget,
/* install the program */
program->Base.Target = target;
if (program->Base.String) {
- FREE(program->Base.String);
+ free(program->Base.String);
}
program->Base.String = programString;
program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB;
diff --git a/mesalib/src/mesa/program/nvvertparse.c b/mesalib/src/mesa/program/nvvertparse.c
index 7b46bef91..62b27b9f4 100644
--- a/mesalib/src/mesa/program/nvvertparse.c
+++ b/mesalib/src/mesa/program/nvvertparse.c
@@ -1293,7 +1293,7 @@ _mesa_parse_nv_vertex_program(struct gl_context *ctx, GLenum dstTarget,
GLubyte *programString;
/* Make a null-terminated copy of the program string */
- programString = (GLubyte *) MALLOC(len + 1);
+ programString = (GLubyte *) malloc(len + 1);
if (!programString) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
return;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index 40e3677f6..01aba8eaf 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -232,7 +232,7 @@ st_renderbuffer_delete(struct gl_renderbuffer *rb)
pipe_surface_reference(&strb->surface, NULL);
pipe_resource_reference(&strb->texture, NULL);
free(strb->data);
- free(strb);
+ _mesa_delete_renderbuffer(rb);
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_syncobj.c b/mesalib/src/mesa/state_tracker/st_cb_syncobj.c
index d575a8497..f9f2348a3 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_syncobj.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_syncobj.c
@@ -60,7 +60,7 @@ static void st_delete_sync_object(struct gl_context *ctx,
struct st_sync_object *so = (struct st_sync_object*)obj;
screen->fence_reference(screen, &so->fence, NULL);
- FREE(so);
+ free(so);
}
static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj,
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 9146f24f3..852dceaf6 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4680,7 +4680,8 @@ st_translate_program(
* so we put all the translated regs in t->constants.
*/
if (proginfo->Parameters) {
- t->constants = (struct ureg_src *)CALLOC(proginfo->Parameters->NumParameters * sizeof(t->constants[0]));
+ t->constants = (struct ureg_src *)
+ calloc(proginfo->Parameters->NumParameters, sizeof(t->constants[0]));
if (t->constants == NULL) {
ret = PIPE_ERROR_OUT_OF_MEMORY;
goto out;
@@ -4719,7 +4720,8 @@ st_translate_program(
/* Emit immediate values.
*/
- t->immediates = (struct ureg_src *)CALLOC(program->num_immediates * sizeof(struct ureg_src));
+ t->immediates = (struct ureg_src *)
+ calloc(program->num_immediates, sizeof(struct ureg_src));
if (t->immediates == NULL) {
ret = PIPE_ERROR_OUT_OF_MEMORY;
goto out;
@@ -4770,16 +4772,16 @@ st_translate_program(
out:
if (t) {
- FREE(t->insn);
- FREE(t->labels);
- FREE(t->constants);
- FREE(t->immediates);
+ free(t->insn);
+ free(t->labels);
+ free(t->constants);
+ free(t->immediates);
if (t->error) {
debug_printf("%s: translate error flag set\n", __FUNCTION__);
}
- FREE(t);
+ free(t);
}
return ret;
diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c
index df73d0e1b..88b886de8 100644
--- a/mesalib/src/mesa/state_tracker/st_manager.c
+++ b/mesalib/src/mesa/state_tracker/st_manager.c
@@ -430,7 +430,7 @@ st_framebuffer_create(struct st_framebuffer_iface *stfbi)
/* add the color buffer */
idx = stfb->Base._ColorDrawBufferIndexes[0];
if (!st_framebuffer_add_renderbuffer(stfb, idx)) {
- FREE(stfb);
+ free(stfb);
return NULL;
}
diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 4d99b17dd..5f056b9b1 100644
--- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -1198,7 +1198,7 @@ st_translate_mesa_program(
* for these, so we put all the translated regs in t->constants.
*/
if (program->Parameters) {
- t->constants = CALLOC( program->Parameters->NumParameters,
+ t->constants = calloc( program->Parameters->NumParameters,
sizeof t->constants[0] );
if (t->constants == NULL) {
ret = PIPE_ERROR_OUT_OF_MEMORY;
@@ -1259,9 +1259,9 @@ st_translate_mesa_program(
}
out:
- FREE(t->insn);
- FREE(t->labels);
- FREE(t->constants);
+ free(t->insn);
+ free(t->labels);
+ free(t->constants);
if (t->error) {
debug_printf("%s: translate error flag set\n", __FUNCTION__);
@@ -1278,5 +1278,5 @@ out:
void
st_free_tokens(const struct tgsi_token *tokens)
{
- FREE((void *)tokens);
+ free((void *)tokens);
}
diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c
index 36015f69a..9816e22ac 100644
--- a/mesalib/src/mesa/state_tracker/st_program.c
+++ b/mesalib/src/mesa/state_tracker/st_program.c
@@ -74,7 +74,7 @@ delete_vp_variant(struct st_context *st, struct st_vp_variant *vpv)
if (vpv->tgsi.tokens)
st_free_tokens(vpv->tgsi.tokens);
- FREE( vpv );
+ free( vpv );
}
@@ -112,7 +112,7 @@ delete_fp_variant(struct st_context *st, struct st_fp_variant *fpv)
_mesa_free_parameter_list(fpv->parameters);
if (fpv->tgsi.tokens)
st_free_tokens(fpv->tgsi.tokens);
- FREE(fpv);
+ free(fpv);
}
@@ -144,7 +144,7 @@ delete_gp_variant(struct st_context *st, struct st_gp_variant *gpv)
if (gpv->driver_shader)
cso_delete_geometry_shader(st->cso_context, gpv->driver_shader);
- FREE(gpv);
+ free(gpv);
}
@@ -316,7 +316,7 @@ st_translate_vertex_program(struct st_context *st,
ureg = ureg_create( TGSI_PROCESSOR_VERTEX );
if (ureg == NULL) {
- FREE(vpv);
+ free(vpv);
return NULL;
}
@@ -676,7 +676,7 @@ st_translate_fragment_program(struct st_context *st,
ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
if (ureg == NULL) {
- FREE(variant);
+ free(variant);
return NULL;
}
@@ -836,7 +836,7 @@ st_translate_geometry_program(struct st_context *st,
ureg = ureg_create( TGSI_PROCESSOR_GEOMETRY );
if (ureg == NULL) {
- FREE(gpv);
+ free(gpv);
return NULL;
}
diff --git a/mesalib/src/mesa/swrast/s_context.c b/mesalib/src/mesa/swrast/s_context.c
index 4ed7b94c7..53497bc9c 100644
--- a/mesalib/src/mesa/swrast/s_context.c
+++ b/mesalib/src/mesa/swrast/s_context.c
@@ -720,7 +720,7 @@ GLboolean
_swrast_CreateContext( struct gl_context *ctx )
{
GLuint i;
- SWcontext *swrast = (SWcontext *)CALLOC(sizeof(SWcontext));
+ SWcontext *swrast = (SWcontext *) calloc(1, sizeof(SWcontext));
#ifdef _OPENMP
const GLuint maxThreads = omp_get_max_threads();
#else
@@ -775,9 +775,9 @@ _swrast_CreateContext( struct gl_context *ctx )
* using multiple threads, it is necessary to have one SpanArrays instance
* per thread.
*/
- swrast->SpanArrays = (SWspanarrays *) MALLOC(maxThreads * sizeof(SWspanarrays));
+ swrast->SpanArrays = (SWspanarrays *) malloc(maxThreads * sizeof(SWspanarrays));
if (!swrast->SpanArrays) {
- FREE(swrast);
+ free(swrast);
return GL_FALSE;
}
for(i = 0; i < maxThreads; i++) {
@@ -828,17 +828,17 @@ _swrast_DestroyContext( struct gl_context *ctx )
_mesa_debug(ctx, "_swrast_DestroyContext\n");
}
- FREE( swrast->SpanArrays );
+ free( swrast->SpanArrays );
if (swrast->ZoomedArrays)
- FREE( swrast->ZoomedArrays );
- FREE( swrast->TexelBuffer );
+ free( swrast->ZoomedArrays );
+ free( swrast->TexelBuffer );
free(swrast->stencil_temp.buf1);
free(swrast->stencil_temp.buf2);
free(swrast->stencil_temp.buf3);
free(swrast->stencil_temp.buf4);
- FREE( swrast );
+ free( swrast );
ctx->swrast_context = 0;
}
diff --git a/mesalib/src/mesa/swrast/s_renderbuffer.c b/mesalib/src/mesa/swrast/s_renderbuffer.c
index d8a7467b0..e468bdb16 100644
--- a/mesalib/src/mesa/swrast/s_renderbuffer.c
+++ b/mesalib/src/mesa/swrast/s_renderbuffer.c
@@ -174,7 +174,7 @@ soft_renderbuffer_delete(struct gl_renderbuffer *rb)
free(srb->Buffer);
srb->Buffer = NULL;
}
- free(srb);
+ _mesa_delete_renderbuffer(rb);
}
diff --git a/mesalib/src/mesa/swrast/s_texcombine.c b/mesalib/src/mesa/swrast/s_texcombine.c
index 2a323613e..9c745d118 100644
--- a/mesalib/src/mesa/swrast/s_texcombine.c
+++ b/mesalib/src/mesa/swrast/s_texcombine.c
@@ -611,7 +611,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
* thread.
*/
swrast->TexelBuffer =
- (GLfloat *) MALLOC(ctx->Const.MaxTextureImageUnits * maxThreads *
+ (GLfloat *) malloc(ctx->Const.MaxTextureImageUnits * maxThreads *
SWRAST_MAX_WIDTH * 4 * sizeof(GLfloat));
if (!swrast->TexelBuffer) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "texture_combine");
diff --git a/mesalib/src/mesa/swrast/s_zoom.c b/mesalib/src/mesa/swrast/s_zoom.c
index 768bbbafd..9304002d2 100644
--- a/mesalib/src/mesa/swrast/s_zoom.c
+++ b/mesalib/src/mesa/swrast/s_zoom.c
@@ -143,7 +143,7 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
if (!swrast->ZoomedArrays) {
/* allocate on demand */
- swrast->ZoomedArrays = (SWspanarrays *) CALLOC(sizeof(SWspanarrays));
+ swrast->ZoomedArrays = (SWspanarrays *) calloc(1, sizeof(SWspanarrays));
if (!swrast->ZoomedArrays)
return;
}
diff --git a/mesalib/src/mesa/swrast_setup/ss_context.c b/mesalib/src/mesa/swrast_setup/ss_context.c
index 9c013a454..40268be2d 100644
--- a/mesalib/src/mesa/swrast_setup/ss_context.c
+++ b/mesalib/src/mesa/swrast_setup/ss_context.c
@@ -49,7 +49,7 @@
GLboolean
_swsetup_CreateContext( struct gl_context *ctx )
{
- SScontext *swsetup = (SScontext *)CALLOC(sizeof(SScontext));
+ SScontext *swsetup = (SScontext *) calloc(1, sizeof(SScontext));
if (!swsetup)
return GL_FALSE;
@@ -72,7 +72,7 @@ _swsetup_DestroyContext( struct gl_context *ctx )
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
if (swsetup) {
- FREE(swsetup);
+ free(swsetup);
ctx->swsetup_context = 0;
}
diff --git a/mesalib/src/mesa/tnl/t_context.c b/mesalib/src/mesa/tnl/t_context.c
index dbda7a5fc..aa6783932 100644
--- a/mesalib/src/mesa/tnl/t_context.c
+++ b/mesalib/src/mesa/tnl/t_context.c
@@ -50,7 +50,7 @@ _tnl_CreateContext( struct gl_context *ctx )
/* Create the TNLcontext structure
*/
- ctx->swtnl_context = tnl = (TNLcontext *) CALLOC( sizeof(TNLcontext) );
+ ctx->swtnl_context = tnl = (TNLcontext *) calloc(1, sizeof(TNLcontext));
if (!tnl) {
return GL_FALSE;
@@ -116,7 +116,7 @@ _tnl_DestroyContext( struct gl_context *ctx )
_tnl_destroy_pipeline( ctx );
- FREE(tnl);
+ free(tnl);
ctx->swtnl_context = NULL;
}
diff --git a/mesalib/src/mesa/tnl/t_vb_fog.c b/mesalib/src/mesa/tnl/t_vb_fog.c
index cbd8dfc96..134cae1c7 100644
--- a/mesalib/src/mesa/tnl/t_vb_fog.c
+++ b/mesalib/src/mesa/tnl/t_vb_fog.c
@@ -239,7 +239,7 @@ alloc_fog_data(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct fog_stage_data *store;
- stage->privatePtr = MALLOC(sizeof(*store));
+ stage->privatePtr = malloc(sizeof(*store));
store = FOG_STAGE_DATA(stage);
if (!store)
return GL_FALSE;
@@ -259,7 +259,7 @@ free_fog_data(struct tnl_pipeline_stage *stage)
struct fog_stage_data *store = FOG_STAGE_DATA(stage);
if (store) {
_mesa_vector4f_free( &store->fogcoord );
- FREE( store );
+ free( store );
stage->privatePtr = NULL;
}
}
diff --git a/mesalib/src/mesa/tnl/t_vb_light.c b/mesalib/src/mesa/tnl/t_vb_light.c
index 854887c8f..39ba49685 100644
--- a/mesalib/src/mesa/tnl/t_vb_light.c
+++ b/mesalib/src/mesa/tnl/t_vb_light.c
@@ -421,7 +421,7 @@ static GLboolean init_lighting( struct gl_context *ctx,
struct light_stage_data *store;
GLuint size = tnl->vb.Size;
- stage->privatePtr = MALLOC(sizeof(*store));
+ stage->privatePtr = malloc(sizeof(*store));
store = LIGHT_STAGE_DATA(stage);
if (!store)
return GL_FALSE;
@@ -457,7 +457,7 @@ static void dtr( struct tnl_pipeline_stage *stage )
_mesa_vector4f_free( &store->LitColor[1] );
_mesa_vector4f_free( &store->LitSecondary[0] );
_mesa_vector4f_free( &store->LitSecondary[1] );
- FREE( store );
+ free( store );
stage->privatePtr = NULL;
}
}
diff --git a/mesalib/src/mesa/tnl/t_vb_program.c b/mesalib/src/mesa/tnl/t_vb_program.c
index 74772dbbe..271137f87 100644
--- a/mesalib/src/mesa/tnl/t_vb_program.c
+++ b/mesalib/src/mesa/tnl/t_vb_program.c
@@ -514,7 +514,7 @@ init_vp(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
struct vp_stage_data *store;
const GLuint size = VB->Size;
- stage->privatePtr = CALLOC(sizeof(*store));
+ stage->privatePtr = calloc(1, sizeof(*store));
store = VP_STAGE_DATA(stage);
if (!store)
return GL_FALSE;
@@ -546,7 +546,7 @@ dtr(struct tnl_pipeline_stage *stage)
_mesa_vector4f_free( &store->ndcCoords );
_mesa_align_free( store->clipmask );
- FREE( store );
+ free( store );
stage->privatePtr = NULL;
}
}
diff --git a/mesalib/src/mesa/tnl/t_vb_texgen.c b/mesalib/src/mesa/tnl/t_vb_texgen.c
index d4c788523..c757ac522 100644
--- a/mesalib/src/mesa/tnl/t_vb_texgen.c
+++ b/mesalib/src/mesa/tnl/t_vb_texgen.c
@@ -562,7 +562,7 @@ static GLboolean alloc_texgen_data( struct gl_context *ctx,
struct texgen_stage_data *store;
GLuint i;
- stage->privatePtr = CALLOC(sizeof(*store));
+ stage->privatePtr = calloc(1, sizeof(*store));
store = TEXGEN_STAGE_DATA(stage);
if (!store)
return GL_FALSE;
@@ -570,8 +570,8 @@ static GLboolean alloc_texgen_data( struct gl_context *ctx,
for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
_mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 );
- store->tmp_f = (GLfloat (*)[3]) MALLOC(VB->Size * sizeof(GLfloat) * 3);
- store->tmp_m = (GLfloat *) MALLOC(VB->Size * sizeof(GLfloat));
+ store->tmp_f = (GLfloat (*)[3]) malloc(VB->Size * sizeof(GLfloat) * 3);
+ store->tmp_m = (GLfloat *) malloc(VB->Size * sizeof(GLfloat));
return GL_TRUE;
}
@@ -589,9 +589,9 @@ static void free_texgen_data( struct tnl_pipeline_stage *stage )
_mesa_vector4f_free( &store->texcoord[i] );
- if (store->tmp_f) FREE( store->tmp_f );
- if (store->tmp_m) FREE( store->tmp_m );
- FREE( store );
+ if (store->tmp_f) free( store->tmp_f );
+ if (store->tmp_m) free( store->tmp_m );
+ free( store );
stage->privatePtr = NULL;
}
}
diff --git a/mesalib/src/mesa/tnl/t_vb_texmat.c b/mesalib/src/mesa/tnl/t_vb_texmat.c
index 38aa51fc4..91bb0f797 100644
--- a/mesalib/src/mesa/tnl/t_vb_texmat.c
+++ b/mesalib/src/mesa/tnl/t_vb_texmat.c
@@ -89,7 +89,7 @@ static GLboolean alloc_texmat_data( struct gl_context *ctx,
struct texmat_stage_data *store;
GLuint i;
- stage->privatePtr = CALLOC(sizeof(*store));
+ stage->privatePtr = calloc(1, sizeof(*store));
store = TEXMAT_STAGE_DATA(stage);
if (!store)
return GL_FALSE;
@@ -110,7 +110,7 @@ static void free_texmat_data( struct tnl_pipeline_stage *stage )
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++)
if (store->texcoord[i].data)
_mesa_vector4f_free( &store->texcoord[i] );
- FREE( store );
+ free( store );
stage->privatePtr = NULL;
}
}
diff --git a/mesalib/src/mesa/tnl/t_vb_vertex.c b/mesalib/src/mesa/tnl/t_vb_vertex.c
index 26e8ae065..64795a57e 100644
--- a/mesalib/src/mesa/tnl/t_vb_vertex.c
+++ b/mesalib/src/mesa/tnl/t_vb_vertex.c
@@ -236,7 +236,7 @@ static GLboolean init_vertex_stage( struct gl_context *ctx,
struct vertex_stage_data *store;
GLuint size = VB->Size;
- stage->privatePtr = CALLOC(sizeof(*store));
+ stage->privatePtr = calloc(1, sizeof(*store));
store = VERTEX_STAGE_DATA(stage);
if (!store)
return GL_FALSE;
@@ -265,7 +265,7 @@ static void dtr( struct tnl_pipeline_stage *stage )
_mesa_vector4f_free( &store->clip );
_mesa_vector4f_free( &store->proj );
_mesa_align_free( store->clipmask );
- FREE(store);
+ free(store);
stage->privatePtr = NULL;
stage->run = init_vertex_stage;
}
diff --git a/mesalib/src/mesa/tnl/t_vertex.c b/mesalib/src/mesa/tnl/t_vertex.c
index 580f95df3..7e83d454d 100644
--- a/mesalib/src/mesa/tnl/t_vertex.c
+++ b/mesalib/src/mesa/tnl/t_vertex.c
@@ -548,7 +548,7 @@ void _tnl_free_vertices( struct gl_context *ctx )
for (fp = vtx->fastpath ; fp ; fp = tmp) {
tmp = fp->next;
- FREE(fp->attr);
+ free(fp->attr);
/* KW: At the moment, fp->func is constrained to be allocated by
* _mesa_exec_alloc(), as the hardwired fastpaths in
@@ -557,7 +557,7 @@ void _tnl_free_vertices( struct gl_context *ctx )
* module gets another overhaul.
*/
_mesa_exec_free((void *) fp->func);
- FREE(fp);
+ free(fp);
}
vtx->fastpath = NULL;
diff --git a/mesalib/src/mesa/vbo/vbo_context.c b/mesalib/src/mesa/vbo/vbo_context.c
index 5f1c72bc1..fd15fb6a9 100644
--- a/mesalib/src/mesa/vbo/vbo_context.c
+++ b/mesalib/src/mesa/vbo/vbo_context.c
@@ -223,7 +223,7 @@ void _vbo_DestroyContext( struct gl_context *ctx )
vbo_exec_destroy(ctx);
if (ctx->API == API_OPENGL)
vbo_save_destroy(ctx);
- FREE(vbo);
+ free(vbo);
ctx->swtnl_im = NULL;
}
}
diff --git a/mesalib/src/mesa/vbo/vbo_save.c b/mesalib/src/mesa/vbo/vbo_save.c
index 7a97d3c65..a40039927 100644
--- a/mesalib/src/mesa/vbo/vbo_save.c
+++ b/mesalib/src/mesa/vbo/vbo_save.c
@@ -101,13 +101,13 @@ void vbo_save_destroy( struct gl_context *ctx )
if (save->prim_store) {
if ( --save->prim_store->refcount == 0 ) {
- FREE( save->prim_store );
+ free(save->prim_store);
save->prim_store = NULL;
}
if ( --save->vertex_store->refcount == 0 ) {
_mesa_reference_buffer_object(ctx,
&save->vertex_store->bufferobj, NULL);
- FREE( save->vertex_store );
+ free(save->vertex_store);
save->vertex_store = NULL;
}
}
diff --git a/mesalib/src/mesa/vbo/vbo_save_api.c b/mesalib/src/mesa/vbo/vbo_save_api.c
index a02a13db5..636aa1fdb 100644
--- a/mesalib/src/mesa/vbo/vbo_save_api.c
+++ b/mesalib/src/mesa/vbo/vbo_save_api.c
@@ -233,7 +233,7 @@ free_vertex_store(struct gl_context *ctx,
_mesa_reference_buffer_object(ctx, &vertex_store->bufferobj, NULL);
}
- FREE(vertex_store);
+ free(vertex_store);
}
@@ -353,7 +353,7 @@ _save_compile_vertex_list(struct gl_context *ctx)
/* If the malloc fails, we just pull the data out of the VBO
* later instead.
*/
- node->current_data = MALLOC(node->current_size * sizeof(GLfloat));
+ node->current_data = malloc(node->current_size * sizeof(GLfloat));
if (node->current_data) {
const char *buffer = (const char *) save->vertex_store->buffer;
unsigned attr_offset = node->attrsz[0] * sizeof(GLfloat);
@@ -1575,10 +1575,10 @@ vbo_destroy_vertex_list(struct gl_context *ctx, void *data)
free_vertex_store(ctx, node->vertex_store);
if (--node->prim_store->refcount == 0)
- FREE(node->prim_store);
+ free(node->prim_store);
if (node->current_data) {
- FREE(node->current_data);
+ free(node->current_data);
node->current_data = NULL;
}
}