summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorJakob Bornecrantz <[email protected]>2010-01-18 00:07:24 +0000
committerJakob Bornecrantz <[email protected]>2010-01-18 00:12:42 +0000
commit90cdf0d67c1086a8fd274689aa2e1b8da3a9ebdc (patch)
treebf71731b0981d453e1026ee8ab9be70eb85a9212 /src/gallium/auxiliary
parent2a60302e51987ae65455b083fa3d9e9bb0e2087b (diff)
cso: Add set_vertex_samplers function
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c32
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.h4
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 2b16332e143..fdfb5faa59e 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 b9e313e32d6..d2089b1c883 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);