GLint size, GLfloat s,
GLint *i0, GLint *i1, GLfloat *weight)
{
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
GLfloat u;
switch (wrapMode) {
case GL_REPEAT:
u = s * size - 0.5F;
- if (img->_IsPowerOfTwo) {
+ if (swImg->_IsPowerOfTwo) {
*i0 = IFLOOR(u) & (size - 1);
*i1 = (*i0 + 1) & (size - 1);
}
const struct gl_texture_image *img,
GLint size, GLfloat s)
{
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
GLint i;
switch (wrapMode) {
/* s limited to [0,1) */
/* i limited to [0,size-1] */
i = IFLOOR(s * size);
- if (img->_IsPowerOfTwo)
+ if (swImg->_IsPowerOfTwo)
i &= (size - 1);
else
i = REMAINDER(i, size);
ASSERT(tObj->Sampler.WrapS == GL_REPEAT);
ASSERT(tObj->Sampler.WrapT == GL_REPEAT);
ASSERT(img->Border == 0);
- ASSERT(img->_IsPowerOfTwo);
+ ASSERT(swImg->_IsPowerOfTwo);
linear_repeat_texel_location(width, texcoord[0], &i0, &i1, &wi);
linear_repeat_texel_location(height, texcoord[1], &j0, &j1, &wj);
{
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(image);
(void) lambda;
if (tObj->Sampler.WrapS == GL_REPEAT &&
tObj->Sampler.WrapT == GL_REPEAT &&
- image->_IsPowerOfTwo &&
+ swImg->_IsPowerOfTwo &&
image->Border == 0) {
for (i = 0; i < n; i++) {
sample_2d_linear_repeat(ctx, tObj, image, texcoords[i], rgba[i]);
const GLfloat lambda[], GLfloat rgba[][4])
{
const struct gl_texture_image *img = tObj->Image[0][tObj->BaseLevel];
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLfloat width = (GLfloat) img->Width;
const GLfloat height = (GLfloat) img->Height;
const GLint colMask = img->Width - 1;
ASSERT(tObj->Sampler.WrapT==GL_REPEAT);
ASSERT(img->Border==0);
ASSERT(img->TexFormat == MESA_FORMAT_RGB888);
- ASSERT(img->_IsPowerOfTwo);
+ ASSERT(swImg->_IsPowerOfTwo);
for (k=0; k<n; k++) {
GLint i = IFLOOR(texcoords[k][0] * width) & colMask;
const GLfloat lambda[], GLfloat rgba[][4])
{
const struct gl_texture_image *img = tObj->Image[0][tObj->BaseLevel];
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLfloat width = (GLfloat) img->Width;
const GLfloat height = (GLfloat) img->Height;
const GLint colMask = img->Width - 1;
ASSERT(tObj->Sampler.WrapT==GL_REPEAT);
ASSERT(img->Border==0);
ASSERT(img->TexFormat == MESA_FORMAT_RGBA8888);
- ASSERT(img->_IsPowerOfTwo);
+ ASSERT(swImg->_IsPowerOfTwo);
for (i = 0; i < n; i++) {
const GLint col = IFLOOR(texcoords[i][0] * width) & colMask;
const GLfloat lambda[], GLfloat rgba[][4])
{
const struct gl_texture_image *tImg = tObj->Image[0][tObj->BaseLevel];
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(tImg);
GLuint minStart, minEnd; /* texels with minification */
GLuint magStart, magEnd; /* texels with magnification */
const GLboolean repeatNoBorderPOT = (tObj->Sampler.WrapS == GL_REPEAT)
&& (tObj->Sampler.WrapT == GL_REPEAT)
&& (tImg->Border == 0 && (tImg->Width == tImg->RowStride))
- && tImg->_IsPowerOfTwo;
+ && swImg->_IsPowerOfTwo;
ASSERT(lambda != NULL);
compute_min_mag_ranges(tObj, n, lambda,
else {
/* check for a few optimized cases */
const struct gl_texture_image *img = t->Image[0][t->BaseLevel];
+ const struct swrast_texture_image *swImg =
+ swrast_texture_image_const(img);
+
ASSERT(t->Sampler.MinFilter == GL_NEAREST);
if (t->Sampler.WrapS == GL_REPEAT &&
t->Sampler.WrapT == GL_REPEAT &&
- img->_IsPowerOfTwo &&
+ swImg->_IsPowerOfTwo &&
img->Border == 0 &&
img->TexFormat == MESA_FORMAT_RGB888) {
return &opt_sample_rgb_2d;
}
else if (t->Sampler.WrapS == GL_REPEAT &&
t->Sampler.WrapT == GL_REPEAT &&
- img->_IsPowerOfTwo &&
+ swImg->_IsPowerOfTwo &&
img->Border == 0 &&
img->TexFormat == MESA_FORMAT_RGBA8888) {
return &opt_sample_rgba_2d;
/* Ugh, we do a _lot_ of tests to pick the best textured tri func */
const struct gl_texture_object *texObj2D;
const struct gl_texture_image *texImg;
+ const struct swrast_texture_image *swImg;
GLenum minFilter, magFilter, envMode;
gl_format format;
texObj2D = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX];
texImg = texObj2D ? texObj2D->Image[0][texObj2D->BaseLevel] : NULL;
+ swImg = swrast_texture_image_const(texImg);
+
format = texImg ? texImg->TexFormat : MESA_FORMAT_NONE;
minFilter = texObj2D ? texObj2D->Sampler.MinFilter : GL_NONE;
magFilter = texObj2D ? texObj2D->Sampler.MagFilter : GL_NONE;
&& texObj2D->Sampler.WrapS == GL_REPEAT
&& texObj2D->Sampler.WrapT == GL_REPEAT
&& texObj2D->_Swizzle == SWIZZLE_NOOP
- && texImg->_IsPowerOfTwo
+ && swImg->_IsPowerOfTwo
&& texImg->Border == 0
&& texImg->Width == texImg->RowStride
&& (format == MESA_FORMAT_RGB888 || format == MESA_FORMAT_RGBA8888)