summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2011-01-28 14:16:00 +1000
committerDave Airlie <[email protected]>2011-02-05 17:06:30 +1000
commit88ffa9ce5b8e5fe2b93238f8b9a7a888be28324e (patch)
treef59e467d5cc03f938f9c4326c72029b9ef08dbc9 /src/mesa/main
parent5c3f1cdbbeb4d787bad7729ccd3f10aa78d113ac (diff)
mesa/965: add support for GL_EXT_framebuffer_sRGB (v2)
This adds i965 support for GL_EXT_framebuffer_sRGB, it introduces a new constant to say that the driver can support sRGB enabled FBOs since enabling the extension doesn't mean the driver can actually support sRGB. Also adds the suggested state flush in the core code suggested by Brian. fix the ARB_fbo color encoding. Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/enable.c7
-rw-r--r--src/mesa/main/fbobject.c2
-rw-r--r--src/mesa/main/framebuffer.c2
-rw-r--r--src/mesa/main/mtypes.h3
4 files changed, 10 insertions, 4 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index c4c4e1bb29d..d34c6ff9085 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -970,9 +970,10 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL3.0 - GL_framebuffer_sRGB */
case GL_FRAMEBUFFER_SRGB_EXT:
- CHECK_EXTENSION(EXT_framebuffer_sRGB, cap);
- ctx->Color.sRGBEnabled = state;
- break;
+ CHECK_EXTENSION(EXT_framebuffer_sRGB, cap);
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+ ctx->Color.sRGBEnabled = state;
+ break;
default:
goto invalid_enum_error;
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 04f02ce37e3..97cbd3c614d 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2157,7 +2157,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
"glGetFramebufferAttachmentParameterivEXT(pname)");
}
else {
- if (ctx->Extensions.EXT_framebuffer_sRGB) {
+ if (ctx->Extensions.EXT_framebuffer_sRGB && ctx->Const.sRGBCapable) {
*params = _mesa_get_format_color_encoding(att->Renderbuffer->Format);
}
else {
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 63da71c95b4..948b3b7b5a2 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -553,6 +553,8 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx,
+ fb->Visual.greenBits + fb->Visual.blueBits;
fb->Visual.floatMode = GL_FALSE;
fb->Visual.samples = rb->NumSamples;
+ if (_mesa_get_format_color_encoding(fmt) == GL_SRGB)
+ fb->Visual.sRGBCapable = ctx->Const.sRGBCapable;
break;
}
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 37f39ceef35..4e762123912 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2710,6 +2710,9 @@ struct gl_constants
/** GL_EXT_gpu_shader4 */
GLint MinProgramTexelOffset, MaxProgramTexelOffset;
+
+ /* GL_EXT_framebuffer_sRGB */
+ GLboolean sRGBCapable; /* can enable sRGB blend/update on FBOs */
};