From cbcc416a5863bfd40038392e65521c8fbd362405 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 7 Dec 2017 21:12:10 -0700 Subject: [PATCH] svga: draw round points when msaa is enabled See comments for details. This allows the piglit ext_framebuffer_multisample-point-smooth test to pass. Also, test the pipe_rasterizer_state::point_quad_rasterization field to see if sprite point rasterization is needed because it's possible for no sprite_coord_enable bits to be set when drawing sprites. Finally, remove old, stale comments. Reviewed-by: Charmaine Lee --- .../drivers/svga/svga_pipe_rasterizer.c | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/svga/svga_pipe_rasterizer.c b/src/gallium/drivers/svga/svga_pipe_rasterizer.c index bc0acd94625..1dbf5b6debb 100644 --- a/src/gallium/drivers/svga/svga_pipe_rasterizer.c +++ b/src/gallium/drivers/svga/svga_pipe_rasterizer.c @@ -172,25 +172,27 @@ svga_create_rasterizer_state(struct pipe_context *pipe, /* need this for draw module. */ rast->templ = *templ; - /* light_twoside - XXX: need fragment shader variant */ - /* poly_smooth - XXX: no fallback available */ - /* poly_stipple_enable - draw module */ - /* sprite_coord_enable - ? */ - /* point_quad_rasterization - ? */ - /* point_size_per_vertex - ? */ - /* sprite_coord_mode - ??? */ - /* flatshade_first - handled by index translation */ - /* half_pixel_center - XXX - viewport code */ - /* line_width - draw module */ - /* fill_cw, fill_ccw - draw module or index translation */ - rast->shademode = svga_translate_flatshade(templ->flatshade); rast->cullmode = svga_translate_cullmode(templ->cull_face, templ->front_ccw); rast->scissortestenable = templ->scissor; rast->multisampleantialias = templ->multisample; rast->antialiasedlineenable = templ->line_smooth; rast->lastpixel = templ->line_last_pixel; - rast->pointsprite = templ->sprite_coord_enable != 0x0; + rast->pointsprite = templ->point_quad_rasterization; + + if (rast->templ.multisample) { + /* The OpenGL 3.0 spec says points are always drawn as circles when + * MSAA is enabled. Note that our implementation isn't 100% correct, + * though. Our smooth point implementation involves drawing a square, + * computing fragment distance from point center, then attenuating + * the fragment alpha value. We should not attenuate alpha if msaa + * is enabled. We should kill fragments entirely outside the circle + * and let the GPU compute per-fragment coverage. + * But as-is, our implementation gives acceptable results and passes + * Piglit's MSAA point smooth test. + */ + rast->templ.point_smooth = TRUE; + } if (templ->point_smooth) { /* For smooth points we need to generate fragments for at least -- 2.30.2