Skip to content

Commit

Permalink
Big nasty wip push
Browse files Browse the repository at this point in the history
  • Loading branch information
galop1n committed Jul 29, 2014
1 parent 1d17239 commit 8128018
Show file tree
Hide file tree
Showing 71 changed files with 3,233 additions and 1,521 deletions.
101 changes: 101 additions & 0 deletions Source/Core/Common/Hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,104 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples);
u64 GetMurmurHash3(const u8 *src, int len, u32 samples);
u64 GetHash64(const u8 *src, int len, u32 samples);
void SetHash64Function(bool useHiresTextures);

#if _M_SSE >= 0x402

template <size_t Sz>
inline u32 GetCRC32_SmallSize(u64 cur, u8 const * b);

template <> inline u32 GetCRC32_SmallSize<0>(u64 cur, u8 const *) { return u32(cur); }

template <> inline u32 GetCRC32_SmallSize<1>(u64 cur, u8 const *b) {
u32 tmp = u32(cur);
tmp = _mm_crc32_u8(tmp, *(u8 const *)(b+0));
return tmp;
}

template <> inline u32 GetCRC32_SmallSize<2>(u64 cur, u8 const *b) {
u32 tmp = u32(cur);
tmp = _mm_crc32_u16(tmp, *(u16 const *)(b+0));
return tmp;
}

template <> inline u32 GetCRC32_SmallSize<3>(u64 cur, u8 const *b) {
u32 tmp = u32(cur);
tmp = _mm_crc32_u16(tmp, *(u16 const *)(b+0));
tmp = _mm_crc32_u8(tmp, *(u8 const *)(b+2));
return tmp;
}

template <> inline u32 GetCRC32_SmallSize<4>(u64 cur, u8 const *b) {
u32 tmp = u32(cur);
tmp = _mm_crc32_u32(tmp, *(u32 const *)(b+0));
return tmp;
}

template <> inline u32 GetCRC32_SmallSize<5>(u64 cur, u8 const *b) {
u32 tmp = u32(cur);
tmp = _mm_crc32_u32(tmp, *(u32 const *)(b+0));
tmp = _mm_crc32_u8(tmp, *(u8 const *)(b+4));
return tmp;
}

template <> inline u32 GetCRC32_SmallSize<6>(u64 cur, u8 const *b) {
u32 tmp = u32(cur);
tmp = _mm_crc32_u32(tmp, *(u32 const *)(b+0));
tmp = _mm_crc32_u16(tmp, *(u16 const *)(b+4));
return tmp;
}

template <> inline u32 GetCRC32_SmallSize<7>(u64 cur, u8 const *b) {
u32 tmp = u32(cur);
tmp = _mm_crc32_u32(tmp, *(u32 const *)(b+0));
tmp = _mm_crc32_u16(tmp, *(u16 const *)(b+4));
tmp = _mm_crc32_u8(tmp, *(u8 const *)(b+6));
return tmp;
}

template <> inline u32 GetCRC32_SmallSize<8>(u64 cur, u8 const *b) {
return u32(_mm_crc32_u64(cur, *(u64*)b));
}

template <size_t Sz>
inline u32 GetCRC32_SmallSize(u64 cur, u8 const * b) {
return GetCRC32_SmallSize<Sz-8>( _mm_crc32_u64(cur, *(u64*)b),b+8);
}

