[Mesa-dev] i965: Set minimum point size to 1.0 for non-sprite non-aa points

Submitted by Pavel Popov on June 4, 2014, 12:34 p.m.

Details

Message ID 1401885249-16401-1-git-send-email-pavel.e.popov@intel.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Pavel Popov June 4, 2014, 12:34 p.m.
Both point size states were covered (glPointSize function and
 gl_PointSize value). Piglit test 'spec_OpenGL_2.0_vs-point_size-zero' which
 uses gl_PointSize value in a shader passes. Modification of this test which
 uses glPointSize function also passes.

Signed-off-by: Pavel Popov <pavel.e.popov@intel.com>
---
 src/mesa/drivers/dri/i965/gen6_clip_state.c | 3 ++-
 src/mesa/drivers/dri/i965/gen6_sf_state.c   | 6 ++++--
 src/mesa/drivers/dri/i965/gen7_sf_state.c   | 6 ++++--
 src/mesa/drivers/dri/i965/gen8_sf_state.c   | 6 ++++--
 4 files changed, 14 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c
index 0ba190e..cf11331 100644
--- a/src/mesa/drivers/dri/i965/gen6_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c
@@ -128,7 +128,8 @@  upload_clip_state(struct brw_context *brw)
 	     GEN6_CLIP_MODE_NORMAL |
 	     GEN6_CLIP_XY_TEST |
 	     dw2);
-   OUT_BATCH(U_FIXED(0.125, 3) << GEN6_CLIP_MIN_POINT_WIDTH_SHIFT |
+   /* Use min size 1.0 if antialiasing and point sprites are disabled (OpenGL 3.0 and earlier) */
+   OUT_BATCH(U_FIXED(!(ctx->Point.SmoothFlag || ctx->Point.PointSprite) ? 1.0 : 0.125, 3) << GEN6_CLIP_MIN_POINT_WIDTH_SHIFT |
              U_FIXED(255.875, 3) << GEN6_CLIP_MAX_POINT_WIDTH_SHIFT |
              (fb->MaxNumLayers > 0 ? 0 : GEN6_CLIP_FORCE_ZERO_RTAINDEX) |
              ((ctx->Const.MaxViewports - 1) & GEN6_CLIP_MAX_VP_INDEX_MASK));
diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index ec14be4..b8d66ab 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -346,8 +346,10 @@  upload_sf_state(struct brw_context *brw)
    /* Clamp to ARB_point_parameters user limits */
    point_size = CLAMP(ctx->Point.Size, ctx->Point.MinSize, ctx->Point.MaxSize);
 
-   /* Clamp to the hardware limits and convert to fixed point */
-   dw4 |= U_FIXED(CLAMP(point_size, 0.125, 255.875), 3);
+   /* Clamp to the hardware limits and convert to fixed point.
+    * Use min size 1.0 if antialiasing and point sprites are disabled (OpenGL 3.0 and earlier).
+    */
+   dw4 |= U_FIXED(CLAMP(point_size, !(ctx->Point.SmoothFlag || ctx->Point.PointSprite) ? 1.0 : 0.125, 255.875), 3);
 
    /*
     * Window coordinates in an FBO are inverted, which means point
diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c b/src/mesa/drivers/dri/i965/gen7_sf_state.c
index 7fe1435..a192dcb 100644
--- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
@@ -220,8 +220,10 @@  upload_sf_state(struct brw_context *brw)
    /* Clamp to ARB_point_parameters user limits */
    point_size = CLAMP(ctx->Point.Size, ctx->Point.MinSize, ctx->Point.MaxSize);
 
-   /* Clamp to the hardware limits and convert to fixed point */
-   dw3 |= U_FIXED(CLAMP(point_size, 0.125, 255.875), 3);
+   /* Clamp to the hardware limits and convert to fixed point.
+    * Use min size 1.0 if antialiasing and point sprites are disabled (OpenGL 3.0 and earlier).
+    */
+   dw3 |= U_FIXED(CLAMP(point_size, !(ctx->Point.SmoothFlag || ctx->Point.PointSprite) ? 1.0 : 0.125, 255.875), 3);
 
    /* _NEW_LIGHT */
    if (ctx->Light.ProvokingVertex != GL_FIRST_VERTEX_CONVENTION) {
diff --git a/src/mesa/drivers/dri/i965/gen8_sf_state.c b/src/mesa/drivers/dri/i965/gen8_sf_state.c
index 0a69e70..d130a00 100644
--- a/src/mesa/drivers/dri/i965/gen8_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_sf_state.c
@@ -132,8 +132,10 @@  upload_sf(struct brw_context *brw)
    /* Clamp to ARB_point_parameters user limits */
    point_size = CLAMP(ctx->Point.Size, ctx->Point.MinSize, ctx->Point.MaxSize);
 
-   /* Clamp to the hardware limits and convert to fixed point */
-   dw3 |= U_FIXED(CLAMP(point_size, 0.125, 255.875), 3);
+   /* Clamp to the hardware limits and convert to fixed point.
+    * Use min size 1.0 if antialiasing and point sprites are disabled (OpenGL 3.0 and earlier).
+    */
+   dw3 |= U_FIXED(CLAMP(point_size, !(ctx->Point.SmoothFlag || ctx->Point.PointSprite) ? 1.0 : 0.125, 255.875), 3);
 
    /* _NEW_PROGRAM | _NEW_POINT */
    if (!(ctx->VertexProgram.PointSizeEnabled || ctx->Point._Attenuated))