Skip to content

Commit

Permalink
Merge pull request #15163 from unknownbrackets/softjit
Browse files Browse the repository at this point in the history
Implement a jit for drawing pixels in the software renderer
  • Loading branch information
hrydgard authored Nov 28, 2021
2 parents cf6e11e + 6fbcf67 commit aa12c9b
Show file tree
Hide file tree
Showing 18 changed files with 2,671 additions and 23 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,7 @@ list(APPEND CoreExtra
Core/MIPS/x86/RegCacheFPU.cpp
Core/MIPS/x86/RegCacheFPU.h
GPU/Common/VertexDecoderX86.cpp
GPU/Software/DrawPixelX86.cpp
GPU/Software/SamplerX86.cpp
)

Expand Down
7 changes: 6 additions & 1 deletion Common/x64Emitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1819,8 +1819,13 @@ void XEmitter::PCMPGTB(X64Reg dest, OpArg arg) {WriteSSEOp(0x66, 0x64, dest, ar
void XEmitter::PCMPGTW(X64Reg dest, OpArg arg) {WriteSSEOp(0x66, 0x65, dest, arg);}
void XEmitter::PCMPGTD(X64Reg dest, OpArg arg) {WriteSSEOp(0x66, 0x66, dest, arg);}

void XEmitter::PEXTRW(X64Reg dest, OpArg arg, u8 subreg) {WriteSSEOp(0x66, 0xC5, dest, arg, 1); Write8(subreg);}
void XEmitter::PEXTRW(X64Reg dest, X64Reg arg, u8 subreg) {WriteSSEOp(0x66, 0xC5, dest, R(arg), 1); Write8(subreg);}
void XEmitter::PINSRW(X64Reg dest, OpArg arg, u8 subreg) {WriteSSEOp(0x66, 0xC4, dest, arg, 1); Write8(subreg);}
void XEmitter::PEXTRB(OpArg dest, X64Reg arg, u8 subreg) {WriteSSE41Op(0x66, 0x3A14, arg, dest, 1); Write8(subreg);}
void XEmitter::PEXTRW(OpArg dest, X64Reg arg, u8 subreg) {WriteSSE41Op(0x66, 0x3A15, arg, dest, 1); Write8(subreg);}
void XEmitter::PEXTRD(OpArg dest, X64Reg arg, u8 subreg) {WriteSSE41Op(0x66, 0x3A16, arg, dest, 1); Write8(subreg);}
void XEmitter::PINSRB(X64Reg dest, OpArg arg, u8 subreg) {WriteSSE41Op(0x66, 0x3A20, dest, arg, 1); Write8(subreg);}
void XEmitter::PINSRD(X64Reg dest, OpArg arg, u8 subreg) {WriteSSE41Op(0x66, 0x3A22, dest, arg, 1); Write8(subreg);}

void XEmitter::PMADDWD(X64Reg dest, OpArg arg) {WriteSSEOp(0x66, 0xF5, dest, arg); }
void XEmitter::PSADBW(X64Reg dest, OpArg arg) {WriteSSEOp(0x66, 0xF6, dest, arg);}
Expand Down
8 changes: 7 additions & 1 deletion Common/x64Emitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -798,8 +798,14 @@ class XEmitter
void PCMPGTW(X64Reg dest, OpArg arg);
void PCMPGTD(X64Reg dest, OpArg arg);

void PEXTRW(X64Reg dest, OpArg arg, u8 subreg);
void PEXTRW(X64Reg dest, X64Reg arg, u8 subreg);
void PINSRW(X64Reg dest, OpArg arg, u8 subreg);
// SSE4 inserts and extracts.
void PEXTRB(OpArg dest, X64Reg arg, u8 subreg);
void PEXTRW(OpArg dest, X64Reg arg, u8 subreg);
void PEXTRD(OpArg dest, X64Reg arg, u8 subreg);
void PINSRB(X64Reg dest, OpArg arg, u8 subreg);
void PINSRD(X64Reg dest, OpArg arg, u8 subreg);

void PMADDWD(X64Reg dest, OpArg arg);
void PSADBW(X64Reg dest, OpArg arg);
Expand Down
1 change: 1 addition & 0 deletions Core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,7 @@ static ConfigSetting graphicsSettings[] = {
ConfigSetting("VendorBugChecksEnabled", &g_Config.bVendorBugChecksEnabled, true, false, false),
ReportedConfigSetting("RenderingMode", &g_Config.iRenderingMode, 1, true, true),
ConfigSetting("SoftwareRenderer", &g_Config.bSoftwareRendering, false, true, true),
ConfigSetting("SoftwareRendererJit", &g_Config.bSoftwareRenderingJit, true, true, true),
ReportedConfigSetting("HardwareTransform", &g_Config.bHardwareTransform, true, true, true),
ReportedConfigSetting("SoftwareSkinning", &g_Config.bSoftwareSkinning, true, true, true),
ReportedConfigSetting("TextureFiltering", &g_Config.iTexFiltering, 1, true, true),
Expand Down
1 change: 1 addition & 0 deletions Core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ struct Config {
std::string sMicDevice;

bool bSoftwareRendering;
bool bSoftwareRenderingJit;
bool bHardwareTransform; // only used in the GLES backend
bool bSoftwareSkinning; // may speed up some games
bool bVendorBugChecksEnabled;
Expand Down
1 change: 1 addition & 0 deletions GPU/GPU.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@
<ClCompile Include="Math3D.cpp" />
<ClCompile Include="Software\Clipper.cpp" />
<ClCompile Include="Software\DrawPixel.cpp" />
<ClCompile Include="Software\DrawPixelX86.cpp" />
<ClCompile Include="Software\Lighting.cpp" />
<ClCompile Include="Software\FuncId.cpp" />
<ClCompile Include="Software\Rasterizer.cpp" />
Expand Down
3 changes: 3 additions & 0 deletions GPU/GPU.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -542,5 +542,8 @@
<ClCompile Include="Software\DrawPixel.cpp">
<Filter>Software</Filter>
</ClCompile>
<ClCompile Include="Software\DrawPixelX86.cpp">
<Filter>Software</Filter>
</ClCompile>
</ItemGroup>
</Project>
Loading

0 comments on commit aa12c9b

Please sign in to comment.