[Mesa-dev] [PATCH 1/2] meta: Don't do srgb to linear decode when blitting srgb textures.

Eric Anholt eric at anholt.net
Fri Jun 3 13:52:58 PDT 2011


On Thu, 02 Jun 2011 14:41:06 -0700, Ian Romanick <idr at freedesktop.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 06/01/2011 01:17 PM, Eric Anholt wrote:
> > Fixes the GL_SRGB8_ALPHA8 -> GL_RGBA8 blits in fbo-srgb-blit.c
> > ---
> >  src/mesa/drivers/common/meta.c |   10 ++++++++++
> >  1 files changed, 10 insertions(+), 0 deletions(-)
> > 
> > diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
> > index 08b6024..a0d4b9e 100644
> > --- a/src/mesa/drivers/common/meta.c
> > +++ b/src/mesa/drivers/common/meta.c
> > @@ -1186,6 +1186,7 @@ blitframebuffer_texture(struct gl_context *ctx,
> >           const GLint maxLevelSave = texObj->MaxLevel;
> >           const GLenum wrapSSave = texObj->Sampler.WrapS;
> >           const GLenum wrapTSave = texObj->Sampler.WrapT;
> > +         const GLenum srgbSave = texObj->Sampler.sRGBDecode;
> >           const GLenum target = texObj->Target;
> >  
> >           if (drawAtt->Texture == readAtt->Texture) {
> > @@ -1217,6 +1218,12 @@ blitframebuffer_texture(struct gl_context *ctx,
> >           }
> >           _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
> >           _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
> > +
> > +	 if (ctx->Extensions.EXT_texture_sRGB_decode) {
> > +	    _mesa_TexParameteri(target, GL_TEXTURE_SRGB_DECODE_EXT,
> > +				GL_SKIP_DECODE_EXT);
> > +	 }
> > +
> 
> Should we skip this block and the other block if srgbSave is already
> GL_SKIP_DECODE_EXT?  I guess maybe it doesn't matter that much.  We just
> seem to be accumulating a lot potentially extraneous state changes in
> metaops.  We always tell app developers to not do that, so...

The things we call almost always do "if (state == new_state) return", so
I don't see it necessarily being a win to avoid the function call in
exchange for another branch in the call-it-anyway case.  Except of
course that everything starts with ASSERT_OUTSIDE_BEGIN_END, which seems
to me like something that ought to be handled by swapping dispatch
tables while we're inside begin/end.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110603/4a2855b4/attachment.pgp>


More information about the mesa-dev mailing list