static void gammaSetTexBorderColor(gammaContextPtr gmesa,
gammaTextureObjectPtr t,
- GLubyte color[4])
+ const GLfloat color[4])
{
- t->TextureBorderColor = PACK_COLOR_8888(color[0], color[1], color[2], color[3]);
+ GLubyte c[4];
+ CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
+ t->TextureBorderColor = PACK_COLOR_8888(c[0], c[1], c[2], c[3]);
}
break;
case GL_TEXTURE_BORDER_COLOR:
- gammaSetTexBorderColor( gmesa, t, tObj->_BorderChan );
+ gammaSetTexBorderColor( gmesa, t, tObj->BorderColor );
break;
case GL_TEXTURE_BASE_LEVEL:
gammaSetTexWrapping( t, tObj->WrapS, tObj->WrapT );
gammaSetTexFilter( gmesa, t, tObj->MinFilter, tObj->MagFilter, bias );
- gammaSetTexBorderColor( gmesa, t, tObj->_BorderChan );
+ gammaSetTexBorderColor( gmesa, t, tObj->BorderColor );
}
}
static void
-i810SetTexBorderColor( i810TextureObjectPtr t, GLubyte color[4] )
+i810SetTexBorderColor( i810TextureObjectPtr t, const GLfloat color[4] )
{
/* Need a fallback.
*/
i810SetTexWrapping( t, texObj->WrapS, texObj->WrapT );
/*i830SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );*/
i810SetTexFilter( imesa, t, texObj->MinFilter, texObj->MagFilter, bias );
- i810SetTexBorderColor( t, texObj->_BorderChan );
+ i810SetTexBorderColor( t, texObj->BorderColor );
}
return t;
break;
case GL_TEXTURE_BORDER_COLOR:
- i810SetTexBorderColor( t, tObj->_BorderChan );
+ i810SetTexBorderColor( t, tObj->BorderColor );
break;
case GL_TEXTURE_BASE_LEVEL:
struct gl_texture_image *firstImage;
GLuint *state = i830->state.Tex[unit], format, pitch;
GLint lodbias;
+ GLubyte border[4];
memset(state, 0, sizeof(state));
(ws)));
}
+ /* convert border color from float to ubyte */
+ CLAMPED_FLOAT_TO_UBYTE(border[0], tObj->BorderColor[0]);
+ CLAMPED_FLOAT_TO_UBYTE(border[1], tObj->BorderColor[1]);
+ CLAMPED_FLOAT_TO_UBYTE(border[2], tObj->BorderColor[2]);
+ CLAMPED_FLOAT_TO_UBYTE(border[3], tObj->BorderColor[3]);
- state[I830_TEXREG_TM0S4] = INTEL_PACKCOLOR8888(tObj->_BorderChan[0],
- tObj->_BorderChan[1],
- tObj->_BorderChan[2],
- tObj->_BorderChan[3]);
+ state[I830_TEXREG_TM0S4] = INTEL_PACKCOLOR8888(border[0],
+ border[1],
+ border[2],
+ border[3]);
I830_ACTIVESTATE(i830, I830_UPLOAD_TEX(unit), GL_TRUE);
struct gl_texture_image *firstImage;
GLuint *state = i915->state.Tex[unit], format, pitch;
GLint lodbias;
+ GLubyte border[4];
memset(state, 0, sizeof(state));
state[I915_TEXREG_SS3] |= (unit << SS3_TEXTUREMAP_INDEX_SHIFT);
}
+ /* convert border color from float to ubyte */
+ CLAMPED_FLOAT_TO_UBYTE(border[0], tObj->BorderColor[0]);
+ CLAMPED_FLOAT_TO_UBYTE(border[1], tObj->BorderColor[1]);
+ CLAMPED_FLOAT_TO_UBYTE(border[2], tObj->BorderColor[2]);
+ CLAMPED_FLOAT_TO_UBYTE(border[3], tObj->BorderColor[3]);
if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) {
/* GL specs that border color for depth textures is taken from the
* R channel, while the hardware uses A. Spam R into all the channels
* for safety.
*/
- state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(tObj->_BorderChan[0],
- tObj->_BorderChan[0],
- tObj->_BorderChan[0],
- tObj->_BorderChan[0]);
+ state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(border[0],
+ border[0],
+ border[0],
+ border[0]);
} else {
- state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(tObj->_BorderChan[0],
- tObj->_BorderChan[1],
- tObj->_BorderChan[2],
- tObj->_BorderChan[3]);
+ state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(border[0],
+ border[1],
+ border[2],
+ border[3]);
}
}
}
-static void mach64SetTexBorderColor( mach64TexObjPtr t, GLubyte c[4] )
+static void mach64SetTexBorderColor( mach64TexObjPtr t, const GLfloat c[4] )
{
#if 0
GLuint border = mach64PackColor( 4, c[0], c[1], c[2], c[3] );
mach64SetTexWrap( t, texObj->WrapS, texObj->WrapT );
mach64SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- mach64SetTexBorderColor( t, texObj->_BorderChan );
+ mach64SetTexBorderColor( t, texObj->BorderColor );
return t;
}
case GL_TEXTURE_BORDER_COLOR:
if ( t->base.bound ) FLUSH_BATCH( mmesa );
- mach64SetTexBorderColor( t, tObj->_BorderChan );
+ mach64SetTexBorderColor( t, tObj->BorderColor );
break;
case GL_TEXTURE_BASE_LEVEL:
t->setup.texfilter |= val;
}
-static void mgaSetTexBorderColor(mgaTextureObjectPtr t, GLubyte color[4])
+static void mgaSetTexBorderColor(mgaTextureObjectPtr t, const GLfloat color[4])
{
- t->setup.texbordercol = PACK_COLOR_8888(color[3], color[0],
- color[1], color[2] );
+ GLubyte c[4];
+ CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
+ t->setup.texbordercol = PACK_COLOR_8888(c[3], c[0], c[1], c[2] );
}
mgaSetTexWrapping( t, tObj->WrapS, tObj->WrapT );
mgaSetTexFilter( t, tObj->MinFilter, tObj->MagFilter );
- mgaSetTexBorderColor( t, tObj->_BorderChan );
+ mgaSetTexBorderColor( t, tObj->BorderColor );
}
return( t );
case GL_TEXTURE_BORDER_COLOR:
FLUSH_BATCH(mmesa);
- mgaSetTexBorderColor(t, tObj->_BorderChan);
+ mgaSetTexBorderColor(t, tObj->BorderColor);
break;
case GL_TEXTURE_BASE_LEVEL:
}
}
-static void r128SetTexBorderColor( r128TexObjPtr t, GLubyte c[4] )
+static void r128SetTexBorderColor( r128TexObjPtr t, const GLfloat color[4] )
{
+ GLubyte c[4];
+ CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
t->setup.tex_border_color = r128PackColor( 4, c[0], c[1], c[2], c[3] );
}
r128SetTexWrap( t, texObj->WrapS, texObj->WrapT );
r128SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- r128SetTexBorderColor( t, texObj->_BorderChan );
+ r128SetTexBorderColor( t, texObj->BorderColor );
}
return t;
case GL_TEXTURE_BORDER_COLOR:
if ( t->base.bound ) FLUSH_BATCH( rmesa );
- r128SetTexBorderColor( t, tObj->_BorderChan );
+ r128SetTexBorderColor( t, tObj->BorderColor );
break;
case GL_TEXTURE_BASE_LEVEL:
}
}
-static void r200SetTexBorderColor( r200TexObjPtr t, GLubyte c[4] )
+static void r200SetTexBorderColor( r200TexObjPtr t, const GLfloat color[4] )
{
+ GLubyte c[4];
+ CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
t->pp_border_color = r200PackColor( 4, c[0], c[1], c[2], c[3] );
}
r200SetTexWrap( t, texObj->WrapS, texObj->WrapT, texObj->WrapR );
r200SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );
r200SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- r200SetTexBorderColor( t, texObj->_BorderChan );
+ r200SetTexBorderColor( t, texObj->BorderColor );
}
return t;
break;
case GL_TEXTURE_BORDER_COLOR:
- r200SetTexBorderColor( t, texObj->_BorderChan );
+ r200SetTexBorderColor( t, texObj->BorderColor );
break;
case GL_TEXTURE_BASE_LEVEL:
}
}
-static void r300SetTexBorderColor(r300TexObjPtr t, GLubyte c[4])
+static void r300SetTexBorderColor(r300TexObjPtr t, const GLfloat color[4])
{
+ GLubyte c[4];
+ CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
t->pp_border_color = PACK_COLOR_8888(c[3], c[0], c[1], c[2]);
}
r300UpdateTexWrap(t);
r300SetTexFilter(t, texObj->MinFilter, texObj->MagFilter, texObj->MaxAnisotropy);
- r300SetTexBorderColor(t, texObj->_BorderChan);
+ r300SetTexBorderColor(t, texObj->BorderColor);
}
return t;
break;
case GL_TEXTURE_BORDER_COLOR:
- r300SetTexBorderColor(t, texObj->_BorderChan);
+ r300SetTexBorderColor(t, texObj->BorderColor);
break;
case GL_TEXTURE_BASE_LEVEL:
}
}
-static void radeonSetTexBorderColor( radeonTexObjPtr t, GLubyte c[4] )
+static void radeonSetTexBorderColor( radeonTexObjPtr t, const GLfloat color[4] )
{
+ GLubyte c[4];
+ CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
t->pp_border_color = radeonPackColor( 4, c[0], c[1], c[2], c[3] );
}
radeonSetTexWrap( t, texObj->WrapS, texObj->WrapT );
radeonSetTexMaxAnisotropy( t, texObj->MaxAnisotropy );
radeonSetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- radeonSetTexBorderColor( t, texObj->_BorderChan );
+ radeonSetTexBorderColor( t, texObj->BorderColor );
}
return t;
break;
case GL_TEXTURE_BORDER_COLOR:
- radeonSetTexBorderColor( t, texObj->_BorderChan );
+ radeonSetTexBorderColor( t, texObj->BorderColor );
break;
case GL_TEXTURE_BASE_LEVEL:
static void s3vSetTexBorderColor(s3vContextPtr vmesa,
s3vTextureObjectPtr t,
- GLubyte color[4])
+ const GLfloat color[4])
{
+ GLubyte c[4];
+ CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
+
#if TEX_DEBUG_ON
static unsigned int times=0;
DEBUG_TEX(("*** s3vSetTexBorderColor: #%i ***\n", ++times));
/* switch(t0 ... t->TextureColorMode) */
/* case TEX_COL_ARGB1555: */
- t->TextureBorderColor =
- S3VIRGEPACKCOLOR555(color[0], color[1], color[2], color[3]);
+ t->TextureBorderColor = S3VIRGEPACKCOLOR555(c[0], c[1], c[2], c[3]);
DEBUG(("TextureBorderColor = 0x%x\n", t->TextureBorderColor));
break;
case GL_TEXTURE_BORDER_COLOR:
- s3vSetTexBorderColor( vmesa, t, tObj->_BorderChan );
+ s3vSetTexBorderColor( vmesa, t, tObj->BorderColor );
break;
case GL_TEXTURE_BASE_LEVEL:
/* Need a fallback ?
*/
-static void savageSetTexBorderColor(savageTexObjPtr t, GLubyte color[4])
+static void savageSetTexBorderColor(savageTexObjPtr t, const GLfloat color[4])
{
/* t->Setup[SAVAGE_TEXREG_TEXBORDERCOL] = */
/*t->setup.borderColor = SAVAGEPACKCOLOR8888(color[0],color[1],color[2],color[3]); */
savageSetTexWrapping(t,texObj->WrapS,texObj->WrapT);
savageSetTexFilter(t,texObj->MinFilter,texObj->MagFilter);
- savageSetTexBorderColor(t,texObj->_BorderChan);
+ savageSetTexBorderColor(t,texObj->BorderColor);
}
return t;
break;
case GL_TEXTURE_BORDER_COLOR:
- savageSetTexBorderColor(t,tObj->_BorderChan);
+ savageSetTexBorderColor(t,tObj->BorderColor);
break;
default:
break;
}
- current->texture[hw_unit].hwTextureBorderColor =
- ((GLuint) texObj->_BorderChan[3] << 24) +
- ((GLuint) texObj->_BorderChan[0] << 16) +
- ((GLuint) texObj->_BorderChan[1] << 8) +
- ((GLuint) texObj->_BorderChan[2]);
+ {
+ GLubyte c[4];
+ CLAMPED_FLOAT_TO_UBYTE(c[0], texObj->BorderColor[0]);
+ CLAMPED_FLOAT_TO_UBYTE(c[1], texObj->BorderColor[1]);
+ CLAMPED_FLOAT_TO_UBYTE(c[2], texObj->BorderColor[2]);
+ CLAMPED_FLOAT_TO_UBYTE(c[3], texObj->BorderColor[3]);
+
+ current->texture[hw_unit].hwTextureBorderColor =
+ PACK_COLOR_8888(c[3], c[0], c[1], c[2]);
+ }
if (current->texture[hw_unit].hwTextureBorderColor !=
prev->texture[hw_unit].hwTextureBorderColor)