X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fllvmpipe%2Flp_state_gs.c;h=55da0f16a8de55f8b50ef7d745c81858bfb7ce12;hb=155139059ba588da1161eaa692515cacdead9f4e;hp=1ba6f10821e8ffaf9fc89c0b456966945939c789;hpb=1218430e1200a08cd64b6555d3fd1fd0274ad9e5;p=mesa.git diff --git a/src/gallium/drivers/llvmpipe/lp_state_gs.c b/src/gallium/drivers/llvmpipe/lp_state_gs.c index 1ba6f10821e..55da0f16a8d 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_gs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_gs.c @@ -53,15 +53,18 @@ llvmpipe_create_gs_state(struct pipe_context *pipe, 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; @@ -97,8 +100,12 @@ llvmpipe_delete_gs_state(struct pipe_context *pipe, void *gs) struct lp_geometry_shader *state = (struct lp_geometry_shader *)gs; - draw_delete_geometry_shader(llvmpipe->draw, - (state) ? state->draw_data : 0); + if (!state) { + return; + } + + draw_delete_geometry_shader(llvmpipe->draw, state->draw_data); + FREE( (void *)state->shader.tokens ); FREE(state); }