Mesa (mesa_7_7_branch): svga: Report the 2d/ 3d texture sizes supported by the host.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Fri Feb 12 23:46:19 UTC 2010


Module: Mesa
Branch: mesa_7_7_branch
Commit: 1ae976be4aacdc27c229b07cb14101d7c3de65de
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ae976be4aacdc27c229b07cb14101d7c3de65de

Author: José Fonseca <jfonseca at vmware.com>
Date:   Fri Feb 12 17:01:48 2010 +0000

svga: Report the 2d/3d texture sizes supported by the host.

---

 src/gallium/drivers/svga/svga_screen.c         |   26 ++++++++++++++++++++---
 src/gallium/drivers/svga/svga_screen_texture.h |    2 +-
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index cd1ed7b..3593d9a 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -104,7 +104,9 @@ svga_get_paramf(struct pipe_screen *screen, int param)
       return 80.0;
 
    case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
-      return 4.0;
+      if(!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_TEXTURE_ANISOTROPY, &result))
+         return 4.0;
+      return result.u;
 
    case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
       return 16.0;
@@ -131,12 +133,28 @@ svga_get_paramf(struct pipe_screen *screen, int param)
       return 1;
    case PIPE_CAP_TEXTURE_SHADOW_MAP:
       return 1;
+
    case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
-      return SVGA_MAX_TEXTURE_LEVELS;
+      {
+         unsigned levels = SVGA_MAX_TEXTURE_LEVELS;
+         if (sws->get_cap(sws, SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH, &result))
+            levels = MIN2(util_logbase2(result.u) + 1, levels);
+         else
+            levels = 12 /* 2048x2048 */;
+         if (sws->get_cap(sws, SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT, &result))
+            levels = MIN2(util_logbase2(result.u) + 1, levels);
+         else
+            levels = 12 /* 2048x2048 */;
+         return levels;
+      }
+
    case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
-      return 8;  /* max 128x128x128 */
+      if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_VOLUME_EXTENT, &result))
+         return 8;  /* max 128x128x128 */
+      return MIN2(util_logbase2(result.u) + 1, SVGA_MAX_TEXTURE_LEVELS);
+
    case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
-      return SVGA_MAX_TEXTURE_LEVELS;
+      return 12 /* 2048x2048 */;
 
    case PIPE_CAP_TEXTURE_MIRROR_REPEAT: /* req. for GL 1.4 */
       return 1;
diff --git a/src/gallium/drivers/svga/svga_screen_texture.h b/src/gallium/drivers/svga/svga_screen_texture.h
index 8cfdfea..4257b49 100644
--- a/src/gallium/drivers/svga/svga_screen_texture.h
+++ b/src/gallium/drivers/svga/svga_screen_texture.h
@@ -38,7 +38,7 @@ struct svga_winsys_surface;
 enum SVGA3dSurfaceFormat;
 
 
-#define SVGA_MAX_TEXTURE_LEVELS 12 /* 2048x2048 */
+#define SVGA_MAX_TEXTURE_LEVELS 16
 
 
 /**




More information about the mesa-commit mailing list