summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/savage/savagetris.c
diff options
context:
space:
mode:
authorFelix Kuehling <[email protected]>2004-12-23 20:26:59 +0000
committerFelix Kuehling <[email protected]>2004-12-23 20:26:59 +0000
commit1c86c7ad9c38b5ef1baa19677b78076889b60e7f (patch)
tree1757a8a1491ebc70dc6c71ec1547e2fbd4fa8fde /src/mesa/drivers/dri/savage/savagetris.c
parent3deaf2174544f25df812af886c424383ba1dafdf (diff)
Simplified and optimized _savage_texnorm_stage.
Diffstat (limited to 'src/mesa/drivers/dri/savage/savagetris.c')
-rw-r--r--src/mesa/drivers/dri/savage/savagetris.c43
1 files changed, 7 insertions, 36 deletions
diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c
index 666863a8ee7..69633ecae75 100644
--- a/src/mesa/drivers/dri/savage/savagetris.c
+++ b/src/mesa/drivers/dri/savage/savagetris.c
@@ -1148,37 +1148,17 @@ static GLboolean run_texnorm_stage( GLcontext *ctx,
GLint j;
if (normalizeS && normalizeT) {
- /* determine extreme values in S and T */
- GLfloat minS = in[0], maxS = in[0], minT = in[1], maxT = in[1];
- GLfloat correctionS, correctionT;
- in = (GLfloat *)((GLubyte *)in + instride);
- for (j = 1; j < VB->Count; ++j) {
- if (in[0] < minS) minS = in[0];
- else if (in[0] > maxS) maxS = in[0];
- if (in[1] < minT) minT = in[1];
- else if (in[1] > maxT) maxT = in[1];
- in = (GLfloat *)((GLubyte *)in + instride);
- }
- correctionS = -floor((minS + maxS) * 0.5 + 0.5);
- correctionT = -floor((minT + maxT) * 0.5 + 0.5);
- in = (GLfloat *)VB->TexCoordPtr[i]->data;
+ /* take first texcoords as rough estimate of mean value */
+ GLfloat correctionS = -floor(in[0]+0.5);
+ GLfloat correctionT = -floor(in[1]+0.5);
for (j = 0; j < VB->Count; ++j) {
out[j][0] = in[0] + correctionS;
out[j][1] = in[1] + correctionT;
in = (GLfloat *)((GLubyte *)in + instride);
}
} else if (normalizeS) {
- /* determine extreme values in S */
- GLfloat minS = in[0], maxS = in[0];
- GLfloat correctionS;
- in = (GLfloat *)((GLubyte *)in + instride);
- for (j = 1; j < VB->Count; ++j) {
- if (in[0] < minS) minS = in[0];
- else if (in[0] > maxS) maxS = in[0];
- in = (GLfloat *)((GLubyte *)in + instride);
- }
- correctionS = -floor((minS + maxS) * 0.5 + 0.5);
- in = (GLfloat *)VB->TexCoordPtr[i]->data;
+ /* take first texcoords as rough estimate of mean value */
+ GLfloat correctionS = -floor(in[0]+0.5);
if (reallyEnabled & TEXTURE_2D_BIT) {
for (j = 0; j < VB->Count; ++j) {
out[j][0] = in[0] + correctionS;
@@ -1192,17 +1172,8 @@ static GLboolean run_texnorm_stage( GLcontext *ctx,
}
}
} else if (normalizeT) {
- /* determine extreme values in T */
- GLfloat minT = in[1], maxT = in[1];
- GLfloat correctionT;
- in = (GLfloat *)((GLubyte *)in + instride);
- for (j = 1; j < VB->Count; ++j) {
- if (in[1] < minT) minT = in[1];
- else if (in[1] > maxT) maxT = in[1];
- in = (GLfloat *)((GLubyte *)in + instride);
- }
- correctionT = -floor((minT + maxT) * 0.5 + 0.5);
- in = (GLfloat *)VB->TexCoordPtr[i]->data;
+ /* take first texcoords as rough estimate of mean value */
+ GLfloat correctionT = -floor(in[1]+0.5);
for (j = 0; j < VB->Count; ++j) {
out[j][0] = in[0];
out[j][1] = in[1] + correctionT;