summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/svga
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2017-12-07 21:12:10 -0700
committerBrian Paul <brianp@vmware.com>2018-09-10 13:07:30 -0600
commitcbcc416a5863bfd40038392e65521c8fbd362405 (patch)
tree6eb35a58b67c33fd5777e105bacc215a3d25e152 /src/gallium/drivers/svga
parent6b039c7d7cb2807a1b16c892b78f5f4ad65c8947 (diff)
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>
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r--src/gallium/drivers/svga/svga_pipe_rasterizer.c28
1 files 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