Mesa (master): svga: Advertise SVGA3D_DEVCAP_MAX_POINT_SIZE.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Tue Feb 28 15:39:29 UTC 2012


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Mon Feb 27 11:12:12 2012 +0000

svga: Advertise SVGA3D_DEVCAP_MAX_POINT_SIZE.

Backends usually advertise a SVGA3D_DEVCAP_MAX_POINT_SIZE between 63 and
256, so an hardcoded max point size of 80 is often incorrect.

This limitation does not apply for anti-aliased points (as they are done
via draw module) but we still advertise the same limit for both, because
all others pipe drivers do.

Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/gallium/drivers/svga/svga_context.h   |    2 --
 src/gallium/drivers/svga/svga_screen.c    |   14 ++++++++++----
 src/gallium/drivers/svga/svga_screen.h    |    2 ++
 src/gallium/drivers/svga/svga_state_rss.c |    4 +++-
 4 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h
index d6309f7..067c791 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -41,8 +41,6 @@
 #include "svga3d_shaderdefs.h"
 
 
-#define SVGA_MAX_POINTSIZE 80.0
-
 struct draw_vertex_shader;
 struct draw_fragment_shader;
 struct svga_shader_result;
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index d29a504..8badcb2 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -109,10 +109,7 @@ svga_get_paramf(struct pipe_screen *screen, enum pipe_capf param)
    case PIPE_CAPF_MAX_POINT_WIDTH:
       /* fall-through */
    case PIPE_CAPF_MAX_POINT_WIDTH_AA:
-      /* Keep this to a reasonable size to avoid failures in
-       * conform/pntaa.c:
-       */
-      return SVGA_MAX_POINTSIZE;
+      return svgascreen->maxPointSize;
 
    case PIPE_CAPF_MAX_TEXTURE_ANISOTROPY:
       if(!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_TEXTURE_ANISOTROPY, &result))
@@ -543,6 +540,15 @@ svga_screen_create(struct svga_winsys_screen *sws)
       }
    }
 
+   if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_POINT_SIZE, &result)) {
+      svgascreen->maxPointSize = 1.0F;
+   } else {
+      /* Keep this to a reasonable size to avoid failures in
+       * conform/pntaa.c:
+       */
+      svgascreen->maxPointSize = MIN2(result.f, 80.0f);
+   }
+
    pipe_mutex_init(svgascreen->tex_mutex);
    pipe_mutex_init(svgascreen->swc_mutex);
 
diff --git a/src/gallium/drivers/svga/svga_screen.h b/src/gallium/drivers/svga/svga_screen.h
index 97424fc..d7d2c75 100644
--- a/src/gallium/drivers/svga/svga_screen.h
+++ b/src/gallium/drivers/svga/svga_screen.h
@@ -49,6 +49,8 @@ struct svga_screen
 
    SVGA3dHardwareVersion hw_version;
 
+   float maxPointSize;
+
    struct {
       boolean force_level_surface_view;
       boolean force_surface_view;
diff --git a/src/gallium/drivers/svga/svga_state_rss.c b/src/gallium/drivers/svga/svga_state_rss.c
index 1ee8b7f..a2bcf24 100644
--- a/src/gallium/drivers/svga/svga_state_rss.c
+++ b/src/gallium/drivers/svga/svga_state_rss.c
@@ -29,6 +29,7 @@
 #include "util/u_math.h"
 
 #include "svga_context.h"
+#include "svga_screen.h"
 #include "svga_state.h"
 #include "svga_cmd.h"
 
@@ -77,6 +78,7 @@ svga_queue_rs( struct rs_queue *q,
 static int emit_rss( struct svga_context *svga,
                      unsigned dirty )
 {
+   struct svga_screen *screen = svga_screen(svga->pipe.screen);
    struct rs_queue queue;
    float point_size_min;
 
@@ -221,7 +223,7 @@ static int emit_rss( struct svga_context *svga,
       EMIT_RS( svga, curr->linepattern, LINEPATTERN, fail );
       EMIT_RS_FLOAT( svga, curr->pointsize, POINTSIZE, fail );
       EMIT_RS_FLOAT( svga, point_size_min, POINTSIZEMIN, fail );
-      EMIT_RS_FLOAT( svga, SVGA_MAX_POINTSIZE, POINTSIZEMAX, fail );
+      EMIT_RS_FLOAT( svga, screen->maxPointSize, POINTSIZEMAX, fail );
       EMIT_RS( svga, curr->pointsprite, POINTSPRITEENABLE, fail);
    }
 




More information about the mesa-commit mailing list