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 <thomashelland90@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
This commit is contained in:
Eric Anholt 2019-07-01 16:45:32 -07:00
parent 5956b46e16
commit ece03848c2
3 changed files with 14 additions and 34 deletions

View File

@ -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 */

View File

@ -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']);

View File

@ -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);
}