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/include | |
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/include')
-rw-r--r-- | src/gallium/include/pipe/p_context.h | 4 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_state.h | 38 |
2 files changed, 21 insertions, 21 deletions
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 4d5535b9fd6..4b75386a65b 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -53,7 +53,6 @@ struct pipe_grid_info; struct pipe_fence_handle; struct pipe_framebuffer_state; struct pipe_image_view; -struct pipe_index_buffer; struct pipe_query; struct pipe_poly_stipple; struct pipe_rasterizer_state; @@ -354,9 +353,6 @@ struct pipe_context { unsigned num_buffers, const struct pipe_vertex_buffer * ); - void (*set_index_buffer)( struct pipe_context *pipe, - const struct pipe_index_buffer * ); - /*@}*/ /** diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 3cfdd349feb..15be8cb5d02 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -628,19 +628,6 @@ struct pipe_vertex_element }; -/** - * An index buffer. When an index buffer is bound, all indices to vertices - * will be looked up in the buffer. - */ -struct pipe_index_buffer -{ - unsigned index_size; /**< size of an index, in bytes */ - unsigned offset; /**< offset to start of data in buffer, in bytes */ - struct pipe_resource *buffer; /**< the actual buffer */ - const void *user_buffer; /**< pointer to a user buffer if buffer == NULL */ -}; - - struct pipe_draw_indirect_info { unsigned offset; /**< must be 4 byte aligned */ @@ -650,7 +637,7 @@ struct pipe_draw_indirect_info /* Indirect draw parameters resource is laid out as follows: * - * if indexed is TRUE: + * if using indexed drawing: * struct { * uint32_t count; * uint32_t instance_count; @@ -680,12 +667,18 @@ struct pipe_draw_indirect_info */ struct pipe_draw_info { - boolean indexed; /**< use index buffer */ + ubyte index_size; /**< if 0, the draw is not indexed. */ enum pipe_prim_type mode:8; /**< the mode of the primitive */ - boolean primitive_restart; + unsigned primitive_restart:1; + unsigned has_user_indices:1; /**< if true, use index.user_buffer */ ubyte vertices_per_patch; /**< the number of vertices per patch */ - unsigned start; /**< the index of the first vertex */ + /** + * Direct draws: start is the index of the first vertex + * Non-indexed indirect draws: not used + * Indexed indirect draws: start is added to the indirect start. + */ + unsigned start; unsigned count; /**< number of vertices */ unsigned start_instance; /**< first instance id */ @@ -707,6 +700,17 @@ struct pipe_draw_info /* Pointers must be at the end for an optimal structure layout on 64-bit. */ + /** + * An index buffer. When an index buffer is bound, all indices to vertices + * will be looked up from the buffer. + * + * If has_user_indices, use index.user, else use index.resource. + */ + union { + struct pipe_resource *resource; /**< real buffer */ + const void *user; /**< pointer to a user buffer */ + } index; + struct pipe_draw_indirect_info *indirect; /**< Indirect draw. */ /** |