diff options
Diffstat (limited to 'src/gallium/auxiliary/util/u_gen_mipmap.c')
-rw-r--r-- | src/gallium/auxiliary/util/u_gen_mipmap.c | 125 |
1 files changed, 62 insertions, 63 deletions
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 2b4cdab6cf3..47dd3fc61fa 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1116,31 +1116,30 @@ make_1d_mipmap(struct gen_mipmap_state *ctx, for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) { const uint srcLevel = dstLevel - 1; - struct pipe_surface *srcSurf, *dstSurf; + struct pipe_transfer *srcTrans, *dstTrans; void *srcMap, *dstMap; - srcSurf = screen->get_tex_surface(screen, pt, face, srcLevel, zslice, - PIPE_BUFFER_USAGE_CPU_READ); - - dstSurf = screen->get_tex_surface(screen, pt, face, dstLevel, zslice, - PIPE_BUFFER_USAGE_CPU_WRITE); - - srcMap = ((ubyte *) pipe_surface_map(srcSurf, - PIPE_BUFFER_USAGE_CPU_READ) - + srcSurf->offset); - dstMap = ((ubyte *) pipe_surface_map(dstSurf, - PIPE_BUFFER_USAGE_CPU_WRITE) - + dstSurf->offset); + srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice, + PIPE_TRANSFER_READ, 0, 0, + pt->width[srcLevel], + pt->height[srcLevel]); + dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice, + PIPE_TRANSFER_WRITE, 0, 0, + pt->width[dstLevel], + pt->height[dstLevel]); + + srcMap = (ubyte *) screen->transfer_map(screen, srcTrans); + dstMap = (ubyte *) screen->transfer_map(screen, dstTrans); reduce_1d(pt->format, - srcSurf->width, srcMap, - dstSurf->width, dstMap); + srcTrans->width, srcMap, + dstTrans->width, dstMap); - pipe_surface_unmap(srcSurf); - pipe_surface_unmap(dstSurf); + screen->transfer_unmap(screen, srcTrans); + screen->transfer_unmap(screen, dstTrans); - pipe_surface_reference(&srcSurf, NULL); - pipe_surface_reference(&dstSurf, NULL); + screen->tex_transfer_release(screen, &srcTrans); + screen->tex_transfer_release(screen, &dstTrans); } } @@ -1160,32 +1159,32 @@ make_2d_mipmap(struct gen_mipmap_state *ctx, for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) { const uint srcLevel = dstLevel - 1; - struct pipe_surface *srcSurf, *dstSurf; + struct pipe_transfer *srcTrans, *dstTrans; ubyte *srcMap, *dstMap; - srcSurf = screen->get_tex_surface(screen, pt, face, srcLevel, zslice, - PIPE_BUFFER_USAGE_CPU_READ); - dstSurf = screen->get_tex_surface(screen, pt, face, dstLevel, zslice, - PIPE_BUFFER_USAGE_CPU_WRITE); - - srcMap = ((ubyte *) pipe_surface_map(srcSurf, - PIPE_BUFFER_USAGE_CPU_READ) - + srcSurf->offset); - dstMap = ((ubyte *) pipe_surface_map(dstSurf, - PIPE_BUFFER_USAGE_CPU_WRITE) - + dstSurf->offset); + srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice, + PIPE_TRANSFER_READ, 0, 0, + pt->width[srcLevel], + pt->height[srcLevel]); + dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice, + PIPE_TRANSFER_WRITE, 0, 0, + pt->width[dstLevel], + pt->height[dstLevel]); + + srcMap = (ubyte *) screen->transfer_map(screen, srcTrans); + dstMap = (ubyte *) screen->transfer_map(screen, dstTrans); reduce_2d(pt->format, - srcSurf->width, srcSurf->height, - srcSurf->stride, srcMap, - dstSurf->width, dstSurf->height, - dstSurf->stride, dstMap); + srcTrans->width, srcTrans->height, + srcTrans->stride, srcMap, + dstTrans->width, dstTrans->height, + dstTrans->stride, dstMap); - pipe_surface_unmap(srcSurf); - pipe_surface_unmap(dstSurf); + screen->transfer_unmap(screen, srcTrans); + screen->transfer_unmap(screen, dstTrans); - pipe_surface_reference(&srcSurf, NULL); - pipe_surface_reference(&dstSurf, NULL); + screen->tex_transfer_release(screen, &srcTrans); + screen->tex_transfer_release(screen, &dstTrans); } } @@ -1195,6 +1194,7 @@ make_3d_mipmap(struct gen_mipmap_state *ctx, struct pipe_texture *pt, uint face, uint baseLevel, uint lastLevel) { +#if 0 struct pipe_context *pipe = ctx->pipe; struct pipe_screen *screen = pipe->screen; uint dstLevel, zslice = 0; @@ -1204,37 +1204,36 @@ make_3d_mipmap(struct gen_mipmap_state *ctx, for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) { const uint srcLevel = dstLevel - 1; - struct pipe_surface *srcSurf, *dstSurf; + struct pipe_transfer *srcTrans, *dstTrans; ubyte *srcMap, *dstMap; - srcSurf = screen->get_tex_surface(screen, pt, face, srcLevel, zslice, - PIPE_BUFFER_USAGE_CPU_READ); - dstSurf = screen->get_tex_surface(screen, pt, face, dstLevel, zslice, - PIPE_BUFFER_USAGE_CPU_WRITE); - - srcMap = ((ubyte *) pipe_surface_map(srcSurf, - PIPE_BUFFER_USAGE_CPU_READ) - + srcSurf->offset); - dstMap = ((ubyte *) pipe_surface_map(dstSurf, - PIPE_BUFFER_USAGE_CPU_WRITE) - + dstSurf->offset); + srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice, + PIPE_TRANSFER_READ, 0, 0, + pt->width[srcLevel], + pt->height[srcLevel]); + dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice, + PIPE_TRANSFER_WRITE, 0, 0, + pt->width[dstLevel], + pt->height[dstLevel]); + + srcMap = (ubyte *) screen->transfer_map(screen, srcTrans); + dstMap = (ubyte *) screen->transfer_map(screen, dstTrans); -#if 0 reduce_3d(pt->format, - srcSurf->width, srcSurf->height, - srcSurf->stride, srcMap, - dstSurf->width, dstSurf->height, - dstSurf->stride, dstMap); -#else - (void) reduce_3d; -#endif + srcTrans->width, srcTrans->height, + srcTrans->stride, srcMap, + dstTrans->width, dstTrans->height, + dstTrans->stride, dstMap); - pipe_surface_unmap(srcSurf); - pipe_surface_unmap(dstSurf); + screen->transfer_unmap(screen, srcTrans); + screen->transfer_unmap(screen, dstTrans); - pipe_surface_reference(&srcSurf, NULL); - pipe_surface_reference(&dstSurf, NULL); + screen->tex_transfer_release(screen, &srcTrans); + screen->tex_transfer_release(screen, &dstTrans); } +#else + (void) reduce_3d; +#endif } |