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

Author: Xavier Chantry <chantry.xav...@gmail.com>
Date:   Wed May  5 14:39:59 2010 +0200

nouveau: only advertise PIPE_FORMAT_DXT* if s3tc available

---

 src/gallium/drivers/nouveau/nouveau_screen.c |    3 +++
 src/gallium/drivers/nv50/nv50_screen.c       |   16 ++++++++++++----
 src/gallium/drivers/nvfx/nvfx_screen.c       |   16 ++++++++++++----
 3 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c 
b/src/gallium/drivers/nouveau/nouveau_screen.c
index 233a91a..a91b00b 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -5,6 +5,7 @@
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
 #include "util/u_format.h"
+#include "util/u_format_s3tc.h"
 
 #include <stdio.h>
 #include <errno.h>
@@ -248,6 +249,8 @@ nouveau_screen_init(struct nouveau_screen *screen, struct 
nouveau_device *dev)
        pscreen->fence_signalled = nouveau_screen_fence_signalled;
        pscreen->fence_finish = nouveau_screen_fence_finish;
 
+       util_format_s3tc_init();
+
        return 0;
 }
 
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index 2dd1042..bf46ceb 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -20,6 +20,7 @@
  * SOFTWARE.
  */
 
+#include "util/u_format_s3tc.h"
 #include "pipe/p_screen.h"
 
 #include "nv50_context.h"
@@ -60,6 +61,17 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
                        break;
                }
        } else {
+               if (tex_usage & PIPE_BIND_SAMPLER_VIEW) {
+                       switch (format) {
+                       case PIPE_FORMAT_DXT1_RGB:
+                       case PIPE_FORMAT_DXT1_RGBA:
+                       case PIPE_FORMAT_DXT3_RGBA:
+                       case PIPE_FORMAT_DXT5_RGBA:
+                               return util_format_s3tc_enabled;
+                       default:
+                               break;
+                       }
+               }
                switch (format) {
                case PIPE_FORMAT_B8G8R8A8_UNORM:
                case PIPE_FORMAT_B8G8R8X8_UNORM:
@@ -72,10 +84,6 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
                case PIPE_FORMAT_A8_UNORM:
                case PIPE_FORMAT_I8_UNORM:
                case PIPE_FORMAT_L8A8_UNORM:
-               case PIPE_FORMAT_DXT1_RGB:
-               case PIPE_FORMAT_DXT1_RGBA:
-               case PIPE_FORMAT_DXT3_RGBA:
-               case PIPE_FORMAT_DXT5_RGBA:
                case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
                case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
                case PIPE_FORMAT_Z32_FLOAT:
diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c 
b/src/gallium/drivers/nvfx/nvfx_screen.c
index 9f03ab1..c70f254 100644
--- a/src/gallium/drivers/nvfx/nvfx_screen.c
+++ b/src/gallium/drivers/nvfx/nvfx_screen.c
@@ -1,5 +1,6 @@
 #include "pipe/p_screen.h"
 #include "pipe/p_state.h"
+#include "util/u_format_s3tc.h"
 #include "util/u_simple_screen.h"
 
 #include "nouveau/nouveau_screen.h"
@@ -145,6 +146,17 @@ nvfx_screen_surface_format_supported(struct pipe_screen 
*pscreen,
                }
        } else {
                switch (format) {
+               if (tex_usage & PIPE_BIND_SAMPLER_VIEW) {
+                       switch (format) {
+                       case PIPE_FORMAT_DXT1_RGB:
+                       case PIPE_FORMAT_DXT1_RGBA:
+                       case PIPE_FORMAT_DXT3_RGBA:
+                       case PIPE_FORMAT_DXT5_RGBA:
+                               return util_format_s3tc_enabled;
+                       default:
+                               break;
+                       }
+               }
                case PIPE_FORMAT_B8G8R8A8_UNORM:
                case PIPE_FORMAT_B8G8R8X8_UNORM:
                case PIPE_FORMAT_B5G5R5A1_UNORM:
@@ -156,10 +168,6 @@ nvfx_screen_surface_format_supported(struct pipe_screen 
*pscreen,
                case PIPE_FORMAT_L8A8_UNORM:
                case PIPE_FORMAT_Z16_UNORM:
                case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
-               case PIPE_FORMAT_DXT1_RGB:
-               case PIPE_FORMAT_DXT1_RGBA:
-               case PIPE_FORMAT_DXT3_RGBA:
-               case PIPE_FORMAT_DXT5_RGBA:
                        return TRUE;
                /* TODO: does nv30 support this? */
                case PIPE_FORMAT_R16_SNORM:

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to