Mercurial > sdl-ios-xcode
comparison src/video/SDL_blit.c @ 739:22dbf364c017
Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 18 Nov 2003 01:27:06 +0000 |
parents | 8468fc0504f3 |
children | b8d311d90021 |
comparison
equal
deleted
inserted
replaced
738:82b85b731fe3 | 739:22dbf364c017 |
---|---|
36 #include "SDL_RLEaccel_c.h" | 36 #include "SDL_RLEaccel_c.h" |
37 #include "SDL_pixels_c.h" | 37 #include "SDL_pixels_c.h" |
38 #include "SDL_memops.h" | 38 #include "SDL_memops.h" |
39 | 39 |
40 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) | 40 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) |
41 #include "SDL_cpuinfo.h" | |
41 #include "mmx.h" | 42 #include "mmx.h" |
42 /* Function to check the CPU flags */ | |
43 #define MMX_CPU 0x800000 | |
44 #define SSE_CPU 0x2000000 | |
45 #define CPU_Flags() Hermes_X86_CPU() | |
46 #define X86_ASSEMBLER | |
47 #define HermesConverterInterface void | |
48 #define HermesClearInterface void | |
49 #define STACKCALL | |
50 #include "HeadX86.h" | |
51 #endif | 43 #endif |
52 | 44 |
53 /* The general purpose software blit routine */ | 45 /* The general purpose software blit routine */ |
54 static int SDL_SoftBlit(SDL_Surface *src, SDL_Rect *srcrect, | 46 static int SDL_SoftBlit(SDL_Surface *src, SDL_Rect *srcrect, |
55 SDL_Surface *dst, SDL_Rect *dstrect) | 47 SDL_Surface *dst, SDL_Rect *dstrect) |
164 static void SDL_BlitCopy(SDL_BlitInfo *info) | 156 static void SDL_BlitCopy(SDL_BlitInfo *info) |
165 { | 157 { |
166 Uint8 *src, *dst; | 158 Uint8 *src, *dst; |
167 int w, h; | 159 int w, h; |
168 int srcskip, dstskip; | 160 int srcskip, dstskip; |
169 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) | |
170 Uint32 f; | |
171 #endif | |
172 | 161 |
173 w = info->d_width*info->dst->BytesPerPixel; | 162 w = info->d_width*info->dst->BytesPerPixel; |
174 h = info->d_height; | 163 h = info->d_height; |
175 src = info->s_pixels; | 164 src = info->s_pixels; |
176 dst = info->d_pixels; | 165 dst = info->d_pixels; |
177 srcskip = w+info->s_skip; | 166 srcskip = w+info->s_skip; |
178 dstskip = w+info->d_skip; | 167 dstskip = w+info->d_skip; |
179 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) | 168 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) |
180 f=CPU_Flags(); | 169 if(SDL_HasSSE()) |
181 if((f&(MMX_CPU|SSE_CPU))==(MMX_CPU|SSE_CPU)) | |
182 { | 170 { |
183 while ( h-- ) { | 171 while ( h-- ) { |
184 SDL_memcpySSE(dst, src, w); | 172 SDL_memcpySSE(dst, src, w); |
185 src += srcskip; | 173 src += srcskip; |
186 dst += dstskip; | 174 dst += dstskip; |
188 __asm__ __volatile__ ( | 176 __asm__ __volatile__ ( |
189 " emms\n" | 177 " emms\n" |
190 ::); | 178 ::); |
191 } | 179 } |
192 else | 180 else |
193 if((f&(MMX_CPU))!=0) | 181 if(SDL_HasMMX()) |
194 { | 182 { |
195 while ( h-- ) { | 183 while ( h-- ) { |
196 SDL_memcpyMMX(dst, src, w); | 184 SDL_memcpyMMX(dst, src, w); |
197 src += srcskip; | 185 src += srcskip; |
198 dst += dstskip; | 186 dst += dstskip; |