mesa: make texture BorderColor a union of float/int/uint
authorBrian Paul <brianp@vmware.com>
Tue, 5 Jan 2010 02:53:28 +0000 (19:53 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 5 Jan 2010 02:53:30 +0000 (19:53 -0700)
When we have integer-valued texture formats, the texture border color
must also store integer and uint values.

With GL 3.0, the new glTexParameterIiv() and glTexParameterIuiv() functions
can set the border color to int or uint values.

21 files changed:
src/mesa/drivers/dri/gamma/gamma_tex.c
src/mesa/drivers/dri/i810/i810tex.c
src/mesa/drivers/dri/i915/i830_texstate.c
src/mesa/drivers/dri/i915/i915_texstate.c
src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
src/mesa/drivers/dri/mach64/mach64_tex.c
src/mesa/drivers/dri/mga/mgatex.c
src/mesa/drivers/dri/r128/r128_tex.c
src/mesa/drivers/dri/r200/r200_tex.c
src/mesa/drivers/dri/r300/r300_tex.c
src/mesa/drivers/dri/r600/r600_tex.c
src/mesa/drivers/dri/radeon/radeon_tex.c
src/mesa/drivers/dri/savage/savagetex.c
src/mesa/drivers/dri/sis/sis_texstate.c
src/mesa/drivers/dri/unichrome/via_state.c
src/mesa/main/attrib.c
src/mesa/main/mtypes.h
src/mesa/main/texobj.c
src/mesa/main/texparam.c
src/mesa/state_tracker/st_atom_sampler.c
src/mesa/swrast/s_texfilter.c

index 0dad250e4d86dd8ad0b6f6c37dbff50c1aedda54..694e5eba5bb8d82e7fcfc01275f9363fa322e25c 100644 (file)
@@ -145,7 +145,7 @@ static void gammaTexParameter( GLcontext *ctx, GLenum target,
       break;
   
    case GL_TEXTURE_BORDER_COLOR:
-      gammaSetTexBorderColor( gmesa, t, tObj->BorderColor );
+      gammaSetTexBorderColor( gmesa, t, tObj->BorderColor.f );
       break;
 
    case GL_TEXTURE_BASE_LEVEL:
@@ -349,7 +349,7 @@ static void gammaBindTexture( GLcontext *ctx, GLenum target,
 
         gammaSetTexWrapping( t, tObj->WrapS, tObj->WrapT );
         gammaSetTexFilter( gmesa, t, tObj->MinFilter, tObj->MagFilter, bias );
-        gammaSetTexBorderColor( gmesa, t, tObj->BorderColor );
+        gammaSetTexBorderColor( gmesa, t, tObj->BorderColor.f );
       }
 }
 
index 2f6978f5aae221955211873572dc515c08f2200a..e764644a6c1b8b7e651d88cc12baf43b0bff67fa 100644 (file)
@@ -210,7 +210,7 @@ i810AllocTexObj( GLcontext *ctx, struct gl_texture_object *texObj )
       i810SetTexWrapping( t, texObj->WrapS, texObj->WrapT );
       /*i830SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );*/
       i810SetTexFilter( imesa, t, texObj->MinFilter, texObj->MagFilter, bias );
-      i810SetTexBorderColor( t, texObj->BorderColor );
+      i810SetTexBorderColor( t, texObj->BorderColor.f );
    }
 
    return t;
