Commit 5d8720fd authored by Sam Lantinga's avatar Sam Lantinga

Added SSE and MMX optimization for SDL_FillRect()

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402611
parent d7134d38
......@@ -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;
......@@ -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;
......
......@@ -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 */
......@@ -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))
......
......@@ -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
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment