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

Popov, Pavel E pavel.e.popov at intel.com
Thu Jul 17 20:33:40 PDT 2014


Hi Ian,

Looks like this patch is not reasonable for Mesa which now concentrates on OpenGL 3.3 Core. Am I right?

I prepared this patch to pass Piglit test 'spec_OpenGL_2.0_vs-point_size-zero' which was created for earlier versions of OpenGL. 
Also I found these analogous patches for 'svga', 'r300g' and 'r600g' implementations from Marek:
    2012-01-30	r600g: set minimum point size to 1.0 for non-sprite non-aa points	Marek Olšák
    2012-01-30	r300g: set minimum point size to 1.0 for non-sprite non-aa points	Marek Olšák
    2012-01-30	svga: set POINTSIZEMIN to 1.0 for non-sprite non-aa points	Marek Olšák

Regards,
Pavel

-----Original Message-----
From: Popov, Pavel E 
Sent: Wednesday, June 04, 2014 7:34 PM
To: mesa-dev at lists.freedesktop.org
Cc: Popov, Pavel E
Subject: [PATCH] i965: Set minimum point size to 1.0 for non-sprite non-aa points

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 at 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(-)

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))
--
1.8.3.2


--------------------------------------------------------------------
Closed Joint Stock Company Intel A/O
Registered legal address: Krylatsky Hills Business Park, 
17 Krylatskaya Str., Bldg 4, Moscow 121614, 
Russian Federation

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



More information about the mesa-dev mailing list