@@ -251,7 +251,7 @@ static void i810TexParameter( GLcontext *ctx, GLenum target,
       break;
   
    case GL_TEXTURE_BORDER_COLOR:
-      i810SetTexBorderColor( t, tObj->BorderColor );
+      i810SetTexBorderColor( t, tObj->BorderColor.f );
       break;
 
    case GL_TEXTURE_BASE_LEVEL:
index 27c5aa1e08590258b895d4b660596f5763c4d4f7..7525f9f2e0540b03c7ede9a1295b3fb5d51e53d2 100644 (file)
@@ -304,10 +304,10 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
    }
 
    /* 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]);
+   CLAMPED_FLOAT_TO_UBYTE(border[0], tObj->BorderColor.f[0]);
+   CLAMPED_FLOAT_TO_UBYTE(border[1], tObj->BorderColor.f[1]);
+   CLAMPED_FLOAT_TO_UBYTE(border[2], tObj->BorderColor.f[2]);
+   CLAMPED_FLOAT_TO_UBYTE(border[3], tObj->BorderColor.f[3]);
 
    state[I830_TEXREG_TM0S4] = PACK_COLOR_8888(border[3],
                                              border[0],
index db71c0094136c508cb5c5dea87193d242fe5ce7b..3ee4c8653a980c9c0299dd294511c2344d2c8af1 100644 (file)
@@ -348,10 +348,10 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
    }
 
    /* 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]);
+   CLAMPED_FLOAT_TO_UBYTE(border[0], tObj->BorderColor.f[0]);
+   CLAMPED_FLOAT_TO_UBYTE(border[1], tObj->BorderColor.f[1]);
+   CLAMPED_FLOAT_TO_UBYTE(border[2], tObj->BorderColor.f[2]);
+   CLAMPED_FLOAT_TO_UBYTE(border[3], tObj->BorderColor.f[3]);
 
    if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) {
       /* GL specs that border color for depth textures is taken from the
index aa2e519588179ea4a4897f0d345e1d68dbe18dfb..ad267a4e6aef554041e0fc3393caa07d316d6f4c 100644 (file)
@@ -262,10 +262,10 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
         dri_bo_unreference(brw->wm.sdc_bo[unit]);
         if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) {
            float bordercolor[4] = {
-              texObj->BorderColor[0],
-              texObj->BorderColor[0],
-              texObj->BorderColor[0],
-              texObj->BorderColor[0]
+              texObj->BorderColor.f[0],
+              texObj->BorderColor.f[0],
+              texObj->BorderColor.f[0],
+              texObj->BorderColor.f[0]
            };
            /* GL specs that border color for depth textures is taken from the
             * R channel, while the hardware uses A.  Spam R into all the
@@ -274,7 +274,7 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
            brw->wm.sdc_bo[unit] = upload_default_color(brw, bordercolor);
         } else {
            brw->wm.sdc_bo[unit] = upload_default_color(brw,
-                                                       texObj->BorderColor);
+                                                       texObj->BorderColor.f);
         }
         key->sampler_count = unit + 1;
       }
index 72917ee13bfa76180df67c6ea80edc0da289fc1f..6627d3c38a05b82e1261186428a5dbe061c54811 100644 (file)
@@ -130,7 +130,7 @@ mach64AllocTexObj( struct gl_texture_object *texObj )
 
    mach64SetTexWrap( t, texObj->WrapS, texObj->WrapT );
    mach64SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
-   mach64SetTexBorderColor( t, texObj->BorderColor );
+   mach64SetTexBorderColor( t, texObj->BorderColor.f );
 
    return t;
 }
@@ -470,7 +470,7 @@ static void mach64DDTexParameter( GLcontext *ctx, GLenum target,
 
    case GL_TEXTURE_BORDER_COLOR:
       if ( t->base.bound ) FLUSH_BATCH( mmesa );
-      mach64SetTexBorderColor( t, tObj->BorderColor );
+      mach64SetTexBorderColor( t, tObj->BorderColor.f );
       break;
 
    case GL_TEXTURE_BASE_LEVEL:
index 9163371b3325cbc3ae297c5f84abe41d6098a059..62a9317cd48ab317aa946f2463874e062cc03074 100644 (file)
@@ -332,7 +332,7 @@ mgaAllocTexObj( struct gl_texture_object *tObj )
 
       mgaSetTexWrapping( t, tObj->WrapS, tObj->WrapT );
       mgaSetTexFilter( t, tObj->MinFilter, tObj->MagFilter );
-      mgaSetTexBorderColor( t, tObj->BorderColor );
+      mgaSetTexBorderColor( t, tObj->BorderColor.f );
    }
 
    return( t );
@@ -461,7 +461,7 @@ mgaTexParameter( GLcontext *ctx, GLenum target,
 
    case GL_TEXTURE_BORDER_COLOR:
       FLUSH_BATCH(mmesa);
-      mgaSetTexBorderColor(t, tObj->BorderColor);
+      mgaSetTexBorderColor(t, tObj->BorderColor.f);
       break;
 
    case GL_TEXTURE_BASE_LEVEL:
index 0a1207fb89f041987c004f0ffe65ce22d281fb68..f1be7cc1c4f41e297de5cb7f9c9e546deaea9aac 100644 (file)
@@ -169,7 +169,7 @@ static r128TexObjPtr r128AllocTexObj( struct gl_texture_object *texObj )
 
       r128SetTexWrap( t, texObj->WrapS, texObj->WrapT );
       r128SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
-      r128SetTexBorderColor( t, texObj->BorderColor );
+      r128SetTexBorderColor( t, texObj->BorderColor.f );
    }
 
    return t;
@@ -535,7 +535,7 @@ static void r128TexParameter( GLcontext *ctx, GLenum target,
 
    case GL_TEXTURE_BORDER_COLOR:
       if ( t->base.bound ) FLUSH_BATCH( rmesa );
-      r128SetTexBorderColor( t, tObj->BorderColor );
+      r128SetTexBorderColor( t, tObj->BorderColor.f );
       break;
 
    case GL_TEXTURE_BASE_LEVEL:
index a4177215537ae4149e0674d2bed63dd04753a36d..5b87ba6ccdf39e888e973a120995436828511e4d 100644 (file)
@@ -378,7 +378,7 @@ static void r200TexParameter( GLcontext *ctx, GLenum target,
       break;
 
    case GL_TEXTURE_BORDER_COLOR:
-      r200SetTexBorderColor( t, texObj->BorderColor );
+      r200SetTexBorderColor( t, texObj->BorderColor.f );
       break;
 
    case GL_TEXTURE_BASE_LEVEL:
@@ -470,7 +470,7 @@ static struct gl_texture_object *r200NewTextureObject(GLcontext * ctx,
    r200SetTexWrap( t, t->base.WrapS, t->base.WrapT, t->base.WrapR );
    r200SetTexMaxAnisotropy( t, t->base.MaxAnisotropy );
    r200SetTexFilter(t, t->base.MinFilter, t->base.MagFilter);
-   r200SetTexBorderColor(t, t->base.BorderColor);
+   r200SetTexBorderColor(t, t->base.BorderColor.f);
 
    return &t->base;
 }
index ac3d5b1bec34840ec691910b48ba6c4915c1c457..963f648cb14b5af8d11bc3e4be1fa7386123fd4f 100644 (file)
@@ -215,7 +215,7 @@ static void r300TexParameter(GLcontext * ctx, GLenum target,
                break;
 
        case GL_TEXTURE_BORDER_COLOR:
-               r300SetTexBorderColor(t, texObj->BorderColor);
+               r300SetTexBorderColor(t, texObj->BorderColor.f);
                break;
 
        case GL_TEXTURE_BASE_LEVEL:
@@ -307,7 +307,7 @@ static struct gl_texture_object *r300NewTextureObject(GLcontext * ctx,
        /* Initialize hardware state */
        r300UpdateTexWrap(t);
        r300SetTexFilter(t, t->base.MinFilter, t->base.MagFilter, t->base.MaxAnisotropy);
