Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Added SSE and MMX optimization for SDL_FillRect()
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Aug 16, 2007
1 parent 4ebb935 commit 344ba2c
Show file tree
Hide file tree
Showing 4 changed files with 295 additions and 107 deletions.
9 changes: 6 additions & 3 deletions src/video/SDL_blit.c
Expand Up @@ -110,7 +110,8 @@ SDL_SoftBlit(SDL_Surface * src, SDL_Rect * srcrect,
#ifdef __MACOSX__
#include <sys/sysctl.h>

static SDL_bool SDL_UseAltivecPrefetch()
static SDL_bool
SDL_UseAltivecPrefetch()
{
const char key[] = "hw.l3cachesize";
u_int64_t result = 0;
Expand All @@ -123,14 +124,16 @@ static SDL_bool SDL_UseAltivecPrefetch()
}
}
#else
static SDL_bool SDL_UseAltivecPrefetch()
static SDL_bool
SDL_UseAltivecPrefetch()
{
/* Just guess G4 */
return SDL_TRUE;
}
#endif /* __MACOSX__ */

static SDL_loblit SDL_ChooseBlitFunc(SDL_BlitEntry *entries, int count)
static SDL_loblit
SDL_ChooseBlitFunc(SDL_BlitEntry * entries, int count)
{
int i;
static Uint32 features = 0xffffffff;
Expand Down
15 changes: 15 additions & 0 deletions src/video/SDL_blit.h
Expand Up @@ -24,6 +24,13 @@
#ifndef _SDL_blit_h
#define _SDL_blit_h

#ifdef __MMX__
#include <mmintrin.h>
#endif
#ifdef __SSE__
#include <xmmintrin.h>
#endif

#include "SDL_endian.h"

/* The structure passed to the low level blit functions */
Expand Down Expand Up @@ -92,6 +99,14 @@ extern SDL_loblit SDL_CalculateAlphaBlit(SDL_Surface * surface, int complex);
* Useful macros for blitting routines
*/

#if defined(__GNUC__)
#define DECLARE_ALIGNED(t,v,a) t __attribute__((aligned(a))) v
#elif defined(_MSC_VER)
#define DECLARE_ALIGNED(t,v,a) t __declspec(align(a)) v
#else
#define DECLARE_ALIGNED(t,v,a) t v
#endif

#define FORMAT_EQUAL(A, B) \
((A)->BitsPerPixel == (B)->BitsPerPixel \
&& ((A)->Rmask == (B)->Rmask) && ((A)->Amask == (B)->Amask))
Expand Down
7 changes: 1 addition & 6 deletions src/video/SDL_blit_copy.c
Expand Up @@ -23,13 +23,8 @@

#include "SDL_video.h"
#include "SDL_blit.h"
#include "SDL_blit_copy.h"

#ifdef __MMX__
#include <mmintrin.h>
#endif
#ifdef __SSE__
#include <xmmintrin.h>
#endif

#ifdef __MMX__
static __inline__ void
Expand Down

0 comments on commit 344ba2c

Please sign in to comment.