Commit 0908342a authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Basic indexed draw code

parent ac2038e4
......@@ -1010,14 +1010,28 @@ panfrost_draw_vbo(
ctx->payload_tiler.vertex_count = ctx->payload_vertex.vertex_count;
if (info->index_size) {
/* TODO: Indexed draws */
printf("ERROR: No indexed draws supported yet\n");
return;
ctx->payload_tiler.index_count = info->index_size;
assert(!info->restart_index);
assert(!info->index_bias);
assert(!info->min_index);
assert(!info->has_user_indices);
/* TODO: Type specifiers? */
ctx->payload_tiler.unknown_draw |= MALI_DRAW_INDEXED_UINT32;
/* TODO: User buffers */
struct panfrost_resource *rsrc = (struct panfrost_resource *) (info->index.resource);
ctx->payload_tiler.indices = panfrost_upload(&ctx->cmdstream, rsrc->cpu, info->index_size * 4, true);
} else {
/* Index count == vertex count, if no indexing is applied, as
* if it is internally indexed in the expected order */
ctx->payload_tiler.index_count = ctx->payload_tiler.vertex_count;
/* Reverse index state */
ctx->payload_tiler.unknown_draw &= ~MALI_DRAW_INDEXED_UINT32;
ctx->payload_tiler.indices = NULL;
}
/* Fire off the draw itself */
......
......@@ -83,6 +83,15 @@ int main(int argc, const char **argv)
gallium->set_constant_buffer(gallium, PIPE_SHADER_VERTEX, 0, &consts);
uint32_t indices[] = {
0, 1, 2
};
struct pipe_transfer *transfer3;
struct pipe_resource *ibuf = screen->resource_create(screen, &templ);
memcpy(gallium->transfer_map(gallium, cbuf, 0, 0, &box, &transfer3), indices, sizeof(indices));
memcpy(attrib_trans,
attributes_data_1_0,
sizeof(attributes_data_1_0));
......@@ -118,6 +127,8 @@ int main(int argc, const char **argv)
struct pipe_draw_info info = {
.start = 0,
.count = 3,
.index_size = 3,
.index = { .resource = ibuf },
.mode = PIPE_PRIM_LINE_LOOP
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment