Browse Source

intel buggy driver hack

David Rose 17 years ago
parent
commit
12539bfd45

+ 9 - 0
panda/src/dxgsg9/config_dxgsg9.cxx

@@ -120,6 +120,15 @@ ConfigVariableBool dx_preserve_fpu_state
 ConfigVariableInt dx_preferred_device_id
 ConfigVariableInt dx_preferred_device_id
 ("dx-preferred-device-id", -1);
 ("dx-preferred-device-id", -1);
 
 
+ConfigVariableBool dx_intel_compressed_texture_bug
+("dx-intel-compressed-texture-bug", true,
+ PRC_DESC("Set this true to work around a bug in the Intel driver "
+          "igdumd32.dll, for at least the 965 Express chipset family, "
+          "which breaks compressed texture images smaller "
+          "than about 256x256 (even mipmap levels).  The workaround is "
+          "simply to disable compressed texture support when this "
+          "driver is detected."));
+
 #ifdef _DEBUG
 #ifdef _DEBUG
 ConfigVariableDouble dx_global_miplevel_bias
 ConfigVariableDouble dx_global_miplevel_bias
 ("dx-global-miplevel-bias", 0.0);
 ("dx-global-miplevel-bias", 0.0);

+ 2 - 0
panda/src/dxgsg9/config_dxgsg9.h

@@ -47,6 +47,8 @@ extern ConfigVariableBool dx_do_vidmemsize_check;
 extern ConfigVariableBool dx_preserve_fpu_state;
 extern ConfigVariableBool dx_preserve_fpu_state;
 extern ConfigVariableInt dx_preferred_device_id;
 extern ConfigVariableInt dx_preferred_device_id;
 
 
+extern ConfigVariableBool dx_intel_compressed_texture_bug;
+
 #ifndef NDEBUG
 #ifndef NDEBUG
 extern ConfigVariableInt dx_force_backface_culling;
 extern ConfigVariableInt dx_force_backface_culling;
 #endif
 #endif

+ 15 - 6
panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx

@@ -2678,12 +2678,21 @@ reset() {
     _compressed_texture_formats.set_bit(Texture::CM_dxt##num);\
     _compressed_texture_formats.set_bit(Texture::CM_dxt##num);\
   }
   }
 
 
-  CHECK_FOR_DXTVERSION(1)
-  CHECK_FOR_DXTVERSION(2)
-  CHECK_FOR_DXTVERSION(3)
-  CHECK_FOR_DXTVERSION(4)
-  CHECK_FOR_DXTVERSION(5)
-
+  if (_screen->_intel_compressed_texture_bug) {
+    dxgsg9_cat.info()
+      << "Buggy Intel driver detected; disabling compressed textures.\n";
+    _screen->_supported_tex_formats_mask &= 
+      ~(DXT1_FLAG | DXT2_FLAG | DXT3_FLAG | DXT4_FLAG | DXT5_FLAG);
+                                              
+  } else {
+    // Check for available compressed formats normally.
+    CHECK_FOR_DXTVERSION(1);
+    CHECK_FOR_DXTVERSION(2);
+    CHECK_FOR_DXTVERSION(3);
+    CHECK_FOR_DXTVERSION(4);
+    CHECK_FOR_DXTVERSION(5);
+  }
+      
   #undef CHECK_FOR_DXTVERSION
   #undef CHECK_FOR_DXTVERSION
 
 
   _screen->_supports_rgba16f_texture_format = false;
   _screen->_supports_rgba16f_texture_format = false;

+ 1 - 0
panda/src/dxgsg9/dxgsg9base.h

@@ -210,6 +210,7 @@ struct DXScreenData {
 
 
   bool _supports_dynamic_textures;
   bool _supports_dynamic_textures;
   bool _supports_automatic_mipmap_generation;
   bool _supports_automatic_mipmap_generation;
+  bool _intel_compressed_texture_bug;
 };
 };
 
 
 
 

+ 10 - 0
panda/src/dxgsg9/wdxGraphicsWindow9.cxx

@@ -930,6 +930,7 @@ choose_device() {
             MAX_DEVICE_IDENTIFIER_STRING);
             MAX_DEVICE_IDENTIFIER_STRING);
     devinfo.VendorID = adapter_info.VendorId;
     devinfo.VendorID = adapter_info.VendorId;
     devinfo.DeviceID = adapter_info.DeviceId;
     devinfo.DeviceID = adapter_info.DeviceId;
+    devinfo._driver_version = adapter_info.DriverVersion;
     devinfo._monitor = _monitor;
     devinfo._monitor = _monitor;
     devinfo.cardID = i;
     devinfo.cardID = i;
 
 
@@ -1136,6 +1137,15 @@ consider_device(wdxGraphicsPipe9 *dxpipe, DXDeviceInfo *device_info) {
   _wcontext._display_mode.RefreshRate = D3DPRESENT_RATE_DEFAULT;
   _wcontext._display_mode.RefreshRate = D3DPRESENT_RATE_DEFAULT;
   _wcontext._monitor = device_info->_monitor;
   _wcontext._monitor = device_info->_monitor;
 
 
+  if (strcmp(device_info->szDriver, "igdumd32.dll") == 0 &&
+      device_info->_driver_version.QuadPart <= 0x0007000e000a0531LL &&
+      dx_intel_compressed_texture_bug) {
+    // Disable compressed textures for this buggy driver (7.14.10.1329
+    // and earlier--I don't know whether any other drivers also
+    // exhibit the bug).
+    _wcontext._intel_compressed_texture_bug = true;
+  }
+
   return true;
   return true;
 }
 }
 
 

+ 1 - 0
panda/src/dxgsg9/wdxGraphicsWindow9.h

@@ -61,6 +61,7 @@ private:
     char szDescription[MAX_DEVICE_IDENTIFIER_STRING];
     char szDescription[MAX_DEVICE_IDENTIFIER_STRING];
     GUID guidDeviceIdentifier;
     GUID guidDeviceIdentifier;
     DWORD VendorID, DeviceID;
     DWORD VendorID, DeviceID;
+    LARGE_INTEGER _driver_version;
     HMONITOR _monitor;
     HMONITOR _monitor;
   };
   };
   typedef pvector<DXDeviceInfo> DXDeviceInfoVec;
   typedef pvector<DXDeviceInfo> DXDeviceInfoVec;