summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-04-29 21:34:18 +0200
committerMarek Olšák <[email protected]>2012-04-30 01:18:49 +0200
commit889c9a566c1b0e1d3ef269c53900e5cfbd6d7b45 (patch)
tree82e621413bb1cbdd7cd772c67e8161585ebd240e
parentfa20733a622770eaaa941f64d570d7b63d8f37b6 (diff)
st/xa: don't use user_buffer_create
-rw-r--r--src/gallium/state_trackers/xa/xa_renderer.c59
1 files changed, 15 insertions, 44 deletions
diff --git a/src/gallium/state_trackers/xa/xa_renderer.c b/src/gallium/state_trackers/xa/xa_renderer.c
index 8ba6e1ead69..217887ec1ae 100644
--- a/src/gallium/state_trackers/xa/xa_renderer.c
+++ b/src/gallium/state_trackers/xa/xa_renderer.c
@@ -71,40 +71,19 @@ map_point(float *mat, float x, float y, float *out_x, float *out_y)
}
}
-static INLINE struct pipe_resource *
-renderer_buffer_create(struct xa_context *r)
-{
- struct pipe_resource *buf = pipe_user_buffer_create(r->pipe->screen,
- r->buffer,
- sizeof(float) *
- r->buffer_size,
- PIPE_BIND_VERTEX_BUFFER);
-
- r->buffer_size = 0;
-
- return buf;
-}
-
static INLINE void
renderer_draw(struct xa_context *r)
{
- struct pipe_context *pipe = r->pipe;
- struct pipe_resource *buf = 0;
int num_verts = r->buffer_size / (r->attrs_per_vertex * NUM_COMPONENTS);
if (!r->buffer_size)
return;
- buf = renderer_buffer_create(r);
-
- if (buf) {
- cso_set_vertex_elements(r->cso, r->attrs_per_vertex, r->velems);
-
- util_draw_vertex_buffer(pipe, r->cso, buf, 0, PIPE_PRIM_QUADS, num_verts, /* verts */
- r->attrs_per_vertex); /* attribs/vert */
-
- pipe_resource_reference(&buf, NULL);
- }
+ cso_set_vertex_elements(r->cso, r->attrs_per_vertex, r->velems);
+ util_draw_user_vertex_buffer(r->cso, r->buffer, PIPE_PRIM_QUADS,
+ num_verts, /* verts */
+ r->attrs_per_vertex); /* attribs/vert */
+ r->buffer_size = 0;
}
static INLINE void
@@ -304,7 +283,7 @@ add_vertex_data2(struct xa_context *r,
src_s0, src_t1, mask_s0, mask_t1);
}
-static struct pipe_resource *
+static void
setup_vertex_data_yuv(struct xa_context *r,
float srcX,
float srcY,
@@ -337,8 +316,6 @@ setup_vertex_data_yuv(struct xa_context *r,
add_vertex_1tex(r, dstX + dstW, dstY + dstH, s1, t1);
/* 4th vertex */
add_vertex_1tex(r, dstX, dstY + dstH, s0, t1);
-
- return renderer_buffer_create(r);
}
/* Set up framebuffer, viewport and vertex shader constant buffer
@@ -530,23 +507,17 @@ renderer_draw_yuv(struct xa_context *r,
int dst_x,
int dst_y, int dst_w, int dst_h, struct xa_surface *srf[])
{
- struct pipe_context *pipe = r->pipe;
- struct pipe_resource *buf = 0;
+ const int num_attribs = 2; /*pos + tex coord */
- buf = setup_vertex_data_yuv(r,
- src_x, src_y, src_w, src_h, dst_x, dst_y, dst_w,
- dst_h, srf);
+ setup_vertex_data_yuv(r,
+ src_x, src_y, src_w, src_h,
+ dst_x, dst_y, dst_w, dst_h, srf);
- if (buf) {
- const int num_attribs = 2; /*pos + tex coord */
-
- cso_set_vertex_elements(r->cso, num_attribs, r->velems);
-
- util_draw_vertex_buffer(pipe, r->cso, buf, 0, PIPE_PRIM_QUADS, 4, /* verts */
- num_attribs); /* attribs/vert */
-
- pipe_resource_reference(&buf, NULL);
- }
+ cso_set_vertex_elements(r->cso, num_attribs, r->velems);
+ util_draw_user_vertex_buffer(r->cso, r->buffer, PIPE_PRIM_QUADS,
+ 4, /* verts */
+ num_attribs); /* attribs/vert */
+ r->buffer_size = 0;
}
void