Mesa (master): gallium: Add pipe_context::draw_vbo and pipe_context:: set_index_buffer.
Chia-I Wu
olv at kemper.freedesktop.org
Thu Jul 29 05:45:45 UTC 2010
Module: Mesa
Branch: master
Commit: c5e9d3114a80d6d35a2f4e65783cdc75fcc2deac
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c5e9d3114a80d6d35a2f4e65783cdc75fcc2deac
Author: Chia-I Wu <olv at lunarg.com>
Date: Fri Jul 16 04:02:55 2010 +0800
gallium: Add pipe_context::draw_vbo and pipe_context::set_index_buffer.
This commit adds a new unified draw_vbo method to pipe_context. Unlike
other draw methods, draw_vbo treats the index buffer as a state which is
set with set_index_buffer.
---
src/gallium/include/pipe/p_context.h | 6 +++++
src/gallium/include/pipe/p_state.h | 35 ++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 7ec3d63..3314b1e 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -102,6 +102,9 @@ struct pipe_context {
unsigned start,
unsigned count);
+ void (*draw_vbo)( struct pipe_context *pipe,
+ const struct pipe_draw_info *info );
+
/**
* Draw the stream output buffer at index 0
*/
@@ -249,6 +252,9 @@ struct pipe_context {
unsigned num_buffers,
const struct pipe_vertex_buffer * );
+ void (*set_index_buffer)( struct pipe_context *pipe,
+ const struct pipe_index_buffer * );
+
void (*set_stream_output_buffers)(struct pipe_context *,
struct pipe_resource **buffers,
int *offsets, /*array of offsets
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 301fe2b..0f1a44c 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -426,6 +426,41 @@ 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 */
+};
+
+
+/**
+ * Information to describe a draw_vbo call.
+ */
+struct pipe_draw_info
+{
+ boolean indexed; /**< use index buffer */
+
+ unsigned mode; /**< the mode of the primitive */
+ unsigned start; /**< the index of the first vertex */
+ unsigned count; /**< number of vertices */
+
+ unsigned start_instance; /**< first instance id */
+ unsigned instance_count; /**< number of instances */
+
+ /**
+ * For indexed drawing, these fields apply after index lookup.
+ */
+ int index_bias; /**< a bias to be added to each index */
+ unsigned min_index; /**< the min index */
+ unsigned max_index; /**< the max index */
+};
+
+
#ifdef __cplusplus
}
#endif
More information about the mesa-commit
mailing list