Merge branch 'llvm-cliptest-viewport'
[mesa.git] / src / mesa / drivers / dri / sis / sis_texstate.c
index 7ef20f880c533f1c6c22775d25af57a46e5106a3..daec2393211b3809cd0241aceebbfbbcab59032e 100644 (file)
@@ -24,7 +24,6 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **************************************************************************/
-/* $XFree86$ */
 
 /*
  * Authors:
@@ -32,15 +31,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
  *   Eric Anholt <anholt@FreeBSD.org>
  */
 
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "texformat.h"
+#include "main/glheader.h"
+#include "main/imports.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
 
 #include "sis_context.h"
-#include "sis_state.h"
 #include "sis_tex.h"
 #include "sis_tris.h"
 #include "sis_alloc.h"
@@ -49,7 +46,7 @@ static GLint TransferTexturePitch (GLint dwPitch);
 
 /* Handle texenv stuff, called from validate_texture (renderstart) */
 static void
-sis_set_texture_env0( GLcontext *ctx, struct gl_texture_object *texObj,
+sis_set_texture_env0( struct gl_context *ctx, struct gl_texture_object *texObj,
    int unit )
 {
    sisContextPtr smesa = SIS_CONTEXT(ctx);
@@ -185,7 +182,7 @@ sis_set_texture_env0( GLcontext *ctx, struct gl_texture_object *texObj,
 
 /* Handle texenv stuff, called from validate_texture (renderstart) */
 static void
-sis_set_texture_env1( GLcontext *ctx, struct gl_texture_object *texObj,
+sis_set_texture_env1( struct gl_context *ctx, struct gl_texture_object *texObj,
    int unit)
 {
    sisContextPtr smesa = SIS_CONTEXT(ctx);
@@ -321,7 +318,7 @@ sis_set_texture_env1( GLcontext *ctx, struct gl_texture_object *texObj,
 
 /* Returns 0 if a software fallback is necessary */
 static GLboolean
-sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj,
+sis_set_texobj_parm( struct gl_context *ctx, struct gl_texture_object *texObj,
    int hw_unit )
 {
    sisContextPtr smesa = SIS_CONTEXT(ctx);
@@ -457,11 +454,16 @@ sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj,
       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.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]);
+   }
 
    if (current->texture[hw_unit].hwTextureBorderColor !=
        prev->texture[hw_unit].hwTextureBorderColor) 
@@ -581,7 +583,7 @@ sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj,
 
 /* Disable a texture unit, called from validate_texture */
 static void
-sis_reset_texture_env (GLcontext *ctx, int hw_unit)
+sis_reset_texture_env (struct gl_context *ctx, int hw_unit)
 {
    sisContextPtr smesa = SIS_CONTEXT(ctx);
 
@@ -618,7 +620,7 @@ sis_reset_texture_env (GLcontext *ctx, int hw_unit)
    }
 }
 
-static void updateTextureUnit( GLcontext *ctx, int unit )
+static void updateTextureUnit( struct gl_context *ctx, int unit )
 {
    sisContextPtr smesa = SIS_CONTEXT( ctx );
    const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
@@ -654,7 +656,7 @@ static void updateTextureUnit( GLcontext *ctx, int unit )
 }
 
 
-void sisUpdateTextureState( GLcontext *ctx )
+void sisUpdateTextureState( struct gl_context *ctx )
 {
    sisContextPtr smesa = SIS_CONTEXT( ctx );
    int i;