summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/draw
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-09-06 17:07:09 -0600
committerBrian <[email protected]>2007-09-06 17:07:09 -0600
commit63a51aee86f76ae54fb1ce572d584fb0f01aaec5 (patch)
treed506eebeccfc1365bd2dd982c497fe1d14be2117 /src/mesa/pipe/draw
parent41ddd76b98e9e236a796f1bb9480ea0b2fb18010 (diff)
Initial work for post-transformed vertex feedback buffers.
This will be used for: GL_NV_transform_feedback, or similar GL3 functionality glRasterPos GL selection/feedback modes
Diffstat (limited to 'src/mesa/pipe/draw')
-rw-r--r--src/mesa/pipe/draw/draw_context.c42
-rw-r--r--src/mesa/pipe/draw/draw_context.h23
-rw-r--r--src/mesa/pipe/draw/draw_prim.c17
-rw-r--r--src/mesa/pipe/draw/draw_private.h9
4 files changed, 61 insertions, 30 deletions
diff --git a/src/mesa/pipe/draw/draw_context.c b/src/mesa/pipe/draw/draw_context.c
index 2936a14d65a..3c095810e55 100644
--- a/src/mesa/pipe/draw/draw_context.c
+++ b/src/mesa/pipe/draw/draw_context.c
@@ -137,7 +137,12 @@ static void validate_pipeline( struct draw_context *draw )
draw->pipeline.flatshade->next = next;
next = draw->pipeline.flatshade;
}
-
+
+ if (draw->feedback.enabled || draw->feedback.discard) {
+ draw->pipeline.feedback->next = next;
+ next = draw->pipeline.feedback;
+ }
+
draw->pipeline.first = next;
}
@@ -190,6 +195,14 @@ void draw_set_viewport_state( struct draw_context *draw,
void
+draw_set_vertex_shader(struct draw_context *draw,
+ const struct pipe_shader_state *shader)
+{
+ draw->vertex_shader = *shader;
+}
+
+
+void
draw_set_vertex_buffer(struct draw_context *draw,
unsigned attr,
const struct pipe_vertex_buffer *buffer)
@@ -209,9 +222,30 @@ draw_set_vertex_element(struct draw_context *draw,
}
+/**
+ * Tell drawing context where to find mapped vertex buffers.
+ */
void
-draw_set_vertex_shader(struct draw_context *draw,
- const struct pipe_shader_state *shader)
+draw_set_mapped_vertex_buffer(struct draw_context *draw,
+ unsigned attr, const void *buffer)
{
- draw->vertex_shader = *shader;
+ draw->mapped_vbuffer[attr] = buffer;
+}
+
+
+void
+draw_set_mapped_constant_buffer(struct draw_context *draw,
+ const void *buffer)
+{
+ draw->mapped_constants = buffer;
}
+
+
+void
+draw_set_mapped_feedback_buffer(struct draw_context *draw, uint index,
+ void *buffer, uint size)
+{
+ draw->mapped_feedback_buffer[index] = buffer;
+ draw->mapped_feedback_buffer_size[index] = size; /* in bytes */
+}
+
diff --git a/src/mesa/pipe/draw/draw_context.h b/src/mesa/pipe/draw/draw_context.h
index 7c4f1a12974..50315749693 100644
--- a/src/mesa/pipe/draw/draw_context.h
+++ b/src/mesa/pipe/draw/draw_context.h
@@ -93,14 +93,11 @@ unsigned draw_prim_info( unsigned prim, unsigned *first, unsigned *incr );
unsigned draw_trim( unsigned count, unsigned first, unsigned incr );
-void draw_set_mapped_element_buffer( struct draw_context *draw,
- unsigned eltSize, void *elements );
-void draw_set_mapped_vertex_buffer(struct draw_context *draw,
- unsigned attr, const void *buffer);
+void
+draw_set_vertex_shader(struct draw_context *draw,
+ const struct pipe_shader_state *shader);
-void draw_set_mapped_constant_buffer(struct draw_context *draw,
- const void *buffer);
void
draw_set_vertex_buffer(struct draw_context *draw,
@@ -112,10 +109,18 @@ draw_set_vertex_element(struct draw_context *draw,
unsigned attr,
const struct pipe_vertex_element *element);
-void
-draw_set_vertex_shader(struct draw_context *draw,
- const struct pipe_shader_state *shader);
+void draw_set_mapped_element_buffer( struct draw_context *draw,
+ unsigned eltSize, void *elements );
+
+void draw_set_mapped_vertex_buffer(struct draw_context *draw,
+ unsigned attr, const void *buffer);
+void draw_set_mapped_constant_buffer(struct draw_context *draw,
+ const void *buffer);
+
+void
+draw_set_mapped_feedback_buffer(struct draw_context *draw, uint index,
+ void *buffer, uint size);
void
draw_arrays(struct draw_context *draw, unsigned prim,
diff --git a/src/mesa/pipe/draw/draw_prim.c b/src/mesa/pipe/draw/draw_prim.c
index b68cca57064..a90d1df7f9f 100644
--- a/src/mesa/pipe/draw/draw_prim.c
+++ b/src/mesa/pipe/draw/draw_prim.c
@@ -353,23 +353,6 @@ draw_set_prim( struct draw_context *draw, unsigned prim )
}
-/**
- * Tell drawing context where to find mapped vertex buffers.
- */
-void draw_set_mapped_vertex_buffer(struct draw_context *draw,
- unsigned attr, const void *buffer)
-{
- draw->mapped_vbuffer[attr] = buffer;
-}
-
-
-void draw_set_mapped_constant_buffer(struct draw_context *draw,
- const void *buffer)
-{
- draw->mapped_constants = buffer;
-}
-
-
unsigned
draw_prim_info(unsigned prim, unsigned *first, unsigned *incr)
{
diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h
index 9f90dc3e26a..8bcc3717c45 100644
--- a/src/mesa/pipe/draw/draw_private.h
+++ b/src/mesa/pipe/draw/draw_private.h
@@ -126,6 +126,7 @@ struct draw_context
struct draw_stage *first; /**< one of the following */
/* stages (in logical order) */
+ struct draw_stage *feedback;
struct draw_stage *flatshade;
struct draw_stage *clip;
struct draw_stage *cull;
@@ -137,10 +138,13 @@ struct draw_context
/* pipe state that we need: */
struct pipe_setup_state setup;
+ struct pipe_feedback_state feedback;
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
struct pipe_vertex_element vertex_element[PIPE_ATTRIB_MAX];
struct pipe_shader_state vertex_shader;
+ struct pipe_vertex_buffer feedback_buffer[PIPE_ATTRIB_MAX];
+ struct pipe_vertex_element feedback_element[PIPE_ATTRIB_MAX];
/** The mapped vertex element/index buffer */
const void *mapped_elts;
@@ -150,6 +154,10 @@ struct draw_context
/** The mapped constant buffers (for vertex shader) */
const void *mapped_constants;
+ /** The mapped vertex element/index buffer */
+ void *mapped_feedback_buffer[PIPE_MAX_FEEDBACK_ATTRIBS];
+ uint mapped_feedback_buffer_size[PIPE_MAX_FEEDBACK_ATTRIBS]; /* in bytes */
+
/* Clip derived state:
*/
float plane[12][4];
@@ -203,6 +211,7 @@ struct draw_context
+extern struct draw_stage *draw_feedback_stage( struct draw_context *context );
extern struct draw_stage *draw_unfilled_stage( struct draw_context *context );
extern struct draw_stage *draw_twoside_stage( struct draw_context *context );
extern struct draw_stage *draw_offset_stage( struct draw_context *context );