diff options
author | Eric Anholt <[email protected]> | 2013-04-18 09:20:55 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2013-04-30 11:59:23 -0700 |
commit | e34c857639380303a43146a50cdd724774f59a2f (patch) | |
tree | 919d6ab25240cf3f46ebc452b0d682fa1a4c92e8 /src/mesa/main/blend.c | |
parent | db31bc5cfb7c08c1a32067b09d769c880bc4e954 (diff) |
mesa: Make a Mesa core function for sRGB render encoding handling.
v2: const-qualify ctx, and add a comment about the function (recommended
by Brian and Kenneth).
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]> (v1)
Diffstat (limited to 'src/mesa/main/blend.c')
-rw-r--r-- | src/mesa/main/blend.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 7413b156233..0c28352b236 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -856,6 +856,23 @@ _mesa_update_clamp_vertex_color(struct gl_context *ctx) ctx->Light._ClampVertexColor = _mesa_get_clamp_vertex_color(ctx); } +/** + * Returns an appropriate gl_format for color rendering based on the + * GL_FRAMEBUFFER_SRGB state. + * + * Some drivers implement GL_FRAMEBUFFER_SRGB using a flag on the blend state + * (which GL_FRAMEBUFFER_SRGB maps to reasonably), but some have to do so by + * overriding the format of the surface. This is a helper for doing the + * surface format override variant. + */ +gl_format +_mesa_get_render_format(const struct gl_context *ctx, gl_format format) +{ + if (ctx->Color.sRGBEnabled) + return format; + else + return _mesa_get_srgb_format_linear(format); +} /**********************************************************************/ /** \name Initialization */ |