Mesa (master): enable: Create _mesa_set_framebuffer_srgb() function for use by meta ops.

Paul Berry stereotype441 at kemper.freedesktop.org
Tue Sep 25 22:18:44 UTC 2012


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

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Mon Sep 24 14:24:28 2012 -0700

enable: Create _mesa_set_framebuffer_srgb() function for use by meta ops.

GLES3 supports sRGB formats, but it does not support the
GL_FRAMEBUFFER_SRGB enable/disable flag (instead it behaves as if this
flag is always enabled).  Therefore, meta ops that need to disable
GL_FRAMEBUFFER_SRGB will need a backdoor mechanism to do so when the
API is GLES3.

We were already doing a similar thing for GL_MULTISAMPLE, which has
the same constraints.

Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>

---

 src/mesa/main/enable.c |   22 +++++++++++++++++++---
 src/mesa/main/enable.h |    3 +++
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 3643cfb..676cd9b 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -264,6 +264,23 @@ _mesa_set_multisample(struct gl_context *ctx, GLboolean state)
 }
 
 /**
+ * Helper function to enable or disable GL_FRAMEBUFFER_SRGB, skipping the
+ * check for whether the API supports it (GLES doesn't).
+ */
+void
+_mesa_set_framebuffer_srgb(struct gl_context *ctx, GLboolean state)
+{
+   if (ctx->Color.sRGBEnabled == state)
+      return;
+   FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+   ctx->Color.sRGBEnabled = state;
+
+   if (ctx->Driver.Enable) {
+      ctx->Driver.Enable(ctx, GL_FRAMEBUFFER_SRGB, state);
+   }
+}
+
+/**
  * Helper function to enable or disable state.
  *
  * \param ctx GL context.
@@ -1047,9 +1064,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
          if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
             goto invalid_enum_error;
          CHECK_EXTENSION(EXT_framebuffer_sRGB, cap);
-         FLUSH_VERTICES(ctx, _NEW_BUFFERS);
-         ctx->Color.sRGBEnabled = state;
-         break;
+         _mesa_set_framebuffer_srgb(ctx, state);
+         return;
 
       /* GL_OES_EGL_image_external */
       case GL_TEXTURE_EXTERNAL_OES:
diff --git a/src/mesa/main/enable.h b/src/mesa/main/enable.h
index c49b494..be79094 100644
--- a/src/mesa/main/enable.h
+++ b/src/mesa/main/enable.h
@@ -70,6 +70,9 @@ _mesa_DisableClientState( GLenum cap );
 extern void
 _mesa_set_multisample(struct gl_context *ctx, GLboolean state);
 
+extern void
+_mesa_set_framebuffer_srgb(struct gl_context *ctx, GLboolean state);
+
 
 
 #endif




More information about the mesa-commit mailing list