Remove _IsPowerOfTwo from gl_texture_object, not really needed.
This commit is contained in:
@@ -1299,7 +1299,6 @@ struct gl_texture_object
|
|||||||
GLint _MaxLevel; /**< actual max mipmap level (q in the spec) */
|
GLint _MaxLevel; /**< actual max mipmap level (q in the spec) */
|
||||||
GLfloat _MaxLambda; /**< = _MaxLevel - BaseLevel (q - b in spec) */
|
GLfloat _MaxLambda; /**< = _MaxLevel - BaseLevel (q - b in spec) */
|
||||||
GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */
|
GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */
|
||||||
GLboolean _IsPowerOfTwo; /**< Are all image dimensions powers of two? */
|
|
||||||
GLboolean Complete; /**< Is texture object complete? */
|
GLboolean Complete; /**< Is texture object complete? */
|
||||||
|
|
||||||
/** Actual texture images, indexed by [cube face] and [mipmap level] */
|
/** Actual texture images, indexed by [cube face] and [mipmap level] */
|
||||||
|
@@ -201,7 +201,6 @@ _mesa_copy_texture_object( struct gl_texture_object *dest,
|
|||||||
dest->GenerateMipmap = src->GenerateMipmap;
|
dest->GenerateMipmap = src->GenerateMipmap;
|
||||||
dest->Palette = src->Palette;
|
dest->Palette = src->Palette;
|
||||||
dest->Complete = src->Complete;
|
dest->Complete = src->Complete;
|
||||||
dest->_IsPowerOfTwo = src->_IsPowerOfTwo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -244,7 +243,6 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
|
|||||||
GLint maxLog2 = 0, maxLevels = 0;
|
GLint maxLog2 = 0, maxLevels = 0;
|
||||||
|
|
||||||
t->Complete = GL_TRUE; /* be optimistic */
|
t->Complete = GL_TRUE; /* be optimistic */
|
||||||
t->_IsPowerOfTwo = GL_TRUE; /* may be set FALSE below */
|
|
||||||
|
|
||||||
/* Always need the base level image */
|
/* Always need the base level image */
|
||||||
if (!t->Image[0][baseLevel]) {
|
if (!t->Image[0][baseLevel]) {
|
||||||
@@ -320,11 +318,6 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for non power of two */
|
|
||||||
if (!t->Image[0][baseLevel]->_IsPowerOfTwo) {
|
|
||||||
t->_IsPowerOfTwo = GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* extra checking for mipmaps */
|
/* extra checking for mipmaps */
|
||||||
if (t->MinFilter != GL_NEAREST && t->MinFilter != GL_LINEAR) {
|
if (t->MinFilter != GL_NEAREST && t->MinFilter != GL_LINEAR) {
|
||||||
/*
|
/*
|
||||||
|
@@ -241,7 +241,7 @@ repeat_remainder(GLint a, GLint b)
|
|||||||
switch (wrapMode) { \
|
switch (wrapMode) { \
|
||||||
case GL_REPEAT: \
|
case GL_REPEAT: \
|
||||||
U = S * SIZE - 0.5F; \
|
U = S * SIZE - 0.5F; \
|
||||||
if (tObj->_IsPowerOfTwo) { \
|
if (img->_IsPowerOfTwo) { \
|
||||||
I0 = IFLOOR(U) & (SIZE - 1); \
|
I0 = IFLOOR(U) & (SIZE - 1); \
|
||||||
I1 = (I0 + 1) & (SIZE - 1); \
|
I1 = (I0 + 1) & (SIZE - 1); \
|
||||||
} \
|
} \
|
||||||
@@ -363,7 +363,7 @@ repeat_remainder(GLint a, GLint b)
|
|||||||
/* s limited to [0,1) */ \
|
/* s limited to [0,1) */ \
|
||||||
/* i limited to [0,size-1] */ \
|
/* i limited to [0,size-1] */ \
|
||||||
I = IFLOOR(S * SIZE); \
|
I = IFLOOR(S * SIZE); \
|
||||||
if (tObj->_IsPowerOfTwo) \
|
if (img->_IsPowerOfTwo) \
|
||||||
I &= (SIZE - 1); \
|
I &= (SIZE - 1); \
|
||||||
else \
|
else \
|
||||||
I = repeat_remainder(I, SIZE); \
|
I = repeat_remainder(I, SIZE); \
|
||||||
@@ -1152,7 +1152,6 @@ sample_2d_linear_mipmap_linear_repeat( GLcontext *ctx,
|
|||||||
ASSERT(lambda != NULL);
|
ASSERT(lambda != NULL);
|
||||||
ASSERT(tObj->WrapS == GL_REPEAT);
|
ASSERT(tObj->WrapS == GL_REPEAT);
|
||||||
ASSERT(tObj->WrapT == GL_REPEAT);
|
ASSERT(tObj->WrapT == GL_REPEAT);
|
||||||
ASSERT(tObj->_IsPowerOfTwo);
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
GLint level = linear_mipmap_level(tObj, lambda[i]);
|
GLint level = linear_mipmap_level(tObj, lambda[i]);
|
||||||
if (level >= tObj->_MaxLevel) {
|
if (level >= tObj->_MaxLevel) {
|
||||||
@@ -2239,9 +2238,9 @@ sample_depth_texture( GLcontext *ctx,
|
|||||||
GLchan texel[][4] )
|
GLchan texel[][4] )
|
||||||
{
|
{
|
||||||
const GLint baseLevel = tObj->BaseLevel;
|
const GLint baseLevel = tObj->BaseLevel;
|
||||||
const struct gl_texture_image *texImage = tObj->Image[0][baseLevel];
|
const struct gl_texture_image *img = tObj->Image[0][baseLevel];
|
||||||
const GLuint width = texImage->Width;
|
const GLuint width = img->Width;
|
||||||
const GLuint height = texImage->Height;
|
const GLuint height = img->Height;
|
||||||
GLchan ambient;
|
GLchan ambient;
|
||||||
GLenum function;
|
GLenum function;
|
||||||
GLchan result;
|
GLchan result;
|
||||||
@@ -2286,7 +2285,7 @@ sample_depth_texture( GLcontext *ctx,
|
|||||||
/* XXX fix for texture rectangle! */
|
/* XXX fix for texture rectangle! */
|
||||||
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoords[i][0], width, col);
|
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoords[i][0], width, col);
|
||||||
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoords[i][1], height, row);
|
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoords[i][1], height, row);
|
||||||
texImage->FetchTexelf(texImage, col, row, 0, &depthSample);
|
img->FetchTexelf(img, col, row, 0, &depthSample);
|
||||||
|
|
||||||
switch (function) {
|
switch (function) {
|
||||||
case GL_LEQUAL:
|
case GL_LEQUAL:
|
||||||
@@ -2359,11 +2358,11 @@ sample_depth_texture( GLcontext *ctx,
|
|||||||
COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoords[i][1], v, height,j0, j1);
|
COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoords[i][1], v, height,j0, j1);
|
||||||
|
|
||||||
useBorderTexel = 0;
|
useBorderTexel = 0;
|
||||||
if (texImage->Border) {
|
if (img->Border) {
|
||||||
i0 += texImage->Border;
|
i0 += img->Border;
|
||||||
i1 += texImage->Border;
|
i1 += img->Border;
|
||||||
j0 += texImage->Border;
|
j0 += img->Border;
|
||||||
j1 += texImage->Border;
|
j1 += img->Border;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (i0 < 0 || i0 >= (GLint) width) useBorderTexel |= I0BIT;
|
if (i0 < 0 || i0 >= (GLint) width) useBorderTexel |= I0BIT;
|
||||||
@@ -2377,25 +2376,25 @@ sample_depth_texture( GLcontext *ctx,
|
|||||||
depth00 = 1.0;
|
depth00 = 1.0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
texImage->FetchTexelf(texImage, i0, j0, 0, &depth00);
|
img->FetchTexelf(img, i0, j0, 0, &depth00);
|
||||||
}
|
}
|
||||||
if (useBorderTexel & (I1BIT | J0BIT)) {
|
if (useBorderTexel & (I1BIT | J0BIT)) {
|
||||||
depth10 = 1.0;
|
depth10 = 1.0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
texImage->FetchTexelf(texImage, i1, j0, 0, &depth10);
|
img->FetchTexelf(img, i1, j0, 0, &depth10);
|
||||||
}
|
}
|
||||||
if (useBorderTexel & (I0BIT | J1BIT)) {
|
if (useBorderTexel & (I0BIT | J1BIT)) {
|
||||||
depth01 = 1.0;
|
depth01 = 1.0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
texImage->FetchTexelf(texImage, i0, j1, 0, &depth01);
|
img->FetchTexelf(img, i0, j1, 0, &depth01);
|
||||||
}
|
}
|
||||||
if (useBorderTexel & (I1BIT | J1BIT)) {
|
if (useBorderTexel & (I1BIT | J1BIT)) {
|
||||||
depth11 = 1.0;
|
depth11 = 1.0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
texImage->FetchTexelf(texImage, i1, j1, 0, &depth11);
|
img->FetchTexelf(img, i1, j1, 0, &depth11);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
@@ -2675,20 +2674,21 @@ _swrast_choose_texture_sample_func( GLcontext *ctx,
|
|||||||
return &sample_linear_2d;
|
return &sample_linear_2d;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GLint baseLevel = t->BaseLevel;
|
/* check for a few optimized cases */
|
||||||
|
const struct gl_texture_image *img = t->Image[0][t->BaseLevel];
|
||||||
ASSERT(t->MinFilter == GL_NEAREST);
|
ASSERT(t->MinFilter == GL_NEAREST);
|
||||||
if (t->WrapS == GL_REPEAT &&
|
if (t->WrapS == GL_REPEAT &&
|
||||||
t->WrapT == GL_REPEAT &&
|
t->WrapT == GL_REPEAT &&
|
||||||
t->_IsPowerOfTwo &&
|
img->_IsPowerOfTwo &&
|
||||||
t->Image[0][baseLevel]->Border == 0 &&
|
img->Border == 0 &&
|
||||||
t->Image[0][baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGB) {
|
img->TexFormat->MesaFormat == MESA_FORMAT_RGB) {
|
||||||
return &opt_sample_rgb_2d;
|
return &opt_sample_rgb_2d;
|
||||||
}
|
}
|
||||||
else if (t->WrapS == GL_REPEAT &&
|
else if (t->WrapS == GL_REPEAT &&
|
||||||
t->WrapT == GL_REPEAT &&
|
t->WrapT == GL_REPEAT &&
|
||||||
t->_IsPowerOfTwo &&
|
img->_IsPowerOfTwo &&
|
||||||
t->Image[0][baseLevel]->Border == 0 &&
|
img->Border == 0 &&
|
||||||
t->Image[0][baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGBA) {
|
img->TexFormat->MesaFormat == MESA_FORMAT_RGBA) {
|
||||||
return &opt_sample_rgba_2d;
|
return &opt_sample_rgba_2d;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@@ -1093,7 +1093,7 @@ _swrast_choose_triangle( GLcontext *ctx )
|
|||||||
&& ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT
|
&& ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT
|
||||||
&& texObj2D->WrapS == GL_REPEAT
|
&& texObj2D->WrapS == GL_REPEAT
|
||||||
&& texObj2D->WrapT == GL_REPEAT
|
&& texObj2D->WrapT == GL_REPEAT
|
||||||
&& texObj2D->_IsPowerOfTwo
|
&& texImg->_IsPowerOfTwo
|
||||||
&& texImg->Border == 0
|
&& texImg->Border == 0
|
||||||
&& texImg->Width == texImg->RowStride
|
&& texImg->Width == texImg->RowStride
|
||||||
&& (format == MESA_FORMAT_RGB || format == MESA_FORMAT_RGBA)
|
&& (format == MESA_FORMAT_RGB || format == MESA_FORMAT_RGBA)
|
||||||
|
Reference in New Issue
Block a user