From: Brian Paul Date: Fri, 8 Dec 2017 04:12:10 +0000 (-0700) Subject: svga: draw round points when msaa is enabled X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cbcc416a5863bfd40038392e65521c8fbd362405;p=mesa.git 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 --- 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