diff options
Diffstat (limited to 'mesalib')
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_cpu_detect.c | 9 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_cpu_detect.h | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/common/meta.c | 8 | ||||
-rw-r--r-- | mesalib/src/mesa/main/eval.c | 70 | ||||
-rw-r--r-- | mesalib/src/mesa/main/imports.h | 24 | ||||
-rw-r--r-- | mesalib/src/mesa/main/light.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/macros.h | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texcompress_fxt1.c | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texcompress_rgtc.c | 16 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texcompress_s3tc.c | 12 | ||||
-rw-r--r-- | mesalib/src/mesa/math/m_matrix.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/swrast/s_aalinetemp.h | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/swrast/s_span.c | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/swrast/s_texfilter.c | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/tnl/t_rasterpos.c | 2 |
15 files changed, 73 insertions, 93 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c b/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c index e0c8f73c7..d7f0be40e 100644 --- a/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c @@ -182,7 +182,7 @@ static int has_cpuid(void) static INLINE void cpuid(uint32_t ax, uint32_t *p) { -#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86) +#if (defined(PIPE_CC_GCC) || defined(PIPE_CC_SUNPRO)) && defined(PIPE_ARCH_X86) __asm __volatile ( "xchgl %%ebx, %1\n\t" "cpuid\n\t" @@ -193,7 +193,7 @@ cpuid(uint32_t ax, uint32_t *p) "=d" (p[3]) : "0" (ax) ); -#elif defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64) +#elif (defined(PIPE_CC_GCC) || defined(PIPE_CC_SUNPRO)) && defined(PIPE_ARCH_X86_64) __asm __volatile ( "cpuid\n\t" : "=a" (p[0]), @@ -286,6 +286,11 @@ util_cpu_detect(void) util_cpu_caps.cacheline = cacheline; } + if (regs[1] == 0x756e6547 && regs[2] == 0x6c65746e && regs[3] == 0x49656e69) { + /* GenuineIntel */ + util_cpu_caps.has_intel = 1; + } + cpuid(0x80000000, regs); if (regs[0] >= 0x80000001) { diff --git a/mesalib/src/gallium/auxiliary/util/u_cpu_detect.h b/mesalib/src/gallium/auxiliary/util/u_cpu_detect.h index b44d9d9a0..acac68658 100644 --- a/mesalib/src/gallium/auxiliary/util/u_cpu_detect.h +++ b/mesalib/src/gallium/auxiliary/util/u_cpu_detect.h @@ -52,6 +52,7 @@ struct util_cpu_caps { int x86_cpu_type; unsigned cacheline; + unsigned has_intel:1; unsigned has_tsc:1; unsigned has_mmx:1; unsigned has_mmx2:1; diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index 4b448fed5..36672a71d 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -538,7 +538,9 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) _mesa_set_enable(ctx, GL_DEPTH_TEST, GL_FALSE); } - if (state & MESA_META_FOG) { + if ((state & MESA_META_FOG) + && ctx->API != API_OPENGL_CORE + && ctx->API != API_OPENGLES2) { save->Fog = ctx->Fog.Enabled; if (ctx->Fog.Enabled) _mesa_set_enable(ctx, GL_FOG, GL_FALSE); @@ -856,7 +858,9 @@ _mesa_meta_end(struct gl_context *ctx) _mesa_DepthMask(save->Depth.Mask); } - if (state & MESA_META_FOG) { + if ((state & MESA_META_FOG) + && ctx->API != API_OPENGL_CORE + && ctx->API != API_OPENGLES2) { _mesa_set_enable(ctx, GL_FOG, save->Fog); } diff --git a/mesalib/src/mesa/main/eval.c b/mesalib/src/mesa/main/eval.c index 0ae349f2d..487c4ce04 100644 --- a/mesalib/src/mesa/main/eval.c +++ b/mesalib/src/mesa/main/eval.c @@ -384,6 +384,7 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, k = _mesa_evaluator_components( target ); if (k == 0) { _mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" ); + return; } if (ustride < k) { @@ -415,8 +416,7 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, map->u1 = u1; map->u2 = u2; map->du = 1.0F / (u2 - u1); - if (map->Points) - free( map->Points ); + free(map->Points); map->Points = pnts; } @@ -474,6 +474,7 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, k = _mesa_evaluator_components( target ); if (k==0) { _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" ); + return; } if (ustride < k) { @@ -515,8 +516,7 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, map->v1 = v1; map->v2 = v2; map->dv = 1.0F / (v2 - v1); - if (map->Points) - free( map->Points ); + free(map->Points); map->Points = pnts; } @@ -1047,45 +1047,27 @@ void _mesa_free_eval_data( struct gl_context *ctx ) int i; /* Free evaluator data */ - if (ctx->EvalMap.Map1Vertex3.Points) - free( ctx->EvalMap.Map1Vertex3.Points ); - if (ctx->EvalMap.Map1Vertex4.Points) - free( ctx->EvalMap.Map1Vertex4.Points ); - if (ctx->EvalMap.Map1Index.Points) - free( ctx->EvalMap.Map1Index.Points ); - if (ctx->EvalMap.Map1Color4.Points) - free( ctx->EvalMap.Map1Color4.Points ); - if (ctx->EvalMap.Map1Normal.Points) - free( ctx->EvalMap.Map1Normal.Points ); - if (ctx->EvalMap.Map1Texture1.Points) - free( ctx->EvalMap.Map1Texture1.Points ); - if (ctx->EvalMap.Map1Texture2.Points) - free( ctx->EvalMap.Map1Texture2.Points ); - if (ctx->EvalMap.Map1Texture3.Points) - free( ctx->EvalMap.Map1Texture3.Points ); - if (ctx->EvalMap.Map1Texture4.Points) - free( ctx->EvalMap.Map1Texture4.Points ); - for (i = 0; i < 16; i++) - free((ctx->EvalMap.Map1Attrib[i].Points)); - - if (ctx->EvalMap.Map2Vertex3.Points) - free( ctx->EvalMap.Map2Vertex3.Points ); - if (ctx->EvalMap.Map2Vertex4.Points) - free( ctx->EvalMap.Map2Vertex4.Points ); - if (ctx->EvalMap.Map2Index.Points) - free( ctx->EvalMap.Map2Index.Points ); - if (ctx->EvalMap.Map2Color4.Points) - free( ctx->EvalMap.Map2Color4.Points ); - if (ctx->EvalMap.Map2Normal.Points) - free( ctx->EvalMap.Map2Normal.Points ); - if (ctx->EvalMap.Map2Texture1.Points) - free( ctx->EvalMap.Map2Texture1.Points ); - if (ctx->EvalMap.Map2Texture2.Points) - free( ctx->EvalMap.Map2Texture2.Points ); - if (ctx->EvalMap.Map2Texture3.Points) - free( ctx->EvalMap.Map2Texture3.Points ); - if (ctx->EvalMap.Map2Texture4.Points) - free( ctx->EvalMap.Map2Texture4.Points ); - for (i = 0; i < 16; i++) + free(ctx->EvalMap.Map1Vertex3.Points); + free(ctx->EvalMap.Map1Vertex4.Points); + free(ctx->EvalMap.Map1Index.Points); + free(ctx->EvalMap.Map1Color4.Points); + free(ctx->EvalMap.Map1Normal.Points); + free(ctx->EvalMap.Map1Texture1.Points); + free(ctx->EvalMap.Map1Texture2.Points); + free(ctx->EvalMap.Map1Texture3.Points); + free(ctx->EvalMap.Map1Texture4.Points); + for (i = 0; i < Elements(ctx->EvalMap.Map1Attrib); i++) + free(ctx->EvalMap.Map1Attrib[i].Points); + + free(ctx->EvalMap.Map2Vertex3.Points); + free(ctx->EvalMap.Map2Vertex4.Points); + free(ctx->EvalMap.Map2Index.Points); + free(ctx->EvalMap.Map2Color4.Points); + free(ctx->EvalMap.Map2Normal.Points); + free(ctx->EvalMap.Map2Texture1.Points); + free(ctx->EvalMap.Map2Texture2.Points); + free(ctx->EvalMap.Map2Texture3.Points); + free(ctx->EvalMap.Map2Texture4.Points); + for (i = 0; i < Elements(ctx->EvalMap.Map2Attrib); i++) free((ctx->EvalMap.Map2Attrib[i].Points)); } diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h index 2f854e574..abf216c99 100644 --- a/mesalib/src/mesa/main/imports.h +++ b/mesalib/src/mesa/main/imports.h @@ -96,18 +96,6 @@ typedef union { GLfloat f; GLint i; } fi_type; #define DEG2RAD (M_PI/180.0) -/*** - *** SQRTF: single-precision square root - ***/ -#define SQRTF(X) (float) sqrt((float) (X)) - - -/*** - *** INV_SQRTF: single-precision inverse square root - ***/ -#define INV_SQRTF(X) (1.0F / SQRTF(X)) - - /** * \name Work-arounds for platforms that lack C99 math functions */ @@ -156,9 +144,15 @@ static inline int isblank(int ch) { return ch == ' ' || ch == '\t'; } #endif /*@}*/ -#if defined(__SUNPRO_C) -#define sqrtf(f) ((float) sqrt(f)) -#endif + + +/** single-precision inverse square root */ +static inline float +INV_SQRTF(float x) +{ + /* XXX we could try Quake's fast inverse square root function here */ + return 1.0F / sqrtf(x); +} /*** diff --git a/mesalib/src/mesa/main/light.c b/mesalib/src/mesa/main/light.c index cfb53dc06..042ed1cb8 100644 --- a/mesalib/src/mesa/main/light.c +++ b/mesalib/src/mesa/main/light.c @@ -1038,7 +1038,7 @@ update_modelview_scale( struct gl_context *ctx ) if (ctx->_NeedEyeCoords) ctx->_ModelViewInvScale = (GLfloat) INV_SQRTF(f); else - ctx->_ModelViewInvScale = (GLfloat) SQRTF(f); + ctx->_ModelViewInvScale = (GLfloat) sqrtf(f); } } diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h index 7d0a375d1..fc6f2a28f 100644 --- a/mesalib/src/mesa/main/macros.h +++ b/mesalib/src/mesa/main/macros.h @@ -665,13 +665,13 @@ LEN_SQUARED_2FV(const GLfloat v[2]) static inline GLfloat LEN_3FV(const GLfloat v[3]) { - return SQRTF(LEN_SQUARED_3FV(v)); + return sqrtf(LEN_SQUARED_3FV(v)); } static inline GLfloat LEN_2FV(const GLfloat v[2]) { - return SQRTF(LEN_SQUARED_2FV(v)); + return sqrtf(LEN_SQUARED_2FV(v)); } diff --git a/mesalib/src/mesa/main/texcompress_fxt1.c b/mesalib/src/mesa/main/texcompress_fxt1.c index eafa18794..8948bd278 100644 --- a/mesalib/src/mesa/main/texcompress_fxt1.c +++ b/mesalib/src/mesa/main/texcompress_fxt1.c @@ -99,8 +99,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) fxt1_encode(srcWidth, srcHeight, 3, pixels, srcRowStride, dst, dstRowStride); - if (tempImage) - free((void*) tempImage); + free((void*) tempImage); return GL_TRUE; } @@ -149,8 +148,7 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) fxt1_encode(srcWidth, srcHeight, 4, pixels, srcRowStride, dst, dstRowStride); - if (tempImage) - free((void*) tempImage); + free((void*) tempImage); return GL_TRUE; } diff --git a/mesalib/src/mesa/main/texcompress_rgtc.c b/mesalib/src/mesa/main/texcompress_rgtc.c index 84d8fc7fc..5773459d7 100644 --- a/mesalib/src/mesa/main/texcompress_rgtc.c +++ b/mesalib/src/mesa/main/texcompress_rgtc.c @@ -129,8 +129,8 @@ _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS) } blkaddr += dstRowDiff; } - if (tempImage) - free((void *) tempImage); + + free((void *) tempImage); return GL_TRUE; } @@ -176,8 +176,8 @@ _mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS) } blkaddr += dstRowDiff; } - if (tempImage) - free((void *) tempImage); + + free((void *) tempImage); return GL_TRUE; } @@ -230,8 +230,8 @@ _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS) } blkaddr += dstRowDiff; } - if (tempImage) - free((void *) tempImage); + + free((void *) tempImage); return GL_TRUE; } @@ -285,8 +285,8 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS) } blkaddr += dstRowDiff; } - if (tempImage) - free((void *) tempImage); + + free((void *) tempImage); return GL_TRUE; } diff --git a/mesalib/src/mesa/main/texcompress_s3tc.c b/mesalib/src/mesa/main/texcompress_s3tc.c index 230242c56..8736e208f 100644 --- a/mesalib/src/mesa/main/texcompress_s3tc.c +++ b/mesalib/src/mesa/main/texcompress_s3tc.c @@ -203,8 +203,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) _mesa_warning(ctx, "external dxt library not available: texstore_rgb_dxt1"); } - if (tempImage) - free((void *) tempImage); + free((void *) tempImage); return GL_TRUE; } @@ -256,8 +255,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) _mesa_warning(ctx, "external dxt library not available: texstore_rgba_dxt1"); } - if (tempImage) - free((void*) tempImage); + free((void*) tempImage); return GL_TRUE; } @@ -308,8 +306,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) _mesa_warning(ctx, "external dxt library not available: texstore_rgba_dxt3"); } - if (tempImage) - free((void *) tempImage); + free((void *) tempImage); return GL_TRUE; } @@ -360,8 +357,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) _mesa_warning(ctx, "external dxt library not available: texstore_rgba_dxt5"); } - if (tempImage) - free((void *) tempImage); + free((void *) tempImage); return GL_TRUE; } diff --git a/mesalib/src/mesa/math/m_matrix.c b/mesalib/src/mesa/math/m_matrix.c index 00a6c814f..b9f22d796 100644 --- a/mesalib/src/mesa/math/m_matrix.c +++ b/mesalib/src/mesa/math/m_matrix.c @@ -856,7 +856,7 @@ _math_matrix_rotate( GLmatrix *mat, } if (!optimized) { - const GLfloat mag = SQRTF(x * x + y * y + z * z); + const GLfloat mag = sqrtf(x * x + y * y + z * z); if (mag <= 1.0e-4) { /* no rotation, leave mat as-is */ diff --git a/mesalib/src/mesa/swrast/s_aalinetemp.h b/mesalib/src/mesa/swrast/s_aalinetemp.h index a517fb697..6cfd3bc28 100644 --- a/mesalib/src/mesa/swrast/s_aalinetemp.h +++ b/mesalib/src/mesa/swrast/s_aalinetemp.h @@ -118,7 +118,7 @@ NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) line.y1 = v1->attrib[FRAG_ATTRIB_WPOS][1]; line.dx = line.x1 - line.x0; line.dy = line.y1 - line.y0; - line.len = SQRTF(line.dx * line.dx + line.dy * line.dy); + line.len = sqrtf(line.dx * line.dx + line.dy * line.dy); line.halfWidth = 0.5F * CLAMP(ctx->Line.Width, ctx->Const.MinLineWidthAA, ctx->Const.MaxLineWidthAA); diff --git a/mesalib/src/mesa/swrast/s_span.c b/mesalib/src/mesa/swrast/s_span.c index ef51479fd..ff653a622 100644 --- a/mesalib/src/mesa/swrast/s_span.c +++ b/mesalib/src/mesa/swrast/s_span.c @@ -419,8 +419,8 @@ _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, GLfloat dvdx = texH * ((t + dtdx) / (q + dqdx) - t * invQ); GLfloat dudy = texW * ((s + dsdy) / (q + dqdy) - s * invQ); GLfloat dvdy = texH * ((t + dtdy) / (q + dqdy) - t * invQ); - GLfloat x = SQRTF(dudx * dudx + dvdx * dvdx); - GLfloat y = SQRTF(dudy * dudy + dvdy * dvdy); + GLfloat x = sqrtf(dudx * dudx + dvdx * dvdx); + GLfloat y = sqrtf(dudy * dudy + dvdy * dvdy); GLfloat rho = MAX2(x, y); GLfloat lambda = LOG2(rho); return lambda; diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c index d116a059d..152b1ff3e 100644 --- a/mesalib/src/mesa/swrast/s_texfilter.c +++ b/mesalib/src/mesa/swrast/s_texfilter.c @@ -1795,12 +1795,12 @@ sample_2d_footprint(struct gl_context *ctx, /* Calculate the per anisotropic sample offsets in s,t space. */ if (Px2 > Py2) { - numSamples = ceil(SQRTF(Px2)); + numSamples = ceil(sqrtf(Px2)); ds = ux / ((GLfloat) img->Width2); dt = vx / ((GLfloat) img->Height2); } else { - numSamples = ceil(SQRTF(Py2)); + numSamples = ceil(sqrtf(Py2)); ds = uy / ((GLfloat) img->Width2); dt = vy / ((GLfloat) img->Height2); } diff --git a/mesalib/src/mesa/tnl/t_rasterpos.c b/mesalib/src/mesa/tnl/t_rasterpos.c index a28ad0daf..1673b81ef 100644 --- a/mesalib/src/mesa/tnl/t_rasterpos.c +++ b/mesalib/src/mesa/tnl/t_rasterpos.c @@ -429,7 +429,7 @@ _tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4]) ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; else ctx->Current.RasterDistance = - SQRTF( eye[0]*eye[0] + eye[1]*eye[1] + eye[2]*eye[2] ); + sqrtf( eye[0]*eye[0] + eye[1]*eye[1] + eye[2]*eye[2] ); /* compute transformed normal vector (for lighting or texgen) */ if (ctx->_NeedEyeCoords) { |