Merge branch 'llvm-cliptest-viewport'
[mesa.git] / src / mesa / drivers / dri / i810 / i810tex.c
index f657abe6711e9d8e4e0294b69b4eb56d65076ff7..49364aeb225efd412a06bf9e0415863948281fd7 100644 (file)
  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810tex.c,v 1.9 2002/10/30 12:51:33 alanh Exp $ */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texstore.h"
-#include "texformat.h"
-#include "teximage.h"
+
+#include "main/glheader.h"
+#include "main/mtypes.h"
+#include "main/imports.h"
+#include "main/simple_list.h"
+#include "main/enums.h"
+#include "main/texstore.h"
+#include "main/teximage.h"
+#include "main/texobj.h"
+#include "main/colormac.h"
+#include "main/mm.h"
+
 #include "texmem.h"
-#include "texobj.h"
-#include "swrast/swrast.h"
-#include "colormac.h"
-#include "texobj.h"
-#include "mm.h"
 
 #include "i810screen.h"
 #include "i810_dri.h"
 
 #include "i810context.h"
 #include "i810tex.h"
-#include "i810state.h"
 #include "i810ioctl.h"
 
 
@@ -162,7 +158,7 @@ static void i810SetTexFilter(i810ContextPtr imesa,
 
 
 static void
-i810SetTexBorderColor( i810TextureObjectPtr t, GLubyte color[4] )
+i810SetTexBorderColor( i810TextureObjectPtr t, const GLfloat color[4] )
 {
    /* Need a fallback.
     */
@@ -170,7 +166,7 @@ i810SetTexBorderColor( i810TextureObjectPtr t, GLubyte color[4] )
 
 
 static i810TextureObjectPtr
-i810AllocTexObj( GLcontext *ctx, struct gl_texture_object *texObj )
+i810AllocTexObj( struct gl_context *ctx, struct gl_texture_object *texObj )
 {
    i810TextureObjectPtr t;
    i810ContextPtr imesa = I810_CONTEXT(ctx);
@@ -211,14 +207,14 @@ 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->_BorderChan );
+      i810SetTexBorderColor( t, texObj->BorderColor.f );
    }
 
    return t;
 }
 
 
