diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/format_unpack.c | 35 | ||||
-rw-r--r-- | src/mesa/main/format_unpack.h | 4 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c index 3d044af0d4d..eaa33dfdb71 100644 --- a/src/mesa/main/format_unpack.c +++ b/src/mesa/main/format_unpack.c @@ -1539,3 +1539,38 @@ _mesa_unpack_ubyte_stencil_row(gl_format format, GLuint n, return; } } + +static void +unpack_uint_24_8_depth_stencil_S8_Z24(const GLuint *src, GLuint *dst, GLuint n) +{ + GLuint i; + + for (i = 0; i < n; i++) { + GLuint val = src[i]; + dst[i] = val >> 24 | val << 8; + } +} + +static void +unpack_uint_24_8_depth_stencil_Z24_S8(const GLuint *src, GLuint *dst, GLuint n) +{ + memcpy(dst, src, n * 4); +} + +void +_mesa_unpack_uint_24_8_depth_stencil_row(gl_format format, GLuint n, + const void *src, GLuint *dst) +{ + switch (format) { + case MESA_FORMAT_Z24_S8: + unpack_uint_24_8_depth_stencil_Z24_S8(src, dst, n); + break; + case MESA_FORMAT_S8_Z24: + unpack_uint_24_8_depth_stencil_S8_Z24(src, dst, n); + break; + default: + _mesa_problem(NULL, "bad format %s in _mesa_unpack_ubyte_s_row", + _mesa_get_format_name(format)); + return; + } +} diff --git a/src/mesa/main/format_unpack.h b/src/mesa/main/format_unpack.h index 2e00047c201..a8a829c8867 100644 --- a/src/mesa/main/format_unpack.h +++ b/src/mesa/main/format_unpack.h @@ -49,5 +49,9 @@ void _mesa_unpack_ubyte_stencil_row(gl_format format, GLuint n, const void *src, GLubyte *dst); +void +_mesa_unpack_uint_24_8_depth_stencil_row(gl_format format, GLuint n, + const void *src, GLuint *dst); + #endif /* FORMAT_UNPACK_H */ |