radeonsi: use a switch statement in si_delete_shader_selector
authorMarek Olšák <marek.olsak@amd.com>
Sun, 22 Feb 2015 14:38:21 +0000 (15:38 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 26 May 2015 10:42:37 +0000 (12:42 +0200)
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeonsi/si_state_shaders.c

index e037ce41468be756275a45b48c160c0824ea88f1..208c8523ef107807c68364d70b850cdb5520e96f 100644 (file)
@@ -592,15 +592,22 @@ static void si_delete_shader_selector(struct pipe_context *ctx,
 
        while (p) {
                c = p->next_variant;
-               if (sel->type == PIPE_SHADER_GEOMETRY) {
+               switch (sel->type) {
+               case PIPE_SHADER_VERTEX:
+                       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_GEOMETRY:
                        si_pm4_delete_state(sctx, gs, p->pm4);
                        si_pm4_delete_state(sctx, vs, p->gs_copy_shader->pm4);
-               } else if (sel->type == PIPE_SHADER_FRAGMENT)
+                       break;
+               case PIPE_SHADER_FRAGMENT:
                        si_pm4_delete_state(sctx, ps, 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;
+               }
+
                si_shader_destroy(ctx, p);
                free(p);
                p = c;