aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
-rw-r--r--src/mesa/pipe/p_context.h18
-rw-r--r--src/mesa/pipe/p_state.h15
-rw-r--r--src/mesa/sources1
7 files changed, 93 insertions, 32 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 );
diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h
index ec9973383c4..c9246e883ad 100644
--- a/src/mesa/pipe/p_context.h
+++ b/src/mesa/pipe/p_context.h
@@ -138,14 +138,28 @@ struct pipe_context {
void (*set_viewport_state)( struct pipe_context *,
const struct pipe_viewport_state * );
+ /*
+ * Vertex arrays
+ */
void (*set_vertex_buffer)( struct pipe_context *,
unsigned index,
const struct pipe_vertex_buffer * );
-
+
void (*set_vertex_element)( struct pipe_context *,
unsigned index,
const struct pipe_vertex_element * );
-
+
+ /*
+ * Vertex feedback
+ */
+ void (*set_feedback_buffer)(struct pipe_context *,
+ unsigned index,
+ struct pipe_vertex_buffer *);
+
+ void (*set_feedback_element)(struct pipe_context *,
+ unsigned index,
+ const struct pipe_vertex_element *);
+
/*
* Surface functions
diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h
index 25e5861e1e5..cad96807df3 100644
--- a/src/mesa/pipe/p_state.h
+++ b/src/mesa/pipe/p_state.h
@@ -49,6 +49,7 @@
#define PIPE_ATTRIB_MAX 32
#define PIPE_MAX_COLOR_BUFS 8
#define PIPE_MAX_TEXTURE_LEVELS 16
+#define PIPE_MAX_FEEDBACK_ATTRIBS 16
/* fwd decl */
@@ -92,6 +93,20 @@ struct pipe_setup_state
float offset_scale;
};
+
+/**
+ * Post-transform vertex feeback
+ */
+struct pipe_feedback_state {
+ uint enabled:1; /**< enable feedback? */
+ uint discard:1; /**< discard primitives? */
+ uint interleaved:1; /**< interleaved output? */
+ uint num_attribs;
+ uint attrib[PIPE_MAX_FEEDBACK_ATTRIBS];
+ uint size[PIPE_MAX_FEEDBACK_ATTRIBS];
+};
+
+
struct pipe_poly_stipple {
unsigned stipple[32];
};
diff --git a/src/mesa/sources b/src/mesa/sources
index 437af0f57b0..28f865f2ede 100644
--- a/src/mesa/sources
+++ b/src/mesa/sources
@@ -161,6 +161,7 @@ DRAW_SOURCES = \
pipe/draw/draw_clip.c \
pipe/draw/draw_context.c\
pipe/draw/draw_cull.c \
+ pipe/draw/draw_feedback.c \
pipe/draw/draw_flatshade.c \
pipe/draw/draw_offset.c \
pipe/draw/draw_prim.c \