-
- svga_update_state_retry( svga, SVGA_STATE_NEED_SWTNL );
-
-#ifdef DEBUG
- if (svga->curr.vs->base.id == svga->debug.disable_shader ||
- svga->curr.fs->base.id == svga->debug.disable_shader)
- return;
-#endif
-
- if (svga->state.sw.need_swtnl)
- {
- ret = svga_swtnl_draw_range_elements( svga,
- index_buffer,
- index_size,
- index_bias,
- min_index, max_index,
- prim,
- start, count );
+
+ if (need_fallback_prim_restart(svga, info)) {
+ enum pipe_error r;
+ r = util_draw_vbo_without_prim_restart(pipe, info);
+ assert(r == PIPE_OK);
+ (void) r;
+ goto done;
+ }
+
+ if (!u_trim_pipe_prim(info->mode, &count))
+ goto done;
+
+ needed_swtnl = svga->state.sw.need_swtnl;
+
+ svga_update_state_retry(svga, SVGA_STATE_NEED_SWTNL);
+
+ if (svga->state.sw.need_swtnl) {
+ svga->hud.num_fallbacks++; /* for SVGA_QUERY_NUM_FALLBACKS */
+ if (!needed_swtnl) {
+ /*
+ * We're switching from HW to SW TNL. SW TNL will require mapping all
+ * currently bound vertex buffers, some of which may already be
+ * referenced in the current command buffer as result of previous HW
+ * TNL. So flush now, to prevent the context to flush while a referred
+ * vertex buffer is mapped.
+ */
+
+ svga_context_flush(svga, NULL);
+ }
+
+ /* Avoid leaking the previous hwtnl bias to swtnl */
+ svga_hwtnl_set_index_bias(svga->hwtnl, 0);
+ ret = svga_swtnl_draw_vbo(svga, info);