summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/freedreno_draw.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-02-17 02:14:36 +0100
committerMarek Olšák <[email protected]>2017-02-25 00:03:09 +0100
commit7fff5b77f12174610d82d0c14da19fd8e81c92db (patch)
tree2c86a56e04659fd1bac86585374cc15fc5ec37d5 /src/gallium/drivers/freedreno/freedreno_draw.c
parent19c51e072b6fa614bc9c0f379bf462acd94c5431 (diff)
freedreno: add support for user index buffers
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_draw.c')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_draw.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c
index cfe13cd6782..5d5b7c11beb 100644
--- a/src/gallium/drivers/freedreno/freedreno_draw.c
+++ b/src/gallium/drivers/freedreno/freedreno_draw.c
@@ -31,6 +31,7 @@
#include "util/u_memory.h"
#include "util/u_prim.h"
#include "util/u_format.h"
+#include "util/u_helpers.h"
#include "freedreno_draw.h"
#include "freedreno_context.h"
@@ -84,6 +85,14 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
return;
}
+ /* Upload a user index buffer. */
+ struct pipe_index_buffer ibuffer_saved = {};
+ if (info->indexed && ctx->indexbuf.user_buffer &&
+ !util_save_and_upload_index_buffer(pctx, info, &ctx->indexbuf,
+ &ibuffer_saved)) {
+ return;
+ }
+
if (ctx->in_blit) {
fd_batch_reset(batch);
ctx->dirty = ~0;
@@ -201,6 +210,9 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
ctx->dirty = 0xffffffff;
fd_batch_check_size(batch);
+
+ if (info->indexed && ibuffer_saved.user_buffer)
+ pctx->set_index_buffer(pctx, &ibuffer_saved);
}
/* Generic clear implementation (partially) using u_blitter: */