summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_context.c
diff options
context:
space:
mode:
authorChristian König <[email protected]>2011-06-03 10:47:56 +0200
committerChristian König <[email protected]>2011-06-03 10:47:56 +0200
commit10370b752cd793665feec9494e6545a3f04c69f9 (patch)
treedc37e605259796a8cef29be46a4c0da46b083176 /src/gallium/drivers/r300/r300_context.c
parentded2a9a628c58c2c8bfaaf6b8dd213e68de1dd20 (diff)
parent596f09aa7bafd769912b1c0efe97434dff4c3f0b (diff)
Merge remote-tracking branch 'mareko/r300g-draw-instanced' into pipe-video
Diffstat (limited to 'src/gallium/drivers/r300/r300_context.c')
-rw-r--r--src/gallium/drivers/r300/r300_context.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 0554c40eef0..b8053f51455 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -81,6 +81,7 @@ static void r300_release_referenced_objects(struct r300_context *r300)
/* Manually-created vertex buffers. */
pipe_resource_reference(&r300->dummy_vb, NULL);
pipe_resource_reference(&r300->vbo, NULL);
+ pipe_resource_reference((struct pipe_resource**)&r300->vb_instanceid, NULL);
/* If there are any queries pending or not destroyed, remove them now. */
foreach_s(query, temp, &r300->query_list) {
@@ -494,6 +495,31 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
}
{
+ int i, num = 128000;
+ struct pipe_resource vb, *r;
+ struct pipe_transfer *transfer;
+ float *buf;
+
+ memset(&vb, 0, sizeof(vb));
+ vb.target = PIPE_BUFFER;
+ vb.format = PIPE_FORMAT_R8_UNORM;
+ vb.bind = PIPE_BIND_VERTEX_BUFFER;
+ vb.usage = PIPE_USAGE_IMMUTABLE;
+ vb.width0 = 4 * num;
+ vb.height0 = 1;
+ vb.depth0 = 1;
+
+ r = screen->resource_create(screen, &vb);
+
+ buf = pipe_buffer_map(&r300->context, r, PIPE_TRANSFER_WRITE, &transfer);
+ for (i = 0; i < num; i++)
+ buf[i] = i;
+ pipe_buffer_unmap(&r300->context, transfer);
+
+ r300->vb_instanceid = r300_resource(r);
+ }
+
+ {
struct pipe_depth_stencil_alpha_state dsa;
memset(&dsa, 0, sizeof(dsa));
dsa.depth.writemask = 1;