Browse Source

allow driver_compress_textures even if we have squish

David Rose 17 years ago
parent
commit
762079f703
1 changed files with 44 additions and 24 deletions
  1. 44 24
      panda/src/gobj/texturePool.cxx

+ 44 - 24
panda/src/gobj/texturePool.cxx

@@ -280,13 +280,18 @@ ns_load_texture(const Filename &orig_filename, int primary_file_num_channels,
 
 
   if (cache->get_cache_compressed_textures() && tex->has_compression()) {
   if (cache->get_cache_compressed_textures() && tex->has_compression()) {
 #ifndef HAVE_SQUISH
 #ifndef HAVE_SQUISH
-    // We don't want to save the uncompressed version; we'll save the
-    // compressed version when it becomes available.
-    store_record = false;
-    if (!compressed_cache_record) {
-      tex->set_post_load_store_cache(true);
-    }
+    bool needs_driver_compression = true;
+#else
+    bool needs_driver_compression = driver_compress_textures;
 #endif // HAVE_SQUISH
 #endif // HAVE_SQUISH
+    if (needs_driver_compression) {
+      // We don't want to save the uncompressed version; we'll save the
+      // compressed version when it becomes available.
+      store_record = false;
+      if (!compressed_cache_record) {
+        tex->set_post_load_store_cache(true);
+      }
+    }
 
 
   } else if (!cache->get_cache_textures()) {
   } else if (!cache->get_cache_textures()) {
     // We don't want to save this texture.
     // We don't want to save this texture.
@@ -406,13 +411,18 @@ ns_load_texture(const Filename &orig_filename,
 
 
   if (cache->get_cache_compressed_textures() && tex->has_compression()) {
   if (cache->get_cache_compressed_textures() && tex->has_compression()) {
 #ifndef HAVE_SQUISH
 #ifndef HAVE_SQUISH
-    // We don't want to save the uncompressed version; we'll save the
-    // compressed version when it becomes available.
-    store_record = false;
-    if (!compressed_cache_record) {
-      tex->set_post_load_store_cache(true);
+    bool needs_driver_compression = true;
+#else
+    bool needs_driver_compression = driver_compress_textures;
+#endif // HAVE_SQUISH
+    if (needs_driver_compression) {
+      // We don't want to save the uncompressed version; we'll save the
+      // compressed version when it becomes available.
+      store_record = false;
+      if (!compressed_cache_record) {
+        tex->set_post_load_store_cache(true);
+      }
     }
     }
-#endif  // HAVE_SQUISH
 
 
   } else if (!cache->get_cache_textures()) {
   } else if (!cache->get_cache_textures()) {
     // We don't want to save this texture.
     // We don't want to save this texture.
@@ -513,13 +523,18 @@ ns_load_3d_texture(const Filename &filename_pattern,
 
 
   if (cache->get_cache_compressed_textures() && tex->has_compression()) {
   if (cache->get_cache_compressed_textures() && tex->has_compression()) {
 #ifndef HAVE_SQUISH
 #ifndef HAVE_SQUISH
-    // We don't want to save the uncompressed version; we'll save the
-    // compressed version when it becomes available.
-    store_record = false;
-    if (!compressed_cache_record) {
-      tex->set_post_load_store_cache(true);
+    bool needs_driver_compression = true;
+#else
+    bool needs_driver_compression = driver_compress_textures;
+#endif // HAVE_SQUISH
+    if (needs_driver_compression) {
+      // We don't want to save the uncompressed version; we'll save the
+      // compressed version when it becomes available.
+      store_record = false;
+      if (!compressed_cache_record) {
+        tex->set_post_load_store_cache(true);
+      }
     }
     }
-#endif  // HAVE_SQUISH
 
 
   } else if (!cache->get_cache_textures()) {
   } else if (!cache->get_cache_textures()) {
     // We don't want to save this texture.
     // We don't want to save this texture.
@@ -607,13 +622,18 @@ ns_load_cube_map(const Filename &filename_pattern, bool read_mipmaps,
 
 
   if (cache->get_cache_compressed_textures() && tex->has_compression()) {
   if (cache->get_cache_compressed_textures() && tex->has_compression()) {
 #ifndef HAVE_SQUISH
 #ifndef HAVE_SQUISH
-    // We don't want to save the uncompressed version; we'll save the
-    // compressed version when it becomes available.
-    store_record = false;
-    if (!compressed_cache_record) {
-      tex->set_post_load_store_cache(true);
+    bool needs_driver_compression = true;
+#else
+    bool needs_driver_compression = driver_compress_textures;
+#endif // HAVE_SQUISH
+    if (needs_driver_compression) {
+      // We don't want to save the uncompressed version; we'll save the
+      // compressed version when it becomes available.
+      store_record = false;
+      if (!compressed_cache_record) {
+        tex->set_post_load_store_cache(true);
+      }
     }
     }
-#endif  // HAVE_SQUISH
 
 
   } else if (!cache->get_cache_textures()) {
   } else if (!cache->get_cache_textures()) {
     // We don't want to save this texture.
     // We don't want to save this texture.