Mesa (master): st/mesa: don't enable smoothing if multisampling is enabled

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 27 20:07:28 UTC 2021


Module: Mesa
Branch: master
Commit: 24ede1ba5b57675321cdb20ecbd9f12c4ed4f88a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=24ede1ba5b57675321cdb20ecbd9f12c4ed4f88a

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Tue Jan 12 03:23:23 2021 -0500

st/mesa: don't enable smoothing if multisampling is enabled

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8684>

---

 src/mesa/state_tracker/st_atom_rasterizer.c | 40 +++++++++++++++++++++++------
 1 file changed, 32 insertions(+), 8 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
index 9f3ba33427f..4c1abfb6800 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -163,13 +163,40 @@ st_update_rasterizer(struct st_context *st)
       raster->offset_clamp = ctx->Polygon.OffsetClamp;
    }
 
-   raster->poly_smooth = ctx->Polygon.SmoothFlag;
    raster->poly_stipple_enable = ctx->Polygon.StippleFlag;
 
+   /* Multisampling disables point, line, and polygon smoothing.
+    *
+    * GL_ARB_multisample says:
+    *
+    *   "If MULTISAMPLE_ARB is enabled, and SAMPLE_BUFFERS_ARB is a value of
+    *    one, then points are rasterized using the following algorithm,
+    *    regardless of whether point antialiasing (POINT_SMOOTH) is enabled"
+    *
+    *   "If MULTISAMPLE_ARB is enabled, and SAMPLE_BUFFERS_ARB is a value of
+    *    one, then lines are rasterized using the following algorithm,
+    *    regardless of whether line antialiasing (LINE_SMOOTH) is enabled"
+    *
+    *   "If MULTISAMPLE_ARB is enabled, and SAMPLE_BUFFERS_ARB is a value of
+    *    one, then polygons are rasterized using the following algorithm,
+    *    regardless of whether polygon antialiasing (POLYGON_SMOOTH) is
+    *    enabled"
+    */
+
+   /* _NEW_MULTISAMPLE */
+   bool multisample = _mesa_is_multisample_enabled(ctx);
+   raster->multisample = multisample;
+
+   /* _NEW_POLYGON | _NEW_MULTISAMPLE */
+   raster->poly_smooth = !multisample && ctx->Polygon.SmoothFlag;
+
    /* _NEW_POINT
     */
    raster->point_size = ctx->Point.Size;
-   raster->point_smooth = !ctx->Point.PointSprite && ctx->Point.SmoothFlag;
+
+   /* _NEW_POINT | _NEW_MULTISAMPLE */
+   raster->point_smooth = !multisample && !ctx->Point.PointSprite &&
+                          ctx->Point.SmoothFlag;
 
    /* _NEW_POINT | _NEW_PROGRAM
     */
@@ -206,10 +233,10 @@ st_update_rasterizer(struct st_context *st)
                                  ctx->Point.MaxSize);
    }
 
-   /* _NEW_LINE
+   /* _NEW_LINE | _NEW_MULTISAMPLE
     */
-   raster->line_smooth = ctx->Line.SmoothFlag;
-   if (ctx->Line.SmoothFlag) {
+   if (!multisample && ctx->Line.SmoothFlag) {
+      raster->line_smooth = 1;
       raster->line_width = CLAMP(ctx->Line.Width,
                                  ctx->Const.MinLineWidthAA,
                                  ctx->Const.MaxLineWidthAA);
@@ -226,9 +253,6 @@ st_update_rasterizer(struct st_context *st)
    /* GL stipple factor is in [1,256], remap to [0, 255] here */
    raster->line_stipple_factor = ctx->Line.StippleFactor - 1;
 
-   /* _NEW_MULTISAMPLE */
-   raster->multisample = _mesa_is_multisample_enabled(ctx);
-
    /* _NEW_MULTISAMPLE | _NEW_BUFFERS */
    raster->force_persample_interp =
          !st->force_persample_in_shader &&



More information about the mesa-commit mailing list