diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/hud/hud_context.c | 28 | ||||
-rw-r--r-- | src/gallium/auxiliary/hud/hud_private.h | 2 |
2 files changed, 8 insertions, 22 deletions
diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c index 57f577a3a92..2b84e6f88e6 100644 --- a/src/gallium/auxiliary/hud/hud_context.c +++ b/src/gallium/auxiliary/hud/hud_context.c @@ -73,13 +73,7 @@ hud_draw_colored_prims(struct hud_context *hud, unsigned prim, 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; @@ -91,13 +85,13 @@ 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); - 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 @@ -645,7 +639,6 @@ hud_stop_queries(struct hud_context *hud, struct pipe_context *pipe) 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. @@ -653,8 +646,7 @@ hud_stop_queries(struct hud_context *hud, struct pipe_context *pipe) 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) @@ -662,7 +654,6 @@ hud_stop_queries(struct hud_context *hud, struct pipe_context *pipe) 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; @@ -674,11 +665,6 @@ hud_stop_queries(struct hud_context *hud, struct pipe_context *pipe) 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); diff --git a/src/gallium/auxiliary/hud/hud_private.h b/src/gallium/auxiliary/hud/hud_private.h index da0b47e498d..c95f4c42b44 100644 --- a/src/gallium/auxiliary/hud/hud_private.h +++ b/src/gallium/auxiliary/hud/hud_private.h @@ -90,7 +90,7 @@ struct hud_context { unsigned max_num_vertices; unsigned num_vertices; unsigned buffer_size; - } text, bg, whitelines, color_prims; + } text, bg, whitelines; bool has_srgb; }; |