From: Ian Romanick Date: Mon, 9 Nov 2015 19:59:19 +0000 (-0800) Subject: mesa: Add _mesa_set_sampler_filters method X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ecba76d3c0f644c5f3ca84a7b40ea799a9eaf165;p=mesa.git mesa: Add _mesa_set_sampler_filters method v2: Add filter enum assertions. Suggested by Jason. Signed-off-by: Ian Romanick Reviewed-by: Jason Ekstrand --- diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c index 17b34005263..d74435eaf8b 100644 --- a/src/mesa/main/samplerobj.c +++ b/src/mesa/main/samplerobj.c @@ -509,6 +509,27 @@ set_sampler_wrap_r(struct gl_context *ctx, struct gl_sampler_object *samp, return INVALID_PARAM; } +void +_mesa_set_sampler_filters(struct gl_context *ctx, + struct gl_sampler_object *samp, + GLenum min_filter, GLenum mag_filter) +{ + assert(min_filter == GL_NEAREST || + min_filter == GL_LINEAR || + min_filter == GL_NEAREST_MIPMAP_NEAREST || + min_filter == GL_LINEAR_MIPMAP_NEAREST || + min_filter == GL_NEAREST_MIPMAP_LINEAR || + min_filter == GL_LINEAR_MIPMAP_LINEAR); + assert(mag_filter == GL_NEAREST || + mag_filter == GL_LINEAR); + + if (samp->MinFilter == min_filter && samp->MagFilter == mag_filter) + return; + + flush(ctx); + samp->MinFilter = min_filter; + samp->MagFilter = mag_filter; +} static GLuint set_sampler_min_filter(struct gl_context *ctx, struct gl_sampler_object *samp, diff --git a/src/mesa/main/samplerobj.h b/src/mesa/main/samplerobj.h index 1817c1a4468..c35052e0ac3 100644 --- a/src/mesa/main/samplerobj.h +++ b/src/mesa/main/samplerobj.h @@ -84,6 +84,11 @@ extern void _mesa_set_sampler_wrap(struct gl_context *ctx, struct gl_sampler_object *samp, GLenum s, GLenum t, GLenum r); +extern void +_mesa_set_sampler_filters(struct gl_context *ctx, + struct gl_sampler_object *samp, + GLenum min_filter, GLenum mag_filter); + void GLAPIENTRY _mesa_GenSamplers(GLsizei count, GLuint *samplers); void GLAPIENTRY