-       r300SetTexBorderColor(t, t->base.BorderColor);
+       r300SetTexBorderColor(t, t->base.BorderColor.f);
 
        return &t->base;
 }
index 9d83a64e22018941a83693feb10f17f89d15407d..f745fe3e8a635fb35e9c225e633e1708084f3c22 100644 (file)
@@ -305,7 +305,7 @@ static void r600TexParameter(GLcontext * ctx, GLenum target,
                break;
 
        case GL_TEXTURE_BORDER_COLOR:
-               r600SetTexBorderColor(t, texObj->BorderColor);
+               r600SetTexBorderColor(t, texObj->BorderColor.f);
                break;
 
        case GL_TEXTURE_BASE_LEVEL:
@@ -391,7 +391,7 @@ static struct gl_texture_object *r600NewTextureObject(GLcontext * ctx,
        r600SetTexDefaultState(t);
        r600UpdateTexWrap(t);
        r600SetTexFilter(t, t->base.MinFilter, t->base.MagFilter, t->base.MaxAnisotropy);
-       r600SetTexBorderColor(t, t->base.BorderColor);
+       r600SetTexBorderColor(t, t->base.BorderColor.f);
 
        return &t->base;
 }
index 749ab75f2016f2d0a1912d56356dc6fbddbc08a7..14163f13af4a25c6a46b1b812f87f017baa6831b 100644 (file)
@@ -341,7 +341,7 @@ static void radeonTexParameter( GLcontext *ctx, GLenum target,
       break;
 
    case GL_TEXTURE_BORDER_COLOR:
-      radeonSetTexBorderColor( t, texObj->BorderColor );
+      radeonSetTexBorderColor( t, texObj->BorderColor.f );
       break;
 
    case GL_TEXTURE_BASE_LEVEL:
@@ -428,7 +428,7 @@ radeonNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
    radeonSetTexWrap( t, t->base.WrapS, t->base.WrapT );
    radeonSetTexMaxAnisotropy( t, t->base.MaxAnisotropy );
    radeonSetTexFilter( t, t->base.MinFilter, t->base.MagFilter );
-   radeonSetTexBorderColor( t, t->base.BorderColor );
+   radeonSetTexBorderColor( t, t->base.BorderColor.f );
    return &t->base;
 }
 
index 6c97bb6c7029ddfbe24889cb327fd519c017f92c..97598f599e56f79c478928aa76c2e804bd22c3ea 100644 (file)
@@ -507,7 +507,7 @@ savageAllocTexObj( struct gl_texture_object *texObj )
 
       savageSetTexWrapping(t,texObj->WrapS,texObj->WrapT);
       savageSetTexFilter(t,texObj->MinFilter,texObj->MagFilter);
-      savageSetTexBorderColor(t,texObj->BorderColor);
+      savageSetTexBorderColor(t,texObj->BorderColor.f);
    }
 
    return t;
