intel: pass zslice to intel_miptree_image_offset()
[mesa.git] / src / mesa / drivers / dri / intel / intel_tex_copy.c
index 028b49c14d36e8e9083a886fa4c312f02c5fdd9c..99cd818417d8149394ddc10e5f1893736ce72b90 100644 (file)
@@ -30,7 +30,8 @@
 #include "main/image.h"
 #include "main/teximage.h"
 #include "main/mipmap.h"
-#include "swrast/swrast.h"
+
+#include "drivers/common/meta.h"
 
 #include "intel_screen.h"
 #include "intel_context.h"
@@ -74,6 +75,7 @@ get_teximage_source(struct intel_context *intel, GLenum internalFormat)
    case GL_RGBA:
    case GL_RGBA8:
    case GL_RGB:
+   case GL_RGB8:
       return intel_readbuf_region(intel);
    default:
       return NULL;
@@ -90,7 +92,6 @@ do_copy_texsubimage(struct intel_context *intel,
                     GLint x, GLint y, GLsizei width, GLsizei height)
 {
    GLcontext *ctx = &intel->ctx;
-   struct gl_texture_object *texObj = intelImage->base.TexObject;
    const struct intel_region *src =
       get_teximage_source(intel, internalFormat);
 
@@ -116,7 +117,7 @@ do_copy_texsubimage(struct intel_context *intel,
                                                 INTEL_WRITE_PART);
       GLuint image_offset = intel_miptree_image_offset(intelImage->mt,
                                                        intelImage->face,
-                                                       intelImage->level);
+                                                       intelImage->level, 0);
       const GLint orig_x = x;
       const GLint orig_y = y;
       GLshort src_pitch;
@@ -134,7 +135,7 @@ do_copy_texsubimage(struct intel_context *intel,
 
       if (ctx->ReadBuffer->Name == 0) {
         /* reading from a window, adjust x, y */
-        __DRIdrawablePrivate *dPriv = intel->driDrawable;
+        const __DRIdrawablePrivate *dPriv = intel->driReadDrawable;
         y = dPriv->y + (dPriv->h - (y + height));
         x += dPriv->x;
 
@@ -170,11 +171,6 @@ do_copy_texsubimage(struct intel_context *intel,
 
    UNLOCK_HARDWARE(intel);
 
-   /* GL_SGIS_generate_mipmap */
-   if (intelImage->level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      intel_generate_mipmap(ctx, target, texObj);
-   }
-
    return GL_TRUE;
 }
 
@@ -221,8 +217,8 @@ intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level,
    return;
 
  fail:
-   _swrast_copy_teximage1d(ctx, target, level, internalFormat, x, y,
-                           width, border);
+   _mesa_meta_CopyTexImage1D(ctx, target, level, internalFormat, x, y,
+                             width, border);
 }
 
 
@@ -269,8 +265,8 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level,
    return;
 
  fail:
-   _swrast_copy_teximage2d(ctx, target, level, internalFormat, x, y,
-                           width, height, border);
+   _mesa_meta_CopyTexImage2D(ctx, target, level, internalFormat, x, y,
+                             width, height, border);
 }
 
 
@@ -294,7 +290,7 @@ intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level,
    if (!do_copy_texsubimage(intel_context(ctx), target,
                             intel_texture_image(texImage),
                             internalFormat, xoffset, 0, x, y, width, 1)) {
-      _swrast_copy_texsubimage1d(ctx, target, level, xoffset, x, y, width);
+      _mesa_meta_CopyTexSubImage1D(ctx, target, level, xoffset, x, y, width);
    }
 }
 
@@ -320,10 +316,10 @@ intelCopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
                             internalFormat,
                             xoffset, yoffset, x, y, width, height)) {
 
-      DBG("%s - fallback to swrast\n", __FUNCTION__);
+      DBG("%s - fallback to _mesa_meta_CopyTexSubImage2D\n", __FUNCTION__);
 
-      _swrast_copy_texsubimage2d(ctx, target, level,
-                                 xoffset, yoffset, x, y, width, height);
+      _mesa_meta_CopyTexSubImage2D(ctx, target, level,
+                                   xoffset, yoffset, x, y, width, height);
    }
 }