radeonsi: add an initial dump_debug_state implementation dumping shaders
[mesa.git] / src / gallium / drivers / svga / svga_draw_elements.c
index f6603be920a3fb716e5658c351a4708f291437fe..038500a35bde9b60f58e027dc649f72359c6b273 100644 (file)
@@ -58,7 +58,7 @@ translate_indices(struct svga_hwtnl *hwtnl, struct pipe_resource *src,
    size = index_size * nr;
 
    dst = pipe_buffer_create(pipe->screen,
-                            PIPE_BIND_INDEX_BUFFER, PIPE_USAGE_STATIC, size);
+                            PIPE_BIND_INDEX_BUFFER, PIPE_USAGE_DEFAULT, size);
    if (dst == NULL)
       goto fail;
 
@@ -70,7 +70,7 @@ translate_indices(struct svga_hwtnl *hwtnl, struct pipe_resource *src,
    if (dst_map == NULL)
       goto fail;
 
-   translate((const char *) src_map + offset, 0, nr, dst_map);
+   translate((const char *) src_map + offset, 0, 0, nr, 0, dst_map);
 
    pipe_buffer_unmap(pipe, src_transfer);
    pipe_buffer_unmap(pipe, dst_transfer);
@@ -100,16 +100,14 @@ svga_hwtnl_simple_draw_range_elements(struct svga_hwtnl *hwtnl,
                                       unsigned prim, unsigned start,
                                       unsigned count)
 {
-   struct pipe_resource *upload_buffer = NULL;
    SVGA3dPrimitiveRange range;
    unsigned hw_prim;
    unsigned hw_count;
    unsigned index_offset = start * index_size;
-   enum pipe_error ret = PIPE_OK;
 
    hw_prim = svga_translate_prim(prim, count, &hw_count);
    if (hw_count == 0)
-      goto done;
+      return PIPE_OK; /* nothing to draw */
 
    /* We should never see user-space buffers in the driver.  The vbuf
     * module should have converted them into real buffers.
@@ -124,15 +122,7 @@ svga_hwtnl_simple_draw_range_elements(struct svga_hwtnl *hwtnl,
    range.indexWidth = index_size;
    range.indexBias = index_bias;
 
-   ret = svga_hwtnl_prim(hwtnl, &range, min_index, max_index, index_buffer);
-   if (ret != PIPE_OK)
-      goto done;
-
-done:
-   if (upload_buffer)
-      pipe_resource_reference(&upload_buffer, NULL);
-
-   return ret;
+   return svga_hwtnl_prim(hwtnl, &range, min_index, max_index, index_buffer);
 }
 
 
@@ -163,6 +153,7 @@ svga_hwtnl_draw_range_elements(struct svga_hwtnl *hwtnl,
                                     count,
                                     hwtnl->api_pv,
                                     hwtnl->hw_pv,
+                                    PR_DISABLE,
                                     &gen_prim, &gen_size, &gen_nr, &gen_func);
    }