[Mesa-dev] [PATCH 08/12] mesa/main: Modify generate_mipmap_compressed to cope with float textures

Neil Roberts neil at linux.intel.com
Wed Aug 6 09:27:53 PDT 2014


Once we add BPTC texture support we will need to generate mipmaps for
compressed floating point textures too. Most of the code seems to already be
there but it just needs a few extra lines to get it to use GL_FLOAT instead of
GL_UNSIGNED_BYTE as the type for the temporary buffers.
---
 src/mesa/main/mipmap.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index cc109cc..fdaa682 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -2038,12 +2038,15 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
 
    components = _mesa_format_num_components(temp_format);
 
-   /* Revisit this if we get compressed formats with >8 bits per component */
-   if (_mesa_get_format_datatype(srcImage->TexFormat)
-       == GL_SIGNED_NORMALIZED) {
+   switch (_mesa_get_format_datatype(srcImage->TexFormat)) {
+   case GL_FLOAT:
+      temp_datatype = GL_FLOAT;
+      break;
+   case GL_SIGNED_NORMALIZED:
+      /* Revisit this if we get compressed formats with >8 bits per component */
       temp_datatype = GL_BYTE;
-   }
-   else {
+      break;
+   default:
       temp_datatype = GL_UNSIGNED_BYTE;
    }
 
-- 
1.9.3



More information about the mesa-dev mailing list