mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 19:50:11 +01:00
Simplified and optimized _savage_texnorm_stage.
This commit is contained in:
parent
3deaf21745
commit
1c86c7ad9c
1 changed files with 7 additions and 36 deletions
|
|
@ -1148,37 +1148,17 @@ static GLboolean run_texnorm_stage( GLcontext *ctx,
|
||||||
GLint j;
|
GLint j;
|
||||||
|
|
||||||
if (normalizeS && normalizeT) {
|
if (normalizeS && normalizeT) {
|
||||||
/* determine extreme values in S and T */
|
/* take first texcoords as rough estimate of mean value */
|
||||||
GLfloat minS = in[0], maxS = in[0], minT = in[1], maxT = in[1];
|
GLfloat correctionS = -floor(in[0]+0.5);
|
||||||
GLfloat correctionS, correctionT;
|
GLfloat correctionT = -floor(in[1]+0.5);
|
||||||
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;
|
|
||||||
for (j = 0; j < VB->Count; ++j) {
|
for (j = 0; j < VB->Count; ++j) {
|
||||||
out[j][0] = in[0] + correctionS;
|
out[j][0] = in[0] + correctionS;
|
||||||
out[j][1] = in[1] + correctionT;
|
out[j][1] = in[1] + correctionT;
|
||||||
in = (GLfloat *)((GLubyte *)in + instride);
|
in = (GLfloat *)((GLubyte *)in + instride);
|
||||||
}
|
}
|
||||||
} else if (normalizeS) {
|
} else if (normalizeS) {
|
||||||
/* determine extreme values in S */
|
/* take first texcoords as rough estimate of mean value */
|
||||||
GLfloat minS = in[0], maxS = in[0];
|
GLfloat correctionS = -floor(in[0]+0.5);
|
||||||
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;
|
|
||||||
if (reallyEnabled & TEXTURE_2D_BIT) {
|
if (reallyEnabled & TEXTURE_2D_BIT) {
|
||||||
for (j = 0; j < VB->Count; ++j) {
|
for (j = 0; j < VB->Count; ++j) {
|
||||||
out[j][0] = in[0] + correctionS;
|
out[j][0] = in[0] + correctionS;
|
||||||
|
|
@ -1192,17 +1172,8 @@ static GLboolean run_texnorm_stage( GLcontext *ctx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (normalizeT) {
|
} else if (normalizeT) {
|
||||||
/* determine extreme values in T */
|
/* take first texcoords as rough estimate of mean value */
|
||||||
GLfloat minT = in[1], maxT = in[1];
|
GLfloat correctionT = -floor(in[1]+0.5);
|
||||||
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;
|
|
||||||
for (j = 0; j < VB->Count; ++j) {
|
for (j = 0; j < VB->Count; ++j) {
|
||||||
out[j][0] = in[0];
|
out[j][0] = in[0];
|
||||||
out[j][1] = in[1] + correctionT;
|
out[j][1] = in[1] + correctionT;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue