From 88cb5e4d47e6d3f4015924db8856c66d850b27a3 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 16 Aug 2007 06:37:22 +0000 Subject: [PATCH] SSE and MMX intrinsics work with Visual Studio now... --- VisualC/SDL/SDL.vcproj | 4 ++-- src/video/SDL_blit.h | 2 +- src/video/SDL_surface.c | 9 +++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/VisualC/SDL/SDL.vcproj b/VisualC/SDL/SDL.vcproj index 76d298c29..a6eabda7a 100644 --- a/VisualC/SDL/SDL.vcproj +++ b/VisualC/SDL/SDL.vcproj @@ -47,7 +47,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\include" - PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_DEBUG;_WINDOWS;_WIN32_WINNT=0x0400" + PreprocessorDefinitions="_DEBUG;_WINDOWS;_WIN32_WINNT=0x0400;__SSE__;__MMX__" RuntimeLibrary="2" BufferSecurityCheck="false" UsePrecompiledHeader="0" @@ -145,7 +145,7 @@ InlineFunctionExpansion="1" EnableIntrinsicFunctions="false" AdditionalIncludeDirectories="..\..\include" - PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0400" + PreprocessorDefinitions="NDEBUG;_WINDOWS;_WIN32_WINNT=0x0400;__SSE__;__MMX__" StringPooling="true" RuntimeLibrary="2" BufferSecurityCheck="false" diff --git a/src/video/SDL_blit.h b/src/video/SDL_blit.h index e4f5726b3..95282180e 100644 --- a/src/video/SDL_blit.h +++ b/src/video/SDL_blit.h @@ -103,7 +103,7 @@ extern SDL_loblit SDL_CalculateAlphaBlit(SDL_Surface * surface, int complex); #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 +#define DECLARE_ALIGNED(t,v,a) __declspec(align(a)) t v #else #define DECLARE_ALIGNED(t,v,a) t v #endif diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index eabab7de5..fa1daaf0e 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -512,6 +512,14 @@ SDL_UpperBlit(SDL_Surface * src, SDL_Rect * srcrect, #ifdef __SSE__ /* *INDENT-OFF* */ +#ifdef _MSC_VER +#define SSE_BEGIN \ + __m128 c128; \ + c128.m128_u32[0] = color; \ + c128.m128_u32[1] = color; \ + c128.m128_u32[2] = color; \ + c128.m128_u32[3] = color; +#else #define SSE_BEGIN \ DECLARE_ALIGNED(Uint32, cccc[4], 16); \ cccc[0] = color; \ @@ -519,6 +527,7 @@ SDL_UpperBlit(SDL_Surface * src, SDL_Rect * srcrect, cccc[2] = color; \ cccc[3] = color; \ __m128 c128 = *(__m128 *)cccc; +#endif #define SSE_WORK \ for (i = n / 64; i--;) { \