-/* Copy mipmap image between textures
- */
-void
-st_texture_image_copy(struct pipe_context *pipe,
- struct pipe_texture *dst, GLuint dstLevel,
- struct pipe_texture *src,
- GLuint face)
-{
- struct pipe_screen *screen = pipe->screen;
- GLuint width = u_minify(dst->width0, dstLevel);
- GLuint height = u_minify(dst->height0, dstLevel);
- GLuint depth = u_minify(dst->depth0, dstLevel);
- struct pipe_surface *src_surface;
- struct pipe_surface *dst_surface;
- GLuint i;
-
- for (i = 0; i < depth; i++) {
- GLuint srcLevel;
-
- /* find src texture level of needed size */
- for (srcLevel = 0; srcLevel <= src->last_level; srcLevel++) {
- if (u_minify(src->width0, srcLevel) == width &&
- u_minify(src->height0, srcLevel) == height) {
- break;
- }
- }
- assert(u_minify(src->width0, srcLevel) == width);
- assert(u_minify(src->height0, srcLevel) == height);
-
-#if 0
- {
- src_surface = screen->get_tex_surface(screen, src, face, srcLevel, i,
- PIPE_BUFFER_USAGE_CPU_READ);
- ubyte *map = screen->surface_map(screen, src_surface, PIPE_BUFFER_USAGE_CPU_READ);
- map += src_surface->width * src_surface->height * 4 / 2;
- printf("%s center pixel: %d %d %d %d (pt %p[%d] -> %p[%d])\n",
- __FUNCTION__,
- map[0], map[1], map[2], map[3],
- src, srcLevel, dst, dstLevel);
-
- screen->surface_unmap(screen, src_surface);
- pipe_surface_reference(&src_surface, NULL);
- }
-#endif
-
- dst_surface = screen->get_tex_surface(screen, dst, face, dstLevel, i,
- PIPE_BUFFER_USAGE_GPU_WRITE);
-
- src_surface = screen->get_tex_surface(screen, src, face, srcLevel, i,
- PIPE_BUFFER_USAGE_GPU_READ);
-
- pipe->surface_copy(pipe,
- dst_surface,
- 0, 0, /* destX, Y */
- src_surface,
- 0, 0, /* srcX, Y */
- width, height);
-
- pipe_surface_reference(&src_surface, NULL);
- pipe_surface_reference(&dst_surface, NULL);
- }
-}
-
-