diff options
Diffstat (limited to 'o3d/plugin/mac')
-rw-r--r-- | o3d/plugin/mac/Info.plist | 2 | ||||
-rw-r--r-- | o3d/plugin/mac/config_mac.mm | 58 |
2 files changed, 44 insertions, 16 deletions
diff --git a/o3d/plugin/mac/Info.plist b/o3d/plugin/mac/Info.plist index 5d0a28e..c772f77 100644 --- a/o3d/plugin/mac/Info.plist +++ b/o3d/plugin/mac/Info.plist @@ -38,6 +38,8 @@ </dict> <key>WebPluginName</key> <string>@@@PluginName@@@</string> + <key>O3DForceSoftwareRenderer</key> + <false/> <key>BreakpadProduct</key> <string>O3D</string> diff --git a/o3d/plugin/mac/config_mac.mm b/o3d/plugin/mac/config_mac.mm index eb995298..c85f8c8 100644 --- a/o3d/plugin/mac/config_mac.mm +++ b/o3d/plugin/mac/config_mac.mm @@ -46,6 +46,20 @@ #include "plugin/cross/plugin_metrics.h" #include "plugin_mac.h" +@interface BundleReader : NSObject { +} + +- (BOOL)boolValueForKey:(NSString*)key; +@end + +@implementation BundleReader + +- (BOOL) boolValueForKey:(NSString*)key { + NSBundle *bundle = [NSBundle bundleForClass:[self class]]; + return [[bundle objectForInfoDictionaryKey:key] boolValue]; +} +@end + namespace o3d { // Trivial little functions to check for the OS version boundaries we care about @@ -161,27 +175,39 @@ GPUInfo softwareRenderList[] = { {0x8086, 0x2a02}, // Intel GMA X3100 Macbook {0x8086, 0x27a2} // Intel GMA 950 Mac Mini }; - + +static bool BundleFlagForcesSoftwareRenderer() { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + BundleReader *bundle = [[[BundleReader alloc] init] autorelease]; + BOOL result = [bundle boolValueForKey:@"O3DForceSoftwareRenderer"]; + [pool release]; + return result != NO; +} + bool UseSoftwareRenderer() { static bool use_software_renderer = false; static bool is_initialized = false; if (!is_initialized) { - int vendorID; - int deviceID; - GetVideoCardInfo(kCGDirectMainDisplay, - &vendorID, - &deviceID, - NULL); - - use_software_renderer = false; - int list_count = arraysize(softwareRenderList); - for (int i = 0; i < list_count; ++i) { - GPUInfo &softwareRenderInfo = softwareRenderList[i]; - if (vendorID == softwareRenderInfo.vendorID - && deviceID == softwareRenderInfo.deviceID) { - use_software_renderer = true; - break; + if (BundleFlagForcesSoftwareRenderer()) { + use_software_renderer = true; + } else { + int vendorID; + int deviceID; + GetVideoCardInfo(kCGDirectMainDisplay, + &vendorID, + &deviceID, + NULL); + + use_software_renderer = false; + int list_count = arraysize(softwareRenderList); + for (int i = 0; i < list_count; ++i) { + GPUInfo &softwareRenderInfo = softwareRenderList[i]; + if (vendorID == softwareRenderInfo.vendorID + && deviceID == softwareRenderInfo.deviceID) { + use_software_renderer = true; + break; + } } } is_initialized = true; |