diff options
author | Axel Davy <[email protected]> | 2016-03-07 21:35:59 +0100 |
---|---|---|
committer | Axel Davy <[email protected]> | 2016-05-18 23:37:14 +0200 |
commit | 52cb8e33c32c3fac1691ff0db34f4c6cd5909995 (patch) | |
tree | cb08c45b2fd7f94f4d6f62926b4a1e2e38a211b8 /src/gallium/auxiliary/util/u_format.c | |
parent | 89344a80fc4479fa3ac466cb17706cf12070afe1 (diff) |
gallium/util: Implement util_format_translate_3d
This is the equivalent of util_format_translate, but for volumes.
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util/u_format.c')
-rw-r--r-- | src/gallium/auxiliary/util/u_format.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c index 34df01d8b5e..cbdb5ce9ddc 100644 --- a/src/gallium/auxiliary/util/u_format.c +++ b/src/gallium/auxiliary/util/u_format.c @@ -739,6 +739,40 @@ util_format_translate(enum pipe_format dst_format, return TRUE; } +boolean +util_format_translate_3d(enum pipe_format dst_format, + void *dst, unsigned dst_stride, + unsigned dst_slice_stride, + unsigned dst_x, unsigned dst_y, + unsigned dst_z, + enum pipe_format src_format, + const void *src, unsigned src_stride, + unsigned src_slice_stride, + unsigned src_x, unsigned src_y, + unsigned src_z, unsigned width, + unsigned height, unsigned depth) +{ + uint8_t *dst_layer; + const uint8_t *src_layer; + unsigned z; + dst_layer = dst; + src_layer = src; + dst_layer += dst_z * dst_slice_stride; + src_layer += src_z * src_slice_stride; + for (z = 0; z < depth; ++z) { + if (!util_format_translate(dst_format, dst_layer, dst_stride, + dst_x, dst_y, + src_format, src_layer, src_stride, + src_x, src_y, + width, height)) + return FALSE; + + dst_layer += dst_slice_stride; + src_layer += src_slice_stride; + } + return TRUE; +} + void util_format_compose_swizzles(const unsigned char swz1[4], const unsigned char swz2[4], unsigned char dst[4]) |