draw->pipeline.clip = draw_clip_stage( draw );
draw->pipeline.flatshade = draw_flatshade_stage( draw );
draw->pipeline.cull = draw_cull_stage( draw );
+ draw->pipeline.feedback = draw_feedback_stage( draw );
ASSIGN_4V( draw->plane[0], -1, 0, 0, 1 );
ASSIGN_4V( draw->plane[1], 1, 0, 0, 1 );
}
+void draw_set_feedback_state( struct draw_context *draw,
+ const struct pipe_feedback_state *feedback )
+{
+ draw->feedback = *feedback;
+ validate_pipeline( draw );
+}
+
+
/**
* Register new primitive setup/rendering state.
* This causes the drawing pipeline to be rebuilt.
draw_set_mapped_feedback_buffer(struct draw_context *draw, uint index,
void *buffer, uint size)
{
+ assert(index < PIPE_MAX_FEEDBACK_ATTRIBS);
draw->mapped_feedback_buffer[index] = buffer;
draw->mapped_feedback_buffer_size[index] = size; /* in bytes */
}
void draw_set_clip_state( struct draw_context *pipe,
const struct pipe_clip_state *clip );
+void draw_set_feedback_state( struct draw_context *draw,
+ const struct pipe_feedback_state * );
+
void draw_set_setup_state( struct draw_context *draw,
const struct pipe_setup_state *setup );
for (i = 0; i < feedback->num_attribs; i++) {
const uint attr = feedback->attrib[i];
- const float *src = attr ? vertex->data[attr] : vertex->clip;
+ const uint slot = stage->draw->vertex_info.attrib_to_slot[attr];
+ const float *src = attr ? vertex->data[slot] : vertex->clip;
const uint size = feedback->size[i];
float *dest = fs->dest[i * select];
void (*set_depth_state)( struct pipe_context *,
const struct pipe_depth_state * );
+ void (*set_feedback_state)( struct pipe_context *,
+ const struct pipe_feedback_state *);
+
void (*set_framebuffer_state)( struct pipe_context *,
const struct pipe_framebuffer_state * );
*/
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 *);
+ const struct pipe_feedback_buffer *);
-
/*
* Surface functions
* This might go away...
};
+/**
+ * Vertex feedback buffer
+ */
+struct pipe_feedback_buffer {
+ struct pipe_buffer_handle *buffer;
+ unsigned size;
+ unsigned start_offset;
+};
+
#endif
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 \
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;
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;
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;
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:
*/
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);
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);
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 * );
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 );