r300/radeon: move face_for_target
authorDave Airlie <airlied@redhat.com>
Wed, 21 Jan 2009 08:41:11 +0000 (18:41 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 21 Jan 2009 08:41:11 +0000 (18:41 +1000)
src/mesa/drivers/dri/r300/r300_tex.c
src/mesa/drivers/dri/radeon/common_misc.c
src/mesa/drivers/dri/radeon/common_misc.h

index 3ef1cc2859424cbf0d8a58fb747978c641833240..7363c045716d9564ab5d74feb6a618f258feb01b 100644 (file)
@@ -509,23 +509,6 @@ static void r300_teximage(
        }
 }
 
-
-static GLuint face_for_target(GLenum target)
-{
-       switch (target) {
-       case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
-       case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
-       case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
-       case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
-       case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
-       case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
-               return (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
-       default:
-               return 0;
-       }
-}
-
-
 static void r300TexImage1D(GLcontext * ctx, GLenum target, GLint level,
                           GLint internalFormat,
                           GLint width, GLint border,
@@ -546,7 +529,7 @@ static void r300TexImage2D(GLcontext * ctx, GLenum target, GLint level,
                           struct gl_texture_object *texObj,
                           struct gl_texture_image *texImage)
 {
-       GLuint face = face_for_target(target);
+       GLuint face = radeon_face_for_target(target);
 
        r300_teximage(ctx, 2, face, level, internalFormat, width, height, 1,
                0, format, type, pixels, packing, texObj, texImage, 0);
@@ -559,7 +542,7 @@ static void r300CompressedTexImage2D(GLcontext * ctx, GLenum target,
                                     struct gl_texture_object *texObj,
                                     struct gl_texture_image *texImage)
 {
-       GLuint face = face_for_target(target);
+       GLuint face = radeon_face_for_target(target);
 
        r300_teximage(ctx, 2, face, level, internalFormat, width, height, 1,
                imageSize, 0, 0, data, 0, texObj, texImage, 1);
index f70a694eb92dcb931b86bc4cc9225011cc964da3..2d0fc3a0dd3e03d07faba6a9fc05cc26be9ea8c9 100644 (file)
@@ -1447,7 +1447,20 @@ void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj)
        radeon_bo_unmap(t->mt->bo);
 }
 
-
+GLuint radeon_face_for_target(GLenum target)
+{
+       switch (target) {
+       case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+       case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+       case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+       case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+       case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+       case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+               return (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
+       default:
+               return 0;
+       }
+}
 
 /**
  * Wraps Mesa's implementation to ensure that the base level image is mapped.
@@ -1457,7 +1470,7 @@ void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj)
  */
 void radeon_generate_mipmap(GLcontext* ctx, GLenum target, struct gl_texture_object *texObj)
 {
-       GLuint face = face_for_target(target);
+       GLuint face = radeon_face_for_target(target);
        radeon_texture_image *baseimage = get_radeon_texture_image(texObj->Image[face][texObj->BaseLevel]);
 
        radeon_teximage_map(baseimage, GL_FALSE);
index a55e00a76c5331ffe1c6a037165b707ecb6c2642..828fb85b38b18072ddf783d06da8583d084348e6 100644 (file)
@@ -42,4 +42,5 @@ void radeon_teximage_unmap(radeon_texture_image *image);
 void radeonMapTexture(GLcontext *ctx, struct gl_texture_object *texObj);
 void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj);
 void radeon_generate_mipmap(GLcontext* ctx, GLenum target, struct gl_texture_object *texObj);
+GLuint radeon_face_for_target(GLenum target);
 #endif