diff options
author | Dave Airlie <[email protected]> | 2011-01-13 12:12:21 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2011-01-16 12:54:06 +1000 |
commit | edc2dd8e4788e556d445c9f59974ed95b33c2bbc (patch) | |
tree | 414f98866a8197661563ec673806ead56de3afc7 /src/mesa/main/texparam.c | |
parent | ac6334145ec8eef42505cdd727aed7fae0831e12 (diff) |
mesa/swrast: implement EXT_texture_sRGB_decode
This implements the extension by choosing a different set of texture
fetch functions when the texture parameter changes.
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/main/texparam.c')
-rw-r--r-- | src/mesa/main/texparam.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index d2b8b5ca4ad..29e409d0b8c 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -41,6 +41,7 @@ #include "main/texparam.h" #include "main/teximage.h" #include "main/texstate.h" +#include "main/texfetch.h" #include "program/prog_instruction.h" @@ -419,7 +420,20 @@ set_tex_parameteri(struct gl_context *ctx, } _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname); return GL_FALSE; - + case GL_TEXTURE_SRGB_DECODE_EXT: + if (ctx->Extensions.EXT_texture_sRGB_decode) { + GLenum decode = params[0]; + if (decode == GL_DECODE_EXT || decode == GL_SKIP_DECODE_EXT) { + if (texObj->sRGBDecode != decode) { + flush(ctx, texObj); + texObj->sRGBDecode = decode; + _mesa_update_fetch_functions(texObj); + } + return GL_TRUE; + } + } + _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname); + return GL_FALSE; default: _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname); } @@ -543,6 +557,7 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param) case GL_TEXTURE_COMPARE_MODE_ARB: case GL_TEXTURE_COMPARE_FUNC_ARB: case GL_DEPTH_TEXTURE_MODE_ARB: + case GL_TEXTURE_SRGB_DECODE_EXT: { /* convert float param to int */ GLint p[4]; @@ -591,6 +606,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) case GL_TEXTURE_COMPARE_MODE_ARB: case GL_TEXTURE_COMPARE_FUNC_ARB: case GL_DEPTH_TEXTURE_MODE_ARB: + case GL_TEXTURE_SRGB_DECODE_EXT: { /* convert float param to int */ GLint p[4]; |