@@ -2044,7 +2044,7 @@ static void savageTexParameter( GLcontext *ctx, GLenum target,
       break;
   
    case GL_TEXTURE_BORDER_COLOR:
-      savageSetTexBorderColor(t,tObj->BorderColor);
+      savageSetTexBorderColor(t,tObj->BorderColor.f);
       break;
 
    default:
index a507173b2188f0a087a015f29c1bef2f2b28134c..4c22a10cf7e361e9cdda9ef23d595675ad3949c4 100644 (file)
@@ -457,10 +457,10 @@ sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj,
 
    {
       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]);
+      CLAMPED_FLOAT_TO_UBYTE(c[0], texObj->BorderColor.f[0]);
+      CLAMPED_FLOAT_TO_UBYTE(c[1], texObj->BorderColor.f[1]);
+      CLAMPED_FLOAT_TO_UBYTE(c[2], texObj->BorderColor.f[2]);
+      CLAMPED_FLOAT_TO_UBYTE(c[3], texObj->BorderColor.f[3]);
 
       current->texture[hw_unit].hwTextureBorderColor = 
          PACK_COLOR_8888(c[3], c[0], c[1], c[2]);
index a9db6c45f7d03412e73b7162a11cb25bc089c08a..16982309525fae029a0b7c30fa45406062390ad7 100644 (file)
@@ -891,10 +891,10 @@ static GLboolean viaChooseTextureState(GLcontext *ctx)
             if (texObj->Image[0][texObj->BaseLevel]->Border > 0) {
               vmesa->regHTXnTB[0] |= (HC_HTXnTB_TBC_S | HC_HTXnTB_TBC_T);
               vmesa->regHTXnTBC[0] = 
-                 PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->BorderColor[0]),
-                                FLOAT_TO_UBYTE(texObj->BorderColor[1]),
-                                FLOAT_TO_UBYTE(texObj->BorderColor[2]));
-              vmesa->regHTXnTRAH[0] = FLOAT_TO_UBYTE(texObj->BorderColor[3]);
+                 PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->BorderColor.f[0]),
+                                FLOAT_TO_UBYTE(texObj->BorderColor.f[1]),
+                                FLOAT_TO_UBYTE(texObj->BorderColor.f[2]));
+              vmesa->regHTXnTRAH[0] = FLOAT_TO_UBYTE(texObj->BorderColor.f[3]);
             }
 
            if (texUnit0->LodBias != 0.0f) {
@@ -924,10 +924,10 @@ static GLboolean viaChooseTextureState(GLcontext *ctx)
             if (texObj->Image[0][texObj->BaseLevel]->Border > 0) {
               vmesa->regHTXnTB[1] |= (HC_HTXnTB_TBC_S | HC_HTXnTB_TBC_T);
               vmesa->regHTXnTBC[1] = 
-                 PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->BorderColor[0]),
-                                FLOAT_TO_UBYTE(texObj->BorderColor[1]),
-                                FLOAT_TO_UBYTE(texObj->BorderColor[2]));
-              vmesa->regHTXnTRAH[1] = FLOAT_TO_UBYTE(texObj->BorderColor[3]);
+                 PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->BorderColor.f[0]),
+                                FLOAT_TO_UBYTE(texObj->BorderColor.f[1]),
+                                FLOAT_TO_UBYTE(texObj->BorderColor.f[2]));
+              vmesa->regHTXnTRAH[1] = FLOAT_TO_UBYTE(texObj->BorderColor.f[3]);
             }
 
 
