summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r600/r600_translate.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2011-01-29 16:39:45 +0100
committerMarek Olšák <maraeo@gmail.com>2011-01-30 03:29:48 +0100
commit77900843b42d9672c6b10f49c177a172041f6a8d (patch)
treeffd3e7b492dab503ec17a92a2b0ba5329bcedf76 /src/gallium/drivers/r600/r600_translate.c
parent73a40d1383071fe25599509d218f4c40d049988d (diff)
r600g: upload translated indices via the uploader
Diffstat (limited to 'src/gallium/drivers/r600/r600_translate.c')
-rw-r--r--src/gallium/drivers/r600/r600_translate.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gallium/drivers/r600/r600_translate.c b/src/gallium/drivers/r600/r600_translate.c
index 4b88a9bfd4..68429b99d0 100644
--- a/src/gallium/drivers/r600/r600_translate.c
+++ b/src/gallium/drivers/r600/r600_translate.c
@@ -194,17 +194,27 @@ void r600_end_vertex_translate(struct r600_pipe_context *rctx)
rctx->nreal_vertex_buffers = rctx->nvertex_buffers;
}
-/* XXX Use the uploader. */
void r600_translate_index_buffer(struct r600_pipe_context *r600,
struct pipe_resource **index_buffer,
unsigned *index_size,
unsigned *start, unsigned count)
{
+ struct pipe_resource *out_buffer = NULL;
+ unsigned out_offset;
+ void *ptr;
+ boolean flushed;
+
switch (*index_size) {
case 1:
- util_shorten_ubyte_elts(&r600->context, index_buffer, 0, *start, count);
+ u_upload_alloc(r600->upload_vb, 0, count * 2,
+ &out_offset, &out_buffer, &flushed, &ptr);
+
+ util_shorten_ubyte_elts_to_userptr(
+ &r600->context, *index_buffer, 0, *start, count, ptr);
+
+ pipe_resource_reference(index_buffer, out_buffer);
*index_size = 2;
- *start = 0;
+ *start = out_offset / 2;
break;
}
}