aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/common/meta.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-09-27 15:09:52 +0200
committermarha <marha@users.sourceforge.net>2012-09-27 15:09:52 +0200
commit2cf1e3de4759264eac2fa8ac758ea750636542f8 (patch)
tree80298679c1f3134223c592ad3939739aee333eb8 /mesalib/src/mesa/drivers/common/meta.c
parent0ebcd32e91486caccc041c8ca23e39e160b24702 (diff)
downloadvcxsrv-2cf1e3de4759264eac2fa8ac758ea750636542f8.tar.gz
vcxsrv-2cf1e3de4759264eac2fa8ac758ea750636542f8.tar.bz2
vcxsrv-2cf1e3de4759264eac2fa8ac758ea750636542f8.zip
mesa xserver pixman xkeyboard-config git update 27 sep 2012
xserver 0b02150c27e98f996e10d7489f9f67a30e4e3497 pixman aff796d6cee4cb81f0352c2f7d0c994229bd5ca1 xkeyboard-config 33ccc8f4b3f1c6ae95242cf9cb19e8df87f6f37e mesa 6d6aef79742ece3bb570ae44e6c13791aae15e01
Diffstat (limited to 'mesalib/src/mesa/drivers/common/meta.c')
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c47
1 files changed, 20 insertions, 27 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 28a79b0a0..6689337e3 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -187,6 +187,9 @@ struct save_state
/** MESA_META_MULTISAMPLE */
GLboolean MultisampleEnabled;
+ /** MESA_META_FRAMEBUFFER_SRGB */
+ GLboolean sRGBEnabled;
+
/** Miscellaneous (always disabled) */
GLboolean Lighting;
GLboolean RasterDiscard;
@@ -773,6 +776,12 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
_mesa_set_multisample(ctx, GL_FALSE);
}
+ if (state & MESA_META_FRAMEBUFFER_SRGB) {
+ save->sRGBEnabled = ctx->Color.sRGBEnabled;
+ if (ctx->Color.sRGBEnabled)
+ _mesa_set_framebuffer_srgb(ctx, GL_FALSE);
+ }
+
/* misc */
{
save->Lighting = ctx->Light.Enabled;
@@ -1075,6 +1084,11 @@ _mesa_meta_end(struct gl_context *ctx)
_mesa_set_multisample(ctx, save->MultisampleEnabled);
}
+ if (state & MESA_META_FRAMEBUFFER_SRGB) {
+ if (ctx->Color.sRGBEnabled != save->sRGBEnabled)
+ _mesa_set_framebuffer_srgb(ctx, save->sRGBEnabled);
+ }
+
/* misc */
if (save->Lighting) {
_mesa_set_enable(ctx, GL_LIGHTING, GL_TRUE);
@@ -1394,7 +1408,6 @@ blitframebuffer_texture(struct gl_context *ctx,
const GLuint srcLevel = readAtt->TextureLevel;
const GLint baseLevelSave = texObj->BaseLevel;
const GLint maxLevelSave = texObj->MaxLevel;
- const GLenum fbo_srgb_save = ctx->Color.sRGBEnabled;
const GLenum target = texObj->Target;
GLuint sampler, samplerSave =
ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ?
@@ -1433,15 +1446,14 @@ blitframebuffer_texture(struct gl_context *ctx,
_mesa_SamplerParameteri(sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
_mesa_SamplerParameteri(sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- /* Always do our blits with no sRGB decode or encode.*/
+ /* Always do our blits with no sRGB decode or encode. Note that
+ * GL_FRAMEBUFFER_SRGB has already been disabled by
+ * _mesa_meta_begin().
+ */
if (ctx->Extensions.EXT_texture_sRGB_decode) {
_mesa_SamplerParameteri(sampler, GL_TEXTURE_SRGB_DECODE_EXT,
GL_SKIP_DECODE_EXT);
}
- if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_framebuffer_sRGB)
- || _mesa_is_gles3(ctx)) {
- _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
- }
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
_mesa_set_enable(ctx, target, GL_TRUE);
@@ -1500,9 +1512,6 @@ blitframebuffer_texture(struct gl_context *ctx,
_mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, baseLevelSave);
_mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
}
- if (ctx->Extensions.EXT_framebuffer_sRGB && fbo_srgb_save) {
- _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_TRUE);
- }
_mesa_BindSampler(ctx->Texture.CurrentUnit, samplerSave);
_mesa_DeleteSamplers(1, &sampler);
@@ -1713,7 +1722,8 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers)
GLbitfield metaSave = (MESA_META_ALL -
MESA_META_SCISSOR -
MESA_META_PIXEL_STORE -
- MESA_META_CONDITIONAL_RENDER);
+ MESA_META_CONDITIONAL_RENDER -
+ MESA_META_FRAMEBUFFER_SRGB);
const GLuint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
if (buffers & BUFFER_BITS_COLOR) {
@@ -3236,7 +3246,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
const GLuint maxLevel = texObj->MaxLevel;
const GLint maxLevelSave = texObj->MaxLevel;
const GLboolean genMipmapSave = texObj->GenerateMipmap;
- const GLenum srgbBufferSave = ctx->Color.sRGBEnabled;
const GLuint fboSave = ctx->DrawBuffer->Name;
const GLuint currentTexUnitSave = ctx->Texture.CurrentUnit;
const GLboolean use_glsl_version = ctx->Extensions.ARB_vertex_shader &&
@@ -3330,12 +3339,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
else
assert(!genMipmapSave);
- if ((ctx->Extensions.EXT_framebuffer_sRGB &&
- _mesa_is_desktop_gl(ctx)) ||
- _mesa_is_gles3(ctx)) {
- _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
- }
-
/* Setup texture coordinates */
setup_texture_coords(faceTarget,
slice,
@@ -3452,10 +3455,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
- if (ctx->Extensions.EXT_framebuffer_sRGB && srgbBufferSave) {
- _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_TRUE);
- }
-
_mesa_lock_texture(ctx, texObj); /* relock */
_mesa_BindSampler(ctx->Texture.CurrentUnit, samplerSave);
@@ -3734,12 +3733,6 @@ decompress_texture_image(struct gl_context *ctx,
_mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, texImage->Level);
}
- /* No sRGB decode or encode.*/
- if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_framebuffer_sRGB)
- || _mesa_is_gles3(ctx)) {
- _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
- }
-
/* render quad w/ texture into renderbuffer */
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);