diff options
author | Marek Olšák <[email protected]> | 2016-01-28 01:29:25 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-02-09 21:19:51 +0100 |
commit | f7a8b6fff5ae23546ed92aad4ad67470355ed919 (patch) | |
tree | 1f6e9f87a020389c2746a016b81b7ae1e484e55d /src/gallium/drivers | |
parent | e21142087c43627a8b4bdf5aefac8efb58bb5aad (diff) |
radeonsi: split out code for deleting si_shader
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_shaders.c | 65 |
1 files changed, 36 insertions, 29 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index f48d7ca360f..27a981ee0dc 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1053,6 +1053,41 @@ static void si_bind_ps_shader(struct pipe_context *ctx, void *state) si_mark_atom_dirty(sctx, &sctx->cb_render_state); } +static void si_delete_shader(struct si_context *sctx, struct si_shader *shader) +{ + if (shader->pm4) { + switch (shader->selector->type) { + case PIPE_SHADER_VERTEX: + if (shader->key.vs.as_ls) + si_pm4_delete_state(sctx, ls, shader->pm4); + else if (shader->key.vs.as_es) + si_pm4_delete_state(sctx, es, shader->pm4); + else + si_pm4_delete_state(sctx, vs, shader->pm4); + break; + case PIPE_SHADER_TESS_CTRL: + si_pm4_delete_state(sctx, hs, shader->pm4); + break; + case PIPE_SHADER_TESS_EVAL: + if (shader->key.tes.as_es) + si_pm4_delete_state(sctx, es, shader->pm4); + else + si_pm4_delete_state(sctx, vs, shader->pm4); + break; + case PIPE_SHADER_GEOMETRY: + si_pm4_delete_state(sctx, gs, shader->pm4); + si_pm4_delete_state(sctx, vs, shader->gs_copy_shader->pm4); + break; + case PIPE_SHADER_FRAGMENT: + si_pm4_delete_state(sctx, ps, shader->pm4); + break; + } + } + + si_shader_destroy(shader); + free(shader); +} + static void si_delete_shader_selector(struct pipe_context *ctx, void *state) { struct si_context *sctx = (struct si_context *)ctx; @@ -1073,35 +1108,7 @@ static void si_delete_shader_selector(struct pipe_context *ctx, void *state) while (p) { c = p->next_variant; - switch (sel->type) { - case PIPE_SHADER_VERTEX: - if (p->key.vs.as_ls) - si_pm4_delete_state(sctx, ls, p->pm4); - else if (p->key.vs.as_es) - si_pm4_delete_state(sctx, es, p->pm4); - else - si_pm4_delete_state(sctx, vs, p->pm4); - break; - case PIPE_SHADER_TESS_CTRL: - si_pm4_delete_state(sctx, hs, p->pm4); - break; - case PIPE_SHADER_TESS_EVAL: - if (p->key.tes.as_es) - si_pm4_delete_state(sctx, es, p->pm4); - else - si_pm4_delete_state(sctx, vs, p->pm4); - break; - case PIPE_SHADER_GEOMETRY: - si_pm4_delete_state(sctx, gs, p->pm4); - si_pm4_delete_state(sctx, vs, p->gs_copy_shader->pm4); - break; - case PIPE_SHADER_FRAGMENT: - si_pm4_delete_state(sctx, ps, p->pm4); - break; - } - - si_shader_destroy(p); - free(p); + si_delete_shader(sctx, p); p = c; } |