Mesa (master): mesa: add missing SNORM formats in _mesa_base_fbo_format()

Brian Paul brianp at kemper.freedesktop.org
Thu Jan 9 18:37:00 UTC 2014


Module: Mesa
Branch: master
Commit: 513a324b885689702f32d9ffa1432c4212d899ad
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=513a324b885689702f32d9ffa1432c4212d899ad

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Jan  8 09:05:29 2014 -0700

mesa: add missing SNORM formats in _mesa_base_fbo_format()

We weren't handling the LUMINANCE_SNORM, LUMINANCE_ALPHA_SNORM and
INTENSITY_SNORM cases.  Note that adding these cases here does not
require a driver to support rendering to these surface types.  If
the driver can't do it we'll report an incomplete framebuffer.

NVIDIA doesn't support GL_EXT_texture_snorm but their driver
accepts these formats in glRenderBufferStorage().

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>

---

 src/mesa/main/fbobject.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 2892784..d846808 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1504,6 +1504,22 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
       return ctx->API == API_OPENGL_COMPAT &&
              ctx->Extensions.EXT_texture_snorm &&
              ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
+   case GL_LUMINANCE_SNORM:
+   case GL_LUMINANCE8_SNORM:
+   case GL_LUMINANCE16_SNORM:
+      return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
+         ? GL_LUMINANCE : 0;
+   case GL_LUMINANCE_ALPHA_SNORM:
+   case GL_LUMINANCE8_ALPHA8_SNORM:
+   case GL_LUMINANCE16_ALPHA16_SNORM:
+      return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
+         ? GL_LUMINANCE_ALPHA : 0;
+   case GL_INTENSITY_SNORM:
+   case GL_INTENSITY8_SNORM:
+   case GL_INTENSITY16_SNORM:
+      return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
+         ? GL_INTENSITY : 0;
+
    case GL_R16F:
    case GL_R32F:
       return ((_mesa_is_desktop_gl(ctx) &&




More information about the mesa-commit mailing list