summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_context.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-03-05 15:54:27 +0100
committerMarek Olšák <[email protected]>2011-04-25 14:04:51 +0200
commit596f09aa7bafd769912b1c0efe97434dff4c3f0b (patch)
treeb7cbb82386562d55db5c571ede750887afe45274 /src/gallium/drivers/r300/r300_context.c
parent0fecb928f5c92e6e79a249421a1646247676b435 (diff)
r300g: implement draw_instanced for HWTCL
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 15d1278c3bb..934871f6553 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -80,6 +80,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;