diff options
author | Marek Olšák <[email protected]> | 2017-04-02 16:24:39 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-05-10 19:00:16 +0200 |
commit | 330d0607ed60fd3edca192e54b4246310f06652f (patch) | |
tree | 56bceba5b291ffcf42209ef1ab7ec515a8f5b666 /src/gallium/drivers/freedreno/a5xx | |
parent | 22f6624ed318e8131681ec1f2e7b3a59449df412 (diff) |
gallium: remove pipe_index_buffer and set_index_buffer
pipe_draw_info::indexed is replaced with index_size. index_size == 0 means
non-indexed.
Instead of pipe_index_buffer::offset, pipe_draw_info::start is used.
For indexed indirect draws, pipe_draw_info::start is added to the indirect
start. This is the only case when "start" affects indirect draws.
pipe_draw_info::index is a union. Use either index::resource or
index::user depending on the value of pipe_draw_info::has_user_indices.
v2: fixes for nine, svga
Diffstat (limited to 'src/gallium/drivers/freedreno/a5xx')
-rw-r--r-- | src/gallium/drivers/freedreno/a5xx/fd5_draw.c | 11 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a5xx/fd5_draw.h | 17 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_draw.c b/src/gallium/drivers/freedreno/a5xx/fd5_draw.c index 4ef0c7303d2..5c735734e68 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_draw.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_draw.c @@ -42,7 +42,7 @@ static void draw_impl(struct fd_context *ctx, struct fd_ringbuffer *ring, - struct fd5_emit *emit) + struct fd5_emit *emit, unsigned index_offset) { const struct pipe_draw_info *info = emit->info; enum pc_di_primtype primtype = ctx->primtypes[info->mode]; @@ -53,7 +53,7 @@ draw_impl(struct fd_context *ctx, struct fd_ringbuffer *ring, fd5_emit_vertex_bufs(ring, emit); OUT_PKT4(ring, REG_A5XX_VFD_INDEX_OFFSET, 2); - OUT_RING(ring, info->indexed ? info->index_bias : info->start); /* VFD_INDEX_OFFSET */ + OUT_RING(ring, info->index_size ? info->index_bias : info->start); /* VFD_INDEX_OFFSET */ OUT_RING(ring, info->start_instance); /* ??? UNKNOWN_2209 */ OUT_PKT4(ring, REG_A5XX_PC_RESTART_INDEX, 1); @@ -63,7 +63,7 @@ draw_impl(struct fd_context *ctx, struct fd_ringbuffer *ring, fd5_emit_render_cntl(ctx, false); fd5_draw_emit(ctx->batch, ring, primtype, emit->key.binning_pass ? IGNORE_VISIBILITY : USE_VISIBILITY, - info); + info, index_offset); } /* fixup dirty shader state in case some "unrelated" (from the state- @@ -92,7 +92,8 @@ fixup_shader_state(struct fd_context *ctx, struct ir3_shader_key *key) } static bool -fd5_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info) +fd5_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info, + unsigned index_offset) { struct fd5_context *fd5_ctx = fd5_context(ctx); struct fd5_emit emit = { @@ -136,7 +137,7 @@ fd5_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info) emit.key.binning_pass = false; emit.dirty = dirty; - draw_impl(ctx, ctx->batch->draw, &emit); + draw_impl(ctx, ctx->batch->draw, &emit, index_offset); // /* and now binning pass: */ // emit.key.binning_pass = true; diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_draw.h b/src/gallium/drivers/freedreno/a5xx/fd5_draw.h index 8ce70d308ad..5baf1676f15 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_draw.h +++ b/src/gallium/drivers/freedreno/a5xx/fd5_draw.h @@ -80,22 +80,21 @@ static inline void fd5_draw_emit(struct fd_batch *batch, struct fd_ringbuffer *ring, enum pc_di_primtype primtype, enum pc_di_vis_cull_mode vismode, - const struct pipe_draw_info *info) + const struct pipe_draw_info *info, + unsigned index_offset) { struct pipe_resource *idx_buffer = NULL; enum a4xx_index_size idx_type; enum pc_di_src_sel src_sel; uint32_t idx_size, idx_offset; - if (info->indexed) { - struct pipe_index_buffer *idx = &batch->ctx->indexbuf; + if (info->index_size) { + assert(!info->has_user_indices); - assert(!idx->user_buffer); - - idx_buffer = idx->buffer; - idx_type = fd4_size2indextype(idx->index_size); - idx_size = idx->index_size * info->count; - idx_offset = idx->offset + (info->start * idx->index_size); + idx_buffer = info->index.resource; + idx_type = fd4_size2indextype(info->index_size); + idx_size = info->index_size * info->count; + idx_offset = index_offset + info->start * info->index_size; src_sel = DI_SRC_SEL_DMA; } else { idx_buffer = NULL; |