mesa: Remove _mesa_pow(), which is always just pow().

This commit is contained in:
Eric Anholt
2010-05-05 08:29:13 -07:00
parent 60a0535101
commit fef303bc94
9 changed files with 14 additions and 26 deletions

View File

@@ -210,7 +210,7 @@ gamma_adjust( GLfloat gamma, GLint value, GLint max )
} }
else { else {
double x = (double) value / (double) max; double x = (double) value / (double) max;
return IROUND_POS((GLfloat) max * _mesa_pow(x, 1.0F/gamma)); return IROUND_POS((GLfloat) max * pow(x, 1.0F/gamma));
} }
} }
@@ -846,19 +846,19 @@ setup_8bit_hpcr(XMesaVisual v)
g = 1.0 / v->RedGamma; g = 1.0 / v->RedGamma;
for (i=0; i<256; i++) { for (i=0; i<256; i++) {
GLint red = IROUND_POS(255.0 * _mesa_pow( hpcr_rgbTbl[0][i]/255.0, g )); GLint red = IROUND_POS(255.0 * pow( hpcr_rgbTbl[0][i]/255.0, g ));
v->hpcr_rgbTbl[0][i] = CLAMP( red, 16, 239 ); v->hpcr_rgbTbl[0][i] = CLAMP( red, 16, 239 );
} }
g = 1.0 / v->GreenGamma; g = 1.0 / v->GreenGamma;
for (i=0; i<256; i++) { for (i=0; i<256; i++) {
GLint green = IROUND_POS(255.0 * _mesa_pow( hpcr_rgbTbl[1][i]/255.0, g )); GLint green = IROUND_POS(255.0 * pow( hpcr_rgbTbl[1][i]/255.0, g ));
v->hpcr_rgbTbl[1][i] = CLAMP( green, 16, 239 ); v->hpcr_rgbTbl[1][i] = CLAMP( green, 16, 239 );
} }
g = 1.0 / v->BlueGamma; g = 1.0 / v->BlueGamma;
for (i=0; i<256; i++) { for (i=0; i<256; i++) {
GLint blue = IROUND_POS(255.0 * _mesa_pow( hpcr_rgbTbl[2][i]/255.0, g )); GLint blue = IROUND_POS(255.0 * pow( hpcr_rgbTbl[2][i]/255.0, g ));
v->hpcr_rgbTbl[2][i] = CLAMP( blue, 32, 223 ); v->hpcr_rgbTbl[2][i] = CLAMP( blue, 32, 223 );
} }
v->undithered_pf = PF_HPCR; /* can't really disable dithering for now */ v->undithered_pf = PF_HPCR; /* can't really disable dithering for now */

View File

@@ -486,15 +486,6 @@ _mesa_inv_sqrtf(float n)
#endif #endif
} }
/** Wrapper around pow() */
double
_mesa_pow(double x, double y)
{
return pow(x, y);
}
/** /**
* Find the first bit set in a word. * Find the first bit set in a word.
*/ */

View File

@@ -548,9 +548,6 @@ _mesa_inv_sqrtf(float x);
extern void extern void
_mesa_init_sqrt_table(void); _mesa_init_sqrt_table(void);
extern double
_mesa_pow(double x, double y);
extern int extern int
_mesa_ffs(int32_t i); _mesa_ffs(int32_t i);

View File