template <typename T>
u32 GetCRC32_CT(T const & st) {
return GetCRC32_SmallSize<sizeof(st)>(sizeof(st), (u8 const*)&st);
#if 0
u32 sz { sizeof(st) };
u8 const * ptr{(u8 const *)&st};

u64 crc{sz};

while( sz >= 8 ) {
crc = _mm_crc32_u64(crc, *(u64*)ptr);
ptr += 8;
sz -= 8;
}
u32 crc32 = u32(crc);
if( sz >= 4 ) {
crc32 = _mm_crc32_u32(crc32, *(u32*)ptr);
ptr += 4;
sz -= 4;
}
if( sz >= 2 ) {
crc32 = _mm_crc32_u16(crc32, *(u16*)ptr);
ptr += 2;
sz -= 2;
}
if( sz ) {
crc32 = _mm_crc32_u8(crc32, *(u8*)ptr);
}

return crc32;
#endif
}
#else
u64 GetCRC32_CT(const u8 *src, int len) {
return GetHash64(src,len, 0);
}
#endif
2 changes: 1 addition & 1 deletion Source/Core/Common/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type,
if (!(_a_)) {\
ERROR_LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
__LINE__, __FILE__, __TIME__); \
if (!PanicYesNo("*** Assertion (see log)***\n")) {Crash();} \
if (!PanicYesNo("Assertion (see log) : \n" #_a_ "\n")) {Crash();} \
}
#define _dbg_assert_msg_(_t_, _a_, ...)\
if (!(_a_)) {\
Expand Down
6 changes: 6 additions & 0 deletions Source/Core/Common/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@
#include <process.h>
#endif

bool g_skipYield{true};
namespace Common
{
void YieldCPU()
{
if (!g_skipYield)
std::this_thread::yield();
}

int CurrentThreadId()
{
Expand Down
5 changes: 1 addition & 4 deletions Source/Core/Common/Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ void SwitchCurrentThread(); // On Linux, this is equal to sleep 1ms
// Use this function during a spin-wait to make the current thread
// relax while another thread is working. This may be more efficient
// than using events because event functions use kernel calls.
inline void YieldCPU()
{
std::this_thread::yield();
}
void YieldCPU();

void SetCurrentThreadName(const char *name);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,14 @@ void Interpreter::fnegx(UGeckoInstruction _inst)

void Interpreter::fselx(UGeckoInstruction _inst)
{
//double a, b, c,d;
//a = rPS0(_inst.FA);
//b = rPS0(_inst.FB);
//c = rPS0(_inst.FC);
rPS0(_inst.FD) = (rPS0(_inst.FA) >= -0.0) ? rPS0(_inst.FC) : rPS0(_inst.FB);
//d = rPS0(_inst.FD);
//NOTICE_LOG(VIDEO,"%lf = fsel(%lf %lf %lf)",d,a,b,c );

// This is a binary instruction. Does not alter FPSCR
if (_inst.Rc) Helper_UpdateCR1();
}
Expand Down
11 changes: 8 additions & 3 deletions Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ void Jit64::fsign(UGeckoInstruction inst)

void Jit64::fselx(UGeckoInstruction inst)
{
FallBackToInterpreter(inst);
return;

INSTRUCTION_START
JITDISABLE(bJITFloatingPointOff)

Expand All @@ -215,12 +218,14 @@ void Jit64::fselx(UGeckoInstruction inst)

fpr.Lock(a, b, c, d);
MOVSD(XMM0, fpr.R(a));
PXOR(XMM0, M((void*)&psSignBits2));

PXOR(XMM1, R(XMM1));
// XMM0 = XMM0 < 0 ? all 1s : all 0s
CMPSD(XMM0, R(XMM1), LT);
CMPSD(XMM0, R(XMM1), NLT);
MOVSD(XMM1, R(XMM0));
PAND(XMM0, fpr.R(b));
PANDN(XMM1, fpr.R(c));
PAND(XMM0, fpr.R(c));
PANDN(XMM1, fpr.R(b));
POR(XMM0, R(XMM1));
fpr.BindToRegister(d, false);
MOVSD(fpr.RX(d), R(XMM0));
Expand Down
6 changes: 5 additions & 1 deletion Source/Core/DolphinWX/DolphinWX.vcxproj.user
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--For some stupid reason this has to be in the .user file...-->
<LocalDebuggerCommand>$(BinaryOutputDir)$(TargetFileName)</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>$(BinaryOutputDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion Source/Core/DolphinWX/Frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
{
OSDChoice = 1;
// Toggle native resolution
if (++g_Config.iEFBScale > SCALE_4X)
if (++g_Config.iEFBScale > SCALE_7X)
g_Config.iEFBScale = SCALE_AUTO;
}
else if (IsHotkey(event, HK_TOGGLE_AR))
Expand Down
14 changes: 12 additions & 2 deletions Source/Core/DolphinWX/VideoConfigDiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,13 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
{
const wxString efbscale_choices[] = { _("Auto (Window Size)"), _("Auto (Multiple of 640x528)"),
_("1x Native (640x528)"), _("1.5x Native (960x792)"), _("2x Native (1280x1056)"),
_("2.5x Native (1600x1320)"), _("3x Native (1920x1584)"), _("4x Native (2560x2112)") };
_("2.5x Native (1600x1320)"), _("3x Native (1920x1584)"), _("4x Native (2560x2112)"),
_("5x Native (2560x2112)"),
_("6x Native (2560x2112)"),
_("7x Native (2560x2112)"),


};

wxChoice *const choice_efbscale = CreateChoice(page_enh,
vconfig.iEFBScale, wxGetTranslation(internal_res_desc), sizeof(efbscale_choices)/sizeof(*efbscale_choices), efbscale_choices);
Expand Down Expand Up @@ -514,7 +520,11 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
wxGridSizer* const szr_other = new wxGridSizer(2, 5, 5);
szr_other->Add(CreateCheckBox(page_hacks, _("Disable Destination Alpha"), wxGetTranslation(disable_dstalpha_desc), vconfig.bDstAlphaPass));
szr_other->Add(CreateCheckBox(page_hacks, _("OpenMP Texture Decoder"), wxGetTranslation(omp_desc), vconfig.bOMPDecoder));
szr_other->Add(CreateCheckBox(page_hacks, _("Fast Depth Calculation"), wxGetTranslation(fast_depth_calc_desc), vconfig.bFastDepthCalc));

if (vconfig.backend_info.APIType != API_D3D)
{
szr_other->Add(CreateCheckBox(page_hacks, _("Fast Depth Calculation"), wxGetTranslation(fast_depth_calc_desc), vconfig.bFastDepthCalc));
}

wxStaticBoxSizer* const group_other = new wxStaticBoxSizer(wxVERTICAL, page_hacks, _("Other"));
group_other->Add(szr_other, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/VideoBackends/D3D/D3D.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<ClCompile Include="NativeVertexFormat.cpp" />
<ClCompile Include="PerfQuery.cpp" />
<ClCompile Include="PixelShaderCache.cpp" />
<ClCompile Include="PSTextureDecoder.cpp" />
<ClCompile Include="PSTextureEncoder.cpp" />
<ClCompile Include="Render.cpp" />
<ClCompile Include="stdafx.cpp">
Expand All @@ -81,6 +82,7 @@
<ClInclude Include="main.h" />
<ClInclude Include="PerfQuery.h" />
<ClInclude Include="PixelShaderCache.h" />
<ClInclude Include="PSTextureDecoder.h" />
<ClInclude Include="PSTextureEncoder.h" />
<ClInclude Include="Render.h" />
<ClInclude Include="stdafx.h" />
Expand Down
6 changes: 6 additions & 0 deletions Source/Core/VideoBackends/D3D/D3D.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
<ClCompile Include="LineAndPointGeometryShader.cpp">
<Filter>Render</Filter>
</ClCompile>
<ClCompile Include="PSTextureDecoder.cpp">
<Filter>Render</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="D3DBase.h">
Expand Down Expand Up @@ -131,5 +134,8 @@
<ClInclude Include="LineAndPointGeometryShader.h">
<Filter>Render</Filter>
</ClInclude>
<ClInclude Include="PSTextureDecoder.h">
<Filter>Render</Filter>
</ClInclude>
</ItemGroup>
</Project>
Loading

0 comments on commit 8128018

Please sign in to comment.