int xoffset, int yoffset, float yscale)
{
struct cso_context *cso = hud->cso;
- unsigned size = num_vertices * hud->color_prims.vbuf.stride;
-
- /* If a recording context is inactive, don't draw anything. */
- if (size > hud->color_prims.buffer_size)
- return;
-
- memcpy(hud->color_prims.vertices, buffer, size);
+ struct pipe_vertex_buffer vbuffer = {0};
hud->constants.color[0] = r;
hud->constants.color[1] = g;
hud->constants.scale[1] = yscale * hud_scale;
cso_set_constant_buffer(cso, PIPE_SHADER_VERTEX, 0, &hud->constbuf);
- cso_set_vertex_buffers(cso, 0, 1, &hud->color_prims.vbuf);
+ vbuffer.is_user_buffer = true;
+ vbuffer.buffer.user = buffer;
+ vbuffer.stride = 2 * sizeof(float);
+
+ cso_set_vertex_buffers(cso, 0, 1, &vbuffer);
cso_set_fragment_shader_handle(hud->cso, hud->fs_color);
cso_draw_arrays(cso, prim, 0, num_vertices);
-
- hud->color_prims.vertices += size / sizeof(float);
- hud->color_prims.vbuf.buffer_offset += size;
- hud->color_prims.buffer_size -= size;
}
static void
hud_prepare_vertices(hud, &hud->bg, 16 * 256, 2 * sizeof(float));
hud_prepare_vertices(hud, &hud->whitelines, 4 * 256, 2 * sizeof(float));
hud_prepare_vertices(hud, &hud->text, 16 * 1024, 4 * sizeof(float));
- hud_prepare_vertices(hud, &hud->color_prims, 32 * 1024, 2 * sizeof(float));
/* Allocate everything once and divide the storage into 3 portions
* manually, because u_upload_alloc can unmap memory from previous calls.
u_upload_alloc(pipe->stream_uploader, 0,
hud->bg.buffer_size +
hud->whitelines.buffer_size +
- hud->text.buffer_size +
- hud->color_prims.buffer_size,
+ hud->text.buffer_size,
16, &hud->bg.vbuf.buffer_offset, &hud->bg.vbuf.buffer.resource,
(void**)&hud->bg.vertices);
if (!hud->bg.vertices)
pipe_resource_reference(&hud->whitelines.vbuf.buffer.resource, hud->bg.vbuf.buffer.resource);
pipe_resource_reference(&hud->text.vbuf.buffer.resource, hud->bg.vbuf.buffer.resource);
- pipe_resource_reference(&hud->color_prims.vbuf.buffer.resource, hud->bg.vbuf.buffer.resource);
hud->whitelines.vbuf.buffer_offset = hud->bg.vbuf.buffer_offset +
hud->bg.buffer_size;
hud->text.vertices = hud->whitelines.vertices +
hud->whitelines.buffer_size / sizeof(float);
- hud->color_prims.vbuf.buffer_offset = hud->text.vbuf.buffer_offset +
- hud->text.buffer_size;
- hud->color_prims.vertices = hud->text.vertices +
- hud->text.buffer_size / sizeof(float);
-
/* prepare all graphs */
hud_batch_query_update(hud->batch_query, pipe);