index fb15a5ba47861ead2a5d5e2bb52dbb9bc72a0c17..0641b98b3b78a88056751d406f962e4ff39d6b6a 100644 (file)
@@ -835,7 +835,7 @@ pop_texture_group(GLcontext *ctx, struct texture_state *texstate)
 
          _mesa_BindTexture(target, obj->Name);
 
-         _mesa_TexParameterfv(target, GL_TEXTURE_BORDER_COLOR, obj->BorderColor);
+         _mesa_TexParameterfv(target, GL_TEXTURE_BORDER_COLOR, obj->BorderColor.f);
          _mesa_TexParameterf(target, GL_TEXTURE_PRIORITY, obj->Priority);
          _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, obj->WrapS);
          _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, obj->WrapT);
index a7f70a1875ba958f27c96cb73aca550bb07efcd6..01ad246504aa4536b9ba1fb69a3f01522266ced3 100644 (file)
@@ -1217,7 +1217,11 @@ struct gl_texture_object
    GLuint Name;                        /**< the user-visible texture object ID */
    GLenum Target;               /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
    GLfloat Priority;           /**< in [0,1] */
-   GLfloat BorderColor[4];     /**< unclamped */
+   union {
+      GLfloat f[4];
+      GLuint ui[4];
+      GLint i[4];
+   } BorderColor;               /**< Interpreted according to texture format */
    GLenum WrapS;               /**< S-axis texture image wrap mode */
    GLenum WrapT;               /**< T-axis texture image wrap mode */
    GLenum WrapR;               /**< R-axis texture image wrap mode */
