summaryrefslogtreecommitdiff
path: root/src/mesa/main/samplerobj.c
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2015-11-09 11:59:19 -0800
committerIan Romanick <ian.d.romanick@intel.com>2016-01-11 15:38:03 -0800
commitecba76d3c0f644c5f3ca84a7b40ea799a9eaf165 (patch)
tree7d10d39a756d82429f873594108f77ca774b99f1 /src/mesa/main/samplerobj.c
parent08822b4b43e3bc51bbcc42ab01ba1095b30a9298 (diff)
mesa: Add _mesa_set_sampler_filters method
v2: Add filter enum assertions. Suggested by Jason. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Diffstat (limited to 'src/mesa/main/samplerobj.c')
-rw-r--r--src/mesa/main/samplerobj.c21
1 files changed, 21 insertions, 0 deletions
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,