[Mesa-dev] [PATCH 2/4] mesa: Add helper function to see if we have a float depth format.

Mathias.Froehlich at gmx.net Mathias.Froehlich at gmx.net
Sun Sep 14 07:07:37 PDT 2014


From: Mathias Fröhlich <Mathias.Froehlich at gmx.net>

Will be used in the implementation of NV_depth_buffer_float.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich at web.de
---
 src/mesa/main/glformats.c | 18 ++++++++++++++++++
 src/mesa/main/glformats.h |  3 +++
 2 files changed, 21 insertions(+)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 00478f9..16f7d6b 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -983,6 +983,24 @@ _mesa_is_depth_or_stencil_format(GLenum format)
 
 
 /**
+ * Test if the given image format is a float depth format.
+ */
+GLboolean
+_mesa_is_float_depth_format(GLenum format)
+{
+   switch (format) {
+      case GL_DEPTH_COMPONENT32F:
+      case GL_DEPTH_COMPONENT32F_NV:
+      case GL_DEPTH32F_STENCIL8:
+      case GL_DEPTH32F_STENCIL8_NV:
+         return GL_TRUE;
+      default:
+         return GL_FALSE;
+   }
+}
+
+
+/**
  * Test if an image format is a supported compressed format.
  * \param format the internal format token provided by the user.
  * \return GL_TRUE if compressed, GL_FALSE if uncompressed
diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
index 7b03215..a960786 100644
--- a/src/mesa/main/glformats.h
+++ b/src/mesa/main/glformats.h
@@ -93,6 +93,9 @@ extern GLboolean
 _mesa_is_depth_or_stencil_format(GLenum format);
 
 extern GLboolean
+_mesa_is_float_depth_format(GLenum format);
+
+extern GLboolean
 _mesa_is_compressed_format(struct gl_context *ctx, GLenum format);
 
 extern GLenum
-- 
1.9.3



More information about the mesa-dev mailing list