Commit 74901184 authored by Emma Anholt's avatar Emma Anholt
Browse files

v3d: Use util_upload_index_buffer like other drivers.

Saves some upload boilerplate.
parent cba017ff
Pipeline #37895 passed with stages
in 11 minutes and 23 seconds
......@@ -24,6 +24,7 @@
#include "util/u_blitter.h"
#include "util/u_prim.h"
#include "util/u_format.h"
#include "util/u_helpers.h"
#include "util/u_pack_color.h"
#include "util/u_prim_restart.h"
#include "util/u_upload_mgr.h"
......@@ -504,6 +505,10 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
return;
}
struct pipe_draw_info tmp_info;
if (!util_upload_index_buffer(pctx, &info, &tmp_info))
return;
/* Before setting up the draw, flush anything writing to the textures
* that we read from.
*/
......@@ -606,19 +611,8 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
* definitions, up to but not including QUADS.
*/
if (info->index_size) {
uint32_t index_size = info->index_size;
uint32_t offset = info->start * index_size;
struct pipe_resource *prsc;
if (info->has_user_indices) {
prsc = NULL;
u_upload_data(v3d->uploader, 0,
info->count * info->index_size, 4,
info->index.user,
&offset, &prsc);
} else {
prsc = info->index.resource;
}
struct v3d_resource *rsc = v3d_resource(prsc);
uint32_t offset = info->start * info->index_size;
struct v3d_resource *rsc = v3d_resource(info->index.resource);
#if V3D_VERSION >= 40
cl_emit(&job->bcl, INDEX_BUFFER_SETUP, ib) {
......@@ -677,8 +671,7 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
job->draw_calls_queued++;
if (info->has_user_indices)
pipe_resource_reference(&prsc, NULL);
pipe_resource_reference(&tmp_info.index.resource, NULL);
} else {
if (info->indirect) {
cl_emit(&job->bcl, INDIRECT_VERTEX_ARRAY_INSTANCED_PRIMS, prim) {
......
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