i965/tex: Use offset helper instead of accessing table directly
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Fri, 30 Jun 2017 17:56:01 +0000 (20:56 +0300)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Tue, 18 Jul 2017 18:35:03 +0000 (21:35 +0300)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/intel_tex_image.c
src/mesa/drivers/dri/i965/intel_tex_subimage.c

index 68d0a5766709134838fdfa48fb671a65440a7dcd..ba5d099fb40172f7d55681ab0787c7a475ef1291 100644 (file)
@@ -484,8 +484,10 @@ intel_gettexsubimage_tiled_memcpy(struct gl_context *ctx,
        packing->SkipRows);
 
    /* Adjust x and y offset based on miplevel */
-   xoffset += image->mt->level[level].level_x;
-   yoffset += image->mt->level[level].level_y;
+   unsigned level_x, level_y;
+   intel_miptree_get_image_offset(image->mt, level, 0, &level_x, &level_y);
+   xoffset += level_x;
+   yoffset += level_y;
 
    tiled_to_linear(
       xoffset * cpp, (xoffset + width) * cpp,
index da5b3f0d30235ae1bb06812da4ab6bfcdfd19e11..b498b2e1c0caec3718f675aa54cd2c8d91f67c2d 100644 (file)
@@ -181,8 +181,10 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
        packing->SkipRows, for_glTexImage);
 
    /* Adjust x and y offset based on miplevel */
-   xoffset += image->mt->level[level].level_x;
-   yoffset += image->mt->level[level].level_y;
+   unsigned level_x, level_y;
+   intel_miptree_get_image_offset(image->mt, level, 0, &level_x, &level_y);
+   xoffset += level_x;
+   yoffset += level_y;
 
    linear_to_tiled(
       xoffset * cpp, (xoffset + width) * cpp,