draw->so.num_targets = num_targets;
}
-void
-draw_set_so_state(struct draw_context *draw,
- struct pipe_stream_output_info *state)
-{
- memcpy(&draw->so.state,
- state,
- sizeof(struct pipe_stream_output_info));
-}
-
void
draw_set_sampler_views(struct draw_context *draw,
unsigned shader_stage,
struct draw_vertex_shader *dvs);
void draw_delete_vertex_shader(struct draw_context *draw,
struct draw_vertex_shader *dvs);
+void draw_vs_attach_so(struct draw_vertex_shader *dvs,
+ const struct pipe_stream_output_info *info);
+void draw_vs_reset_so(struct draw_vertex_shader *dvs);
/*
int num_targets,
struct draw_so_target *targets[PIPE_MAX_SO_BUFFERS]);
-void
-draw_set_so_state(struct draw_context *draw,
- struct pipe_stream_output_info *state);
-
/***********************************************************************
* draw_pt.c
/** Stream output (vertex feedback) state */
struct {
- struct pipe_stream_output_info state;
struct draw_so_target *targets[PIPE_MAX_SO_BUFFERS];
uint num_targets;
} so;
return draw->vs.emit;
}
+
+void
+draw_vs_attach_so(struct draw_vertex_shader *dvs,
+ const struct pipe_stream_output_info *info)
+{
+ dvs->state.stream_output = *info;
+}
+
+void
+draw_vs_reset_so(struct draw_vertex_shader *dvs)
+{
+ memset(&dvs->state.stream_output, 0, sizeof(dvs->state.stream_output));
+}
llvmpipe_prepare_geometry_sampling(lp,
lp->num_sampler_views[PIPE_SHADER_GEOMETRY],
lp->sampler_views[PIPE_SHADER_GEOMETRY]);
+ if (lp->gs && !lp->gs->shader.tokens) {
+ /* we have an empty geometry shader with stream output, so
+ attach the stream output info to the current vertex shader */
+ if (lp->vs) {
+ draw_vs_attach_so(lp->vs->draw_data, &lp->gs->shader.stream_output);
+ }
+ }
/* draw! */
draw_vbo(draw, info);
}
draw_set_mapped_so_targets(draw, 0, NULL);
+ if (lp->gs && !lp->gs->shader.tokens) {
+ /* we have attached stream output to the vs for rendering,
+ now lets reset it */
+ if (lp->vs) {
+ draw_vs_reset_so(lp->vs->draw_data);
+ }
+ }
+
llvmpipe_cleanup_vertex_sampling(lp);
llvmpipe_cleanup_geometry_sampling(lp);
if (0)
tgsi_dump(templ->tokens, 0);
- /* copy shader tokens, the ones passed in will go away.
- */
- state->shader.tokens = tgsi_dup_tokens(templ->tokens);
- if (state->shader.tokens == NULL)
- goto fail;
-
- state->draw_data = draw_create_geometry_shader(llvmpipe->draw, templ);
- if (state->draw_data == NULL)
- goto fail;
+ /* copy stream output info */
+ state->shader = *templ;
+ if (templ->tokens) {
+ /* copy shader tokens, the ones passed in will go away. */
+ state->shader.tokens = tgsi_dup_tokens(templ->tokens);
+ if (state->shader.tokens == NULL)
+ goto fail;
+
+ state->draw_data = draw_create_geometry_shader(llvmpipe->draw, templ);
+ if (state->draw_data == NULL)
+ goto fail;
+ }
return state;