Minor tweaks to help out at a driver level.
[mesa.git] / src / mesa / main / texstore.c
index 08e625bc0d4816b4a6fdcb00298fe736cb3d68de..899201e6c4ab80c278cab04401b8f969be63ae3e 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id: texstore.c,v 1.55 2003/04/01 16:41:55 brianp Exp $ */
-
 /*
  * Mesa 3-D graphics library
  * Version:  5.1
@@ -159,7 +157,7 @@ components_in_intformat( GLint format )
  * apply pixel transfer ops into a temporary image buffer.  Then,
  * convert the temporary image into the special hardware format.
  *
- * Input:
+ * \param
  *   dimensions - 1, 2, or 3
  *   texDestFormat - GL_LUMINANCE, GL_INTENSITY, GL_LUMINANCE_ALPHA, GL_ALPHA,
  *                   GL_RGB or GL_RGBA (the destination format)
@@ -197,9 +195,9 @@ transfer_teximage(GLcontext *ctx, GLuint dimensions,
           texDestFormat == GL_COLOR_INDEX ||
           texDestFormat == GL_DEPTH_COMPONENT);
    ASSERT(texDestAddr);
-   ASSERT(srcWidth >= 1);
-   ASSERT(srcHeight >= 1);
-   ASSERT(srcDepth >= 1);
+   ASSERT(srcWidth >= 0);
+   ASSERT(srcHeight >= 0);
+   ASSERT(srcDepth >= 0);
    ASSERT(dstXoffset >= 0);
    ASSERT(dstYoffset >= 0);
    ASSERT(dstZoffset >= 0);
@@ -437,7 +435,7 @@ transfer_teximage(GLcontext *ctx, GLuint dimensions,
  * Transfer a texture image from user space to <destAddr> applying all
  * needed image transfer operations and storing the result in the format
  * specified by <dstFormat>.  <dstFormat> may be any format from texformat.h.
- * Input:
+ * \param
  *   dimensions - 1, 2 or 3
  *   baseInternalFormat - base format of the internal texture format
  *       specified by the user.  This is very important, see below.
@@ -447,7 +445,7 @@ transfer_teximage(GLcontext *ctx, GLuint dimensions,
  *   dstX/Y/Zoffset - as specified by glTexSubImage
  *   dstRowStride - stride between dest rows in bytes
  *   dstImageStride - stride between dest images in bytes
- *   srcFormat, srcType - incoming image format and datatype
+ *   srcFormat, srcType - incoming image format and data type
  *   srcAddr - source image address
  *   srcPacking - packing params of source image
  *
@@ -482,6 +480,7 @@ _mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions,
           baseInternalFormat == GL_ALPHA ||
           baseInternalFormat == GL_RGB ||
           baseInternalFormat == GL_RGBA ||
+          baseInternalFormat == GL_YCBCR_MESA ||
           baseInternalFormat == GL_COLOR_INDEX ||
           baseInternalFormat == GL_DEPTH_COMPONENT);
 
@@ -628,6 +627,7 @@ _mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions,
                                          srcPacking, srcAddr,
                                          dstAddr);
          assert(b);
+         (void) b;
       }
       else if (dimensions == 2) {
          GLboolean b;
@@ -639,6 +639,7 @@ _mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions,
                                          srcPacking, srcAddr,
                                          dstAddr);
          assert(b);
+         (void) b;
       }
       else {
          GLboolean b;
@@ -649,6 +650,7 @@ _mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions,
                                       srcFormat, srcType,
                                       srcPacking, srcAddr, dstAddr);
          assert(b);
+         (void) b;
       }
    }
    else {
@@ -1094,7 +1096,7 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
                            texImage->Format,
                            texImage->TexFormat, texImage->Data,
                            width, height, depth, /* src size */
-                           xoffset, yoffset, xoffset, /* dest offsets */
+                           xoffset, yoffset, zoffset, /* dest offsets */
                            texImage->Width * texelBytes,  /* dst row stride */
                            texImage->Width * texImage->Height * texelBytes,
                            format, type, pixels, packing);
@@ -1264,40 +1266,6 @@ _mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target,
 }
 
 
-
-
-
-/*
- * This is the fallback for Driver.TestProxyTexImage().
- */
-GLboolean
-_mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
-                          GLint internalFormat, GLenum format, GLenum type,
-                          GLint width, GLint height, GLint depth, GLint border)
-{
-   struct gl_texture_image *texImage;
-
-   (void) format;
-   (void) type;
-
-   texImage = _mesa_get_proxy_tex_image(ctx, target, level);
-
-   /* We always pass.
-    * The core Mesa code will have already tested the image size, etc.
-    * If a driver has more stringent texture limits to enforce it will
-    * have to override this function.
-    */
-   /* choose the texture format */
-   assert(ctx->Driver.ChooseTextureFormat);
-   texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
-                                          internalFormat, format, type);
-   assert(texImage->TexFormat);
-
-   return GL_TRUE;
-}
-
-
-
 /*
  * Average together two rows of a source image to produce a single new
  * row in the dest image.  It's legal for the two source rows to point
@@ -1312,7 +1280,9 @@ do_row(const struct gl_texture_format *format, GLint srcWidth,
    const GLuint k0 = (srcWidth == dstWidth) ? 0 : 1;
    const GLuint colStride = (srcWidth == dstWidth) ? 1 : 2;
 
+   /* This assertion is no longer valid with non-power-of-2 textures
    assert(srcWidth == dstWidth || srcWidth == 2 * dstWidth);
+   */
 
    switch (format->MesaFormat) {
    case MESA_FORMAT_RGBA: