Mesa (master): mesa: Add and use _mesa_has_depth_float_channel
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Nov 13 19:01:49 UTC 2020
Module: Mesa
Branch: master
Commit: fda015023af5d0d2d844d5fde07a8c19e4d8f453
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fda015023af5d0d2d844d5fde07a8c19e4d8f453
Author: Nanley Chery <nanley.g.chery at intel.com>
Date: Thu Nov 5 15:45:44 2020 -0800
mesa: Add and use _mesa_has_depth_float_channel
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7410>
---
src/mesa/main/glformats.c | 9 +++++++++
src/mesa/main/glformats.h | 3 +++
src/mesa/main/readpix.c | 3 +--
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 1d528f4bff5..f98d189c8e6 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -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.
diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
index 0a65ef6cace..90438ffba0d 100644
--- a/src/mesa/main/glformats.h
+++ b/src/mesa/main/glformats.h
@@ -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);
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index bca9c0c90a4..5f9b4b9d159 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -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) {
More information about the mesa-commit
mailing list