Mercurial > sdl-ios-xcode
comparison src/video/SDL_blit.c @ 5264:6a65c1fc07af
Updated CPU detection code for SSE3 and SSE4 and removed obsolete 3DNow! and Altivec support.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 11 Feb 2011 14:51:04 -0800 |
parents | d976b67150c5 |
children | b530ef003506 |
comparison
equal
deleted
inserted
replaced
5263:f26314c20071 | 5264:6a65c1fc07af |
---|---|
98 } | 98 } |
99 /* Blit is done! */ | 99 /* Blit is done! */ |
100 return (okay ? 0 : -1); | 100 return (okay ? 0 : -1); |
101 } | 101 } |
102 | 102 |
103 #ifdef __MACOSX__ | |
104 #include <sys/sysctl.h> | |
105 | |
106 static SDL_bool | |
107 SDL_UseAltivecPrefetch() | |
108 { | |
109 const char key[] = "hw.l3cachesize"; | |
110 u_int64_t result = 0; | |
111 size_t typeSize = sizeof(result); | |
112 | |
113 if (sysctlbyname(key, &result, &typeSize, NULL, 0) == 0 && result > 0) { | |
114 return SDL_TRUE; | |
115 } else { | |
116 return SDL_FALSE; | |
117 } | |
118 } | |
119 #else | |
120 static SDL_bool | |
121 SDL_UseAltivecPrefetch() | |
122 { | |
123 /* Just guess G4 */ | |
124 return SDL_TRUE; | |
125 } | |
126 #endif /* __MACOSX__ */ | |
127 | 103 |
128 static SDL_BlitFunc | 104 static SDL_BlitFunc |
129 SDL_ChooseBlitFunc(Uint32 src_format, Uint32 dst_format, int flags, | 105 SDL_ChooseBlitFunc(Uint32 src_format, Uint32 dst_format, int flags, |
130 SDL_BlitFuncEntry * entries) | 106 SDL_BlitFuncEntry * entries) |
131 { | 107 { |
143 SDL_sscanf(override, "%u", &features); | 119 SDL_sscanf(override, "%u", &features); |
144 } else { | 120 } else { |
145 if (SDL_HasMMX()) { | 121 if (SDL_HasMMX()) { |
146 features |= SDL_CPU_MMX; | 122 features |= SDL_CPU_MMX; |
147 } | 123 } |
148 if (SDL_Has3DNow()) { | |
149 features |= SDL_CPU_3DNOW; | |
150 } | |
151 if (SDL_HasSSE()) { | 124 if (SDL_HasSSE()) { |
152 features |= SDL_CPU_SSE; | 125 features |= SDL_CPU_SSE; |
153 } | 126 } |
154 if (SDL_HasSSE2()) { | 127 if (SDL_HasSSE2()) { |
155 features |= SDL_CPU_SSE2; | 128 features |= SDL_CPU_SSE2; |
156 } | |
157 if (SDL_HasAltiVec()) { | |
158 if (SDL_UseAltivecPrefetch()) { | |
159 features |= SDL_CPU_ALTIVEC_PREFETCH; | |
160 } else { | |
161 features |= SDL_CPU_ALTIVEC_NOPREFETCH; | |
162 } | |
163 } | 129 } |
164 } | 130 } |
165 } | 131 } |
166 | 132 |
167 for (i = 0; entries[i].func; ++i) { | 133 for (i = 0; entries[i].func; ++i) { |