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 <charmainel@vmware.com>
This commit is contained in:
Brian Paul 2017-12-07 21:12:10 -07:00
parent 6b039c7d7c
commit cbcc416a58
1 changed files with 15 additions and 13 deletions

View File

@ -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