diff options
Diffstat (limited to 'src/mesa/pipe/draw')
-rw-r--r-- | src/mesa/pipe/draw/draw_context.c | 42 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_context.h | 23 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_prim.c | 17 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_private.h | 9 |
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 ); |