diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-09-13 14:40:56 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-09-13 14:40:56 +0200 |
commit | a8f5ed55321a2c7628f5b7a89585e8ccc5c66bd0 (patch) | |
tree | a49157cd7a23f0c6279a8f49789706b0629e91b3 | |
parent | eaf7bc66baeca01c416fb9cd95aac67e412337de (diff) |
etnaviv: Fix destination stride issue
This solves the texturing problems in Ken's labyrinth
(and many other applications, probably).
-rw-r--r-- | native/driver/etna_transfer.c | 14 | ||||
-rw-r--r-- | native/etnaviv/etna_tex.c | 12 | ||||
-rw-r--r-- | native/etnaviv/etna_tex.h | 4 |
3 files changed, 14 insertions, 16 deletions
diff --git a/native/driver/etna_transfer.c b/native/driver/etna_transfer.c index ea96778..382f4bb 100644 --- a/native/driver/etna_transfer.c +++ b/native/driver/etna_transfer.c @@ -137,9 +137,10 @@ static void *etna_pipe_transfer_map(struct pipe_context *pipe, { if(resource_priv->layout == ETNA_LAYOUT_TILED && !util_format_is_compressed(resource_priv->base.format)) { - etna_texture_untile(ptrans->buffer, res_level->logical, ptrans->base.box.x, ptrans->base.box.y, - ptrans->base.box.width, ptrans->base.box.height, - ptrans->base.stride, util_format_get_blocksize(resource_priv->base.format)); + etna_texture_untile(ptrans->buffer, res_level->logical, + ptrans->base.box.x, ptrans->base.box.y, res_level->stride, + ptrans->base.box.width, ptrans->base.box.height, ptrans->base.stride, + util_format_get_blocksize(resource_priv->base.format)); } else { /* non-tiled or compressed format */ util_copy_box(ptrans->buffer, resource_priv->base.format, @@ -192,9 +193,10 @@ static void etna_pipe_transfer_unmap(struct pipe_context *pipe, { if(resource->layout == ETNA_LAYOUT_TILED && !util_format_is_compressed(resource->base.format)) { - etna_texture_tile(level->logical, ptrans->buffer, ptrans->base.box.x, ptrans->base.box.y, - ptrans->base.box.width, ptrans->base.box.height, - ptrans->base.stride, util_format_get_blocksize(resource->base.format)); + etna_texture_tile(level->logical, ptrans->buffer, + ptrans->base.box.x, ptrans->base.box.y, level->stride, + ptrans->base.box.width, ptrans->base.box.height, ptrans->base.stride, + util_format_get_blocksize(resource->base.format)); } else { /* non-tiled or compressed format */ util_copy_box(level->logical, resource->base.format, diff --git a/native/etnaviv/etna_tex.c b/native/etnaviv/etna_tex.c index 09425e2..8582c65 100644 --- a/native/etnaviv/etna_tex.c +++ b/native/etnaviv/etna_tex.c @@ -9,6 +9,7 @@ #define DO_TILE(type) \ src_stride /= sizeof(type); \ + dst_stride = (dst_stride * TEX_TILE_HEIGHT) / sizeof(type); \ for(unsigned srcy=0; srcy<height; ++srcy) \ { \ unsigned dsty = basey + srcy; \ @@ -22,6 +23,7 @@ } #define DO_UNTILE(type) \ + src_stride = (src_stride * TEX_TILE_HEIGHT) / sizeof(type); \ dst_stride /= sizeof(type); \ for(unsigned dsty=0; dsty<height; ++dsty) \ { \ @@ -35,11 +37,8 @@ } \ } -void etna_texture_tile(void *dest, void *src, unsigned basex, unsigned basey, unsigned width, unsigned height, unsigned src_stride, unsigned elmtsize) +void etna_texture_tile(void *dest, void *src, unsigned basex, unsigned basey, unsigned dst_stride, unsigned width, unsigned height, unsigned src_stride, unsigned elmtsize) { - //unsigned ytiles = (height + TEX_TILE_HEIGHT - 1) / TEX_TILE_HEIGHT; - unsigned xtiles = (width + TEX_TILE_WIDTH - 1) / TEX_TILE_WIDTH; - unsigned dst_stride = xtiles * TEX_TILE_WORDS; if(elmtsize == 4) { DO_TILE(uint32_t) @@ -56,11 +55,8 @@ void etna_texture_tile(void *dest, void *src, unsigned basex, unsigned basey, un } } -void etna_texture_untile(void *dest, void *src, unsigned basex, unsigned basey, unsigned width, unsigned height, unsigned dst_stride, unsigned elmtsize) +void etna_texture_untile(void *dest, void *src, unsigned basex, unsigned basey, unsigned src_stride, unsigned width, unsigned height, unsigned dst_stride, unsigned elmtsize) { - //unsigned ytiles = (height + TEX_TILE_HEIGHT - 1) / TEX_TILE_HEIGHT; - unsigned xtiles = (width + TEX_TILE_WIDTH - 1) / TEX_TILE_WIDTH; - unsigned src_stride = xtiles * TEX_TILE_WORDS; if(elmtsize == 4) { DO_UNTILE(uint32_t); diff --git a/native/etnaviv/etna_tex.h b/native/etnaviv/etna_tex.h index 83cac3d..d6df2aa 100644 --- a/native/etnaviv/etna_tex.h +++ b/native/etnaviv/etna_tex.h @@ -36,8 +36,8 @@ enum etna_surface_layout ETNA_LAYOUT_MULTI_SUPERTILED = 4|1|2 /* multi pipe supertiled */ }; -void etna_texture_tile(void *dest, void *src, unsigned basex, unsigned basey, unsigned width, unsigned height, unsigned src_stride, unsigned elmtsize); -void etna_texture_untile(void *dest, void *src, unsigned basex, unsigned basey, unsigned width, unsigned height, unsigned dst_stride, unsigned elmtsize); +void etna_texture_tile(void *dest, void *src, unsigned basex, unsigned basey, unsigned dst_stride, unsigned width, unsigned height, unsigned src_stride, unsigned elmtsize); +void etna_texture_untile(void *dest, void *src, unsigned basex, unsigned basey, unsigned src_stride, unsigned width, unsigned height, unsigned dst_stride, unsigned elmtsize); /* XXX from/to supertiling (can have different layouts, may be better to leave to RS) */ |