} u;
/* we will draw with IB mapped */
- if (ib->buffer) {
- u.ptr = intel_bo_map(ilo_buffer(ib->buffer)->bo, false);
+ if (ib->state.buffer) {
+ u.ptr = intel_bo_map(ilo_buffer(ib->state.buffer)->bo, false);
if (u.ptr)
- u.u8 += ib->offset;
+ u.u8 += ib->state.offset;
} else {
- u.ptr = ib->user_buffer;
+ u.ptr = ib->state.user_buffer;
}
if (!u.ptr)
(pipe)->draw_vbo(pipe, &subinfo); \
} while (0)
- switch (ib->index_size) {
+ switch (ib->state.index_size) {
case 1:
DRAW_VBO_WITH_SW_RESTART(&ilo->base, info, u.u8);
break;
#undef DRAW_VBO_WITH_SW_RESTART
- if (ib->buffer)
- intel_bo_unmap(ilo_buffer(ib->buffer)->bo);
+ if (ib->state.buffer)
+ intel_bo_unmap(ilo_buffer(ib->state.buffer)->bo);
}
static bool
/* the restart index is fixed prior to GEN7.5 */
if (ilo_dev_gen(ilo->dev) < ILO_GEN(7.5)) {
const unsigned cut_index =
- (ilo->state_vector.ib.index_size == 1) ? 0xff :
- (ilo->state_vector.ib.index_size == 2) ? 0xffff :
- (ilo->state_vector.ib.index_size == 4) ? 0xffffffff : 0;
+ (ilo->state_vector.ib.state.index_size == 1) ? 0xff :
+ (ilo->state_vector.ib.state.index_size == 2) ? 0xffff :
+ (ilo->state_vector.ib.state.index_size == 4) ? 0xffffffff : 0;
if (info->restart_index < cut_index)
return true;
{
struct ilo_state_vector *vec = &ilo->state_vector;
const bool need_upload = (vec->draw->indexed &&
- (vec->ib.user_buffer || vec->ib.offset % vec->ib.index_size));
+ (vec->ib.state.user_buffer ||
+ vec->ib.state.offset % vec->ib.state.index_size));
struct pipe_resource *current_hw_res = NULL;
if (!(vec->dirty & ILO_DIRTY_IB) && !need_upload)
pipe_resource_reference(¤t_hw_res, vec->ib.hw_resource);
if (need_upload) {
- const unsigned offset = vec->ib.index_size * vec->draw->start;
- const unsigned size = vec->ib.index_size * vec->draw->count;
+ const unsigned offset = vec->ib.state.index_size * vec->draw->start;
+ const unsigned size = vec->ib.state.index_size * vec->draw->count;
unsigned hw_offset;
- if (vec->ib.user_buffer) {
+ if (vec->ib.state.user_buffer) {
u_upload_data(ilo->uploader, 0, size,
- vec->ib.user_buffer + offset, &hw_offset, &vec->ib.hw_resource);
- }
- else {
- u_upload_buffer(ilo->uploader, 0, vec->ib.offset + offset, size,
- vec->ib.buffer, &hw_offset, &vec->ib.hw_resource);
+ vec->ib.state.user_buffer + offset,
+ &hw_offset, &vec->ib.hw_resource);
+ } else {
+ u_upload_buffer(ilo->uploader, 0,
+ vec->ib.state.offset + offset, size, vec->ib.state.buffer,
+ &hw_offset, &vec->ib.hw_resource);
}
/* the HW offset should be aligned */
- assert(hw_offset % vec->ib.index_size == 0);
- vec->ib.draw_start_offset = hw_offset / vec->ib.index_size;
+ assert(hw_offset % vec->ib.state.index_size == 0);
+ vec->ib.draw_start_offset = hw_offset / vec->ib.state.index_size;
/*
* INDEX[vec->draw->start] in the original buffer is INDEX[0] in the HW
* resource
*/
vec->ib.draw_start_offset -= vec->draw->start;
- }
- else {
- pipe_resource_reference(&vec->ib.hw_resource, vec->ib.buffer);
+ } else {
+ pipe_resource_reference(&vec->ib.hw_resource, vec->ib.state.buffer);
/* note that index size may be zero when the draw is not indexed */
- if (vec->draw->indexed)
- vec->ib.draw_start_offset = vec->ib.offset / vec->ib.index_size;
- else
+ if (vec->draw->indexed) {
+ vec->ib.draw_start_offset =
+ vec->ib.state.offset / vec->ib.state.index_size;
+ } else {
vec->ib.draw_start_offset = 0;
+ }
}
/* treat the IB as clean if the HW states do not change */
if (vec->ib.hw_resource == current_hw_res &&
- vec->ib.hw_index_size == vec->ib.index_size)
+ vec->ib.hw_index_size == vec->ib.state.index_size)
vec->dirty &= ~ILO_DIRTY_IB;
else
- vec->ib.hw_index_size = vec->ib.index_size;
+ vec->ib.hw_index_size = vec->ib.state.index_size;
pipe_resource_reference(¤t_hw_res, NULL);
}
struct ilo_state_vector *vec = &ilo_context(pipe)->state_vector;
if (state) {
- pipe_resource_reference(&vec->ib.buffer, state->buffer);
- vec->ib.user_buffer = state->user_buffer;
- vec->ib.offset = state->offset;
- vec->ib.index_size = state->index_size;
- }
- else {
- pipe_resource_reference(&vec->ib.buffer, NULL);
- vec->ib.user_buffer = NULL;
- vec->ib.offset = 0;
- vec->ib.index_size = 0;
+ pipe_resource_reference(&vec->ib.state.buffer, state->buffer);
+ vec->ib.state = *state;
+ } else {
+ pipe_resource_reference(&vec->ib.state.buffer, NULL);
+ memset(&vec->ib.state, 0, sizeof(vec->ib.state));
}
vec->dirty |= ILO_DIRTY_IB;
pipe_resource_reference(&vec->vb.states[i].buffer, NULL);
}
- pipe_resource_reference(&vec->ib.buffer, NULL);
+ pipe_resource_reference(&vec->ib.state.buffer, NULL);
pipe_resource_reference(&vec->ib.hw_resource, NULL);
for (i = 0; i < vec->so.count; i++)
}
}
- if (vec->ib.buffer == res) {
+ if (vec->ib.state.buffer == res) {
states |= ILO_DIRTY_IB;
/*