[Mesa-dev] Gallium: Removal of set_index_buffer (discussion)
Marek Olšák
maraeo at gmail.com
Mon Feb 20 19:01:15 UTC 2017
Hi,
I'd like to remove pipe_context::set_index_buffer. It's not useful to
most drivers and the interface is inconvenient for Mesa/OpenGL,
because it's a draw state that is set with a separate driver callback,
which is an unnecessary driver roundtrip taking some CPU cycles. I'd
prefer to pass the index buffer via pipe_draw_info.
I'm aware that the interface was inherited from DX10, but I don't
think that makes any difference here. DX10 state trackers can pass the
index buffer via pipe_draw_info too.
This is my proposal:
iff --git a/src/gallium/include/pipe/p_state.h
b/src/gallium/include/pipe/p_state.h
index ce19b92..cffbb33 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -635,7 +635,7 @@ struct pipe_index_buffer
*/
struct pipe_draw_info
{
- boolean indexed; /**< use index buffer */
+ ubyte index_size; /**< 0 = non-indexed */
enum pipe_prim_type mode; /**< the mode of the primitive */
boolean primitive_restart;
ubyte vertices_per_patch; /**< the number of vertices per patch */
@@ -666,12 +666,18 @@ struct pipe_draw_info
unsigned indirect_params_offset; /**< must be 4 byte aligned */
+ /**
+ * Index buffer. Only one can be non-NULL.
+ */
+ struct pipe_resource *index_buffer; /* "start" is the offset */
+ void *user_indices;
+
/* Pointers must be at the end for an optimal structure layout on 64-bit. */
Comments welcome,
Marek
More information about the mesa-dev
mailing list