comparison src/video/SDL_blit_A.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 f90d80d68071
children b8d311d90021
comparison
equal deleted inserted replaced
738:82b85b731fe3 739:22dbf364c017
30 #include "SDL_types.h" 30 #include "SDL_types.h"
31 #include "SDL_video.h" 31 #include "SDL_video.h"
32 #include "SDL_blit.h" 32 #include "SDL_blit.h"
33 33
34 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) 34 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
35 /* Function to check the CPU flags */
36 #include "SDL_cpuinfo.h"
35 #include "mmx.h" 37 #include "mmx.h"
36 /* Function to check the CPU flags */
37 #define MMX_CPU 0x800000
38 #define TDNOW_CPU 0x80000000
39 #define CPU_Flags() Hermes_X86_CPU()
40 #define X86_ASSEMBLER
41 #define HermesConverterInterface void
42 #define HermesClearInterface void
43 #define STACKCALL
44 #include "HeadX86.h"
45 #endif 38 #endif
46 39
47 /* Functions to perform alpha blended blitting */ 40 /* Functions to perform alpha blended blitting */
48 41
49 /* N->1 blending with per-surface alpha */ 42 /* N->1 blending with per-surface alpha */
1385 case 2: 1378 case 2:
1386 if(surface->map->identity) { 1379 if(surface->map->identity) {
1387 if(df->Gmask == 0x7e0) 1380 if(df->Gmask == 0x7e0)
1388 { 1381 {
1389 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) 1382 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
1390 if((CPU_Flags()&MMX_CPU)!=0) 1383 if(SDL_HasMMX())
1391 return Blit565to565SurfaceAlphaMMX; 1384 return Blit565to565SurfaceAlphaMMX;
1392 else 1385 else
1393 #endif 1386 #endif
1394 return Blit565to565SurfaceAlpha; 1387 return Blit565to565SurfaceAlpha;
1395 } 1388 }
1396 else if(df->Gmask == 0x3e0) 1389 else if(df->Gmask == 0x3e0)
1397 { 1390 {
1398 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) 1391 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
1399 if((CPU_Flags()&MMX_CPU)!=0) 1392 if(SDL_HasMMX())
1400 return Blit555to555SurfaceAlphaMMX; 1393 return Blit555to555SurfaceAlphaMMX;
1401 else 1394 else
1402 #endif 1395 #endif
1403 return Blit555to555SurfaceAlpha; 1396 return Blit555to555SurfaceAlpha;
1404 } 1397 }
1411 && sf->Bmask == df->Bmask 1404 && sf->Bmask == df->Bmask
1412 && (sf->Rmask | sf->Gmask | sf->Bmask) == 0xffffff 1405 && (sf->Rmask | sf->Gmask | sf->Bmask) == 0xffffff
1413 && sf->BytesPerPixel == 4) 1406 && sf->BytesPerPixel == 4)
1414 { 1407 {
1415 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) 1408 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
1416 if((CPU_Flags()&MMX_CPU)!=0) 1409 if(SDL_HasMMX())
1417 return BlitRGBtoRGBSurfaceAlphaMMX; 1410 return BlitRGBtoRGBSurfaceAlphaMMX;
1418 else 1411 else
1419 #endif 1412 #endif
1420 return BlitRGBtoRGBSurfaceAlpha; 1413 return BlitRGBtoRGBSurfaceAlpha;
1421 } 1414 }
1451 && sf->Gmask == df->Gmask 1444 && sf->Gmask == df->Gmask
1452 && sf->Bmask == df->Bmask 1445 && sf->Bmask == df->Bmask
1453 && sf->BytesPerPixel == 4) 1446 && sf->BytesPerPixel == 4)
1454 { 1447 {
1455 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) 1448 #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
1456 Uint32 f; 1449 if(SDL_Has3DNow())
1457 f=CPU_Flags();
1458 if((f&(TDNOW_CPU|MMX_CPU))==(TDNOW_CPU|MMX_CPU))
1459 return BlitRGBtoRGBPixelAlphaMMX3DNOW; 1450 return BlitRGBtoRGBPixelAlphaMMX3DNOW;
1460 else 1451 else
1461 if((f&MMX_CPU)!=0) 1452 if(SDL_HasMMX())
1462 return BlitRGBtoRGBPixelAlphaMMX; 1453 return BlitRGBtoRGBPixelAlphaMMX;
1463 else 1454 else
1464 #endif 1455 #endif
1465 return BlitRGBtoRGBPixelAlpha; 1456 return BlitRGBtoRGBPixelAlpha;
1466 } 1457 }