summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/cso_cache
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2012-04-11 15:51:13 +0200
committerMarek Olšák <maraeo@gmail.com>2012-04-24 01:39:21 +0200
commit76eefcc70cc62db7d226591de3f918ff102f6de3 (patch)
treee67cd8cab1cff35759deeecbde736aa24947248e /src/gallium/auxiliary/cso_cache
parentd9c9c7a1119abd3f1d5461ad4e8ee1f11e80ca6f (diff)
downloadexternal_mesa3d-76eefcc70cc62db7d226591de3f918ff102f6de3.zip
external_mesa3d-76eefcc70cc62db7d226591de3f918ff102f6de3.tar.gz
external_mesa3d-76eefcc70cc62db7d226591de3f918ff102f6de3.tar.bz2
cso: add set_index_buffer and draw_vbo passthrough functions
v2: use util_draw_init_info Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/cso_cache')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c35
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.h13
2 files changed, 48 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 43b8343..9ec7a2a 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -36,6 +36,7 @@
*/
#include "pipe/p_state.h"
+#include "util/u_draw.h"
#include "util/u_framebuffer.h"
#include "util/u_inlines.h"
#include "util/u_math.h"
@@ -1290,3 +1291,37 @@ cso_restore_stream_outputs(struct cso_context *ctx)
ctx->nr_so_targets = ctx->nr_so_targets_saved;
ctx->nr_so_targets_saved = 0;
}
+
+/* drawing */
+
+void
+cso_set_index_buffer(struct cso_context *cso,
+ const struct pipe_index_buffer *ib)
+{
+ struct pipe_context *pipe = cso->pipe;
+ pipe->set_index_buffer(pipe, ib);
+}
+
+void
+cso_draw_vbo(struct cso_context *cso,
+ const struct pipe_draw_info *info)
+{
+ struct pipe_context *pipe = cso->pipe;
+ pipe->draw_vbo(pipe, info);
+}
+
+void
+cso_draw_arrays(struct cso_context *cso, uint mode, uint start, uint count)
+{
+ struct pipe_draw_info info;
+
+ util_draw_init_info(&info);
+
+ info.mode = mode;
+ info.start = start;
+ info.count = count;
+ info.min_index = start;
+ info.max_index = start + count - 1;
+
+ cso_draw_vbo(cso, &info);
+}
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h
index 8cc1bbf..d0f8bc2 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.h
+++ b/src/gallium/auxiliary/cso_cache/cso_context.h
@@ -217,6 +217,19 @@ cso_save_vertex_sampler_views(struct cso_context *cso);
void
cso_restore_vertex_sampler_views(struct cso_context *cso);
+/* drawing */
+
+void
+cso_set_index_buffer(struct cso_context *cso,
+ const struct pipe_index_buffer *ib);
+
+void
+cso_draw_vbo(struct cso_context *cso,
+ const struct pipe_draw_info *info);
+
+/* helper drawing function */
+void
+cso_draw_arrays(struct cso_context *cso, uint mode, uint start, uint count);
#ifdef __cplusplus
}