-static void i810TexParameter( GLcontext *ctx, GLenum target,
+static void i810TexParameter( struct gl_context *ctx, GLenum target,
                              struct gl_texture_object *tObj,
                              GLenum pname, const GLfloat *params )
 {
@@ -252,7 +248,7 @@ static void i810TexParameter( GLcontext *ctx, GLenum target,
       break;
   
    case GL_TEXTURE_BORDER_COLOR:
-      i810SetTexBorderColor( t, tObj->_BorderChan );
+      i810SetTexBorderColor( t, tObj->BorderColor.f );
       break;
 
    case GL_TEXTURE_BASE_LEVEL:
@@ -289,7 +285,7 @@ static void i810TexParameter( GLcontext *ctx, GLenum target,
  * Determine whether or not \c param can be used instead of
  * \c texUnit->EnvColor in the \c GL_TEXTURE_ENV_COLOR case.
  */
-static void i810TexEnv( GLcontext *ctx, GLenum target, 
+static void i810TexEnv( struct gl_context *ctx, GLenum target, 
                        GLenum pname, const GLfloat *param )
 {
    i810ContextPtr imesa = I810_CONTEXT( ctx );
@@ -337,7 +333,7 @@ static void i810TexEnv( GLcontext *ctx, GLenum target,
 
 
 #if 0
-static void i810TexImage1D( GLcontext *ctx, GLenum target, GLint level,
+static void i810TexImage1D( struct gl_context *ctx, GLenum target, GLint level,
                            GLint internalFormat,
                            GLint width, GLint border,
                            GLenum format, GLenum type, 
@@ -352,7 +348,7 @@ static void i810TexImage1D( GLcontext *ctx, GLenum target, GLint level,
    }
 }
 
-static void i810TexSubImage1D( GLcontext *ctx, 
+static void i810TexSubImage1D( struct gl_context *ctx, 
                               GLenum target,
                               GLint level,     
                               GLint xoffset,
@@ -367,7 +363,7 @@ static void i810TexSubImage1D( GLcontext *ctx,
 #endif
 
 
-static void i810TexImage2D( GLcontext *ctx, GLenum target, GLint level,
+static void i810TexImage2D( struct gl_context *ctx, GLenum target, GLint level,
                            GLint internalFormat,
                            GLint width, GLint height, GLint border,
                            GLenum format, GLenum type, const GLvoid *pixels,
@@ -392,7 +388,7 @@ static void i810TexImage2D( GLcontext *ctx, GLenum target, GLint level,
                           pixels, packing, texObj, texImage );
 }
 
-static void i810TexSubImage2D( GLcontext *ctx, 
+static void i810TexSubImage2D( struct gl_context *ctx, 
                               GLenum target,
                               GLint level,     
                               GLint xoffset, GLint yoffset,
@@ -414,14 +410,14 @@ static void i810TexSubImage2D( GLcontext *ctx,
 }
 
 
-static void i810BindTexture( GLcontext *ctx, GLenum target,
+static void i810BindTexture( struct gl_context *ctx, GLenum target,
                             struct gl_texture_object *tObj )
 {
    assert( (target != GL_TEXTURE_2D) || (tObj->DriverData != NULL) );
 }
 
 
-static void i810DeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
+static void i810DeleteTexture( struct gl_context *ctx, struct gl_texture_object *tObj )
 {
    driTextureObject * t = (driTextureObject *) tObj->DriverData;
    if (t) {
@@ -440,8 +436,8 @@ static void i810DeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
  * The i810 only supports 5 texture modes that are useful to Mesa.  That
  * makes this routine pretty simple.
  */
-static const struct gl_texture_format *
-i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
+static gl_format
+i810ChooseTextureFormat( struct gl_context *ctx, GLint internalFormat,
                         GLenum format, GLenum type )
 {
    switch ( internalFormat ) {
@@ -458,9 +454,9 @@ i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
       if ( ((format == GL_BGRA) && (type == GL_UNSIGNED_SHORT_1_5_5_5_REV))
           || ((format == GL_RGBA) && (type == GL_UNSIGNED_SHORT_5_5_5_1))
           || (internalFormat == GL_RGB5_A1) ) {
-        return &_mesa_texformat_argb1555;
+        return MESA_FORMAT_ARGB1555;
       }
-      return &_mesa_texformat_argb4444;
+      return MESA_FORMAT_ARGB4444;
 
    case 3:
    case GL_RGB:
@@ -472,7 +468,7 @@ i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
    case GL_RGB10:
    case GL_RGB12:
    case GL_RGB16:
-      return &_mesa_texformat_rgb565;
+      return MESA_FORMAT_RGB565;
 
    case GL_ALPHA:
    case GL_ALPHA4:
@@ -502,21 +498,21 @@ i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
    case GL_INTENSITY12:
    case GL_INTENSITY16:
    case GL_COMPRESSED_INTENSITY:
-      return &_mesa_texformat_al88;
+      return MESA_FORMAT_AL88;
 
    case GL_YCBCR_MESA:
       if (type == GL_UNSIGNED_SHORT_8_8_MESA ||
          type == GL_UNSIGNED_BYTE)
-         return &_mesa_texformat_ycbcr;
+         return MESA_FORMAT_YCBCR;
       else
-         return &_mesa_texformat_ycbcr_rev;
+         return MESA_FORMAT_YCBCR_REV;
 
    default:
       fprintf(stderr, "unexpected texture format in %s\n", __FUNCTION__);
-      return NULL;
+      return MESA_FORMAT_NONE;
    }
 
-   return NULL; /* never get here */
+   return MESA_FORMAT_NONE; /* never get here */
 }
 
 /**
@@ -528,7 +524,7 @@ i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
  * texture object from the core mesa gl_texture_object.  Not done at this time.
  */
 static struct gl_texture_object *
-i810NewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
+i810NewTextureObject( struct gl_context *ctx, GLuint name, GLenum target )
 {
    struct gl_texture_object *obj;
    obj = _mesa_new_texture_object(ctx, name, target);