Mesa (master): mesa: EXT_framebuffer_sRGB interface additions.
Dave Airlie
airlied at kemper.freedesktop.org
Fri Jan 21 10:07:54 UTC 2011
Module: Mesa
Branch: master
Commit: a637280e42b9a2f4ccbb5e7b209c5645073f584e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a637280e42b9a2f4ccbb5e7b209c5645073f584e
Author: Dave Airlie <airlied at redhat.com>
Date: Mon Jan 17 09:45:26 2011 +1000
mesa: EXT_framebuffer_sRGB interface additions.
This adds the get/enable enums and internal gl_config storage
for this extension.
In theory this is all that is needed to enable this extension
from what I can see, since its not mandatory to implement the
features if you don't advertise the visuals or the fb configs.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/mesa/main/enable.c | 11 +++++++++++
src/mesa/main/get.c | 5 +++++
src/mesa/main/mtypes.h | 5 +++++
3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index d047586..c4c4e1b 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -968,6 +968,12 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
}
break;
+ /* GL3.0 - GL_framebuffer_sRGB */
+ case GL_FRAMEBUFFER_SRGB_EXT:
+ CHECK_EXTENSION(EXT_framebuffer_sRGB, cap);
+ ctx->Color.sRGBEnabled = state;
+ break;
+
default:
goto invalid_enum_error;
}
@@ -1480,6 +1486,11 @@ _mesa_IsEnabled( GLenum cap )
}
return ctx->Array.PrimitiveRestart;
+ /* GL3.0 - GL_framebuffer_sRGB */
+ case GL_FRAMEBUFFER_SRGB_EXT:
+ CHECK_EXTENSION(EXT_framebuffer_sRGB);
+ return ctx->Color.sRGBEnabled;
+
default:
goto invalid_enum_error;
}
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index e223cf4..fa7aa11 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -317,6 +317,7 @@ EXTRA_EXT2(ARB_vertex_program, ARB_fragment_program);
EXTRA_EXT(ARB_vertex_buffer_object);
EXTRA_EXT(ARB_geometry_shader4);
EXTRA_EXT(ARB_copy_buffer);
+EXTRA_EXT(EXT_framebuffer_sRGB);
static const int
extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = {
@@ -1238,6 +1239,10 @@ static const struct value_desc values[] = {
{ GL_MINOR_VERSION, CONTEXT_INT(VersionMinor), extra_version_30 },
{ GL_CONTEXT_FLAGS, CONTEXT_INT(Const.ContextFlags), extra_version_30 },
+ /* GL3.0 / GL_EXT_framebuffer_sRGB */
+ { GL_FRAMEBUFFER_SRGB_EXT, CONTEXT_BOOL(Color.sRGBEnabled), extra_EXT_framebuffer_sRGB },
+ { GL_FRAMEBUFFER_SRGB_CAPABLE_EXT, BUFFER_INT(Visual.sRGBCapable), extra_EXT_framebuffer_sRGB },
+
/* GL 3.1 */
/* NOTE: different enum values for GL_PRIMITIVE_RESTART_NV
* vs. GL_PRIMITIVE_RESTART!
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 49dad4d..34003b4 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -524,6 +524,9 @@ struct gl_config
GLint bindToMipmapTexture;
GLint bindToTextureTargets;
GLint yInverted;
+
+ /* EXT_framebuffer_sRGB */
+ GLint sRGBCapable;
};
@@ -754,6 +757,8 @@ struct gl_colorbuffer_attrib
GLenum ClampFragmentColor; /**< GL_TRUE, GL_FALSE or GL_FIXED_ONLY_ARB */
GLenum ClampReadColor; /**< GL_TRUE, GL_FALSE or GL_FIXED_ONLY_ARB */
+
+ GLboolean sRGBEnabled; /**< Framebuffer sRGB blending/updating requested */
};
More information about the mesa-commit
mailing list