From 8574eba804031f6b19713f0b02952280730bf62e Mon Sep 17 00:00:00 2001 From: marha Date: Thu, 5 Mar 2015 22:17:40 +0100 Subject: fontconfig mesa git update 5 Mar 2015 --- mesalib/src/mesa/tnl/t_context.c | 2 +- mesalib/src/mesa/tnl/t_draw.c | 2 + mesalib/src/mesa/tnl/t_pipeline.c | 78 +++++++++++++++++++++++++++++++++++++ mesalib/src/mesa/tnl/t_rasterpos.c | 3 +- mesalib/src/mesa/tnl/t_vb_cliptmp.h | 8 ++-- mesalib/src/mesa/tnl/t_vb_fog.c | 7 ++-- mesalib/src/mesa/tnl/t_vb_light.c | 4 +- mesalib/src/mesa/tnl/t_vb_points.c | 5 ++- mesalib/src/mesa/tnl/t_vb_program.c | 2 +- mesalib/src/mesa/tnl/t_vb_render.c | 27 ++++++------- mesalib/src/mesa/tnl/t_vb_texgen.c | 4 +- mesalib/src/mesa/tnl/t_vertex.c | 1 + mesalib/src/mesa/tnl/t_vertex_sse.c | 2 + 13 files changed, 116 insertions(+), 29 deletions(-) (limited to 'mesalib/src/mesa/tnl') diff --git a/mesalib/src/mesa/tnl/t_context.c b/mesalib/src/mesa/tnl/t_context.c index eb5bae41d..bc705d7a3 100644 --- a/mesalib/src/mesa/tnl/t_context.c +++ b/mesalib/src/mesa/tnl/t_context.c @@ -130,7 +130,7 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state ) GLuint i; if (new_state & (_NEW_HINT | _NEW_PROGRAM)) { - ASSERT(tnl->AllowVertexFog || tnl->AllowPixelFog); + assert(tnl->AllowVertexFog || tnl->AllowPixelFog); tnl->_DoVertexFog = ((tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST)) || !tnl->AllowPixelFog) && !fp; } diff --git a/mesalib/src/mesa/tnl/t_draw.c b/mesalib/src/mesa/tnl/t_draw.c index be3f059bb..60265d60b 100644 --- a/mesalib/src/mesa/tnl/t_draw.c +++ b/mesalib/src/mesa/tnl/t_draw.c @@ -25,6 +25,8 @@ * Keith Whitwell */ +#include + #include "main/glheader.h" #include "main/bufferobj.h" #include "main/condrender.h" diff --git a/mesalib/src/mesa/tnl/t_pipeline.c b/mesalib/src/mesa/tnl/t_pipeline.c index 78508aecf..0adbef012 100644 --- a/mesalib/src/mesa/tnl/t_pipeline.c +++ b/mesalib/src/mesa/tnl/t_pipeline.c @@ -112,6 +112,84 @@ static GLuint check_output_changes( struct gl_context *ctx ) #endif } +/** + * START/END_FAST_MATH macros: + * + * START_FAST_MATH: Set x86 FPU to faster, 32-bit precision mode (and save + * original mode to a temporary). + * END_FAST_MATH: Restore x86 FPU to original mode. + */ +#if defined(__GNUC__) && defined(__i386__) +/* + * Set the x86 FPU control word to guarentee only 32 bits of precision + * are stored in registers. Allowing the FPU to store more introduces + * differences between situations where numbers are pulled out of memory + * vs. situations where the compiler is able to optimize register usage. + * + * In the worst case, we force the compiler to use a memory access to + * truncate the float, by specifying the 'volatile' keyword. + */ +/* Hardware default: All exceptions masked, extended double precision, + * round to nearest (IEEE compliant): + */ +#define DEFAULT_X86_FPU 0x037f +/* All exceptions masked, single precision, round to nearest: + */ +#define FAST_X86_FPU 0x003f +/* The fldcw instruction will cause any pending FP exceptions to be + * raised prior to entering the block, and we clear any pending + * exceptions before exiting the block. Hence, asm code has free + * reign over the FPU while in the fast math block. + */ +#if defined(NO_FAST_MATH) +#define START_FAST_MATH(x) \ +do { \ + static GLuint mask = DEFAULT_X86_FPU; \ + __asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \ + __asm__ ( "fldcw %0" : : "m" (mask) ); \ +} while (0) +#else +#define START_FAST_MATH(x) \ +do { \ + static GLuint mask = FAST_X86_FPU; \ + __asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \ + __asm__ ( "fldcw %0" : : "m" (mask) ); \ +} while (0) +#endif +/* Restore original FPU mode, and clear any exceptions that may have + * occurred in the FAST_MATH block. + */ +#define END_FAST_MATH(x) \ +do { \ + __asm__ ( "fnclex ; fldcw %0" : : "m" (*&(x)) ); \ +} while (0) + +#elif defined(_MSC_VER) && defined(_M_IX86) +#define DEFAULT_X86_FPU 0x037f /* See GCC comments above */ +#define FAST_X86_FPU 0x003f /* See GCC comments above */ +#if defined(NO_FAST_MATH) +#define START_FAST_MATH(x) do {\ + static GLuint mask = DEFAULT_X86_FPU;\ + __asm fnstcw word ptr [x]\ + __asm fldcw word ptr [mask]\ +} while(0) +#else +#define START_FAST_MATH(x) do {\ + static GLuint mask = FAST_X86_FPU;\ + __asm fnstcw word ptr [x]\ + __asm fldcw word ptr [mask]\ +} while(0) +#endif +#define END_FAST_MATH(x) do {\ + __asm fnclex\ + __asm fldcw word ptr [x]\ +} while(0) + +#else +#define START_FAST_MATH(x) x = 0 +#define END_FAST_MATH(x) (void)(x) +#endif + void _tnl_run_pipeline( struct gl_context *ctx ) { diff --git a/mesalib/src/mesa/tnl/t_rasterpos.c b/mesalib/src/mesa/tnl/t_rasterpos.c index 2f52bb306..9ecf947df 100644 --- a/mesalib/src/mesa/tnl/t_rasterpos.c +++ b/mesalib/src/mesa/tnl/t_rasterpos.c @@ -23,6 +23,7 @@ */ +#include "c99_math.h" #include "main/glheader.h" #include "main/colormac.h" #include "main/feedback.h" @@ -271,7 +272,7 @@ compute_texgen(struct gl_context *ctx, const GLfloat vObj[4], const GLfloat vEye rz = u[2] - normal[2] * two_nu; m = rx * rx + ry * ry + (rz + 1.0F) * (rz + 1.0F); if (m > 0.0F) - mInv = 0.5F * INV_SQRTF(m); + mInv = 0.5F * (1.0f / sqrtf(m)); else mInv = 0.0F; diff --git a/mesalib/src/mesa/tnl/t_vb_cliptmp.h b/mesalib/src/mesa/tnl/t_vb_cliptmp.h index 7dafb83cf..12181f085 100644 --- a/mesalib/src/mesa/tnl/t_vb_cliptmp.h +++ b/mesalib/src/mesa/tnl/t_vb_cliptmp.h @@ -155,7 +155,7 @@ TAG(clip_line)( struct gl_context *ctx, GLuint v0, GLuint v1, GLubyte mask ) newvert++; } else { - ASSERT(t0 == 0.0); + assert(t0 == 0.0); } /* Note: we need to use vertex v0_orig when computing the new @@ -174,7 +174,7 @@ TAG(clip_line)( struct gl_context *ctx, GLuint v0, GLuint v1, GLubyte mask ) newvert++; } else { - ASSERT(t1 == 0.0); + assert(t1 == 0.0); } tnl->Driver.Render.ClippedLine( ctx, v0, v1 ); @@ -239,7 +239,7 @@ TAG(clip_tri)( struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte if (ctx->Light.ShadeModel == GL_FLAT) { if (pv != inlist[0]) { - ASSERT( inlist[0] >= VB->Count ); + assert( inlist[0] >= VB->Count ); tnl->Driver.Render.CopyPV( ctx, inlist[0], pv ); } } @@ -302,7 +302,7 @@ TAG(clip_quad)( struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint if (ctx->Light.ShadeModel == GL_FLAT) { if (pv != inlist[0]) { - ASSERT( inlist[0] >= VB->Count ); + assert( inlist[0] >= VB->Count ); tnl->Driver.Render.CopyPV( ctx, inlist[0], pv ); } } diff --git a/mesalib/src/mesa/tnl/t_vb_fog.c b/mesalib/src/mesa/tnl/t_vb_fog.c index ab7901edb..3626f1da3 100644 --- a/mesalib/src/mesa/tnl/t_vb_fog.c +++ b/mesalib/src/mesa/tnl/t_vb_fog.c @@ -26,6 +26,7 @@ */ +#include "c99_math.h" #include "main/glheader.h" #include "main/colormac.h" #include "main/macros.h" @@ -78,7 +79,7 @@ init_static_data( void ) GLfloat f = 0.0F; GLint i = 0; for ( ; i < FOG_EXP_TABLE_SIZE ; i++, f += FOG_INCR) { - exp_table[i] = EXPF(-f); + exp_table[i] = expf(-f); } inited = 1; } @@ -186,7 +187,7 @@ run_fog_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage) NOTE should avoid going through array twice */ coord = input->start; for (i = 0; i < input->count; i++) { - *coord = FABSF(*coord); + *coord = fabsf(*coord); STRIDE_F(coord, input->stride); } } @@ -201,7 +202,7 @@ run_fog_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage) input->count = VB->EyePtr->count; coord = VB->EyePtr->start; for (i = 0 ; i < VB->EyePtr->count; i++) { - input->data[i][0] = FABSF(coord[2]); + input->data[i][0] = fabsf(coord[2]); STRIDE_F(coord, VB->EyePtr->stride); } } diff --git a/mesalib/src/mesa/tnl/t_vb_light.c b/mesalib/src/mesa/tnl/t_vb_light.c index f6884a464..7781b6a6c 100644 --- a/mesalib/src/mesa/tnl/t_vb_light.c +++ b/mesalib/src/mesa/tnl/t_vb_light.c @@ -23,7 +23,7 @@ */ - +#include "c99_math.h" #include "main/glheader.h" #include "main/colormac.h" #include "main/light.h" @@ -123,7 +123,7 @@ validate_shine_table( struct gl_context *ctx, GLuint side, GLfloat shininess ) struct tnl_shine_tab *list = tnl->_ShineTabList; struct tnl_shine_tab *s; - ASSERT(side < 2); + assert(side < 2); foreach(s, list) if ( s->shininess == shininess ) diff --git a/mesalib/src/mesa/tnl/t_vb_points.c b/mesalib/src/mesa/tnl/t_vb_points.c index 5f6c25857..0f8578daa 100644 --- a/mesalib/src/mesa/tnl/t_vb_points.c +++ b/mesalib/src/mesa/tnl/t_vb_points.c @@ -25,6 +25,7 @@ * Brian Paul */ +#include "c99_math.h" #include "main/glheader.h" #include "main/mtypes.h" #include "main/dd.h" @@ -62,9 +63,9 @@ run_point_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage) GLuint i; for (i = 0; i < VB->Count; i++) { - const GLfloat dist = FABSF(*eyeCoord); + const GLfloat dist = fabsf(*eyeCoord); const GLfloat q = p0 + dist * (p1 + dist * p2); - const GLfloat atten = (q != 0.0F) ? INV_SQRTF(q) : 1.0F; + const GLfloat atten = (q != 0.0F) ? (1.0f / sqrtf(q)) : 1.0F; size[i][0] = pointSize * atten; /* clamping done in rasterization */ eyeCoord += eyeCoordStride; } diff --git a/mesalib/src/mesa/tnl/t_vb_program.c b/mesalib/src/mesa/tnl/t_vb_program.c index d08abe7c2..464a4cddd 100644 --- a/mesalib/src/mesa/tnl/t_vb_program.c +++ b/mesalib/src/mesa/tnl/t_vb_program.c @@ -392,7 +392,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) store->results[VARYING_SLOT_FOGC].data[i][3] = 1.0; } #ifdef NAN_CHECK - ASSERT(machine->Outputs[0][3] != 0.0F); + assert(machine->Outputs[0][3] != 0.0F); #endif #if 0 printf("HPOS: %f %f %f %f\n", diff --git a/mesalib/src/mesa/tnl/t_vb_render.c b/mesalib/src/mesa/tnl/t_vb_render.c index aff5b9a68..4960ac096 100644 --- a/mesalib/src/mesa/tnl/t_vb_render.c +++ b/mesalib/src/mesa/tnl/t_vb_render.c @@ -38,6 +38,7 @@ */ +#include #include "main/glheader.h" #include "main/context.h" #include "main/enums.h" @@ -271,22 +272,22 @@ static GLboolean run_render( struct gl_context *ctx, * that window coordinates are guarenteed not to change before * rendering. */ - ASSERT(tnl->Driver.Render.Start); + assert(tnl->Driver.Render.Start); tnl->Driver.Render.Start( ctx ); - ASSERT(tnl->Driver.Render.BuildVertices); - ASSERT(tnl->Driver.Render.PrimitiveNotify); - ASSERT(tnl->Driver.Render.Points); - ASSERT(tnl->Driver.Render.Line); - ASSERT(tnl->Driver.Render.Triangle); - ASSERT(tnl->Driver.Render.Quad); - ASSERT(tnl->Driver.Render.ResetLineStipple); - ASSERT(tnl->Driver.Render.Interp); - ASSERT(tnl->Driver.Render.CopyPV); - ASSERT(tnl->Driver.Render.ClippedLine); - ASSERT(tnl->Driver.Render.ClippedPolygon); - ASSERT(tnl->Driver.Render.Finish); + assert(tnl->Driver.Render.BuildVertices); + assert(tnl->Driver.Render.PrimitiveNotify); + assert(tnl->Driver.Render.Points); + assert(tnl->Driver.Render.Line); + assert(tnl->Driver.Render.Triangle); + assert(tnl->Driver.Render.Quad); + assert(tnl->Driver.Render.ResetLineStipple); + assert(tnl->Driver.Render.Interp); + assert(tnl->Driver.Render.CopyPV); + assert(tnl->Driver.Render.ClippedLine); + assert(tnl->Driver.Render.ClippedPolygon); + assert(tnl->Driver.Render.Finish); tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, ~0 ); diff --git a/mesalib/src/mesa/tnl/t_vb_texgen.c b/mesalib/src/mesa/tnl/t_vb_texgen.c index 8f527e343..9a61ef2fe 100644 --- a/mesalib/src/mesa/tnl/t_vb_texgen.c +++ b/mesalib/src/mesa/tnl/t_vb_texgen.c @@ -116,7 +116,7 @@ static void build_m3( GLfloat f[][3], GLfloat m[], fz = f[i][2] = u[2] - norm[2] * two_nu; m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F); if (m[i] != 0.0F) { - m[i] = 0.5F * INV_SQRTF(m[i]); + m[i] = 0.5F * (1.0f / sqrtf(m[i])); } } } @@ -145,7 +145,7 @@ static void build_m2( GLfloat f[][3], GLfloat m[], fz = f[i][2] = u[2] - norm[2] * two_nu; m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F); if (m[i] != 0.0F) { - m[i] = 0.5F * INV_SQRTF(m[i]); + m[i] = 0.5F * (1.0f / sqrtf(m[i])); } } } diff --git a/mesalib/src/mesa/tnl/t_vertex.c b/mesalib/src/mesa/tnl/t_vertex.c index 90b97a092..369d6d945 100644 --- a/mesalib/src/mesa/tnl/t_vertex.c +++ b/mesalib/src/mesa/tnl/t_vertex.c @@ -25,6 +25,7 @@ * Keith Whitwell */ +#include #include "main/glheader.h" #include "main/context.h" #include "main/colormac.h" diff --git a/mesalib/src/mesa/tnl/t_vertex_sse.c b/mesalib/src/mesa/tnl/t_vertex_sse.c index 93128fbe6..963432c48 100644 --- a/mesalib/src/mesa/tnl/t_vertex_sse.c +++ b/mesalib/src/mesa/tnl/t_vertex_sse.c @@ -25,6 +25,8 @@ * Keith Whitwell */ +#include + #include "main/glheader.h" #include "main/context.h" #include "main/colormac.h" -- cgit v1.2.3