From ece03848c27675eb4933f07f45acd49336d99144 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 1 Jul 2019 16:45:32 -0700 Subject: [PATCH] mesa: Fold _mesa_unpack_depth_stencil_row() into its only caller. This was the last bit of gl.h usage in format packing. Reviewed-by: Thomas Helland Reviewed-by: Kristian H. Kristensen --- src/mesa/main/format_unpack.h | 5 +---- src/mesa/main/format_unpack.py | 24 ------------------------ src/mesa/main/texgetimage.c | 19 +++++++++++++------ 3 files changed, 14 insertions(+), 34 deletions(-) diff --git a/src/mesa/main/format_unpack.h b/src/mesa/main/format_unpack.h index 4d09c767822..4de0cc267e2 100644 --- a/src/mesa/main/format_unpack.h +++ b/src/mesa/main/format_unpack.h @@ -67,8 +67,5 @@ _mesa_unpack_float_32_uint_24_8_depth_stencil_row(mesa_format format, uint32_t n, const void *src, uint32_t *dst); -void -_mesa_unpack_depth_stencil_row(mesa_format format, uint32_t n, - const void *src, GLenum type, - uint32_t *dst); + #endif /* FORMAT_UNPACK_H */ diff --git a/src/mesa/main/format_unpack.py b/src/mesa/main/format_unpack.py index 54df8efb7ce..e3c86bbf4bc 100644 --- a/src/mesa/main/format_unpack.py +++ b/src/mesa/main/format_unpack.py @@ -844,30 +844,6 @@ _mesa_unpack_float_32_uint_24_8_depth_stencil_row(mesa_format format, uint32_t n } } -/** - * Unpack depth/stencil - * \param format the source data format - * \param type the destination data type - */ -void -_mesa_unpack_depth_stencil_row(mesa_format format, uint32_t n, - const void *src, GLenum type, - uint32_t *dst) -{ - assert(type == GL_UNSIGNED_INT_24_8 || - type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV); - - switch (type) { - case GL_UNSIGNED_INT_24_8: - _mesa_unpack_uint_24_8_depth_stencil_row(format, n, src, dst); - break; - case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: - _mesa_unpack_float_32_uint_24_8_depth_stencil_row(format, n, src, dst); - break; - default: - unreachable("bad type 0x%x in _mesa_unpack_depth_stencil_row"); - } -} """ template = Template(string, future_imports=['division']); diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index bb4f7006618..15c4ce00178 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -132,8 +132,6 @@ get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions, GLint img, row; assert(format == GL_DEPTH_STENCIL); - assert(type == GL_UNSIGNED_INT_24_8 || - type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV); for (img = 0; img < depth; img++) { GLubyte *srcMap; @@ -150,10 +148,19 @@ get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions, void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels, width, height, format, type, img, row, 0); - _mesa_unpack_depth_stencil_row(texImage->TexFormat, - width, - (const GLuint *) src, - type, dest); + switch (type) { + case GL_UNSIGNED_INT_24_8: + _mesa_unpack_uint_24_8_depth_stencil_row(texImage->TexFormat, + width, src, dest); + break; + case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: + _mesa_unpack_float_32_uint_24_8_depth_stencil_row(texImage->TexFormat, + width, + src, dest); + break; + default: + unreachable("bad type in get_tex_depth_stencil()"); + } if (ctx->Pack.SwapBytes) { _mesa_swap4((GLuint *) dest, width); } -- 2.30.2