X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fllvmpipe%2Flp_state_gs.c;h=7ea7a3906697e67df30040342db81a7524fa39de;hb=2f2d1b3d9b090aeba316d6c425c23e92340b5502;hp=74cf9923488f7769e8507babe7febc33513e2e36;hpb=2212a97fe36f0d20c4c8dc1db1a3c7da08126f95;p=mesa.git diff --git a/src/gallium/drivers/llvmpipe/lp_state_gs.c b/src/gallium/drivers/llvmpipe/lp_state_gs.c index 74cf9923488..7ea7a390669 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_gs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_gs.c @@ -48,7 +48,7 @@ llvmpipe_create_gs_state(struct pipe_context *pipe, state = CALLOC_STRUCT(lp_geometry_shader); if (state == NULL ) - goto fail; + goto no_state; /* debug */ if (LP_DEBUG & DEBUG_TGSI) { @@ -57,26 +57,21 @@ llvmpipe_create_gs_state(struct pipe_context *pipe, } /* copy stream output info */ - state->shader = *templ; + state->no_tokens = !templ->tokens; + memcpy(&state->stream_output, &templ->stream_output, sizeof state->stream_output); + 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; + state->dgs = draw_create_geometry_shader(llvmpipe->draw, templ); + if (state->dgs == NULL) { + goto no_dgs; + } } return state; -fail: - if (state) { - FREE( (void *)state->shader.tokens ); - FREE( state->draw_data ); - FREE( state ); - } +no_dgs: + FREE( state ); +no_state: return NULL; } @@ -89,7 +84,7 @@ llvmpipe_bind_gs_state(struct pipe_context *pipe, void *gs) llvmpipe->gs = (struct lp_geometry_shader *)gs; draw_bind_geometry_shader(llvmpipe->draw, - (llvmpipe->gs ? llvmpipe->gs->draw_data : NULL)); + (llvmpipe->gs ? llvmpipe->gs->dgs : NULL)); llvmpipe->dirty |= LP_NEW_GS; } @@ -107,8 +102,7 @@ llvmpipe_delete_gs_state(struct pipe_context *pipe, void *gs) return; } - draw_delete_geometry_shader(llvmpipe->draw, state->draw_data); - FREE( (void *)state->shader.tokens ); + draw_delete_geometry_shader(llvmpipe->draw, state->dgs); FREE(state); }