[Mesa-dev] [PATCH 2/6] gallium/hud: use AA lines for graphs

Marek Olšák maraeo at gmail.com
Thu Aug 18 19:56:29 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

this looks a lot better (with the next patch)
---
 src/gallium/auxiliary/hud/hud_context.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index 0b292bc..fb9c8c6 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -60,21 +60,21 @@ struct hud_context {
    struct cso_context *cso;
    struct u_upload_mgr *uploader;
 
    struct hud_batch_query_context *batch_query;
    struct list_head pane_list;
 
    /* states */
    struct pipe_blend_state no_blend, alpha_blend;
    struct pipe_depth_stencil_alpha_state dsa;
    void *fs_color, *fs_text;
-   struct pipe_rasterizer_state rasterizer;
+   struct pipe_rasterizer_state rasterizer, rasterizer_aa_lines;
    void *vs;
    struct pipe_vertex_element velems[2];
 
    /* font */
    struct util_font font;
    struct pipe_sampler_view *font_sampler_view;
    struct pipe_sampler_state font_sampler_state;
 
    /* VS constant buffer */
    struct {
@@ -583,20 +583,21 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex)
    cso_set_blend(cso, &hud->alpha_blend);
    if (hud->text.num_vertices) {
       cso_set_vertex_buffers(cso, cso_get_aux_vertex_buffer_slot(cso), 1,
                              &hud->text.vbuf);
       cso_set_fragment_shader_handle(hud->cso, hud->fs_text);
       cso_draw_arrays(cso, PIPE_PRIM_QUADS, 0, hud->text.num_vertices);
    }
    pipe_resource_reference(&hud->text.vbuf.buffer, NULL);
 
    /* draw the rest */
+   cso_set_rasterizer(cso, &hud->rasterizer_aa_lines);
    LIST_FOR_EACH_ENTRY(pane, &hud->pane_list, head) {
       if (pane)
          hud_pane_draw_colored_objects(hud, pane);
    }
 
    cso_restore_state(cso);
    cso_restore_constant_buffer_slot0(cso, PIPE_SHADER_VERTEX);
 
    pipe_surface_reference(&surf, NULL);
 }
@@ -1220,20 +1221,23 @@ hud_create(struct pipe_context *pipe, struct cso_context *cso)
       hud->fs_text = pipe->create_fs_state(pipe, &state);
    }
 
    /* rasterizer */
    hud->rasterizer.half_pixel_center = 1;
    hud->rasterizer.bottom_edge_rule = 1;
    hud->rasterizer.depth_clip = 1;
    hud->rasterizer.line_width = 1;
    hud->rasterizer.line_last_pixel = 1;
 
+   hud->rasterizer_aa_lines = hud->rasterizer;
+   hud->rasterizer_aa_lines.line_smooth = 1;
+
    /* vertex shader */
    {
       static const char *vertex_shader_text = {
          "VERT\n"
          "DCL IN[0..1]\n"
          "DCL OUT[0], POSITION\n"
          "DCL OUT[1], COLOR[0]\n" /* color */
          "DCL OUT[2], GENERIC[0]\n" /* texcoord */
          /* [0] = color,
           * [1] = (2/fb_width, 2/fb_height, xoffset, yoffset)
-- 
2.7.4



More information about the mesa-dev mailing list