aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/enable.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/enable.c')
-rw-r--r--mesalib/src/mesa/main/enable.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c
index 3643cfb52..a607bdc10 100644
--- a/mesalib/src/mesa/main/enable.c
+++ b/mesalib/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.
@@ -1044,12 +1061,11 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL3.0 - GL_framebuffer_sRGB */
case GL_FRAMEBUFFER_SRGB_EXT:
- if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ if (!_mesa_is_desktop_gl(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:
@@ -1699,7 +1715,7 @@ _mesa_IsEnabled( GLenum cap )
/* GL3.0 - GL_framebuffer_sRGB */
case GL_FRAMEBUFFER_SRGB_EXT:
- if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ if (!_mesa_is_desktop_gl(ctx))
goto invalid_enum_error;
CHECK_EXTENSION(EXT_framebuffer_sRGB);
return ctx->Color.sRGBEnabled;