diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/samplerobj.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c index 8c54c9a4c34..5bb90cf72f0 100644 --- a/src/mesa/main/samplerobj.c +++ b/src/mesa/main/samplerobj.c @@ -582,6 +582,23 @@ set_sampler_cube_map_seamless(struct gl_context *ctx, return GL_TRUE; } +static GLuint +set_sampler_srgb_decode(struct gl_context *ctx, + struct gl_sampler_object *samp, GLenum param) +{ + if (!ctx->Extensions.EXT_texture_sRGB_decode) + return INVALID_PNAME; + + if (samp->sRGBDecode == param) + return GL_FALSE; + + if (param != GL_DECODE_EXT && param != GL_SKIP_DECODE_EXT) + return INVALID_VALUE; + + flush(ctx); + samp->sRGBDecode = param; + return GL_TRUE; +} static void GLAPIENTRY _mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param) @@ -634,6 +651,9 @@ _mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param) case GL_TEXTURE_CUBE_MAP_SEAMLESS: res = set_sampler_cube_map_seamless(ctx, sampObj, param); break; + case GL_TEXTURE_SRGB_DECODE_EXT: + res = set_sampler_srgb_decode(ctx, sampObj, param); + break; case GL_TEXTURE_BORDER_COLOR: /* fall-through */ default: @@ -718,6 +738,9 @@ _mesa_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) case GL_TEXTURE_CUBE_MAP_SEAMLESS: res = set_sampler_cube_map_seamless(ctx, sampObj, (GLboolean) param); break; + case GL_TEXTURE_SRGB_DECODE_EXT: + res = set_sampler_srgb_decode(ctx, sampObj, (GLenum) param); + break; case GL_TEXTURE_BORDER_COLOR: /* fall-through */ default: @@ -799,6 +822,9 @@ _mesa_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params) case GL_TEXTURE_CUBE_MAP_SEAMLESS: res = set_sampler_cube_map_seamless(ctx, sampObj, params[0]); break; + case GL_TEXTURE_SRGB_DECODE_EXT: + res = set_sampler_srgb_decode(ctx, sampObj, params[0]); + break; case GL_TEXTURE_BORDER_COLOR: { GLfloat c[4]; @@ -890,6 +916,9 @@ _mesa_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params) case GL_TEXTURE_CUBE_MAP_SEAMLESS: res = set_sampler_cube_map_seamless(ctx, sampObj, (GLboolean) params[0]); break; + case GL_TEXTURE_SRGB_DECODE_EXT: + res = set_sampler_srgb_decode(ctx, sampObj, (GLenum) params[0]); + break; case GL_TEXTURE_BORDER_COLOR: res = set_sampler_border_colorf(ctx, sampObj, params); break; @@ -972,6 +1001,9 @@ _mesa_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params) case GL_TEXTURE_CUBE_MAP_SEAMLESS: res = set_sampler_cube_map_seamless(ctx, sampObj, params[0]); break; + case GL_TEXTURE_SRGB_DECODE_EXT: + res = set_sampler_srgb_decode(ctx, sampObj, (GLenum) params[0]); + break; case GL_TEXTURE_BORDER_COLOR: res = set_sampler_border_colori(ctx, sampObj, params); break; @@ -1055,6 +1087,9 @@ _mesa_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params) case GL_TEXTURE_CUBE_MAP_SEAMLESS: res = set_sampler_cube_map_seamless(ctx, sampObj, params[0]); break; + case GL_TEXTURE_SRGB_DECODE_EXT: + res = set_sampler_srgb_decode(ctx, sampObj, (GLenum) params[0]); + break; case GL_TEXTURE_BORDER_COLOR: res = set_sampler_border_colorui(ctx, sampObj, params); break; @@ -1149,6 +1184,11 @@ _mesa_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params) goto invalid_pname; *params = sampObj->CubeMapSeamless; break; + case GL_TEXTURE_SRGB_DECODE_EXT: + if (!ctx->Extensions.EXT_texture_sRGB_decode) + goto invalid_pname; + *params = (GLenum) sampObj->sRGBDecode; + break; default: goto invalid_pname; } @@ -1222,6 +1262,11 @@ _mesa_GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params) goto invalid_pname; *params = (GLfloat) sampObj->CubeMapSeamless; break; + case GL_TEXTURE_SRGB_DECODE_EXT: + if (!ctx->Extensions.EXT_texture_sRGB_decode) + goto invalid_pname; + *params = (GLfloat) sampObj->sRGBDecode; + break; default: goto invalid_pname; } @@ -1296,6 +1341,11 @@ _mesa_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params) goto invalid_pname; *params = sampObj->CubeMapSeamless; break; + case GL_TEXTURE_SRGB_DECODE_EXT: + if (!ctx->Extensions.EXT_texture_sRGB_decode) + goto invalid_pname; + *params = (GLenum) sampObj->sRGBDecode; + break; default: goto invalid_pname; } @@ -1370,6 +1420,11 @@ _mesa_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params) goto invalid_pname; *params = sampObj->CubeMapSeamless; break; + case GL_TEXTURE_SRGB_DECODE_EXT: + if (!ctx->Extensions.EXT_texture_sRGB_decode) + goto invalid_pname; + *params = (GLenum) sampObj->sRGBDecode; + break; default: goto invalid_pname; } |