Skip to content
Permalink
Browse files

Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE() in SDL_cpuinfo.h

  • Loading branch information
slouken committed Nov 18, 2003
1 parent 731799f commit 04c9894d563f531a7a04d35de775184b628e105b
@@ -3,6 +3,9 @@ This is a list of API changes in SDL's version history.

Version 1.0:

1.2.7:
Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE()

1.2.6:
Added SDL_LoadObject(), SDL_LoadFunction(), and SDL_UnloadObject()

@@ -503,6 +503,7 @@ CheckNASM()
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hermes"
SDL_EXTRADIRS="$SDL_EXTRADIRS hermes"
SDL_EXTRALIBS="$SDL_EXTRALIBS hermes/libhermes.la"
use_nasm=yes
fi
fi
}
@@ -2569,6 +2570,7 @@ AM_CONDITIONAL(TARGET_MINT, test $ARCH = mint)
# More automake conditionals
AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes)
AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes)
AM_CONDITIONAL(HAVE_NASM, test x$use_nasm = xyes)

# Set conditional variables for shared and static library selection.
# These are not used in any Makefile.am but in sdl-config.in.
@@ -2774,6 +2776,7 @@ src/thread/Makefile
src/timer/Makefile
src/endian/Makefile
src/file/Makefile
src/cpuinfo/Makefile
src/hermes/Makefile
sdl-config
SDL.spec
@@ -11,6 +11,7 @@ libSDLinclude_HEADERS = \
SDL_byteorder.h \
SDL_cdrom.h \
SDL_copying.h \
SDL_cpuinfo.h \
SDL_endian.h \
SDL_error.h \
SDL_events.h \
@@ -0,0 +1,58 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/

#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
#endif

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* CPU feature detection for SDL */

#ifndef _SDL_cpuinfo_h
#define _SDL_cpuinfo_h

#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif

/* This function returns true if the CPU has MMX features
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX();

/* This function returns true if the CPU has 3DNow features
*/
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow();

/* This function returns true if the CPU has SSE features
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE();

/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"

#endif /* _SDL_cpuinfo_h */
@@ -34,28 +34,13 @@ static char rcsid =
#include "SDL_audio.h"
#include "SDL_mutex.h"
#include "SDL_timer.h"
#include "SDL_cpuinfo.h"
#include "SDL_sysaudio.h"
#include "SDL_cpuinfo.h"
#include "SDL_mixer_MMX.h"
#include "SDL_mixer_MMX_VC.h"
#include "SDL_mixer_m68k.h"

/* Function to check the CPU flags */
#define MMX_CPU 0x800000
#ifdef USE_ASMBLIT
#define CPU_Flags() Hermes_X86_CPU()
#else
#define CPU_Flags() 0L
#endif

#ifdef USE_ASMBLIT
#define X86_ASSEMBLER
#define HermesConverterInterface void
#define HermesClearInterface void
#define STACKCALL

#include "HeadX86.h"
#endif

/* This table is used to add two sound values together and pin
* the value to avoid overflow. (used with permission from ARDI)
* Changed to use 0xFE instead of 0xFF for better sound quality.
@@ -154,7 +139,7 @@ void SDL_MixAudio (Uint8 *dst, const Uint8 *src, Uint32 len, int volume)

case AUDIO_S8: {
#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
if (CPU_Flags() & MMX_CPU)
if (SDL_HasMMX())
{
SDL_MixAudio_MMX_S8((char*)dst,(char*)src,(unsigned int)len,(int)volume);
}
@@ -201,7 +186,7 @@ void SDL_MixAudio (Uint8 *dst, const Uint8 *src, Uint32 len, int volume)

case AUDIO_S16LSB: {
#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
if (CPU_Flags() & MMX_CPU)
if (SDL_HasMMX())
{
SDL_MixAudio_MMX_S16((char*)dst,(char*)src,(unsigned int)len,(int)volume);
}

0 comments on commit 04c9894

Please sign in to comment.