summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-04-29 21:33:37 +0200
committerMarek Olšák <[email protected]>2012-04-30 01:18:49 +0200
commitfa20733a622770eaaa941f64d570d7b63d8f37b6 (patch)
tree1ecb4cfdd2405ef74a637302effa2a5cfec106bc /src/gallium/auxiliary/util
parent0279d15c990d831c7cc4e76cbe7caeba1347b689 (diff)
st/vega: don't use user_buffer_create
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_draw_quad.c21
-rw-r--r--src/gallium/auxiliary/util/u_draw_quad.h3
2 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_draw_quad.c b/src/gallium/auxiliary/util/u_draw_quad.c
index 1fbe12171c5..469c874988d 100644
--- a/src/gallium/auxiliary/util/u_draw_quad.c
+++ b/src/gallium/auxiliary/util/u_draw_quad.c
@@ -69,6 +69,27 @@ util_draw_vertex_buffer(struct pipe_context *pipe,
}
+/**
+ * Draw a simple vertex buffer / primitive.
+ * Limited to float[4] vertex attribs, tightly packed.
+ */
+void
+util_draw_user_vertex_buffer(struct cso_context *cso, void *buffer,
+ uint prim_type, uint num_verts, uint num_attribs)
+{
+ struct pipe_vertex_buffer vbuffer = {0};
+
+ assert(num_attribs <= PIPE_MAX_ATTRIBS);
+
+ vbuffer.user_buffer = buffer;
+ vbuffer.stride = num_attribs * 4 * sizeof(float); /* vertex size */
+
+ /* note: vertex elements already set by caller */
+
+ cso_set_vertex_buffers(cso, 1, &vbuffer);
+ cso_draw_arrays(cso, prim_type, 0, num_verts);
+}
+
/**
* Draw screen-aligned textured quad.
diff --git a/src/gallium/auxiliary/util/u_draw_quad.h b/src/gallium/auxiliary/util/u_draw_quad.h
index f1167786f0e..2834a4a8115 100644
--- a/src/gallium/auxiliary/util/u_draw_quad.h
+++ b/src/gallium/auxiliary/util/u_draw_quad.h
@@ -47,6 +47,9 @@ util_draw_vertex_buffer(struct pipe_context *pipe, struct cso_context *cso,
struct pipe_resource *vbuf, uint offset,
uint num_attribs, uint num_verts, uint prim_type);
+void
+util_draw_user_vertex_buffer(struct cso_context *cso, void *buffer,
+ uint prim_type, uint num_verts, uint num_attribs);
extern void
util_draw_texquad(struct pipe_context *pipe, struct cso_context *cso,