From d0b55120beb4848be5e7ef24f0301f8397baa8be Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 23 Dec 2009 19:37:18 +0100 Subject: gallium: Add interfaces needed for instanced drawing. --- src/gallium/include/pipe/p_context.h | 16 ++++++++++++++++ src/gallium/include/pipe/p_shader_tokens.h | 3 ++- src/gallium/include/pipe/p_state.h | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src/gallium/include/pipe') diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 11bcdc0a24..d5d1e0e76b 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -69,6 +69,22 @@ struct pipe_context { unsigned indexSize, unsigned mode, unsigned start, unsigned count); + boolean (*draw_arrays_instanced)(struct pipe_context *pipe, + unsigned mode, + unsigned start, + unsigned count, + unsigned startInstance, + unsigned instanceCount); + + boolean (*draw_elements_instanced)(struct pipe_context *pipe, + struct pipe_buffer *indexBuffer, + unsigned indexSize, + unsigned mode, + unsigned start, + unsigned count, + unsigned startInstance, + unsigned instanceCount); + /* XXX: this is (probably) a temporary entrypoint, as the range * information should be available from the vertex_buffer state. * Using this to quickly evaluate a specialized path in the draw diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index 5da85bbbc2..d79124828f 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -130,7 +130,8 @@ struct tgsi_declaration_range #define TGSI_SEMANTIC_NORMAL 6 #define TGSI_SEMANTIC_FACE 7 #define TGSI_SEMANTIC_EDGEFLAG 8 -#define TGSI_SEMANTIC_COUNT 9 /**< number of semantic values */ +#define TGSI_SEMANTIC_INSTANCEID 9 +#define TGSI_SEMANTIC_COUNT 10 /**< number of semantic values */ struct tgsi_declaration_semantic { diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 60e96b98de..4d38bbcc32 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -364,6 +364,7 @@ struct pipe_vertex_buffer unsigned stride; /**< stride to same attrib in next vertex, in bytes */ unsigned max_index; /**< number of vertices in this buffer */ unsigned buffer_offset; /**< offset to start of data in buffer, in bytes */ + unsigned instance_divisor; /**< instance data rate divisor, 0 means per-vertex data */ struct pipe_buffer *buffer; /**< the actual buffer */ }; -- cgit v1.2.3 From f7d1689cfa8e3eb2aea4b86031510323b4d13110 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 29 Dec 2009 19:18:54 +0100 Subject: gallium: Move instance_divisor field from vertex_buffer to vertex_element. --- src/gallium/include/pipe/p_state.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/gallium/include/pipe') diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 4d38bbcc32..4d25f601f4 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -364,7 +364,6 @@ struct pipe_vertex_buffer unsigned stride; /**< stride to same attrib in next vertex, in bytes */ unsigned max_index; /**< number of vertices in this buffer */ unsigned buffer_offset; /**< offset to start of data in buffer, in bytes */ - unsigned instance_divisor; /**< instance data rate divisor, 0 means per-vertex data */ struct pipe_buffer *buffer; /**< the actual buffer */ }; @@ -377,6 +376,11 @@ struct pipe_vertex_element /** Offset of this attribute, in bytes, from the start of the vertex */ unsigned src_offset; + /** Instance data rate divisor. 0 means this is per-vertex data, + * n means per-instance data used for n consecutive instances (n > 0). + */ + unsigned instance_divisor; + /** Which vertex_buffer (as given to pipe->set_vertex_buffer()) does * this attribute live in? */ -- cgit v1.2.3 From 8c53a2576ec998936981c354b02979f803c0e4de Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 12 Jan 2010 18:51:27 +0100 Subject: gallium: draw_arrays/elements_instanced() are of type void. --- src/gallium/drivers/softpipe/sp_draw_arrays.c | 44 +++++++++++++-------------- src/gallium/drivers/softpipe/sp_state.h | 4 +-- src/gallium/include/pipe/p_context.h | 30 +++++++++--------- 3 files changed, 39 insertions(+), 39 deletions(-) (limited to 'src/gallium/include/pipe') diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c index 87312ae151..b3ece9d8ed 100644 --- a/src/gallium/drivers/softpipe/sp_draw_arrays.c +++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c @@ -172,7 +172,7 @@ softpipe_draw_elements(struct pipe_context *pipe, 1); } -boolean +void softpipe_draw_arrays_instanced(struct pipe_context *pipe, unsigned mode, unsigned start, @@ -180,19 +180,19 @@ softpipe_draw_arrays_instanced(struct pipe_context *pipe, unsigned startInstance, unsigned instanceCount) { - return softpipe_draw_range_elements_instanced(pipe, - NULL, - 0, - 0, - 0xffffffff, - mode, - start, - count, - startInstance, - instanceCount); + softpipe_draw_range_elements_instanced(pipe, + NULL, + 0, + 0, + 0xffffffff, + mode, + start, + count, + startInstance, + instanceCount); } -boolean +void softpipe_draw_elements_instanced(struct pipe_context *pipe, struct pipe_buffer *indexBuffer, unsigned indexSize, @@ -202,16 +202,16 @@ softpipe_draw_elements_instanced(struct pipe_context *pipe, unsigned startInstance, unsigned instanceCount) { - return softpipe_draw_range_elements_instanced(pipe, - indexBuffer, - indexSize, - 0, - 0xffffffff, - mode, - start, - count, - startInstance, - instanceCount); + softpipe_draw_range_elements_instanced(pipe, + indexBuffer, + indexSize, + 0, + 0xffffffff, + mode, + start, + count, + startInstance, + instanceCount); } static boolean diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h index f8886565e9..3153d6e6a4 100644 --- a/src/gallium/drivers/softpipe/sp_state.h +++ b/src/gallium/drivers/softpipe/sp_state.h @@ -199,7 +199,7 @@ softpipe_draw_range_elements(struct pipe_context *pipe, unsigned max_index, unsigned mode, unsigned start, unsigned count); -boolean +void softpipe_draw_arrays_instanced(struct pipe_context *pipe, unsigned mode, unsigned start, @@ -207,7 +207,7 @@ softpipe_draw_arrays_instanced(struct pipe_context *pipe, unsigned startInstance, unsigned instanceCount); -boolean +void softpipe_draw_elements_instanced(struct pipe_context *pipe, struct pipe_buffer *indexBuffer, unsigned indexSize, diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 6394e095d3..f2242d2069 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -69,21 +69,21 @@ struct pipe_context { unsigned indexSize, unsigned mode, unsigned start, unsigned count); - boolean (*draw_arrays_instanced)(struct pipe_context *pipe, - unsigned mode, - unsigned start, - unsigned count, - unsigned startInstance, - unsigned instanceCount); - - boolean (*draw_elements_instanced)(struct pipe_context *pipe, - struct pipe_buffer *indexBuffer, - unsigned indexSize, - unsigned mode, - unsigned start, - unsigned count, - unsigned startInstance, - unsigned instanceCount); + void (*draw_arrays_instanced)(struct pipe_context *pipe, + unsigned mode, + unsigned start, + unsigned count, + unsigned startInstance, + unsigned instanceCount); + + void (*draw_elements_instanced)(struct pipe_context *pipe, + struct pipe_buffer *indexBuffer, + unsigned indexSize, + unsigned mode, + unsigned start, + unsigned count, + unsigned startInstance, + unsigned instanceCount); /* XXX: this is (probably) a temporary entrypoint, as the range * information should be available from the vertex_buffer state. -- cgit v1.2.3