diff options
Diffstat (limited to 'mesalib/src/mesa/main/samplerobj.c')
-rw-r--r-- | mesalib/src/mesa/main/samplerobj.c | 65 |
1 files changed, 59 insertions, 6 deletions
diff --git a/mesalib/src/mesa/main/samplerobj.c b/mesalib/src/mesa/main/samplerobj.c index 5d1b2adbb..dc8adfc3f 100644 --- a/mesalib/src/mesa/main/samplerobj.c +++ b/mesalib/src/mesa/main/samplerobj.c @@ -133,10 +133,8 @@ _mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name) sampObj->CompareFailValue = 0.0; sampObj->sRGBDecode = GL_DECODE_EXT; sampObj->CubeMapSeamless = GL_FALSE; - sampObj->DepthMode = 0; } - /** * Fallback for ctx->Driver.NewSamplerObject(); */ @@ -162,7 +160,7 @@ _mesa_delete_sampler_object(struct gl_context *ctx, } -static void GLAPIENTRY +void GLAPIENTRY _mesa_GenSamplers(GLsizei count, GLuint *samplers) { GET_CURRENT_CONTEXT(ctx); @@ -194,7 +192,7 @@ _mesa_GenSamplers(GLsizei count, GLuint *samplers) } -static void GLAPIENTRY +void GLAPIENTRY _mesa_DeleteSamplers(GLsizei count, const GLuint *samplers) { GET_CURRENT_CONTEXT(ctx); @@ -244,7 +242,7 @@ _mesa_IsSampler(GLuint sampler) } -static void GLAPIENTRY +void GLAPIENTRY _mesa_BindSampler(GLuint unit, GLuint sampler) { struct gl_sampler_object *sampObj; @@ -584,8 +582,25 @@ 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; -static void GLAPIENTRY + 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; +} + +void GLAPIENTRY _mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param) { struct gl_sampler_object *sampObj; @@ -636,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: @@ -720,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: @@ -801,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]; @@ -892,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; @@ -974,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; @@ -1057,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; @@ -1151,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; } @@ -1224,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; } @@ -1298,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; } @@ -1372,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; } |