gallium/hud: don't use user vertex buffers
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Thu, 11 Jun 2020 11:03:22 +0000 (13:03 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 16 Jun 2020 08:02:29 +0000 (08:02 +0000)
This gains back some performance lost in the previous commit, by
bypassing u_vbuf.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5417>

src/gallium/auxiliary/hud/hud_context.c

index 2b84e6f88e66199631b357dc2bd73aa495eacc3d..bb614f76a9508e432f807eefcb3a7f8353af0e8c 100644 (file)
@@ -85,11 +85,14 @@ hud_draw_colored_prims(struct hud_context *hud, unsigned prim,
    hud->constants.scale[1] = yscale * hud_scale;
    cso_set_constant_buffer(cso, PIPE_SHADER_VERTEX, 0, &hud->constbuf);
 
-   vbuffer.is_user_buffer = true;
-   vbuffer.buffer.user = buffer;
+   u_upload_data(hud->pipe->stream_uploader, 0,
+                 num_vertices * 2 * sizeof(float), 16, buffer,
+                 &vbuffer.buffer_offset, &vbuffer.buffer.resource);
+   u_upload_unmap(hud->pipe->stream_uploader);
    vbuffer.stride = 2 * sizeof(float);
 
    cso_set_vertex_buffers(cso, 0, 1, &vbuffer);
+   pipe_resource_reference(&vbuffer.buffer.resource, NULL);
    cso_set_fragment_shader_handle(hud->cso, hud->fs_color);
    cso_draw_arrays(cso, prim, 0, num_vertices);
 }