@@ -950,7 +950,7 @@ validate_spot_exp_table( struct gl_light *l )
for (i = EXP_TABLE_SIZE - 1; i > 0 ;i--) { for (i = EXP_TABLE_SIZE - 1; i > 0 ;i--) {
if (clamp == 0) { if (clamp == 0) {
tmp = _mesa_pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent); tmp = pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent);
if (tmp < FLT_MIN * 100.0) { if (tmp < FLT_MIN * 100.0) {
tmp = 0.0; tmp = 0.0;
clamp = 1; clamp = 1;
@@ -1012,7 +1012,7 @@ validate_shine_table( GLcontext *ctx, GLuint side, GLfloat shininess )
GLdouble t, x = j / (GLfloat) (SHINE_TABLE_SIZE - 1); GLdouble t, x = j / (GLfloat) (SHINE_TABLE_SIZE - 1);
if (x < 0.005) /* underflow check */ if (x < 0.005) /* underflow check */
x = 0.005; x = 0.005;
t = _mesa_pow(x, shininess); t = pow(x, shininess);
if (t > 1e-20) if (t > 1e-20)
m[j] = (GLfloat) t; m[j] = (GLfloat) t;
else else

View File

@@ -94,7 +94,7 @@ do { \
int k = (int) f; \ int k = (int) f; \
if (k < 0 /* gcc may cast an overflow float value to negative int value*/ \ if (k < 0 /* gcc may cast an overflow float value to negative int value*/ \
|| k > SHINE_TABLE_SIZE-2) \ || k > SHINE_TABLE_SIZE-2) \
result = (GLfloat) _mesa_pow( dp, _tab->shininess ); \ result = (GLfloat) pow( dp, _tab->shininess ); \
else \ else \
result = _tab->tab[k] + (f-k)*(_tab->tab[k+1]-_tab->tab[k]); \ result = _tab->tab[k] + (f-k)*(_tab->tab[k+1]-_tab->tab[k]); \
} while (0) } while (0)

View File

@@ -78,7 +78,7 @@ nonlinear_to_linear(GLubyte cs8)
table[i] = cs / 12.92f; table[i] = cs / 12.92f;
} }
else { else {
table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4); table[i] = (GLfloat) pow((cs + 0.055) / 1.055, 2.4);
} }
} }
tableReady = GL_TRUE; tableReady = GL_TRUE;

View File

@@ -60,7 +60,7 @@ nonlinear_to_linear(GLubyte cs8)
table[i] = cs / 12.92f; table[i] = cs / 12.92f;
} }
else { else {
table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4); table[i] = (GLfloat) pow((cs + 0.055) / 1.055, 2.4);
} }
} }
tableReady = GL_TRUE; tableReady = GL_TRUE;

View File

@@ -224,7 +224,7 @@ linear_to_nonlinear(GLfloat cl)
cs = 12.92f * cl; cs = 12.92f * cl;
} }
else { else {
cs = (GLfloat)(1.055 * _mesa_pow(cl, 0.41666) - 0.055); cs = (GLfloat)(1.055 * pow(cl, 0.41666) - 0.055);
} }
return cs; return cs;
} }

View File

@@ -876,7 +876,7 @@ _mesa_execute_program(GLcontext * ctx,
* result.z = result.x * APPX(result.y) * result.z = result.x * APPX(result.y)
* We do what the ARB extension says. * We do what the ARB extension says.
*/ */
q[2] = (GLfloat) _mesa_pow(2.0, t[0]); q[2] = (GLfloat) pow(2.0, t[0]);
} }
q[1] = t[0] - floor_t0; q[1] = t[0] - floor_t0;
q[3] = 1.0F; q[3] = 1.0F;
@@ -887,7 +887,7 @@ _mesa_execute_program(GLcontext * ctx,
{ {
GLfloat a[4], result[4], val; GLfloat a[4], result[4], val;
fetch_vector1(&inst->SrcReg[0], machine, a); fetch_vector1(&inst->SrcReg[0], machine, a);
val = (GLfloat) _mesa_pow(2.0, a[0]); val = (GLfloat) pow(2.0, a[0]);
/* /*
if (IS_INF_OR_NAN(val)) if (IS_INF_OR_NAN(val))
val = 1.0e10; val = 1.0e10;
@@ -1009,7 +1009,7 @@ _mesa_execute_program(GLcontext * ctx,
if (a[1] == 0.0 && a[3] == 0.0) if (a[1] == 0.0 && a[3] == 0.0)
result[2] = 1.0F; result[2] = 1.0F;
else else
result[2] = (GLfloat) _mesa_pow(a[1], a[3]); result[2] = (GLfloat) pow(a[1], a[3]);
} }
else { else {
result[2] = 0.0F; result[2] = 0.0F;
@@ -1336,7 +1336,7 @@ _mesa_execute_program(GLcontext * ctx,
fetch_vector1(&inst->SrcReg[0], machine, a); fetch_vector1(&inst->SrcReg[0], machine, a);
fetch_vector1(&inst->SrcReg[1], machine, b); fetch_vector1(&inst->SrcReg[1], machine, b);
result[0] = result[1] = result[2] = result[3] result[0] = result[1] = result[2] = result[3]
= (GLfloat) _mesa_pow(a[0], b[0]); = (GLfloat) pow(a[0], b[0]);
store_vector4(inst, machine, result); store_vector4(inst, machine, result);
} }
break; break;