summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/etnaviv/etnaviv_context.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-02-17 01:59:48 +0100
committerMarek Olšák <[email protected]>2017-02-25 00:03:09 +0100
commit19c51e072b6fa614bc9c0f379bf462acd94c5431 (patch)
tree01ed4b829f42dd4302b952c0fd603845f799ac1c /src/gallium/drivers/etnaviv/etnaviv_context.c
parentf139b6fb4fc2d06a1df9dce3dc37ddf336bc64b3 (diff)
etnaviv: add support for user index buffers
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_context.c')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_context.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
index 5566e0ed38e..dfd9e1f73a6 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -47,6 +47,7 @@
#include "pipe/p_context.h"
#include "pipe/p_state.h"
#include "util/u_blitter.h"
+#include "util/u_helpers.h"
#include "util/u_memory.h"
#include "util/u_prim.h"
#include "util/u_upload_mgr.h"
@@ -137,6 +138,15 @@ etna_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->index_buffer.ib.user_buffer &&
+ !util_save_and_upload_index_buffer(pctx, info, &ctx->index_buffer.ib,
+ &ibuffer_saved)) {
+ BUG("Index buffer upload failed.");
+ return;
+ }
+
if (info->indexed && !ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.bo) {
BUG("Unsupported or no index buffer");
return;
@@ -211,6 +221,8 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
etna_resource(ctx->framebuffer.cbuf->texture)->seqno++;
if (ctx->framebuffer.zsbuf)
etna_resource(ctx->framebuffer.zsbuf->texture)->seqno++;
+ if (info->indexed && ibuffer_saved.user_buffer)
+ pctx->set_index_buffer(pctx, &ibuffer_saved);
}
static void