svga: replace gotos with conditionals in array drawing code
authorBrian Paul <brianp@vmware.com>
Sat, 19 Aug 2017 03:18:47 +0000 (21:18 -0600)
committerBrian Paul <brianp@vmware.com>
Tue, 22 Aug 2017 01:04:51 +0000 (19:04 -0600)
No Piglit regressions.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
src/gallium/drivers/svga/svga_draw_arrays.c
src/gallium/drivers/svga/svga_draw_elements.c

index b968fb03044f4eb714924df866af5aae53b6897a..19d5e5031377e9885383ef1d850421f8f4d0220f 100644 (file)
@@ -286,25 +286,25 @@ svga_hwtnl_draw_arrays(struct svga_hwtnl *hwtnl,
                                          gen_type,
                                          gen_nr,
                                          gen_size, gen_func, &gen_buf);
-      if (ret != PIPE_OK)
-         goto done;
-
-      pipe_debug_message(&svga->debug.callback, PERF_INFO,
-                         "generating temporary index buffer for drawing %s",
-                         u_prim_name(prim));
-
-      ret = svga_hwtnl_simple_draw_range_elements(hwtnl,
-                                                  gen_buf,
-                                                  gen_size,
-                                                  start,
-                                                  0,
-                                                  count - 1,
-                                                  gen_prim, 0, gen_nr,
-                                                  start_instance,
-                                                  instance_count);
-done:
-      if (gen_buf)
+      if (ret == PIPE_OK) {
+         pipe_debug_message(&svga->debug.callback, PERF_INFO,
+                            "generating temporary index buffer for drawing %s",
+                            u_prim_name(prim));
+
+         ret = svga_hwtnl_simple_draw_range_elements(hwtnl,
+                                                     gen_buf,
+                                                     gen_size,
+                                                     start,
+                                                     0,
+                                                     count - 1,
+                                                     gen_prim, 0, gen_nr,
+                                                     start_instance,
+                                                     instance_count);
+      }
+
+      if (gen_buf) {
          pipe_resource_reference(&gen_buf, NULL);
+      }
    }
 
    SVGA_STATS_TIME_POP(svga_sws(svga));
index f9bb13664f586e6fdb5b52d9788c7e580e7256e4..b1db8710740ce1594de0756c58c88f6d92d766c7 100644 (file)
@@ -242,21 +242,21 @@ svga_hwtnl_draw_range_elements(struct svga_hwtnl *hwtnl,
                               prim, gen_prim,
                               count, gen_nr, gen_size,
                               gen_func, &gen_buf);
-      if (ret != PIPE_OK)
-         goto done;
-
-      ret = svga_hwtnl_simple_draw_range_elements(hwtnl,
-                                                  gen_buf,
-                                                  gen_size,
-                                                  index_bias,
-                                                  min_index,
-                                                  max_index,
-                                                  gen_prim, 0, gen_nr,
-                                                  start_instance,
-                                                  instance_count);
-done:
-      if (gen_buf)
+      if (ret == PIPE_OK) {
+         ret = svga_hwtnl_simple_draw_range_elements(hwtnl,
+                                                     gen_buf,
+                                                     gen_size,
+                                                     index_bias,
+                                                     min_index,
+                                                     max_index,
+                                                     gen_prim, 0, gen_nr,
+                                                     start_instance,
+                                                     instance_count);
+      }
+
+      if (gen_buf) {
          pipe_resource_reference(&gen_buf, NULL);
+      }
    }
 
    SVGA_STATS_TIME_POP(svga_sws(hwtnl->svga));