Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
OOOpenGLExtensionManager(OOPrivate) Category Reference

Instance Methods

(void) - checkShadersSupported
 
(NSDictionary *) - lookUpPerGPUSettingsWithVersionString:extensionsString:
 
(NSComparisonResult) - CompareGPUSettingsByPriority [implementation]
 

Class Methods

(static BOOL) + CheckRegExps [implementation]
 

Detailed Description

Definition at line 158 of file OOOpenGLExtensionManager.m.

Method Documentation

◆ CheckRegExps

+ (static BOOL) CheckRegExps (NSString *) string
(id) regexps 
implementation

Extends class OOOpenGLExtensionManager.

Definition at line 741 of file OOOpenGLExtensionManager.m.

742{
743 if (regexps == nil) return YES; // No restriction == match.
744 if ([regexps isKindOfClass:[NSString class]])
745 {
746 return [string oo_matchesRegularExpression:regexps];
747 }
748 if ([regexps isKindOfClass:[NSArray class]])
749 {
750 NSEnumerator *regexpEnum = nil;
751 NSString *regexp = nil;
752
753 for (regexpEnum = [regexps objectEnumerator]; (regexp = [regexpEnum nextObject]); )
754 {
755 if (EXPECT_NOT(![regexp isKindOfClass:[NSString class]]))
756 {
757 // Invalid type -- match fails.
758 return NO;
759 }
760
761 if (![string oo_matchesRegularExpression:regexp]) return NO;
762 }
763 return YES;
764 }
765
766 // Invalid type -- match fails.
767 return NO;
768}
#define EXPECT_NOT(x)
return nil

References EXPECT_NOT, and nil.

◆ CompareGPUSettingsByPriority

- (NSComparisonResult) CompareGPUSettingsByPriority (id) a
(id) b
(void *) context 
implementation

Extends class OOOpenGLExtensionManager.

Definition at line 771 of file OOOpenGLExtensionManager.m.

772{
773 NSString *keyA = a;
774 NSString *keyB = b;
775 NSDictionary *configurations = context;
776 NSDictionary *dictA = [configurations oo_dictionaryForKey:keyA];
777 NSDictionary *dictB = [configurations oo_dictionaryForKey:keyB];
778 double precedenceA = [dictA oo_doubleForKey:@"precedence" defaultValue:1];
779 double precedenceB = [dictB oo_doubleForKey:@"precedence" defaultValue:1];
780
781 if (precedenceA > precedenceB) return NSOrderedAscending;
782 if (precedenceA < precedenceB) return NSOrderedDescending;
783
784 return [keyA caseInsensitiveCompare:keyB];
785}

◆ lookUpPerGPUSettingsWithVersionString:extensionsString:

- (NSDictionary *) lookUpPerGPUSettingsWithVersionString: (NSString *) version
extensionsString: (NSString *) extensionsStr 

Extends class OOOpenGLExtensionManager.

Definition at line 771 of file OOOpenGLExtensionManager.m.

788 :(NSString *)versionStr extensionsString:(NSString *)extensionsStr
789{
790 NSDictionary *configurations = [ResourceManager dictionaryFromFilesNamed:@"gpu-settings.plist"
791 inFolder:@"Config"
792 andMerge:YES];
793
794 NSArray *keys = [[configurations allKeys] sortedArrayUsingFunction:CompareGPUSettingsByPriority context:configurations];
795
796 NSEnumerator *keyEnum = nil;
797 NSString *key = nil;
798 NSDictionary *config = nil;
799
800 for (keyEnum = [keys objectEnumerator]; (key = [keyEnum nextObject]); )
801 {
802 config = [configurations oo_dictionaryForKey:key];
803 if (EXPECT_NOT(config == nil)) continue;
804
805 NSDictionary *match = [config oo_dictionaryForKey:@"match"];
806 NSString *expr = nil;
807
808 expr = [match objectForKey:@"vendor"];
809 if (!CheckRegExps(vendor, expr)) continue;
810
811 expr = [match oo_stringForKey:@"renderer"];
812 if (!CheckRegExps(renderer, expr)) continue;
813
814 expr = [match oo_stringForKey:@"version"];
815 if (!CheckRegExps(versionStr, expr)) continue;
816
817 expr = [match oo_stringForKey:@"extensions"];
818 if (!CheckRegExps(extensionsStr, expr)) continue;
819
820 OOLog(@"rendering.opengl.gpuSpecific", @"Matched GPU configuration \"%@\".", key);
821 return config;
822 }
823
824 return [NSDictionary dictionary];
825}
#define OOLog(class, format,...)
Definition OOLogging.h:88
static BOOL CheckRegExps(NSString *string, id regexps)
NSDictionary * dictionaryFromFilesNamed:inFolder:andMerge:(NSString *fileName,[inFolder] NSString *folderName,[andMerge] BOOL mergeFiles)

The documentation for this category was generated from the following file: