return true;
/* Note: indices must be unsigned byte, unsigned short or unsigned int */
- switch (ilo->index_buffer.index_size) {
+ switch (ilo->ib.state.index_size) {
case 1:
return ((info->restart_index & 0xff) == 0xff);
break;
struct pipe_transfer *transfer = NULL;
const void *map = NULL;
- map = pipe_buffer_map(pipe,
- ilo->index_buffer.buffer,
- PIPE_TRANSFER_READ,
- &transfer);
-
- sub_prim_count = ilo_find_sub_primitives(map + ilo->index_buffer.offset,
- ilo->index_buffer.index_size,
- info,
- restart_info);
+ map = pipe_buffer_map(pipe, ilo->ib.state.buffer,
+ PIPE_TRANSFER_READ, &transfer);
+
+ sub_prim_count = ilo_find_sub_primitives(map + ilo->ib.state.offset,
+ ilo->ib.state.index_size, info, restart_info);
pipe_buffer_unmap(pipe, transfer);
* VS-generated output data, output URB availability isn't a
* factor."
*/
- if (vs_entry_size < ilo->vertex_elements->num_elements)
- vs_entry_size = ilo->vertex_elements->num_elements;
+ if (vs_entry_size < ilo->ve->count)
+ vs_entry_size = ilo->ve->count;
gs_entry_size = (gs) ? gs->out.count :
(vs && vs->stream_output) ? vs_entry_size : 0;
/* 3DSTATE_INDEX_BUFFER */
if (DIRTY(INDEX_BUFFER)) {
p->gen6_3DSTATE_INDEX_BUFFER(p->dev,
- &ilo->index_buffer, session->info->primitive_restart, p->cp);
+ &ilo->ib.state, session->info->primitive_restart, p->cp);
}
/* 3DSTATE_VERTEX_BUFFERS */
if (DIRTY(VERTEX_BUFFERS)) {
p->gen6_3DSTATE_VERTEX_BUFFERS(p->dev,
- ilo->vertex_buffers.buffers, NULL,
- (1 << ilo->vertex_buffers.num_buffers) - 1, p->cp);
+ ilo->vb.states, NULL, ilo->vb.enabled_mask, p->cp);
}
/* 3DSTATE_VERTEX_ELEMENTS */
if (DIRTY(VERTEX_ELEMENTS) || DIRTY(VS)) {
- const struct ilo_vertex_element *ive = ilo->vertex_elements;
+ const struct ilo_ve_state *ve = ilo->ve;
bool last_velement_edgeflag = false;
bool prepend_generate_ids = false;
if (info->edgeflag_in >= 0) {
/* we rely on the state tracker here */
- assert(info->edgeflag_in == ive->num_elements - 1);
+ assert(info->edgeflag_in == ve->count - 1);
last_velement_edgeflag = true;
}
}
p->gen6_3DSTATE_VERTEX_ELEMENTS(p->dev,
- ive->elements, ive->num_elements,
+ ve->states, ve->count,
last_velement_edgeflag, prepend_generate_ids, p->cp);
}
}
* Allocation Size must be sized to the maximum of the vertex input
* and output structures."
*/
- if (vs_entry_size < ilo->vertex_elements->num_elements)
- vs_entry_size = ilo->vertex_elements->num_elements;
+ if (vs_entry_size < ilo->ve->count)
+ vs_entry_size = ilo->ve->count;
vs_entry_size *= sizeof(float) * 4;
vs_total_size = ilo->dev->urb_size - offset;
ilo_blitter_begin(struct ilo_context *ilo, enum ilo_blitter_op op)
{
/* as documented in util/u_blitter.h */
- util_blitter_save_vertex_buffer_slot(ilo->blitter,
- ilo->vertex_buffers.buffers);
- util_blitter_save_vertex_elements(ilo->blitter, ilo->vertex_elements);
+ util_blitter_save_vertex_buffer_slot(ilo->blitter, ilo->vb.states);
+ util_blitter_save_vertex_elements(ilo->blitter, (void *) ilo->ve);
util_blitter_save_vertex_shader(ilo->blitter, ilo->vs);
util_blitter_save_geometry_shader(ilo->blitter, ilo->gs);
util_blitter_save_so_targets(ilo->blitter,
struct ilo_screen;
struct ilo_shader_state;
-struct ilo_vertex_element {
- struct pipe_vertex_element elements[PIPE_MAX_ATTRIBS];
- unsigned num_elements;
-};
-
struct ilo_context {
struct pipe_context base;
uint32_t dirty;
+ struct ilo_vb_state vb;
+ const struct ilo_ve_state *ve;
+ struct ilo_ib_state ib;
+
struct pipe_blend_state *blend;
struct pipe_rasterizer_state *rasterizer;
struct pipe_depth_stencil_alpha_state *depth_stencil_alpha;
struct ilo_shader_state *fs;
struct ilo_shader_state *vs;
struct ilo_shader_state *gs;
- struct ilo_vertex_element *vertex_elements;
struct pipe_blend_color blend_color;
struct pipe_stencil_ref stencil_ref;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
struct pipe_viewport_state viewport;
- struct pipe_index_buffer index_buffer;
-
- struct {
- struct pipe_vertex_buffer buffers[PIPE_MAX_ATTRIBS];
- unsigned num_buffers;
- } vertex_buffers;
struct {
struct pipe_sampler_state *samplers[ILO_MAX_SAMPLERS];
#define ILO_WM_CONST_SURFACE(i) (ILO_MAX_DRAW_BUFFERS + i)
#define ILO_WM_TEXTURE_SURFACE(i) (ILO_MAX_DRAW_BUFFERS + ILO_MAX_CONST_BUFFERS + i)
+struct ilo_vb_state {
+ struct pipe_vertex_buffer states[PIPE_MAX_ATTRIBS];
+ uint32_t enabled_mask;
+};
+
+struct ilo_ib_state {
+ struct pipe_index_buffer state;
+};
+
+struct ilo_ve_state {
+ struct pipe_vertex_element states[PIPE_MAX_ATTRIBS];
+ unsigned count;
+};
+
#endif /* ILO_GPE_H */
unsigned num_elements,
const struct pipe_vertex_element *elements)
{
- struct ilo_vertex_element *velem;
+ struct ilo_ve_state *ve;
- velem = MALLOC_STRUCT(ilo_vertex_element);
- assert(velem);
+ ve = MALLOC_STRUCT(ilo_ve_state);
+ assert(ve);
- memcpy(velem->elements, elements, sizeof(*elements) * num_elements);
- velem->num_elements = num_elements;
+ memcpy(ve->states, elements, sizeof(*elements) * num_elements);
+ ve->count = num_elements;
- return velem;
+ return ve;
}
static void
{
struct ilo_context *ilo = ilo_context(pipe);
- ilo->vertex_elements = state;
+ ilo->ve = state;
ilo->dirty |= ILO_DIRTY_VERTEX_ELEMENTS;
}
static void
ilo_delete_vertex_elements_state(struct pipe_context *pipe, void *state)
{
- FREE(state);
+ struct ilo_ve_state *ve = state;
+
+ FREE(ve);
}
static void
{
struct ilo_context *ilo = ilo_context(pipe);
- util_set_vertex_buffers_count(ilo->vertex_buffers.buffers,
- &ilo->vertex_buffers.num_buffers, buffers, start_slot, num_buffers);
+ util_set_vertex_buffers_mask(ilo->vb.states,
+ &ilo->vb.enabled_mask, buffers, start_slot, num_buffers);
ilo->dirty |= ILO_DIRTY_VERTEX_BUFFERS;
}
struct ilo_context *ilo = ilo_context(pipe);
if (state) {
- ilo->index_buffer.index_size = state->index_size;
- ilo->index_buffer.offset = state->offset;
- pipe_resource_reference(&ilo->index_buffer.buffer, state->buffer);
- ilo->index_buffer.user_buffer = state->user_buffer;
+ ilo->ib.state.index_size = state->index_size;
+ ilo->ib.state.offset = state->offset;
+ pipe_resource_reference(&ilo->ib.state.buffer, state->buffer);
+ ilo->ib.state.user_buffer = state->user_buffer;
}
else {
- ilo->index_buffer.index_size = 0;
- ilo->index_buffer.offset = 0;
- pipe_resource_reference(&ilo->index_buffer.buffer, NULL);
- ilo->index_buffer.user_buffer = NULL;
+ ilo->ib.state.index_size = 0;
+ ilo->ib.state.offset = 0;
+ pipe_resource_reference(&ilo->ib.state.buffer, NULL);
+ ilo->ib.state.user_buffer = NULL;
}
ilo->dirty |= ILO_DIRTY_INDEX_BUFFER;