diff --git a/Makefile b/Makefile index f30276f1b..d5abfde47 100644 --- a/Makefile +++ b/Makefile @@ -1105,6 +1105,11 @@ ifndef MINGW endif endif +ifeq ($(ARCH),x86_64) + Q3OBJ += \ + $(B)/client/snd_mix_x86_64.o +endif + ifeq ($(HAVE_VM_COMPILED),true) ifeq ($(ARCH),x86) Q3OBJ += $(B)/client/vm_x86.o diff --git a/code/asm/snd_mix_x86_64.s b/code/asm/snd_mix_x86_64.s new file mode 100644 index 000000000..0476b22b9 --- /dev/null +++ b/code/asm/snd_mix_x86_64.s @@ -0,0 +1,126 @@ +#if defined(MACOS_X) +#undef ELF +#endif + +#ifdef __ELF__ +.section .note.GNU-stack,"",@progbits +#endif + +#ifdef ELF +#define C(label) label +#else +#define C(label) _##label +#endif + +.intel_syntax noprefix + +.text + +.globl C(S_WriteLinearBlastStereo16_SSE_x64) +C(S_WriteLinearBlastStereo16_SSE_x64): + push rbx +#ifdef _WIN32 + // RCX RDX R8 R9 + push rsi + push rdi + mov rsi, rcx + mov rdi, rdx + mov ebx, r8d +#else + // RDI RSI RDX RCX R8 R9 + xchg rsi, rdi + mov ebx, edx +#endif + test ebx,ebx + jz LExit + mov ecx,esi + and ecx,63 + jz LMain + and ecx,3 + jnz LTail + shr ecx,2 + not ecx + add ecx,17 +LClamp1: + mov eax,[rsi] + sar eax,8 + cmp eax,32767 + jg LClampHigh1 + cmp eax,-32768 + jnl LClampDone1 + mov eax,-32768 + jmp LClampDone1 +LClampHigh1: + mov eax,32767 +LClampDone1: + mov [rdi],ax + add rsi,4 + add rdi,2 + dec ebx + jz LExit + dec ecx + jnz LClamp1 +LMain: + mov ecx,ebx + shr ecx,4 + jz LTail + and ebx,15 +LAgain: + movq mm0, qword ptr [rsi+ 0] + movq mm1, qword ptr [rsi+ 8] + movq mm2, qword ptr [rsi+16] + movq mm3, qword ptr [rsi+24] + movq mm4, qword ptr [rsi+32] + movq mm5, qword ptr [rsi+40] + movq mm6, qword ptr [rsi+48] + movq mm7, qword ptr [rsi+56] + psrad mm0,8 + psrad mm1,8 + psrad mm2,8 + psrad mm3,8 + psrad mm4,8 + psrad mm5,8 + psrad mm6,8 + psrad mm7,8 + packssdw mm0, mm1 + packssdw mm2, mm3 + packssdw mm4, mm5 + packssdw mm6, mm7 + movntq qword ptr [rdi+ 0], mm0 + movntq qword ptr [rdi+ 8], mm2 + movntq qword ptr [rdi+16], mm4 + movntq qword ptr [rdi+24], mm6 + add rsi, 64 + add rdi, 32 + dec ecx + jnz LAgain +LTail: + test ebx, ebx + jz LEnd +LClamp2: + mov eax,[rsi] + sar eax,8 + cmp eax,32767 + jg LClampHigh2 + cmp eax,-32768 + jnl LClampDone2 + mov eax,-32768 + jmp LClampDone2 +LClampHigh2: + mov eax,32767 +LClampDone2: + mov [rdi],ax + add rsi,4 + add rdi,2 + dec ebx + jnz LClamp2 +LEnd: + sfence + emms +LExit: +#ifdef _WIN32 + pop rdi + pop rsi +#endif + pop rbx + ret diff --git a/code/client/cl_scrn.c b/code/client/cl_scrn.c index 01f69451b..1ce03213c 100644 --- a/code/client/cl_scrn.c +++ b/code/client/cl_scrn.c @@ -530,8 +530,11 @@ static void SCR_DrawScreenField( stereoFrame_t stereoFrame ) { // unless they are displaying game renderings if ( uiFullscreen || cls.state < CA_LOADING ) { if ( cls.glconfig.vidWidth * 480 > cls.glconfig.vidHeight * 640 ) { + // draw vertical bars on sides for legacy mods + const int w = (cls.glconfig.vidWidth - ((cls.glconfig.vidHeight * 640) / 480)) /2; re.SetColor( g_color_table[ ColorIndex( COLOR_BLACK ) ] ); - re.DrawStretchPic( 0, 0, cls.glconfig.vidWidth, cls.glconfig.vidHeight, 0, 0, 0, 0, cls.whiteShader ); + re.DrawStretchPic( 0, 0, w, cls.glconfig.vidHeight, 0, 0, 0, 0, cls.whiteShader ); + re.DrawStretchPic( cls.glconfig.vidWidth - w, 0, w, cls.glconfig.vidHeight, 0, 0, 0, 0, cls.whiteShader ); re.SetColor( NULL ); } } diff --git a/code/client/snd_mix.c b/code/client/snd_mix.c index d9d28006e..ac9af1579 100644 --- a/code/client/snd_mix.c +++ b/code/client/snd_mix.c @@ -265,7 +265,7 @@ __asm { #endif // id386 -#if idx64 && defined (_MSC_VER) && defined(USE_WIN32_ASM) +#if idx64 && (!defined (_MSC_VER) || defined(USE_WIN32_ASM)) void S_WriteLinearBlastStereo16_SSE_x64( int*, short*, int ); #endif @@ -299,7 +299,7 @@ void S_TransferStereo16( unsigned long *pbuf, int endtime ) S_WriteLinearBlastStereo16_MMX(); else #endif -#if idx64 && defined (_MSC_VER) && defined (USE_WIN32_ASM) +#if idx64 && (!defined (_MSC_VER) || defined (USE_WIN32_ASM)) S_WriteLinearBlastStereo16_SSE_x64( snd_p, snd_out, snd_linear_count ); #else S_WriteLinearBlastStereo16(); diff --git a/code/win32/msvc2017/botlib.vcxproj b/code/win32/msvc2017/botlib.vcxproj index dc799cf88..4832312b9 100644 --- a/code/win32/msvc2017/botlib.vcxproj +++ b/code/win32/msvc2017/botlib.vcxproj @@ -106,6 +106,7 @@ Level4 MultiThreaded NoExtensions + true @@ -113,6 +114,7 @@ WIN32;NDEBUG;_LIB;BOTLIB;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) Level4 MultiThreaded + true @@ -120,6 +122,7 @@ WIN32;NDEBUG;_LIB;BOTLIB;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) Level4 MultiThreaded + true @@ -132,6 +135,7 @@ Level3 true NoExtensions + true @@ -143,6 +147,7 @@ true Level3 true + true @@ -154,6 +159,7 @@ true Level3 true + true diff --git a/code/win32/msvc2017/libjpeg.vcxproj b/code/win32/msvc2017/libjpeg.vcxproj index 092c09c25..552d884a8 100644 --- a/code/win32/msvc2017/libjpeg.vcxproj +++ b/code/win32/msvc2017/libjpeg.vcxproj @@ -109,6 +109,7 @@ Level3 true NoExtensions + true @@ -119,6 +120,7 @@ MultiThreadedDebug Level3 true + true @@ -129,6 +131,7 @@ MultiThreadedDebug Level3 true + true @@ -137,6 +140,7 @@ MultiThreaded Level3 NoExtensions + true @@ -144,6 +148,7 @@ WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreaded Level3 + true @@ -152,6 +157,7 @@ MultiThreaded Level3 CompileAsC + true diff --git a/code/win32/msvc2017/libogg.vcxproj b/code/win32/msvc2017/libogg.vcxproj index 4a4a34a22..aab95c18d 100644 --- a/code/win32/msvc2017/libogg.vcxproj +++ b/code/win32/msvc2017/libogg.vcxproj @@ -114,6 +114,7 @@ WIN32;NDEBUG;%(PreprocessorDefinitions) MultiThreaded NoExtensions + true true @@ -128,6 +129,7 @@ MultiThreadedDebug NoExtensions true + true @@ -137,6 +139,7 @@ WIN32;_DEBUG;%(PreprocessorDefinitions) MultiThreadedDebug true + true @@ -144,6 +147,7 @@ Level3 WIN32;NDEBUG;%(PreprocessorDefinitions) MultiThreaded + true true @@ -155,6 +159,7 @@ WIN32;NDEBUG;%(PreprocessorDefinitions) Level3 MultiThreaded + true true @@ -169,6 +174,7 @@ EnableFastChecks true Disabled + true diff --git a/code/win32/msvc2017/libvorbis.vcxproj b/code/win32/msvc2017/libvorbis.vcxproj index 27f332f4c..400c4c693 100644 --- a/code/win32/msvc2017/libvorbis.vcxproj +++ b/code/win32/msvc2017/libvorbis.vcxproj @@ -114,6 +114,7 @@ MultiThreaded Level1 NoExtensions + true true @@ -129,6 +130,7 @@ NoExtensions true EnableFastChecks + true @@ -139,6 +141,7 @@ MultiThreadedDebug true EnableFastChecks + true @@ -148,6 +151,7 @@ _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreaded Level1 + true true @@ -162,6 +166,7 @@ true Level3 Disabled + true @@ -169,6 +174,7 @@ _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreaded Level1 + true true diff --git a/code/win32/msvc2017/quake3e-ded.vcxproj b/code/win32/msvc2017/quake3e-ded.vcxproj index 93bc1dc18..35b9774de 100644 --- a/code/win32/msvc2017/quake3e-ded.vcxproj +++ b/code/win32/msvc2017/quake3e-ded.vcxproj @@ -122,6 +122,7 @@ Level3 true NoExtensions + true _DEBUG;%(PreprocessorDefinitions) @@ -149,6 +150,7 @@ $(IntDir) Level3 true + true @@ -175,6 +177,7 @@ $(IntDir) Level3 true + true @@ -197,6 +200,7 @@ Level4 MultiThreaded NoExtensions + true advapi32.lib;gdi32.lib;user32.lib;comctl32.lib;winmm.lib;wsock32.lib;ws2_32.lib;%(AdditionalDependencies) @@ -218,6 +222,7 @@ WIN32;_WIN32;DEDICATED;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) Level4 MultiThreaded + true /DYNAMICBASE %(AdditionalOptions) @@ -237,6 +242,7 @@ WIN32;_WIN32;DEDICATED;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) Level4 MultiThreaded + true /DYNAMICBASE %(AdditionalOptions) diff --git a/code/win32/msvc2017/quake3e.vcxproj b/code/win32/msvc2017/quake3e.vcxproj index d6753a02f..a341e138a 100644 --- a/code/win32/msvc2017/quake3e.vcxproj +++ b/code/win32/msvc2017/quake3e.vcxproj @@ -128,6 +128,7 @@ Disabled true NoExtensions + true @@ -151,6 +152,7 @@ true Level3 true + true @@ -174,6 +176,7 @@ $(IntDir) Level3 true + true @@ -194,6 +197,7 @@ Level4 MultiThreaded NoExtensions + true comctl32.lib;winmm.lib;wsock32.lib;ws2_32.lib;$(OutDir)$(ConfigurationName)-$(PlatformName)-renderer.lib;..\..\libcurl\windows\vs2017\lib32\libcurl_a.lib;%(AdditionalDependencies) @@ -219,6 +223,7 @@ Level4 MultiThreaded AssemblyAndSourceCode + true /DYNAMICBASE %(AdditionalOptions) @@ -243,6 +248,7 @@ WIN32;_WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_SKIPIDLOGO;USE_OPENGL_API;USE_VULKAN_API;USE_OGG_VORBIS;$(UseWASAPI);%(PreprocessorDefinitions) Level4 MultiThreaded + true /DYNAMICBASE %(AdditionalOptions) diff --git a/code/win32/msvc2017/renderer.vcxproj b/code/win32/msvc2017/renderer.vcxproj index 73a6cb16b..0b4e6dcfd 100644 --- a/code/win32/msvc2017/renderer.vcxproj +++ b/code/win32/msvc2017/renderer.vcxproj @@ -114,6 +114,7 @@ true Fast NoExtensions + true $(OutDir)$(ConfigurationName)-$(PlatformName)-$(TargetName).lib @@ -126,6 +127,7 @@ MultiThreaded true Fast + true $(OutDir)$(ConfigurationName)-$(PlatformName)-$(TargetName).lib @@ -137,6 +139,7 @@ Level4 MultiThreaded Fast + true $(OutDir)$(ConfigurationName)-$(PlatformName)-$(TargetName).lib @@ -153,6 +156,7 @@ true true NoExtensions + true $(OutDir)$(ConfigurationName)-$(PlatformName)-$(TargetName).lib @@ -169,6 +173,7 @@ true ProgramDatabase true + true $(OutDir)$(ConfigurationName)-$(PlatformName)-$(TargetName).lib @@ -185,6 +190,7 @@ true ProgramDatabase true + true $(OutDir)$(ConfigurationName)-$(PlatformName)-$(TargetName).lib diff --git a/code/win32/msvc2017/renderer2.vcxproj b/code/win32/msvc2017/renderer2.vcxproj index fd0dbefaa..58fce5712 100644 --- a/code/win32/msvc2017/renderer2.vcxproj +++ b/code/win32/msvc2017/renderer2.vcxproj @@ -147,6 +147,7 @@ cscript.exe /nologo glsl_stringify.vbs ..\..\renderer2\glsl\tonemap_vp.glsl .\bu MultiThreaded NoExtensions Fast + true $(OutDir)$(ConfigurationName)-$(PlatformName)-$(TargetName).lib @@ -192,6 +193,7 @@ cscript.exe /nologo glsl_stringify.vbs ..\..\renderer2\glsl\tonemap_vp.glsl .\bu Level4 MultiThreaded Fast + true $(OutDir)$(ConfigurationName)-$(PlatformName)-$(TargetName).lib @@ -237,6 +239,7 @@ cscript.exe /nologo glsl_stringify.vbs ..\..\renderer2\glsl\tonemap_vp.glsl .\bu Level4 MultiThreaded Fast + true $(OutDir)$(ConfigurationName)-$(PlatformName)-$(TargetName).lib @@ -286,6 +289,7 @@ cscript.exe /nologo glsl_stringify.vbs ..\..\renderer2\glsl\tonemap_vp.glsl .\bu Level3 true NoExtensions + true $(OutDir)$(ConfigurationName)-$(PlatformName)-$(TargetName).lib @@ -334,6 +338,7 @@ cscript.exe /nologo glsl_stringify.vbs ..\..\renderer2\glsl\tonemap_vp.glsl .\bu true Level3 true + true $(OutDir)$(ConfigurationName)-$(PlatformName)-$(TargetName).lib @@ -382,6 +387,7 @@ cscript.exe /nologo glsl_stringify.vbs ..\..\renderer2\glsl\tonemap_vp.glsl .\bu true Level3 true + true $(OutDir)$(ConfigurationName)-$(PlatformName)-$(TargetName).lib diff --git a/code/win32/msvc2017/renderervk.vcxproj b/code/win32/msvc2017/renderervk.vcxproj index bf172635b..b749cf922 100644 --- a/code/win32/msvc2017/renderervk.vcxproj +++ b/code/win32/msvc2017/renderervk.vcxproj @@ -121,6 +121,7 @@ MultiThreadedDebug true NoExtensions + true $(OutDir)$(ConfigurationName)-$(PlatformName)-$(TargetName).lib @@ -134,6 +135,7 @@ MultiThreadedDebug true true + true $(OutDir)$(ConfigurationName)-$(PlatformName)-$(TargetName).lib @@ -146,6 +148,7 @@ _DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreadedDebug true + true $(OutDir)$(ConfigurationName)-$(PlatformName)-$(TargetName).lib @@ -160,6 +163,7 @@ MultiThreaded Fast NoExtensions + true true @@ -177,6 +181,7 @@ NDEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreaded Fast + true true @@ -194,6 +199,7 @@ NDEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreaded Fast + true true