mesa: Add and use _mesa_has_depth_float_channel

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7410>
This commit is contained in:
Nanley Chery 2020-11-05 15:45:44 -08:00 committed by Marge Bot
parent bf5cea7232
commit fda015023a
3 changed files with 13 additions and 2 deletions

View File

@ -1335,6 +1335,15 @@ _mesa_is_depth_or_stencil_format(GLenum format)
}
}
/**
* Test if the given image format has a floating-point depth component.
*/
GLboolean
_mesa_has_depth_float_channel(GLenum internalFormat)
{
return internalFormat == GL_DEPTH32F_STENCIL8 ||
internalFormat == GL_DEPTH_COMPONENT32F;
}
/**
* Test if an image format is a supported compressed format.

View File

@ -104,6 +104,9 @@ _mesa_is_depthstencil_format(GLenum format);
extern GLboolean
_mesa_is_depth_or_stencil_format(GLenum format);
extern GLboolean
_mesa_has_depth_float_channel(GLenum internalFormat);
extern GLboolean
_mesa_is_compressed_format(const struct gl_context *ctx, GLenum format);

View File

@ -910,8 +910,7 @@ read_pixels_es3_error_check(struct gl_context *ctx, GLenum format, GLenum type,
const GLenum data_type = _mesa_get_format_datatype(rb->Format);
GLboolean is_unsigned_int = GL_FALSE;
GLboolean is_signed_int = GL_FALSE;
GLboolean is_float_depth = (internalFormat == GL_DEPTH_COMPONENT32F) ||
(internalFormat == GL_DEPTH32F_STENCIL8);
GLboolean is_float_depth = _mesa_has_depth_float_channel(internalFormat);
is_unsigned_int = _mesa_is_enum_format_unsigned_int(internalFormat);
if (!is_unsigned_int) {