Dropped support for old pre-SSE processors

Changed buf_to_buf function to SSE implementation.

* affected old processors:
Intel - Pentium II, older Celeron (Covington/Mendocino)
AMD - older K7 (Athlon Classic/Thunderbird)
This commit is contained in:
NovaRain
2022-07-30 00:41:07 +08:00
parent 85862d1599
commit c1475ba453
4 changed files with 20 additions and 28 deletions
+12 -21
View File
@@ -303,7 +303,7 @@ void __fastcall window_trans_cscale(long i_width, long i_height, long s_width, l
}
}
// buf_to_buf_ function with pure MMX implementation
// buf_to_buf_ function with pure SSE implementation
void __cdecl buf_to_buf(BYTE* src, long width, long height, long src_width, BYTE* dst, long dst_width) {
if (height <= 0 || width <= 0) return;
@@ -320,27 +320,19 @@ void __cdecl buf_to_buf(BYTE* src, long width, long height, long src_width, BYTE
mov esi, src;
mov edi, dst;
mov eax, height;
startLoop:
startLoop:
mov ecx, blockCount;
test ecx, ecx;
jz copySmall;
copyBlock: // copies block of 64 bytes
movq mm0, [esi]; // movups xmm0, [esi]; // SSE implementation
movq mm1, [esi + 8];
movq mm2, [esi + 16]; // movups xmm1, [esi + 16];
movq mm3, [esi + 24];
movq mm4, [esi + 32]; // movups xmm2, [esi + 32];
movq mm5, [esi + 40];
movq mm6, [esi + 48]; // movups xmm3, [esi + 48];
movq mm7, [esi + 56];
movq [edi], mm0; // movups [edi], xmm0;
movq [edi + 8], mm1;
movq [edi + 16], mm2; // movups [edi + 16], xmm1;
movq [edi + 24], mm3;
movq [edi + 32], mm4; // movups [edi + 32], xmm2;
movq [edi + 40], mm5;
movq [edi + 48], mm6; // movups [edi + 48], xmm3;
movq [edi + 56], mm7;
copyBlock: // copies block of 64 bytes
movups xmm0, [esi];
movups xmm1, [esi + 16];
movups xmm2, [esi + 32];
movups xmm3, [esi + 48];
movups [edi], xmm0;
movups [edi + 16], xmm1;
movups [edi + 32], xmm2;
movups [edi + 48], xmm3;
add esi, 64;
lea edi, [edi + 64];
dec ecx; // blockCount
@@ -354,9 +346,8 @@ void __cdecl buf_to_buf(BYTE* src, long width, long height, long src_width, BYTE
add edi, edx; // d_pitch
dec eax; // height
jnz startLoop;
emms;
jmp end;
copySmall: // copies the small size data
copySmall: // copies the small size data
mov ecx, sizeD;
rep movsd;
mov ecx, sizeB;
+1 -1
View File
@@ -78,7 +78,7 @@ void __fastcall displayInWindow(long w_here, long width, long height, void* data
// draws an image to the buffer of the active script window
void __fastcall window_trans_cscale(long i_width, long i_height, long s_width, long s_height, long xy_shift, long w_width, void* data);
// buf_to_buf_ function with pure MMX implementation
// buf_to_buf_ function with pure SSE implementation
void __cdecl buf_to_buf(BYTE* src, long width, long height, long src_width, BYTE* dst, long dst_width);
// trans_buf_to_buf_ function implementation
+1 -1
View File
@@ -176,7 +176,7 @@ static __declspec(naked) void GNW_win_refresh_hack() {
}
void Render::init() {
// Replace the srcCopy_ function with a pure MMX implementation
// Replace the srcCopy_ function with a pure SSE implementation
sf::MakeJump(fo::funcoffs::buf_to_buf_, fo::func::buf_to_buf); // 0x4D36D4
// Replace the transSrcCopy_ function
sf::MakeJump(fo::funcoffs::trans_buf_to_buf_, fo::func::trans_buf_to_buf); // 0x4D3704
+6 -5
View File
@@ -97,19 +97,20 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<PreprocessorDefinitions>INITGUID;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AssemblerOutput>NoListing</AssemblerOutput>
<AssemblerListingLocation>$(IntDir)/%(RelativeDir)/</AssemblerListingLocation>
<ObjectFileName>$(IntDir)/%(RelativeDir)/</ObjectFileName>
<ForcedIncludeFiles>stdafx.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(DXSDK_DIR)Include\</AdditionalIncludeDirectories>
<AssemblerOutput>NoListing</AssemblerOutput>
<BufferSecurityCheck>false</BufferSecurityCheck>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
</ClCompile>
<Link>
<AdditionalDependencies>d3d9.lib;d3dx9.lib;dinput.lib;Strmiids.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -224,7 +225,7 @@
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<FloatingPointModel>Fast</FloatingPointModel>
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
@@ -288,7 +289,7 @@
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<FloatingPointModel>Fast</FloatingPointModel>
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
<RuntimeTypeInfo>false</RuntimeTypeInfo>