parent
0187209f46
commit
1cf2b566af
|
@ -384,7 +384,6 @@ dep_option(SDL_SSE "Use SSE assembly routines" ON "SDL_ASSEMBLY;
|
||||||
dep_option(SDL_SSE2 "Use SSE2 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
|
dep_option(SDL_SSE2 "Use SSE2 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
|
||||||
dep_option(SDL_SSE3 "Use SSE3 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
|
dep_option(SDL_SSE3 "Use SSE3 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
|
||||||
dep_option(SDL_MMX "Use MMX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
|
dep_option(SDL_MMX "Use MMX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
|
||||||
dep_option(SDL_3DNOW "Use 3Dnow! MMX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
|
|
||||||
dep_option(SDL_ALTIVEC "Use Altivec assembly routines" ON "SDL_ASSEMBLY" OFF)
|
dep_option(SDL_ALTIVEC "Use Altivec assembly routines" ON "SDL_ASSEMBLY" OFF)
|
||||||
dep_option(SDL_ARMSIMD "Use SIMD assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF)
|
dep_option(SDL_ARMSIMD "Use SIMD assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF)
|
||||||
dep_option(SDL_ARMNEON "Use NEON assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF)
|
dep_option(SDL_ARMNEON "Use NEON assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF)
|
||||||
|
@ -719,26 +718,6 @@ if(SDL_ASSEMBLY)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SDL_3DNOW)
|
|
||||||
cmake_push_check_state()
|
|
||||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -m3dnow")
|
|
||||||
check_c_source_compiles("
|
|
||||||
#include <mm3dnow.h>
|
|
||||||
#ifndef __3dNOW__
|
|
||||||
#error Assembler CPP flag not enabled
|
|
||||||
#endif
|
|
||||||
int main(int argc, char **argv) {
|
|
||||||
void *p = 0;
|
|
||||||
_m_prefetch(p);
|
|
||||||
return 0;
|
|
||||||
}" CPU_SUPPORTS_3DNOW)
|
|
||||||
cmake_pop_check_state()
|
|
||||||
if(CPU_SUPPORTS_3DNOW)
|
|
||||||
set(HAVE_3DNOW TRUE)
|
|
||||||
list(APPEND EXTRA_CFLAGS "-m3dnow")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(SDL_SSE)
|
if(SDL_SSE)
|
||||||
cmake_push_check_state()
|
cmake_push_check_state()
|
||||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -msse")
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -msse")
|
||||||
|
@ -948,9 +927,6 @@ if(SDL_ASSEMBLY)
|
||||||
if(SDL_MMX)
|
if(SDL_MMX)
|
||||||
set(HAVE_MMX TRUE)
|
set(HAVE_MMX TRUE)
|
||||||
endif()
|
endif()
|
||||||
if(SDL_3DNOW)
|
|
||||||
set(HAVE_3DNOW TRUE)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
if(SDL_SSE)
|
if(SDL_SSE)
|
||||||
set(HAVE_SSE TRUE)
|
set(HAVE_SSE TRUE)
|
||||||
|
|
|
@ -34,6 +34,8 @@ begin_code.h and close_code.h in the public headers have been renamed to SDL_beg
|
||||||
|
|
||||||
## SDL_cpuinfo.h
|
## SDL_cpuinfo.h
|
||||||
|
|
||||||
|
- SDL_Has3DNow() has been removed; there is no replacement.
|
||||||
|
|
||||||
The following headers are no longer automatically included, and will need to be included manually:
|
The following headers are no longer automatically included, and will need to be included manually:
|
||||||
- immintrin.h
|
- immintrin.h
|
||||||
- mm3dnow.h
|
- mm3dnow.h
|
||||||
|
|
|
@ -75,7 +75,6 @@ extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_Has3DNow
|
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
* \sa SDL_HasAVX2
|
* \sa SDL_HasAVX2
|
||||||
|
@ -98,7 +97,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_Has3DNow
|
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
* \sa SDL_HasAVX2
|
* \sa SDL_HasAVX2
|
||||||
* \sa SDL_HasMMX
|
* \sa SDL_HasMMX
|
||||||
|
@ -120,7 +118,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_Has3DNow
|
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
* \sa SDL_HasAVX2
|
* \sa SDL_HasAVX2
|
||||||
|
@ -133,28 +130,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the CPU has 3DNow! features.
|
|
||||||
*
|
|
||||||
* This always returns false on CPUs that aren't using AMD instruction sets.
|
|
||||||
*
|
|
||||||
* \returns SDL_TRUE if the CPU has 3DNow! features or SDL_FALSE if not.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.0.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_HasAltiVec
|
|
||||||
* \sa SDL_HasAVX
|
|
||||||
* \sa SDL_HasAVX2
|
|
||||||
* \sa SDL_HasMMX
|
|
||||||
* \sa SDL_HasRDTSC
|
|
||||||
* \sa SDL_HasSSE
|
|
||||||
* \sa SDL_HasSSE2
|
|
||||||
* \sa SDL_HasSSE3
|
|
||||||
* \sa SDL_HasSSE41
|
|
||||||
* \sa SDL_HasSSE42
|
|
||||||
*/
|
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether the CPU has SSE features.
|
* Determine whether the CPU has SSE features.
|
||||||
*
|
*
|
||||||
|
@ -164,7 +139,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_Has3DNow
|
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
* \sa SDL_HasAVX2
|
* \sa SDL_HasAVX2
|
||||||
|
@ -186,7 +160,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_Has3DNow
|
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
* \sa SDL_HasAVX2
|
* \sa SDL_HasAVX2
|
||||||
|
@ -208,7 +181,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_Has3DNow
|
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
* \sa SDL_HasAVX2
|
* \sa SDL_HasAVX2
|
||||||
|
@ -230,7 +202,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void);
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_Has3DNow
|
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
* \sa SDL_HasAVX2
|
* \sa SDL_HasAVX2
|
||||||
|
@ -252,7 +223,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void);
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_Has3DNow
|
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
* \sa SDL_HasAVX2
|
* \sa SDL_HasAVX2
|
||||||
|
@ -274,7 +244,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_Has3DNow
|
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX2
|
* \sa SDL_HasAVX2
|
||||||
* \sa SDL_HasMMX
|
* \sa SDL_HasMMX
|
||||||
|
@ -296,7 +265,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void);
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_Has3DNow
|
|
||||||
* \sa SDL_HasAltiVec
|
* \sa SDL_HasAltiVec
|
||||||
* \sa SDL_HasAVX
|
* \sa SDL_HasAVX
|
||||||
* \sa SDL_HasMMX
|
* \sa SDL_HasMMX
|
||||||
|
|
|
@ -47,9 +47,6 @@ _m_prefetch(void *__P)
|
||||||
#ifndef __MMX__
|
#ifndef __MMX__
|
||||||
#define __MMX__
|
#define __MMX__
|
||||||
#endif
|
#endif
|
||||||
#ifndef __3dNOW__
|
|
||||||
#define __3dNOW__
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef __SSE__
|
#ifndef __SSE__
|
||||||
#define __SSE__
|
#define __SSE__
|
||||||
|
@ -90,9 +87,6 @@ _m_prefetch(void *__P)
|
||||||
#endif
|
#endif
|
||||||
#endif /* compiler version */
|
#endif /* compiler version */
|
||||||
|
|
||||||
#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
|
|
||||||
#include <mm3dnow.h>
|
|
||||||
#endif
|
|
||||||
#if defined(__loongarch_sx) && !defined(SDL_DISABLE_LSX_H)
|
#if defined(__loongarch_sx) && !defined(SDL_DISABLE_LSX_H)
|
||||||
#include <lsxintrin.h>
|
#include <lsxintrin.h>
|
||||||
#define __LSX__
|
#define __LSX__
|
||||||
|
|
|
@ -86,19 +86,18 @@
|
||||||
#define CPU_HAS_RDTSC (1 << 0)
|
#define CPU_HAS_RDTSC (1 << 0)
|
||||||
#define CPU_HAS_ALTIVEC (1 << 1)
|
#define CPU_HAS_ALTIVEC (1 << 1)
|
||||||
#define CPU_HAS_MMX (1 << 2)
|
#define CPU_HAS_MMX (1 << 2)
|
||||||
#define CPU_HAS_3DNOW (1 << 3)
|
#define CPU_HAS_SSE (1 << 3)
|
||||||
#define CPU_HAS_SSE (1 << 4)
|
#define CPU_HAS_SSE2 (1 << 4)
|
||||||
#define CPU_HAS_SSE2 (1 << 5)
|
#define CPU_HAS_SSE3 (1 << 5)
|
||||||
#define CPU_HAS_SSE3 (1 << 6)
|
#define CPU_HAS_SSE41 (1 << 6)
|
||||||
#define CPU_HAS_SSE41 (1 << 7)
|
#define CPU_HAS_SSE42 (1 << 7)
|
||||||
#define CPU_HAS_SSE42 (1 << 8)
|
#define CPU_HAS_AVX (1 << 8)
|
||||||
#define CPU_HAS_AVX (1 << 9)
|
#define CPU_HAS_AVX2 (1 << 9)
|
||||||
#define CPU_HAS_AVX2 (1 << 10)
|
#define CPU_HAS_NEON (1 << 10)
|
||||||
#define CPU_HAS_NEON (1 << 11)
|
#define CPU_HAS_AVX512F (1 << 11)
|
||||||
#define CPU_HAS_AVX512F (1 << 12)
|
#define CPU_HAS_ARM_SIMD (1 << 12)
|
||||||
#define CPU_HAS_ARM_SIMD (1 << 13)
|
#define CPU_HAS_LSX (1 << 13)
|
||||||
#define CPU_HAS_LSX (1 << 14)
|
#define CPU_HAS_LASX (1 << 14)
|
||||||
#define CPU_HAS_LASX (1 << 15)
|
|
||||||
|
|
||||||
#define CPU_CFG2 0x2
|
#define CPU_CFG2 0x2
|
||||||
#define CPU_CFG2_LSX (1 << 6)
|
#define CPU_CFG2_LSX (1 << 6)
|
||||||
|
@ -516,31 +515,6 @@ static int CPU_readCPUCFG(void)
|
||||||
#define CPU_haveLSX() (CPU_readCPUCFG() & CPU_CFG2_LSX)
|
#define CPU_haveLSX() (CPU_readCPUCFG() & CPU_CFG2_LSX)
|
||||||
#define CPU_haveLASX() (CPU_readCPUCFG() & CPU_CFG2_LASX)
|
#define CPU_haveLASX() (CPU_readCPUCFG() & CPU_CFG2_LASX)
|
||||||
|
|
||||||
#if defined(__e2k__)
|
|
||||||
inline int
|
|
||||||
CPU_have3DNow(void)
|
|
||||||
{
|
|
||||||
#if defined(__3dNOW__)
|
|
||||||
return 1;
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static int CPU_have3DNow(void)
|
|
||||||
{
|
|
||||||
if (CPU_CPUIDMaxFunction > 0) { /* that is, do we have CPUID at all? */
|
|
||||||
int a, b, c, d;
|
|
||||||
cpuid(0x80000000, a, b, c, d);
|
|
||||||
if (a >= 0x80000001) {
|
|
||||||
cpuid(0x80000001, a, b, c, d);
|
|
||||||
return d & 0x80000000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__e2k__)
|
#if defined(__e2k__)
|
||||||
#define CPU_haveRDTSC() (0)
|
#define CPU_haveRDTSC() (0)
|
||||||
#if defined(__MMX__)
|
#if defined(__MMX__)
|
||||||
|
@ -900,10 +874,6 @@ static Uint32 SDL_GetCPUFeatures(void)
|
||||||
SDL_CPUFeatures |= CPU_HAS_MMX;
|
SDL_CPUFeatures |= CPU_HAS_MMX;
|
||||||
SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 8);
|
SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 8);
|
||||||
}
|
}
|
||||||
if (CPU_have3DNow()) {
|
|
||||||
SDL_CPUFeatures |= CPU_HAS_3DNOW;
|
|
||||||
SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 8);
|
|
||||||
}
|
|
||||||
if (CPU_haveSSE()) {
|
if (CPU_haveSSE()) {
|
||||||
SDL_CPUFeatures |= CPU_HAS_SSE;
|
SDL_CPUFeatures |= CPU_HAS_SSE;
|
||||||
SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16);
|
SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16);
|
||||||
|
@ -975,12 +945,6 @@ SDL_HasMMX(void)
|
||||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_MMX);
|
return CPU_FEATURE_AVAILABLE(CPU_HAS_MMX);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool
|
|
||||||
SDL_Has3DNow(void)
|
|
||||||
{
|
|
||||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_3DNOW);
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_bool
|
SDL_bool
|
||||||
SDL_HasSSE(void)
|
SDL_HasSSE(void)
|
||||||
{
|
{
|
||||||
|
@ -1228,7 +1192,6 @@ int main()
|
||||||
printf("RDTSC: %d\n", SDL_HasRDTSC());
|
printf("RDTSC: %d\n", SDL_HasRDTSC());
|
||||||
printf("Altivec: %d\n", SDL_HasAltiVec());
|
printf("Altivec: %d\n", SDL_HasAltiVec());
|
||||||
printf("MMX: %d\n", SDL_HasMMX());
|
printf("MMX: %d\n", SDL_HasMMX());
|
||||||
printf("3DNow: %d\n", SDL_Has3DNow());
|
|
||||||
printf("SSE: %d\n", SDL_HasSSE());
|
printf("SSE: %d\n", SDL_HasSSE());
|
||||||
printf("SSE2: %d\n", SDL_HasSSE2());
|
printf("SSE2: %d\n", SDL_HasSSE2());
|
||||||
printf("SSE3: %d\n", SDL_HasSSE3());
|
printf("SSE3: %d\n", SDL_HasSSE3());
|
||||||
|
|
|
@ -632,7 +632,6 @@ SDL3_0.0.0 {
|
||||||
SDL_HasRDTSC;
|
SDL_HasRDTSC;
|
||||||
SDL_HasAltiVec;
|
SDL_HasAltiVec;
|
||||||
SDL_HasMMX;
|
SDL_HasMMX;
|
||||||
SDL_Has3DNow;
|
|
||||||
SDL_HasSSE;
|
SDL_HasSSE;
|
||||||
SDL_HasSSE2;
|
SDL_HasSSE2;
|
||||||
SDL_HasSSE3;
|
SDL_HasSSE3;
|
||||||
|
|
|
@ -102,7 +102,6 @@
|
||||||
#define SDL_HasRDTSC SDL_HasRDTSC_REAL
|
#define SDL_HasRDTSC SDL_HasRDTSC_REAL
|
||||||
#define SDL_HasAltiVec SDL_HasAltiVec_REAL
|
#define SDL_HasAltiVec SDL_HasAltiVec_REAL
|
||||||
#define SDL_HasMMX SDL_HasMMX_REAL
|
#define SDL_HasMMX SDL_HasMMX_REAL
|
||||||
#define SDL_Has3DNow SDL_Has3DNow_REAL
|
|
||||||
#define SDL_HasSSE SDL_HasSSE_REAL
|
#define SDL_HasSSE SDL_HasSSE_REAL
|
||||||
#define SDL_HasSSE2 SDL_HasSSE2_REAL
|
#define SDL_HasSSE2 SDL_HasSSE2_REAL
|
||||||
#define SDL_HasSSE3 SDL_HasSSE3_REAL
|
#define SDL_HasSSE3 SDL_HasSSE3_REAL
|
||||||
|
|
|
@ -129,7 +129,6 @@ SDL_DYNAPI_PROC(int,SDL_GetCPUCacheLineSize,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_HasRDTSC,(void),(),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_HasRDTSC,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_HasAltiVec,(void),(),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_HasAltiVec,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_HasMMX,(void),(),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_HasMMX,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_Has3DNow,(void),(),return)
|
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE,(void),(),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE2,(void),(),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE2,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE3,(void),(),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE3,(void),(),return)
|
||||||
|
|
|
@ -141,9 +141,6 @@ static SDL_BlitFunc SDL_ChooseBlitFunc(Uint32 src_format, Uint32 dst_format, int
|
||||||
if (SDL_HasMMX()) {
|
if (SDL_HasMMX()) {
|
||||||
features |= SDL_CPU_MMX;
|
features |= SDL_CPU_MMX;
|
||||||
}
|
}
|
||||||
if (SDL_Has3DNow()) {
|
|
||||||
features |= SDL_CPU_3DNOW;
|
|
||||||
}
|
|
||||||
if (SDL_HasSSE()) {
|
if (SDL_HasSSE()) {
|
||||||
features |= SDL_CPU_SSE;
|
features |= SDL_CPU_SSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,11 +49,10 @@ extern Uint8 *SDL_expand_byte[9];
|
||||||
/* SDL blit CPU flags */
|
/* SDL blit CPU flags */
|
||||||
#define SDL_CPU_ANY 0x00000000
|
#define SDL_CPU_ANY 0x00000000
|
||||||
#define SDL_CPU_MMX 0x00000001
|
#define SDL_CPU_MMX 0x00000001
|
||||||
#define SDL_CPU_3DNOW 0x00000002
|
#define SDL_CPU_SSE 0x00000002
|
||||||
#define SDL_CPU_SSE 0x00000004
|
#define SDL_CPU_SSE2 0x00000004
|
||||||
#define SDL_CPU_SSE2 0x00000008
|
#define SDL_CPU_ALTIVEC_PREFETCH 0x00000008
|
||||||
#define SDL_CPU_ALTIVEC_PREFETCH 0x00000010
|
#define SDL_CPU_ALTIVEC_NOPREFETCH 0x00000010
|
||||||
#define SDL_CPU_ALTIVEC_NOPREFETCH 0x00000020
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -614,78 +614,6 @@ static void BlitRGBtoBGRPixelAlpha(SDL_BlitInfo *info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __3dNOW__
|
|
||||||
/* fast (as in MMX with prefetch) ARGB888->(A)RGB888 blending with pixel alpha */
|
|
||||||
static void BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo *info)
|
|
||||||
{
|
|
||||||
int width = info->dst_w;
|
|
||||||
int height = info->dst_h;
|
|
||||||
Uint32 *srcp = (Uint32 *)info->src;
|
|
||||||
int srcskip = info->src_skip >> 2;
|
|
||||||
Uint32 *dstp = (Uint32 *)info->dst;
|
|
||||||
int dstskip = info->dst_skip >> 2;
|
|
||||||
SDL_PixelFormat *sf = info->src_fmt;
|
|
||||||
Uint32 amask = sf->Amask;
|
|
||||||
Uint32 ashift = sf->Ashift;
|
|
||||||
Uint64 multmask, multmask2;
|
|
||||||
|
|
||||||
__m64 src1, dst1, mm_alpha, mm_zero, mm_alpha2;
|
|
||||||
|
|
||||||
mm_zero = _mm_setzero_si64(); /* 0 -> mm_zero */
|
|
||||||
multmask = 0x00FF;
|
|
||||||
multmask <<= (ashift * 2);
|
|
||||||
multmask2 = 0x00FF00FF00FF00FFULL;
|
|
||||||
|
|
||||||
while (height--) {
|
|
||||||
/* *INDENT-OFF* */ /* clang-format off */
|
|
||||||
DUFFS_LOOP4({
|
|
||||||
Uint32 alpha;
|
|
||||||
|
|
||||||
_m_prefetch(srcp + 16);
|
|
||||||
_m_prefetch(dstp + 16);
|
|
||||||
|
|
||||||
alpha = *srcp & amask;
|
|
||||||
if (alpha == 0) {
|
|
||||||
/* do nothing */
|
|
||||||
} else if (alpha == amask) {
|
|
||||||
*dstp = *srcp;
|
|
||||||
} else {
|
|
||||||
src1 = _mm_cvtsi32_si64(*srcp); /* src(ARGB) -> src1 (0000ARGB) */
|
|
||||||
src1 = _mm_unpacklo_pi8(src1, mm_zero); /* 0A0R0G0B -> src1 */
|
|
||||||
|
|
||||||
dst1 = _mm_cvtsi32_si64(*dstp); /* dst(ARGB) -> dst1 (0000ARGB) */
|
|
||||||
dst1 = _mm_unpacklo_pi8(dst1, mm_zero); /* 0A0R0G0B -> dst1 */
|
|
||||||
|
|
||||||
mm_alpha = _mm_cvtsi32_si64(alpha); /* alpha -> mm_alpha (0000000A) */
|
|
||||||
mm_alpha = _mm_srli_si64(mm_alpha, ashift); /* mm_alpha >> ashift -> mm_alpha(0000000A) */
|
|
||||||
mm_alpha = _mm_unpacklo_pi16(mm_alpha, mm_alpha); /* 00000A0A -> mm_alpha */
|
|
||||||
mm_alpha2 = _mm_unpacklo_pi32(mm_alpha, mm_alpha); /* 0A0A0A0A -> mm_alpha2 */
|
|
||||||
mm_alpha = _mm_or_si64(mm_alpha2, *(__m64 *) & multmask); /* 0F0A0A0A -> mm_alpha */
|
|
||||||
mm_alpha2 = _mm_xor_si64(mm_alpha2, *(__m64 *) & multmask2); /* 255 - mm_alpha -> mm_alpha */
|
|
||||||
|
|
||||||
|
|
||||||
/* blend */
|
|
||||||
src1 = _mm_mullo_pi16(src1, mm_alpha);
|
|
||||||
src1 = _mm_srli_pi16(src1, 8);
|
|
||||||
dst1 = _mm_mullo_pi16(dst1, mm_alpha2);
|
|
||||||
dst1 = _mm_srli_pi16(dst1, 8);
|
|
||||||
dst1 = _mm_add_pi16(src1, dst1);
|
|
||||||
dst1 = _mm_packs_pu16(dst1, mm_zero);
|
|
||||||
|
|
||||||
*dstp = _mm_cvtsi64_si32(dst1); /* dst1 -> pixel */
|
|
||||||
}
|
|
||||||
++srcp;
|
|
||||||
++dstp;
|
|
||||||
}, width);
|
|
||||||
/* *INDENT-ON* */ /* clang-format on */
|
|
||||||
srcp += srcskip;
|
|
||||||
dstp += dstskip;
|
|
||||||
}
|
|
||||||
_mm_empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* __3dNOW__ */
|
|
||||||
|
|
||||||
/* 16bpp special case for per-surface alpha=50%: blend 2 pixels in parallel */
|
/* 16bpp special case for per-surface alpha=50%: blend 2 pixels in parallel */
|
||||||
|
|
||||||
/* blend a single 16 bit pixel at 50% */
|
/* blend a single 16 bit pixel at 50% */
|
||||||
|
@ -1401,20 +1329,15 @@ SDL_CalculateBlitA(SDL_Surface *surface)
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
if (sf->Rmask == df->Rmask && sf->Gmask == df->Gmask && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
|
if (sf->Rmask == df->Rmask && sf->Gmask == df->Gmask && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
|
||||||
#if defined(__MMX__) || defined(__3dNOW__)
|
#if defined(__MMX__)
|
||||||
if (sf->Rshift % 8 == 0 && sf->Gshift % 8 == 0 && sf->Bshift % 8 == 0 && sf->Ashift % 8 == 0 && sf->Aloss == 0) {
|
if (sf->Rshift % 8 == 0 && sf->Gshift % 8 == 0 && sf->Bshift % 8 == 0 && sf->Ashift % 8 == 0 && sf->Aloss == 0) {
|
||||||
#ifdef __3dNOW__
|
|
||||||
if (SDL_Has3DNow()) {
|
|
||||||
return BlitRGBtoRGBPixelAlphaMMX3DNOW;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef __MMX__
|
#ifdef __MMX__
|
||||||
if (SDL_HasMMX()) {
|
if (SDL_HasMMX()) {
|
||||||
return BlitRGBtoRGBPixelAlphaMMX;
|
return BlitRGBtoRGBPixelAlphaMMX;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* __MMX__ || __3dNOW__ */
|
#endif /* __MMX__ */
|
||||||
if (sf->Amask == 0xff000000) {
|
if (sf->Amask == 0xff000000) {
|
||||||
#if SDL_ARM_NEON_BLITTERS
|
#if SDL_ARM_NEON_BLITTERS
|
||||||
if (SDL_HasNEON()) {
|
if (SDL_HasNEON()) {
|
||||||
|
|
|
@ -164,7 +164,6 @@ int platform_testGetFunctions(void *arg)
|
||||||
/* !
|
/* !
|
||||||
* \brief Tests SDL_HasXYZ() functions
|
* \brief Tests SDL_HasXYZ() functions
|
||||||
* \sa
|
* \sa
|
||||||
* http://wiki.libsdl.org/SDL_Has3DNow
|
|
||||||
* http://wiki.libsdl.org/SDL_HasAltiVec
|
* http://wiki.libsdl.org/SDL_HasAltiVec
|
||||||
* http://wiki.libsdl.org/SDL_HasMMX
|
* http://wiki.libsdl.org/SDL_HasMMX
|
||||||
* http://wiki.libsdl.org/SDL_HasRDTSC
|
* http://wiki.libsdl.org/SDL_HasRDTSC
|
||||||
|
@ -188,9 +187,6 @@ int platform_testHasFunctions(void *arg)
|
||||||
SDL_HasMMX();
|
SDL_HasMMX();
|
||||||
SDLTest_AssertPass("SDL_HasMMX()");
|
SDLTest_AssertPass("SDL_HasMMX()");
|
||||||
|
|
||||||
SDL_Has3DNow();
|
|
||||||
SDLTest_AssertPass("SDL_Has3DNow()");
|
|
||||||
|
|
||||||
SDL_HasSSE();
|
SDL_HasSSE();
|
||||||
SDLTest_AssertPass("SDL_HasSSE()");
|
SDLTest_AssertPass("SDL_HasSSE()");
|
||||||
|
|
||||||
|
|
|
@ -393,7 +393,6 @@ int TestCPUInfo(SDL_bool verbose)
|
||||||
SDL_Log("RDTSC %s\n", SDL_HasRDTSC() ? "detected" : "not detected");
|
SDL_Log("RDTSC %s\n", SDL_HasRDTSC() ? "detected" : "not detected");
|
||||||
SDL_Log("AltiVec %s\n", SDL_HasAltiVec() ? "detected" : "not detected");
|
SDL_Log("AltiVec %s\n", SDL_HasAltiVec() ? "detected" : "not detected");
|
||||||
SDL_Log("MMX %s\n", SDL_HasMMX() ? "detected" : "not detected");
|
SDL_Log("MMX %s\n", SDL_HasMMX() ? "detected" : "not detected");
|
||||||
SDL_Log("3DNow! %s\n", SDL_Has3DNow() ? "detected" : "not detected");
|
|
||||||
SDL_Log("SSE %s\n", SDL_HasSSE() ? "detected" : "not detected");
|
SDL_Log("SSE %s\n", SDL_HasSSE() ? "detected" : "not detected");
|
||||||
SDL_Log("SSE2 %s\n", SDL_HasSSE2() ? "detected" : "not detected");
|
SDL_Log("SSE2 %s\n", SDL_HasSSE2() ? "detected" : "not detected");
|
||||||
SDL_Log("SSE3 %s\n", SDL_HasSSE3() ? "detected" : "not detected");
|
SDL_Log("SSE3 %s\n", SDL_HasSSE3() ? "detected" : "not detected");
|
||||||
|
|
Loading…
Reference in New Issue