- dstLevel = MIN2(stImage->base.Level, stImage->pt->last_level);
-
- /* for resource_copy_region(), y=0=top, always */
- pipe->resource_copy_region(pipe,
- /* dest */
- stImage->pt,
- dstLevel,
- destX, destY, destZ + stImage->base.Face,
- /* src */
- strb->texture,
- strb->surface->u.tex.level,
- &src_box);
+ unsigned dstLevel = MIN2(stImage->base.Level, stImage->pt->last_level);
+ struct pipe_blit_info blit;
+
+ memset(&blit, 0, sizeof(blit));
+ blit.src.resource = strb->texture;
+ blit.src.format = src_format;
+ blit.src.level = strb->surface->u.tex.level;
+ blit.src.box.x = srcX;
+ blit.src.box.y = srcY0;
+ blit.src.box.z = strb->surface->u.tex.first_layer;
+ blit.src.box.width = width;
+ blit.src.box.height = srcY1 - srcY0;
+ blit.src.box.depth = 1;
+ blit.dst.resource = stImage->pt;
+ blit.dst.format = dest_format;
+ blit.dst.level = dstLevel;
+ blit.dst.box.x = destX;
+ blit.dst.box.y = destY;
+ blit.dst.box.z = stImage->base.Face + destZ;
+ blit.dst.box.width = width;
+ blit.dst.box.height = height;
+ blit.dst.box.depth = 1;
+ blit.mask = blit_mask;
+ blit.filter = PIPE_TEX_FILTER_NEAREST;
+
+ /* 1D array textures need special treatment.
+ * Blit rows from the source to layers in the destination. */
+ if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
+ int y, layer;
+
+ for (y = srcY0, layer = 0; layer < height; y += yStep, layer++) {
+ blit.src.box.y = y;
+ blit.src.box.height = 1;
+ blit.dst.box.y = 0;
+ blit.dst.box.height = 1;
+ blit.dst.box.z = destY + layer;
+
+ if (!st_pipe_blit(pipe, &blit)) {
+ goto fallback;
+ }
+ }
+ }
+ else {
+ /* All the other texture targets. */
+ if (!st_pipe_blit(pipe, &blit)) {
+ goto fallback;
+ }
+ }