summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/freedreno_draw.c
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2017-05-13 14:43:45 -0400
committerRob Clark <[email protected]>2017-05-14 15:10:08 -0400
commit06a51fb4e5bcec4fa9911b6a20a38deac45d9e21 (patch)
treed9ef5a21d0300ee584989a374325b2b6599b77bc /src/gallium/drivers/freedreno/freedreno_draw.c
parentd4e4c36c7c96d3e38b7f3ce6f3aac9956b6c9df8 (diff)
freedreno: fix indexbuffer upload
My fault for not having time to test Marek's patches while they were on list. Fixes: 330d0607 ("gallium: remove pipe_index_buffer and set_index_buffer") Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_draw.c')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_draw.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c
index 1d86a49dd45..08cba777510 100644
--- a/src/gallium/drivers/freedreno/freedreno_draw.c
+++ b/src/gallium/drivers/freedreno/freedreno_draw.c
@@ -91,11 +91,20 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
}
/* Upload a user index buffer. */
- struct pipe_resource *indexbuf = info->has_user_indices ? NULL : info->index.resource;
- unsigned index_offset = 0;
- if (info->index_size && info->has_user_indices &&
- !util_upload_index_buffer(pctx, info, &indexbuf, &index_offset)) {
- return;
+ struct pipe_resource *indexbuf = NULL;
+ unsigned index_offset = 0;
+ struct pipe_draw_info new_info;
+ if (info->index_size) {
+ if (info->has_user_indices) {
+ if (!util_upload_index_buffer(pctx, info, &indexbuf, &index_offset))
+ return;
+ new_info = *info;
+ new_info.index.resource = indexbuf;
+ new_info.has_user_indices = false;
+ info = &new_info;
+ } else {
+ indexbuf = info->index.resource;
+ }
}
if (ctx->in_blit) {
@@ -224,7 +233,8 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
fd_context_all_dirty(ctx);
fd_batch_check_size(batch);
- if (info->index_size && indexbuf != info->index.resource)
+
+ if (info == &new_info)
pipe_resource_reference(&indexbuf, NULL);
}