Mesa (master): cso: Add set_vertex_samplers function

Jakob Bornecrantz wallbraker at kemper.freedesktop.org
Mon Jan 18 00:14:49 UTC 2010


Module: Mesa
Branch: master
Commit: 90cdf0d67c1086a8fd274689aa2e1b8da3a9ebdc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=90cdf0d67c1086a8fd274689aa2e1b8da3a9ebdc

Author: Jakob Bornecrantz <jakob at vmware.com>
Date:   Mon Jan 18 00:07:24 2010 +0000

cso: Add set_vertex_samplers function

---

 src/gallium/auxiliary/cso_cache/cso_context.c |   32 +++++++++++++++++++++++++
 src/gallium/auxiliary/cso_cache/cso_context.h |    4 +++
 2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 2b16332..fdfb5fa 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -539,6 +539,38 @@ void cso_restore_samplers(struct cso_context *ctx)
    cso_single_sampler_done( ctx );
 }
 
+/*
+ * If the function encouters any errors it will return the
+ * last one. Done to always try to set as many samplers
+ * as possible.
+ */
+enum pipe_error cso_set_vertex_samplers(struct cso_context *ctx,
+                                        unsigned nr,
+                                        const struct pipe_sampler_state **templates)
+{
+   unsigned i;
+   enum pipe_error temp, error = PIPE_OK;
+
+   /* TODO: fastpath
+    */
+
+   for (i = 0; i < nr; i++) {
+      temp = cso_single_vertex_sampler( ctx, i, templates[i] );
+      if (temp != PIPE_OK)
+         error = temp;
+   }
+
+   for ( ; i < ctx->nr_samplers; i++) {
+      temp = cso_single_vertex_sampler( ctx, i, NULL );
+      if (temp != PIPE_OK)
+         error = temp;
+   }
+
+   cso_single_vertex_sampler_done( ctx );
+
+   return error;
+}
+
 void
 cso_save_vertex_samplers(struct cso_context *ctx)
 {
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h
index b9e313e..d2089b1 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.h
+++ b/src/gallium/auxiliary/cso_cache/cso_context.h
@@ -84,6 +84,10 @@ enum pipe_error cso_single_sampler( struct cso_context *cso,
 
 void cso_single_sampler_done( struct cso_context *cso );
 
+enum pipe_error cso_set_vertex_samplers(struct cso_context *cso,
+                                        unsigned count,
+                                        const struct pipe_sampler_state **states);
+
 void
 cso_save_vertex_samplers(struct cso_context *cso);
 




More information about the mesa-commit mailing list