diff options
author | Chia-I Wu <[email protected]> | 2015-06-19 15:10:02 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2015-06-20 11:18:07 +0800 |
commit | 9904e647cca0a15c80557ed7bcc6893faf147436 (patch) | |
tree | 47b34b667def6d1ded51352151e8c1bd1c0d37e8 /src/gallium/drivers/ilo/ilo_state.c | |
parent | da4878cb807f46e6053731a177c3c75497aaf4fb (diff) |
ilo: add ilo_state_index_buffer
It serves the same purpose as ilo_state_vertex_buffer does.
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_state.c')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_state.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c index e24f8fa316f..966a6e0470c 100644 --- a/src/gallium/drivers/ilo/ilo_state.c +++ b/src/gallium/drivers/ilo/ilo_state.c @@ -379,11 +379,13 @@ finalize_constant_buffers(struct ilo_context *ilo) static void finalize_index_buffer(struct ilo_context *ilo) { + const struct ilo_dev *dev = ilo->dev; struct ilo_state_vector *vec = &ilo->state_vector; const bool need_upload = (vec->draw->indexed && (vec->ib.state.user_buffer || vec->ib.state.offset % vec->ib.state.index_size)); struct pipe_resource *current_hw_res = NULL; + struct ilo_state_index_buffer_info info; if (!(vec->dirty & ILO_DIRTY_IB) && !need_upload) return; @@ -435,6 +437,17 @@ finalize_index_buffer(struct ilo_context *ilo) vec->ib.hw_index_size = vec->ib.state.index_size; pipe_resource_reference(¤t_hw_res, NULL); + + memset(&info, 0, sizeof(info)); + if (vec->ib.hw_resource) { + info.buf = ilo_buffer(vec->ib.hw_resource); + info.size = info.buf->bo_size; + info.format = ilo_translate_index_size(vec->ib.hw_index_size); + + vec->ib.ib.bo = info.buf->bo; + } + + ilo_state_index_buffer_set_info(&vec->ib.ib, dev, &info); } static void |