radeonsi: si_conv_pipe_prim shouldn't fail
authorMarek Olšák <marek.olsak@amd.com>
Sun, 7 Dec 2014 15:02:07 +0000 (16:02 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 10 Dec 2014 20:59:37 +0000 (21:59 +0100)
An assertion should suffice.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeonsi/si_state_draw.c

index e1b5f65ed4f512871a366ae12e9898068124aff2..e87bc3c266113a244e1ee4e1745b9c6f0b9635b6 100644 (file)
@@ -341,7 +341,7 @@ void si_shader_init_pm4_state(struct si_shader *shader)
  * Drawing
  */
 
-static unsigned si_conv_pipe_prim(unsigned pprim)
+static unsigned si_conv_pipe_prim(unsigned mode)
 {
         static const unsigned prim_conv[] = {
                [PIPE_PRIM_POINTS]                      = V_008958_DI_PT_POINTLIST,
@@ -360,11 +360,8 @@ static unsigned si_conv_pipe_prim(unsigned pprim)
                [PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY]    = V_008958_DI_PT_TRISTRIP_ADJ,
                [R600_PRIM_RECTANGLE_LIST]              = V_008958_DI_PT_RECTLIST
         };
-       unsigned result = prim_conv[pprim];
-        if (result == ~0) {
-               R600_ERR("unsupported primitive type %d\n", pprim);
-        }
-       return result;
+       assert(mode < Elements(prim_conv));
+       return prim_conv[mode];
 }
 
 static unsigned si_conv_prim_to_gs_out(unsigned mode)
@@ -465,11 +462,6 @@ static bool si_update_draw_info_state(struct si_context *sctx,
        if (pm4 == NULL)
                return false;
 
-       if (prim == ~0) {
-               FREE(pm4);
-               return false;
-       }
-
        if (sctx->b.chip_class >= CIK) {
                si_pm4_set_reg(pm4, R_028B74_VGT_DISPATCH_DRAW_INDEX,
                               ib->index_size == 4 ? 0xFC000000 : 0xFC00);