summaryrefslogtreecommitdiff
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2012-02-08 20:11:58 -0700
committerBrian Paul <brianp@vmware.com>2012-02-10 08:06:56 -0700
commitae509f88a54b9cc32f16099109330f2792593c83 (patch)
tree482cf3dde475b64fcc3c2d2e9dee17db6df3c23f /src/mesa/tnl
parent4dacf793c8bf5c18f66efeb04e9d8a7e037e7378 (diff)
mesa: remove gl_light::_SpotExpTable field
Just use pow() instead. Spot lights aren't too common and fixed-function lighting isn't as important as it used to me. This saves 32KB per context. Each table was 4KB and there's 8 lights.
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_rasterpos.c5
-rw-r--r--src/mesa/tnl/t_vb_lighttmp.h10
2 files changed, 3 insertions, 12 deletions
diff --git a/src/mesa/tnl/t_rasterpos.c b/src/mesa/tnl/t_rasterpos.c
index a7e4397b660..bdd6129e727 100644
--- a/src/mesa/tnl/t_rasterpos.c
+++ b/src/mesa/tnl/t_rasterpos.c
@@ -167,10 +167,7 @@ shade_rastpos(struct gl_context *ctx,
continue;
}
else {
- double x = PV_dot_dir * (EXP_TABLE_SIZE-1);
- int k = (int) x;
- GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0]
- + (x-k)*light->_SpotExpTable[k][1]);
+ GLfloat spot = powf(PV_dot_dir, light->SpotExponent);
attenuation *= spot;
}
}
diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h
index aae1d18ff7f..0b8c314685e 100644
--- a/src/mesa/tnl/t_vb_lighttmp.h
+++ b/src/mesa/tnl/t_vb_lighttmp.h
@@ -147,10 +147,7 @@ static void TAG(light_rgba_spec)( struct gl_context *ctx,
continue; /* this light makes no contribution */
}
else {
- GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1);
- GLint k = (GLint) x;
- GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0]
- + (x-k)*light->_SpotExpTable[k][1]);
+ GLfloat spot = powf(PV_dot_dir, light->SpotExponent);
attenuation *= spot;
}
}
@@ -331,10 +328,7 @@ static void TAG(light_rgba)( struct gl_context *ctx,
continue; /* this light makes no contribution */
}
else {
- GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1);
- GLint k = (GLint) x;
- GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0]
- + (x-k)*light->_SpotExpTable[k][1]);
+ GLfloat spot = powf(PV_dot_dir, light->SpotExponent);
attenuation *= spot;
}
}