index 09fe7b85ba013e7390c84b8e12696bc8247c73cb..7f0a246025ab1d7319b93f5eb423aa460c13375d 100644 (file)
@@ -228,10 +228,10 @@ _mesa_copy_texture_object( struct gl_texture_object *dest,
    dest->Target = src->Target;
    dest->Name = src->Name;
    dest->Priority = src->Priority;
-   dest->BorderColor[0] = src->BorderColor[0];
-   dest->BorderColor[1] = src->BorderColor[1];
-   dest->BorderColor[2] = src->BorderColor[2];
-   dest->BorderColor[3] = src->BorderColor[3];
+   dest->BorderColor.f[0] = src->BorderColor.f[0];
+   dest->BorderColor.f[1] = src->BorderColor.f[1];
+   dest->BorderColor.f[2] = src->BorderColor.f[2];
+   dest->BorderColor.f[3] = src->BorderColor.f[3];
    dest->WrapS = src->WrapS;
    dest->WrapT = src->WrapT;
    dest->WrapR = src->WrapR;
index 73db7d713ce3051df4d848f6a0a2578ee2146532..474b950def2eed0b118461c25e269ad3276e79bd 100644 (file)
@@ -511,10 +511,7 @@ set_tex_parameterf(GLcontext *ctx,
 
    case GL_TEXTURE_BORDER_COLOR:
       flush(ctx, texObj);
-      texObj->BorderColor[RCOMP] = params[0];
-      texObj->BorderColor[GCOMP] = params[1];
-      texObj->BorderColor[BCOMP] = params[2];
-      texObj->BorderColor[ACOMP] = params[3];
+      COPY_4V(texObj->BorderColor.f, params);
       return GL_TRUE;
 
    default:
@@ -1008,10 +1005,10 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
          *params = ENUM_TO_FLOAT(obj->WrapR);
          break;
       case GL_TEXTURE_BORDER_COLOR:
-         params[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F);
-         params[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F);
-         params[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F);
-         params[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F);
+         params[0] = CLAMP(obj->BorderColor.f[0], 0.0F, 1.0F);
+         params[1] = CLAMP(obj->BorderColor.f[1], 0.0F, 1.0F);
+         params[2] = CLAMP(obj->BorderColor.f[2], 0.0F, 1.0F);
+         params[3] = CLAMP(obj->BorderColor.f[3], 0.0F, 1.0F);
          break;
       case GL_TEXTURE_RESIDENT:
          {
@@ -1166,10 +1163,10 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
       case GL_TEXTURE_BORDER_COLOR:
          {
             GLfloat b[4];
-            b[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F);
-            b[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F);
-            b[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F);
-            b[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F);
+            b[0] = CLAMP(obj->BorderColor.f[0], 0.0F, 1.0F);
+            b[1] = CLAMP(obj->BorderColor.f[1], 0.0F, 1.0F);
+            b[2] = CLAMP(obj->BorderColor.f[2], 0.0F, 1.0F);
+            b[3] = CLAMP(obj->BorderColor.f[3], 0.0F, 1.0F);
             params[0] = FLOAT_TO_INT(b[0]);
             params[1] = FLOAT_TO_INT(b[1]);
             params[2] = FLOAT_TO_INT(b[2]);
index d6e3a3e5610021f85b4bdc9f98ddc3446cd9ca57..e1d6fa9ecad60cdb1a415da7232ce3031d963dfe 100644 (file)
@@ -208,7 +208,7 @@ update_samplers(struct st_context *st)
             assert(sampler->min_lod <= sampler->max_lod);
          }
 
-         xlate_border_color(texobj->BorderColor,
+         xlate_border_color(texobj->BorderColor.f,
                             teximg ? teximg->_BaseFormat : GL_RGBA,
                             sampler->border_color);
 
index 0bb988e3ef973dab41585477d361fb6e8b7c26b4..76b65cc755e4c9bb1f058a3e2d2228ebb6be9bd6 100644 (file)
@@ -747,28 +747,28 @@ get_border_color(const struct gl_texture_object *tObj,
 {
    switch (img->_BaseFormat) {
    case GL_RGB:
-      rgba[0] = tObj->BorderColor[0];
-      rgba[1] = tObj->BorderColor[1];
-      rgba[2] = tObj->BorderColor[2];
+      rgba[0] = tObj->BorderColor.f[0];
+      rgba[1] = tObj->BorderColor.f[1];
+      rgba[2] = tObj->BorderColor.f[2];
       rgba[3] = 1.0F;
       break;
    case GL_ALPHA:
       rgba[0] = rgba[1] = rgba[2] = 0.0;
-      rgba[3] = tObj->BorderColor[3];
+      rgba[3] = tObj->BorderColor.f[3];
       break;
    case GL_LUMINANCE:
-      rgba[0] = rgba[1] = rgba[2] = tObj->BorderColor[0];
+      rgba[0] = rgba[1] = rgba[2] = tObj->BorderColor.f[0];
       rgba[3] = 1.0;
       break;
    case GL_LUMINANCE_ALPHA:
-      rgba[0] = rgba[1] = rgba[2] = tObj->BorderColor[0];
-      rgba[3] = tObj->BorderColor[3];
+      rgba[0] = rgba[1] = rgba[2] = tObj->BorderColor.f[0];
+      rgba[3] = tObj->BorderColor.f[3];
       break;
    case GL_INTENSITY:
-      rgba[0] = rgba[1] = rgba[2] = rgba[3] = tObj->BorderColor[0];
+      rgba[0] = rgba[1] = rgba[2] = rgba[3] = tObj->BorderColor.f[0];
       break;
    default:
-      COPY_4V(rgba, tObj->BorderColor);
+      COPY_4V(rgba, tObj->BorderColor.f);
    }
 }
 
@@ -2331,7 +2331,7 @@ sample_2d_array_linear(GLcontext *ctx,
    array = clamp_rect_coord_nearest(tObj->WrapR, texcoord[2], depth);
 
    if (array < 0 || array >= depth) {
-      COPY_4V(rgba, tObj->BorderColor);
+      COPY_4V(rgba, tObj->BorderColor.f);
    }
    else {
       if (img->Border) {
@@ -3002,7 +3002,7 @@ sample_depth_texture( GLcontext *ctx,
             img->FetchTexelf(img, col, row, slice, &depthSample);
          }
          else {
-            depthSample = tObj->BorderColor[0];
+            depthSample = tObj->BorderColor.f[0];
          }
 
          result = shadow_compare(function, texcoords[i][compare_coord],
@@ -3053,21 +3053,21 @@ sample_depth_texture( GLcontext *ctx,
          }
 
          if (slice < 0 || slice >= (GLint) depth) {
-            depth00 = tObj->BorderColor[0];
-            depth01 = tObj->BorderColor[0];
-            depth10 = tObj->BorderColor[0];
-            depth11 = tObj->BorderColor[0];
+            depth00 = tObj->BorderColor.f[0];
+            depth01 = tObj->BorderColor.f[0];
+            depth10 = tObj->BorderColor.f[0];
+            depth11 = tObj->BorderColor.f[0];
          }
          else {
             /* get four depth samples from the texture */
             if (useBorderTexel & (I0BIT | J0BIT)) {
-               depth00 = tObj->BorderColor[0];
+               depth00 = tObj->BorderColor.f[0];
             }
             else {
                img->FetchTexelf(img, i0, j0, slice, &depth00);
             }
             if (useBorderTexel & (I1BIT | J0BIT)) {
-               depth10 = tObj->BorderColor[0];
+               depth10 = tObj->BorderColor.f[0];
             }
             else {
                img->FetchTexelf(img, i1, j0, slice, &depth10);
@@ -3075,13 +3075,13 @@ sample_depth_texture( GLcontext *ctx,
 
             if (tObj->Target != GL_TEXTURE_1D_ARRAY_EXT) {
                if (useBorderTexel & (I0BIT | J1BIT)) {
-                  depth01 = tObj->BorderColor[0];
+                  depth01 = tObj->BorderColor.f[0];
                }
                else {
                   img->FetchTexelf(img, i0, j1, slice, &depth01);
                }
                if (useBorderTexel & (I1BIT | J1BIT)) {
-                  depth11 = tObj->BorderColor[0];
+                  depth11 = tObj->BorderColor.f[0];
                }
                else {
                   img->FetchTexelf(img, i1, j1, slice, &depth11);