+static void
+intel_upload_tex(struct gl_context * ctx,
+ GLuint dims,
+ struct gl_texture_image *texImage,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type,
+ const GLvoid * pixels,
+ const struct gl_pixelstore_attrib *packing)
+{
+ struct intel_mipmap_tree *mt = intel_texture_image(texImage)->mt;
+ bool ok;
+
+ bool tex_busy = mt && brw_bo_busy(mt->bo);
+
+ if (mt && mt->format == MESA_FORMAT_S_UINT8)
+ mt->r8stencil_needs_update = true;
+
+ ok = _mesa_meta_pbo_TexSubImage(ctx, dims, texImage,
+ xoffset, yoffset, zoffset,
+ width, height, depth, format, type,
+ pixels, tex_busy, packing);
+ if (ok)
+ return;
+
+ ok = intel_texsubimage_tiled_memcpy(ctx, dims, texImage,
+ xoffset, yoffset, zoffset,
+ width, height, depth,
+ format, type, pixels, packing);
+ if (ok)
+ return;
+
+ _mesa_store_texsubimage(ctx, dims, texImage,
+ xoffset, yoffset, zoffset,
+ width, height, depth,
+ format, type, pixels, packing);
+}
+
+