[Mesa-dev] [PATCH 01/18] mesa: Add _mesa_set_sampler_wrap method

Ian Romanick idr at freedesktop.org
Fri Jan 8 18:59:07 PST 2016


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/main/samplerobj.c | 16 ++++++++++++++++
 src/mesa/main/samplerobj.h |  4 ++++
 2 files changed, 20 insertions(+)

diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
index 676dd36..17b3400 100644
--- a/src/mesa/main/samplerobj.c
+++ b/src/mesa/main/samplerobj.c
@@ -444,6 +444,22 @@ flush(struct gl_context *ctx)
    FLUSH_VERTICES(ctx, _NEW_TEXTURE);
 }
 
+void
+_mesa_set_sampler_wrap(struct gl_context *ctx, struct gl_sampler_object *samp,
+                       GLenum s, GLenum t, GLenum r)
+{
+   assert(validate_texture_wrap_mode(ctx, s));
+   assert(validate_texture_wrap_mode(ctx, t));
+   assert(validate_texture_wrap_mode(ctx, r));
+
+   if (samp->WrapS == s && samp->WrapT == t && samp->WrapR == r)
+      return;
+
+   flush(ctx);
+   samp->WrapS = s;
+   samp->WrapT = t;
+   samp->WrapR = r;
+}
 
 #define INVALID_PARAM 0x100
 #define INVALID_PNAME 0x101
diff --git a/src/mesa/main/samplerobj.h b/src/mesa/main/samplerobj.h
index 7bea911..1817c1a 100644
--- a/src/mesa/main/samplerobj.h
+++ b/src/mesa/main/samplerobj.h
@@ -80,6 +80,10 @@ _mesa_new_sampler_object(struct gl_context *ctx, GLuint name);
 extern void
 _mesa_init_sampler_object_functions(struct dd_function_table *driver);
 
+extern void
+_mesa_set_sampler_wrap(struct gl_context *ctx, struct gl_sampler_object *samp,
+                       GLenum s, GLenum t, GLenum r);
+
 void GLAPIENTRY
 _mesa_GenSamplers(GLsizei count, GLuint *samplers);
 void GLAPIENTRY
-- 
2.5.0



More information about the mesa-dev mailing list