diff --git a/CMakeTests/FindMiniupnpc.cmake b/CMakeTests/FindMiniupnpc.cmake index 8f919ca..bb1048c 100644 --- a/CMakeTests/FindMiniupnpc.cmake +++ b/CMakeTests/FindMiniupnpc.cmake @@ -128,7 +128,7 @@ IF (NOT MINIUPNPC_VERSION_1_7_OR_HIGHER) static struct IGDdatas data; int main() { - char externalIP[16] = ""; + char externalIP[16] = \"\"; UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIP); return 0; @@ -148,7 +148,7 @@ IF (NOT MINIUPNPC_VERSION_1_7_OR_HIGHER) static struct IGDdatas data; int main() { - char externalIP[16] = ""; + char externalIP[16] = \"\"; UPNP_GetExternalIPAddress(urls.controlURL, data.servicetype, externalIP); return 0; diff --git a/Source/Core/AudioCommon/AudioCommon.cpp b/Source/Core/AudioCommon/AudioCommon.cpp index a8229b3..b964b6b 100644 --- a/Source/Core/AudioCommon/AudioCommon.cpp +++ b/Source/Core/AudioCommon/AudioCommon.cpp @@ -134,7 +134,7 @@ namespace AudioCommon { return true; } - return SConfig::GetInstance().m_EnableJIT; + return SConfig::GetInstance().m_DSPEnableJIT; } void PauseAndLock(bool doLock, bool unpauseOnUnlock) diff --git a/Source/Core/Common/FPURoundMode.h b/Source/Core/Common/FPURoundMode.h index e7b4884..9cd9a0c 100644 --- a/Source/Core/Common/FPURoundMode.h +++ b/Source/Core/Common/FPURoundMode.h @@ -11,20 +11,20 @@ namespace FPURoundMode enum RoundModes { ROUND_NEAR = 0, - ROUND_CHOP, - ROUND_UP, - ROUND_DOWN + ROUND_CHOP = 1, + ROUND_UP = 2, + ROUND_DOWN = 3 }; enum PrecisionModes { PREC_24 = 0, - PREC_53, - PREC_64 + PREC_53 = 1, + PREC_64 = 2 }; - void SetRoundMode(u32 mode); + void SetRoundMode(enum RoundModes mode); - void SetPrecisionMode(u32 mode); + void SetPrecisionMode(enum PrecisionModes mode); - void SetSIMDMode(u32 roundingMode, u32 nonIEEEMode); + void SetSIMDMode(enum RoundModes rounding_mode, bool non_ieee_mode); /* * There are two different flavors of float to int conversion: diff --git a/Source/Core/Common/GenericFPURoundMode.cpp b/Source/Core/Common/GenericFPURoundMode.cpp index 548e029..0fb37ba 100644 --- a/Source/Core/Common/GenericFPURoundMode.cpp +++ b/Source/Core/Common/GenericFPURoundMode.cpp @@ -21,13 +21,13 @@ // Generic, do nothing namespace FPURoundMode { - void SetRoundMode(u32 mode) + void SetRoundMode(enum RoundModes mode) { } - void SetPrecisionMode(u32 mode) + void SetPrecisionMode(enum PrecisionModes mode) { } - void SetSIMDMode(u32 mode, u32 nonIEEEMode) + void SetSIMDMode(enum RoundModes rounding_mode, bool non_ieee_mode) { } void SaveSIMDState() diff --git a/Source/Core/Common/x64FPURoundMode.cpp b/Source/Core/Common/x64FPURoundMode.cpp index e7dd9db..b66c420 100644 --- a/Source/Core/Common/x64FPURoundMode.cpp +++ b/Source/Core/Common/x64FPURoundMode.cpp @@ -4,30 +4,21 @@ #include "Common/Common.h" #include "Common/CPUDetect.h" +#include "Common/FPURoundMode.h" -#ifndef _WIN32 -static const unsigned short FPU_ROUND_NEAR = 0 << 10; -static const unsigned short FPU_ROUND_DOWN = 1 << 10; -static const unsigned short FPU_ROUND_UP = 2 << 10; -static const unsigned short FPU_ROUND_CHOP = 3 << 10; -static const unsigned short FPU_ROUND_MASK = 3 << 10; -#include +#ifdef _WIN32 +# include +#else +# include #endif -// OR-mask for disabling FPU exceptions (bits 7-12 in the MXCSR register) -static const u32 EXCEPTION_MASK = 0x1F80; -// Denormals-Are-Zero (non-IEEE mode: denormal inputs are set to +/- 0) -static const u32 DAZ = 0x40; -// Flush-To-Zero (non-IEEE mode: denormal outputs are set to +/- 0) -static const u32 FTZ = 0x8000; - namespace FPURoundMode { // Get the default SSE states here. static u32 saved_sse_state = _mm_getcsr(); static const u32 default_sse_state = _mm_getcsr(); - void SetRoundMode(u32 mode) + void SetRoundMode(enum RoundModes mode) { // Set FPU rounding mode to mimic the PowerPC's #ifdef _M_IX86 @@ -42,22 +33,23 @@ namespace FPURoundMode }; _set_controlfp(_MCW_RC, table[mode]); #else - const unsigned short table[4] = + const unsigned short X87_ROUND_MASK = 3 << 10; + const unsigned short x87_rounding_table[] = { - FPU_ROUND_NEAR, - FPU_ROUND_CHOP, - FPU_ROUND_UP, - FPU_ROUND_DOWN + 0 << 10, // nearest + 3 << 10, // zero + 2 << 10, // +inf + 1 << 10, // -inf }; unsigned short _mode; - asm ("fstcw %0" : "=m" (_mode) : ); - _mode = (_mode & ~FPU_ROUND_MASK) | table[mode]; + asm ("fstcw %0" : "=m" (_mode)); + _mode = (_mode & ~X87_ROUND_MASK) | x87_rounding_table[mode]; asm ("fldcw %0" : : "m" (_mode)); #endif #endif } - void SetPrecisionMode(u32 mode) + void SetPrecisionMode(enum PrecisionModes mode) { #ifdef _M_IX86 // sets the floating-point lib to 53-bit @@ -66,15 +58,15 @@ namespace FPURoundMode #ifdef _WIN32 _control87(_PC_53, MCW_PC); #else - const unsigned short table[4] = { - 0 << 8, // FPU_PREC_24 - 2 << 8, // FPU_PREC_53 - 3 << 8, // FPU_PREC_64 - 3 << 8, // FPU_PREC_MASK + const unsigned short PRECISION_MASK = 3 << 8; + const unsigned short precision_table[] = { + 0 << 8, // 24 bits + 2 << 8, // 53 bits + 3 << 8, // 64 bits }; unsigned short _mode; asm ("fstcw %0" : "=m" (_mode)); - _mode = (_mode & ~table[3]) | table[mode]; + _mode = (_mode & ~PRECISION_MASK) | precision_table[mode]; asm ("fldcw %0" : : "m" (_mode)); #endif #else @@ -83,24 +75,32 @@ namespace FPURoundMode #endif } - void SetSIMDMode(u32 roundingMode, u32 nonIEEEMode) + void SetSIMDMode(enum RoundModes rounding_mode, bool non_ieee_mode) { + // OR-mask for disabling FPU exceptions (bits 7-12 in the MXCSR register) + const u32 EXCEPTION_MASK = 0x1F80; + // Denormals-Are-Zero (non-IEEE mode: denormal inputs are set to +/- 0) + const u32 DAZ = 0x40; + // Flush-To-Zero (non-IEEE mode: denormal outputs are set to +/- 0) + const u32 FTZ = 0x8000; // lookup table for FPSCR.RN-to-MXCSR.RC translation - static const u32 roundingModeLUT[4] = + static const u32 simd_rounding_table[] = { (0 << 13) | EXCEPTION_MASK, // nearest (3 << 13) | EXCEPTION_MASK, // -inf (2 << 13) | EXCEPTION_MASK, // +inf (1 << 13) | EXCEPTION_MASK, // zero }; - u32 csr = roundingModeLUT[roundingMode]; + u32 csr = simd_rounding_table[rounding_mode]; + // Some initial steppings of Pentium 4 CPUs support FTZ but not DAZ. + // They will not flush input operands but flushing outputs only is better than nothing. static const u32 denormalLUT[2] = { FTZ, // flush-to-zero only FTZ | DAZ, // flush-to-zero and denormals-are-zero (may not be supported) }; - if (nonIEEEMode) + if (non_ieee_mode) { csr |= denormalLUT[cpu_info.bFlushToZero]; } diff --git a/Source/Core/Core/ARDecrypt.cpp b/Source/Core/Core/ARDecrypt.cpp index 8a9c4c6..cac721a 100644 --- a/Source/Core/Core/ARDecrypt.cpp +++ b/Source/Core/Core/ARDecrypt.cpp @@ -22,11 +22,6 @@ const char *filter = "0123456789ABCDEFGHJKMNPQRTUVWXYZILOS"; u32 genseeds[0x20]; - -const u8 bitstringlen[0x08] = { - 0x06, 0x0A, 0x0C, 0x11, 0x11, 0x08, 0x07, 0x20, -}; - const u8 gentable0[0x38] = { 0x39, 0x31, 0x29, 0x21, 0x19, 0x11, 0x09, 0x01, 0x3A, 0x32, 0x2A, 0x22, 0x1A, 0x12, 0x0A, 0x02, diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp index 35f311b..2417df8 100644 --- a/Source/Core/Core/BootManager.cpp +++ b/Source/Core/Core/BootManager.cpp @@ -109,7 +109,7 @@ bool BootCore(const std::string& _rFilename) config_cache.bDSPHLE = StartUp.bDSPHLE; config_cache.strBackend = StartUp.m_strVideoBackend; config_cache.bHLE_BS2 = StartUp.bHLE_BS2; - config_cache.m_EnableJIT = SConfig::GetInstance().m_EnableJIT; + config_cache.m_EnableJIT = SConfig::GetInstance().m_DSPEnableJIT; config_cache.bDSPThread = StartUp.bDSPThread; config_cache.Volume = SConfig::GetInstance().m_Volume; config_cache.sBackend = SConfig::GetInstance().sBackend; @@ -158,7 +158,7 @@ bool BootCore(const std::string& _rFilename) } if (game_ini.Get("DSP", "Volume", &SConfig::GetInstance().m_Volume, SConfig::GetInstance().m_Volume)) config_cache.bSetVolume = true; - game_ini.Get("DSP", "EnableJIT", &SConfig::GetInstance().m_EnableJIT, SConfig::GetInstance().m_EnableJIT); + game_ini.Get("DSP", "EnableJIT", &SConfig::GetInstance().m_DSPEnableJIT, SConfig::GetInstance().m_DSPEnableJIT); game_ini.Get("DSP", "Backend", &SConfig::GetInstance().sBackend, SConfig::GetInstance().sBackend); VideoBackend::ActivateBackend(StartUp.m_strVideoBackend); @@ -223,7 +223,7 @@ bool BootCore(const std::string& _rFilename) StartUp.bDSPHLE = g_NetPlaySettings.m_DSPHLE; StartUp.bEnableMemcardSaving = g_NetPlaySettings.m_WriteToMemcard; StartUp.iCPUCore = g_NetPlaySettings.m_CPUcore; - SConfig::GetInstance().m_EnableJIT = g_NetPlaySettings.m_DSPEnableJIT; + SConfig::GetInstance().m_DSPEnableJIT = g_NetPlaySettings.m_DSPEnableJIT; SConfig::GetInstance().m_EXIDevice[0] = g_NetPlaySettings.m_EXIDevice[0]; SConfig::GetInstance().m_EXIDevice[1] = g_NetPlaySettings.m_EXIDevice[1]; config_cache.bSetEXIDevice[0] = true; @@ -268,7 +268,7 @@ void Stop() VideoBackend::ActivateBackend(StartUp.m_strVideoBackend); StartUp.bHLE_BS2 = config_cache.bHLE_BS2; SConfig::GetInstance().sBackend = config_cache.sBackend; - SConfig::GetInstance().m_EnableJIT = config_cache.m_EnableJIT; + SConfig::GetInstance().m_DSPEnableJIT = config_cache.m_EnableJIT; // Only change these back if they were actually set by game ini, since they can be changed while a game is running. if (config_cache.bSetFramelimit) diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index 7e2d333..8a58f1d 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -267,7 +267,7 @@ void SConfig::SaveSettings() ini.Set("Movie", "Author", m_strMovieAuthor); // DSP - ini.Set("DSP", "EnableJIT", m_EnableJIT); + ini.Set("DSP", "EnableJIT", m_DSPEnableJIT); ini.Set("DSP", "DumpAudio", m_DumpAudio); ini.Set("DSP", "Backend", sBackend); ini.Set("DSP", "Volume", m_Volume); @@ -430,7 +430,7 @@ void SConfig::LoadSettings() ini.Get("Movie", "Author", &m_strMovieAuthor, ""); // DSP - ini.Get("DSP", "EnableJIT", &m_EnableJIT, true); + ini.Get("DSP", "EnableJIT", &m_DSPEnableJIT, true); ini.Get("DSP", "DumpAudio", &m_DumpAudio, false); #if defined __linux__ && HAVE_ALSA ini.Get("DSP", "Backend", &sBackend, BACKEND_ALSA); diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index 53bf2f5..49d5c17 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -79,7 +79,7 @@ struct SConfig : NonCopyable unsigned int m_FrameSkip; // DSP settings - bool m_EnableJIT; + bool m_DSPEnableJIT; bool m_DumpAudio; int m_Volume; std::string sBackend; diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp index bd503ba..40bd333 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp @@ -296,7 +296,7 @@ restart: { PB.ReachedEnd = 0; - if ((PB.RepeatMode == 0) || (!PB.StopOnSilence == 0)) + if ((PB.RepeatMode == 0) || (PB.StopOnSilence != 0)) { PB.KeyOff = 1; PB.RemLength = 0; diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.cpp b/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.cpp index cb7faaf..7bfa2d9 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.cpp @@ -10,8 +10,8 @@ namespace WiimoteEmu // Extension device IDs to be written to the last bytes of the extension reg // The id for nothing inserted static const u8 nothing_id[] = { 0x00, 0x00, 0x00, 0x00, 0x2e, 0x2e }; -// The id for a partially inserted extension -static const u8 partially_id[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff }; +// The id for a partially inserted extension (currently unused) +//static const u8 partially_id[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff }; Attachment::Attachment( const char* const _name, WiimoteEmu::ExtensionReg& _reg ) : name( _name ), reg( _reg ) diff --git a/Source/Core/Core/PowerPC/Gekko.h b/Source/Core/Core/PowerPC/Gekko.h index e14a10b..0d3b87e 100644 --- a/Source/Core/Core/PowerPC/Gekko.h +++ b/Source/Core/Core/PowerPC/Gekko.h @@ -8,7 +8,7 @@ #pragma once #include "Common/Common.h" - +#include "Common/FPURoundMode.h" // --- Gekko Instruction --- @@ -390,7 +390,7 @@ union UReg_FPSCR struct { // Rounding mode (towards: nearest, zero, +inf, -inf) - u32 RN : 2; + enum FPURoundMode::RoundModes RN : 2; // Non-IEEE mode enable (aka flush-to-zero) u32 NI : 1; // Inexact exception enable diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp index 389c29c..03cd753 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp @@ -10,7 +10,6 @@ static const u64 GC_ALIGNED16(psSignBits2[2]) = {0x8000000000000000ULL, 0x8000000000000000ULL}; static const u64 GC_ALIGNED16(psAbsMask2[2]) = {0x7FFFFFFFFFFFFFFFULL, 0x7FFFFFFFFFFFFFFFULL}; -static const double GC_ALIGNED16(psOneOne2[2]) = {1.0, 1.0}; static const double one_const = 1.0f; void Jit64::fp_tri_op(int d, int a, int b, bool reversible, bool single, void (XEmitter::*op)(Gen::X64Reg, Gen::OpArg)) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp index dac3b9a..6d8879a 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp @@ -16,10 +16,8 @@ namespace { // pshufb todo: MOVQ const u8 GC_ALIGNED16(bswapShuffle1x4[16]) = {3, 2, 1, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; -const u8 GC_ALIGNED16(bswapShuffle2x4[16]) = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11, 12, 13, 14, 15}; const u8 GC_ALIGNED16(bswapShuffle1x8[16]) = {7, 6, 5, 4, 3, 2, 1, 0, 8, 9, 10, 11, 12, 13, 14, 15}; const u8 GC_ALIGNED16(bswapShuffle1x8Dupe[16]) = {7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0}; -const u8 GC_ALIGNED16(bswapShuffle2x8[16]) = {7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8}; u64 GC_ALIGNED16(temp64); diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp index d2557d3..14c5c61 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp @@ -12,8 +12,6 @@ #include "Core/PowerPC/Jit64/JitAsm.h" #include "Core/PowerPC/Jit64/JitRegCache.h" -const u8 GC_ALIGNED16(pbswapShuffle2x4[16]) = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11, 12, 13, 14, 15}; - // The big problem is likely instructions that set the quantizers in the same block. // We will have to break block after quantizers are written to. void Jit64::psq_st(UGeckoInstruction inst) diff --git a/Source/Core/DiscIO/WbfsBlob.cpp b/Source/Core/DiscIO/WbfsBlob.cpp index b51c14a..4e77d9e 100644 --- a/Source/Core/DiscIO/WbfsBlob.cpp +++ b/Source/Core/DiscIO/WbfsBlob.cpp @@ -14,10 +14,9 @@ namespace DiscIO { -const u64 wii_sector_size = 0x8000; -const u64 wii_sector_count = 143432 * 2; -const u64 wii_sector_log2 = 15; -const u64 wii_disc_header_size = 256; +static const u64 wii_sector_size = 0x8000; +static const u64 wii_sector_count = 143432 * 2; +static const u64 wii_disc_header_size = 256; static inline u64 align(u64 value, u64 bounds) { diff --git a/Source/Core/DolphinWX/ConfigMain.cpp b/Source/Core/DolphinWX/ConfigMain.cpp index 716a47b..04c740c 100644 --- a/Source/Core/DolphinWX/ConfigMain.cpp +++ b/Source/Core/DolphinWX/ConfigMain.cpp @@ -368,7 +368,7 @@ void CConfigMain::InitializeGUIValues() if (startup_params.bDSPHLE) DSPEngine->SetSelection(0); else - DSPEngine->SetSelection(SConfig::GetInstance().m_EnableJIT ? 1 : 2); + DSPEngine->SetSelection(SConfig::GetInstance().m_DSPEnableJIT ? 1 : 2); // Audio VolumeSlider->Enable(SupportsVolumeChanges(SConfig::GetInstance().sBackend)); @@ -957,8 +957,7 @@ void CConfigMain::AudioSettingsChanged(wxCommandEvent& event) { case ID_DSPENGINE: SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE = DSPEngine->GetSelection() == 0; - if (!DSPEngine->GetSelection() == 0) - SConfig::GetInstance().m_EnableJIT = DSPEngine->GetSelection() == 1; + SConfig::GetInstance().m_DSPEnableJIT = DSPEngine->GetSelection() == 1; AudioCommon::UpdateSoundStream(); break; diff --git a/Source/Core/DolphinWX/NetWindow.cpp b/Source/Core/DolphinWX/NetWindow.cpp index 82f0dd4..72aa86f 100644 --- a/Source/Core/DolphinWX/NetWindow.cpp +++ b/Source/Core/DolphinWX/NetWindow.cpp @@ -442,7 +442,7 @@ void NetPlayDiag::GetNetSettings(NetSettings &settings) settings.m_CPUthread = instance.m_LocalCoreStartupParameter.bCPUThread; settings.m_CPUcore = instance.m_LocalCoreStartupParameter.iCPUCore; settings.m_DSPHLE = instance.m_LocalCoreStartupParameter.bDSPHLE; - settings.m_DSPEnableJIT = instance.m_EnableJIT; + settings.m_DSPEnableJIT = instance.m_DSPEnableJIT; settings.m_WriteToMemcard = m_memcard_write->GetValue(); settings.m_EXIDevice[0] = instance.m_EXIDevice[0]; settings.m_EXIDevice[1] = instance.m_EXIDevice[1]; diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp index a3bcd3a..1149392 100644 --- a/Source/Core/VideoCommon/BPFunctions.cpp +++ b/Source/Core/VideoCommon/BPFunctions.cpp @@ -14,7 +14,6 @@ #include "VideoCommon/VertexShaderManager.h" #include "VideoCommon/VideoConfig.h" -const bool renderFog = false; namespace BPFunctions { // ---------------------------------------------- diff --git a/Source/Core/VideoCommon/TextureDecoder_x64.cpp b/Source/Core/VideoCommon/TextureDecoder_x64.cpp index d00a9bb..875ba8f 100644 --- a/Source/Core/VideoCommon/TextureDecoder_x64.cpp +++ b/Source/Core/VideoCommon/TextureDecoder_x64.cpp @@ -177,13 +177,6 @@ int TexDecoder_GetPaletteSize(int format) } } -static inline u32 decodeIA8(u16 val) -{ - int a = val >> 8; - int i = val & 0xFF; - return (a << 24) | (i << 16) | (i << 8) | i; -} - static inline u32 decode5A3(u16 val) { int r,g,b,a; diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp index a9bdb46..29abdb2 100644 --- a/Source/Core/VideoCommon/VertexLoader.cpp +++ b/Source/Core/VideoCommon/VertexLoader.cpp @@ -28,11 +28,6 @@ //BBox #include "VideoCommon/XFMemory.h" -#ifndef _M_GENERIC -#ifndef __APPLE__ -#define USE_JIT -#endif -#endif #define COMPILED_CODE_SIZE 4096 @@ -472,7 +467,6 @@ VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr) m_compiledCode = NULL; m_numLoadedVertices = 0; m_VertexSize = 0; - m_numPipelineStages = 0; m_NativeFmt = 0; loop_counter = 0; VertexLoader_Normal::Init(); @@ -482,11 +476,12 @@ VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr) m_VtxDesc = vtx_desc; SetVAT(vtx_attr.g0.Hex, vtx_attr.g1.Hex, vtx_attr.g2.Hex); - #ifdef USE_JIT + #ifdef USE_VERTEX_LOADER_JIT AllocCodeSpace(COMPILED_CODE_SIZE); CompileVertexTranslator(); WriteProtect(); #else + m_numPipelineStages = 0; CompileVertexTranslator(); #endif @@ -494,7 +489,7 @@ VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr) VertexLoader::~VertexLoader() { - #ifdef USE_JIT + #ifdef USE_VERTEX_LOADER_JIT FreeCodeSpace(); #endif delete m_NativeFmt; @@ -505,7 +500,7 @@ void VertexLoader::CompileVertexTranslator() m_VertexSize = 0; const TVtxAttr &vtx_attr = m_VtxAttr; -#ifdef USE_JIT +#ifdef USE_VERTEX_LOADER_JIT if (m_compiledCode) PanicAlert("Trying to recompile a vertex translator"); @@ -531,6 +526,9 @@ void VertexLoader::CompileVertexTranslator() WriteSetVariable(32, &s_texmtxwrite, Imm32(0)); WriteSetVariable(32, &s_texmtxread, Imm32(0)); } +#else + // Reset pipeline + m_numPipelineStages = 0; #endif // Colors @@ -544,8 +542,6 @@ void VertexLoader::CompileVertexTranslator() m_VtxDesc.Tex4Coord, m_VtxDesc.Tex5Coord, m_VtxDesc.Tex6Coord, (const u32)((m_VtxDesc.Hex >> 31) & 3) }; - // Reset pipeline - m_numPipelineStages = 0; u32 components = 0; // Position in pc vertex format. @@ -770,7 +766,7 @@ void VertexLoader::CompileVertexTranslator() native_stride = nat_offset; vtx_decl.stride = native_stride; -#ifdef USE_JIT +#ifdef USE_VERTEX_LOADER_JIT // End loop here #ifdef _M_X64 MOV(64, R(RAX), Imm64((u64)&loop_counter)); @@ -790,7 +786,7 @@ void VertexLoader::CompileVertexTranslator() void VertexLoader::WriteCall(TPipelineFunction func) { -#ifdef USE_JIT +#ifdef USE_VERTEX_LOADER_JIT #ifdef _M_X64 MOV(64, R(RAX), Imm64((u64)func)); CALLptr(R(RAX)); @@ -805,7 +801,7 @@ void VertexLoader::WriteCall(TPipelineFunction func) #ifndef _M_GENERIC void VertexLoader::WriteGetVariable(int bits, OpArg dest, void *address) { -#ifdef USE_JIT +#ifdef USE_VERTEX_LOADER_JIT #ifdef _M_X64 MOV(64, R(RAX), Imm64((u64)address)); MOV(bits, dest, MatR(RAX)); @@ -817,7 +813,7 @@ void VertexLoader::WriteGetVariable(int bits, OpArg dest, void *address) void VertexLoader::WriteSetVariable(int bits, void *address, OpArg value) { -#ifdef USE_JIT +#ifdef USE_VERTEX_LOADER_JIT #ifdef _M_X64 MOV(64, R(RAX), Imm64((u64)address)); MOV(bits, MatR(RAX), value); @@ -870,7 +866,7 @@ void VertexLoader::SetupRunVertices(int vtx_attr_group, int primitive, int const void VertexLoader::ConvertVertices ( int count ) { -#ifdef USE_JIT +#ifdef USE_VERTEX_LOADER_JIT if (count > 0) { loop_counter = count; diff --git a/Source/Core/VideoCommon/VertexLoader.h b/Source/Core/VideoCommon/VertexLoader.h index 6b720b5..01c4bb0 100644 --- a/Source/Core/VideoCommon/VertexLoader.h +++ b/Source/Core/VideoCommon/VertexLoader.h @@ -17,6 +17,11 @@ #include "VideoCommon/DataReader.h" #include "VideoCommon/NativeVertexFormat.h" +#ifndef _M_GENERIC +#ifndef __APPLE__ +#define USE_VERTEX_LOADER_JIT +#endif +#endif class VertexLoaderUID { @@ -119,9 +124,11 @@ private: NativeVertexFormat *m_NativeFmt; int native_stride; - // Pipeline. To be JIT compiled in the future. +#ifndef USE_VERTEX_LOADER_JIT + // Pipeline. TPipelineFunction m_PipelineStages[64]; // TODO - figure out real max. it's lower. int m_numPipelineStages; +#endif const u8 *m_compiledCode;