diff options
Diffstat (limited to 'src/mesa/pipe/softpipe')
-rw-r--r-- | src/mesa/pipe/softpipe/Makefile | 1 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_context.c | 3 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_context.h | 4 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_draw_arrays.c | 24 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_state.h | 9 |
5 files changed, 41 insertions, 0 deletions
diff --git a/src/mesa/pipe/softpipe/Makefile b/src/mesa/pipe/softpipe/Makefile index ffa31102d55..401df1cfb76 100644 --- a/src/mesa/pipe/softpipe/Makefile +++ b/src/mesa/pipe/softpipe/Makefile @@ -26,6 +26,7 @@ DRIVER_SOURCES = \ sp_state_blend.c \ sp_state_clip.c \ sp_state_derived.c \ + sp_state_feedback.c \ sp_state_fs.c \ sp_state_sampler.c \ sp_state_setup.c \ diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index 5404b7f7905..26453d97852 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -239,6 +239,7 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys, softpipe->pipe.set_clear_color_state = softpipe_set_clear_color_state; softpipe->pipe.set_constant_buffer = softpipe_set_constant_buffer; softpipe->pipe.set_depth_state = softpipe_set_depth_test_state; + softpipe->pipe.set_feedback_state = softpipe_set_feedback_state; softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state; softpipe->pipe.set_fs_state = softpipe_set_fs_state; softpipe->pipe.set_vs_state = softpipe_set_vs_state; @@ -249,8 +250,10 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys, softpipe->pipe.set_stencil_state = softpipe_set_stencil_state; softpipe->pipe.set_texture_state = softpipe_set_texture_state; softpipe->pipe.set_viewport_state = softpipe_set_viewport_state; + softpipe->pipe.set_vertex_buffer = softpipe_set_vertex_buffer; softpipe->pipe.set_vertex_element = softpipe_set_vertex_element; + softpipe->pipe.set_feedback_buffer = softpipe_set_feedback_buffer; softpipe->pipe.draw_arrays = softpipe_draw_arrays; softpipe->pipe.draw_elements = softpipe_draw_elements; diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h index fd0af6f727d..2a6b932523a 100644 --- a/src/mesa/pipe/softpipe/sp_context.h +++ b/src/mesa/pipe/softpipe/sp_context.h @@ -78,6 +78,7 @@ struct softpipe_context { struct pipe_clip_state clip; struct pipe_constant_buffer constants[2]; struct pipe_depth_state depth_test; + struct pipe_feedback_state feedback; struct pipe_framebuffer_state framebuffer; struct pipe_shader_state fs; struct pipe_shader_state vs; @@ -107,6 +108,9 @@ struct softpipe_context { boolean need_z; /**< produce quad/fragment Z values? */ boolean need_w; /**< produce quad/fragment W values? */ + /** Feedback buffers */ + struct pipe_feedback_buffer feedback_buffer[PIPE_MAX_FEEDBACK_ATTRIBS]; + #if 0 /* Stipple derived state: */ diff --git a/src/mesa/pipe/softpipe/sp_draw_arrays.c b/src/mesa/pipe/softpipe/sp_draw_arrays.c index 5198a493da3..7ea29a0a269 100644 --- a/src/mesa/pipe/softpipe/sp_draw_arrays.c +++ b/src/mesa/pipe/softpipe/sp_draw_arrays.c @@ -135,6 +135,19 @@ softpipe_draw_elements(struct pipe_context *pipe, draw_set_mapped_element_buffer(draw, 0, NULL); } + /* Map feedback buffers if enabled */ + if (sp->feedback.enabled) { + const uint n = sp->feedback.interleaved ? 1 : sp->feedback.num_attribs; + for (i = 0; i < n; i++) { + void *ptr = pipe->winsys->buffer_map(pipe->winsys, + sp->feedback_buffer[i].buffer, + PIPE_BUFFER_FLAG_WRITE); + draw_set_mapped_feedback_buffer(draw, i, ptr, + sp->feedback_buffer[i].size); + } + } + + /* draw! */ draw_arrays(draw, mode, start, count); @@ -152,6 +165,17 @@ softpipe_draw_elements(struct pipe_context *pipe, draw_set_mapped_element_buffer(draw, 0, NULL); } + /* Unmap feedback buffers if enabled */ + if (sp->feedback.enabled) { + const uint n = sp->feedback.interleaved ? 1 : sp->feedback.num_attribs; + for (i = 0; i < n; i++) { + pipe->winsys->buffer_unmap(pipe->winsys, + sp->feedback_buffer[i].buffer); + draw_set_mapped_feedback_buffer(draw, i, NULL, 0); + } + } + + softpipe_unmap_surfaces(sp); softpipe_unmap_constant_buffers(sp); diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h index 354580b2a5a..f40ebe3e2b8 100644 --- a/src/mesa/pipe/softpipe/sp_state.h +++ b/src/mesa/pipe/softpipe/sp_state.h @@ -59,6 +59,9 @@ void softpipe_set_constant_buffer(struct pipe_context *, void softpipe_set_depth_test_state( struct pipe_context *, const struct pipe_depth_state * ); +void softpipe_set_feedback_state( struct pipe_context *, + const struct pipe_feedback_state * ); + void softpipe_set_fs_state( struct pipe_context *, const struct pipe_shader_state * ); @@ -96,6 +99,12 @@ void softpipe_set_vertex_buffer(struct pipe_context *, unsigned index, const struct pipe_vertex_buffer *); +void softpipe_set_feedback_buffer(struct pipe_context *, + uint index, + const struct pipe_feedback_buffer *); + + + void softpipe_update_derived( struct softpipe_context *softpipe ); |