static-ified a lot of vars to prevent name collisions with plugins, other cosmetic stuff, prep for jit debug

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@147 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-08-07 21:29:15 +00:00
parent ac366022f4
commit b370386983
26 changed files with 212 additions and 157 deletions

View File

@ -5,13 +5,9 @@
#include "../HW/Memmap.h" #include "../HW/Memmap.h"
#include "ElfReader.h" #include "ElfReader.h"
//#include "../PSP/HLE/sceKernelMemory.h"
void bswap(Elf32_Word &w) {w = Common::swap32(w);} void bswap(Elf32_Word &w) {w = Common::swap32(w);}
void bswap(Elf32_Half &w) {w = Common::swap16(w);} void bswap(Elf32_Half &w) {w = Common::swap16(w);}
void byteswapHeader(Elf32_Ehdr &ELF_H) void byteswapHeader(Elf32_Ehdr &ELF_H)
{ {
bswap(ELF_H.e_type); bswap(ELF_H.e_type);

View File

@ -29,11 +29,12 @@
#include "PowerPC/Jit64/JitCache.h" #include "PowerPC/Jit64/JitCache.h"
#include "PowerPCDisasm.h" #include "PowerPCDisasm.h"
#define CASE(x) else if (memcmp(cmd, x,4*sizeof(TCHAR))==0) #define CASE(x) else if (memcmp(cmd, x, 4*sizeof(TCHAR))==0)
#define CASE1(x) if (memcmp(cmd, x,2*sizeof(TCHAR))==0) #define CASE1(x) if (memcmp(cmd, x, 2*sizeof(TCHAR))==0)
Common::Thread *cons_thread;
/* /*
static Common::Thread *cons_thread;
THREAD_RETURN ConsoleThreadFunc(void *) { THREAD_RETURN ConsoleThreadFunc(void *) {
printf("Welcome to the console thread!\n\n"); printf("Welcome to the console thread!\n\n");
while (true) { while (true) {

View File

@ -27,7 +27,7 @@
namespace Debugger namespace Debugger
{ {
XVectorSymbol m_VectorSymbols; static XVectorSymbol m_VectorSymbols;
CSymbol::CSymbol(u32 _Address, u32 _Size, ESymbolType _Type, const char *_rName) : CSymbol::CSymbol(u32 _Address, u32 _Size, ESymbolType _Type, const char *_rName) :
vaddress(_Address), vaddress(_Address),

View File

@ -45,7 +45,7 @@ struct SPatch
int returnType; int returnType;
}; };
SPatch OSPatches[] = static const SPatch OSPatches[] =
{ {
{ "FAKE_TO_SKIP_0", HLE_Misc::UnimplementedFunction }, { "FAKE_TO_SKIP_0", HLE_Misc::UnimplementedFunction },
@ -69,7 +69,7 @@ SPatch OSPatches[] =
// { "GXPeekARGB", HLE_Misc::GXPeekARGB}, // { "GXPeekARGB", HLE_Misc::GXPeekARGB},
}; };
SPatch OSBreakPoints[] = static const SPatch OSBreakPoints[] =
{ {
{ "FAKE_TO_SKIP_0", HLE_Misc::UnimplementedFunction }, { "FAKE_TO_SKIP_0", HLE_Misc::UnimplementedFunction },
}; };

View File

@ -28,9 +28,9 @@
using namespace PowerPC; using namespace PowerPC;
namespace { namespace {
bool g_Branch; static bool g_Branch;
Common::Event m_StepEvent; static Common::Event m_StepEvent;
Common::Event *m_SyncEvent; static Common::Event *m_SyncEvent;
} }
void CCPU::Init() void CCPU::Init()

View File

@ -264,9 +264,9 @@ namespace Jit64
// windoze goes to 8010feb0 // windoze goes to 8010feb0
// after they they are completely out of sync. // after they they are completely out of sync.
// branches from the cmp result of r0, which comes from an lbz (loaded from stack) // branches from the cmp result of r0, which comes from an lbz (loaded from stack)
bool ImHereDebug = false; static const bool ImHereDebug = false;
bool ImHereLog = false; static const bool ImHereLog = false;
std::map<u32, int> been_here; static std::map<u32, int> been_here;
void ImHere() void ImHere()
{ {
static FILE *f = 0; static FILE *f = 0;

View File

@ -45,17 +45,17 @@ const u8 *dispatcherNoCheck;
const u8 *dispatcherPcInEAX; const u8 *dispatcherPcInEAX;
const u8 *computeRc; const u8 *computeRc;
bool blockMode = false; //doesn't work as true! static bool blockMode = false; //doesn't work as true!
bool compareEnabled = false; bool compareEnabled = false;
//TODO - make an option //TODO - make an option
//#if _DEBUG //#if _DEBUG
bool enableDebug = false; static bool enableDebug = false;
//#else //#else
// bool enableDebug = false; // bool enableDebug = false;
//#endif //#endif
bool enableStatistics = false; static bool enableStatistics = false;
//GLOBAL STATIC ALLOCATIONS x86 //GLOBAL STATIC ALLOCATIONS x86
//EAX - ubiquitous scratch register - EVERYBODY scratches this //EAX - ubiquitous scratch register - EVERYBODY scratches this

View File

@ -39,9 +39,9 @@ using namespace Gen;
namespace Jit64 namespace Jit64
{ {
u8 *codeCache; static u8 *codeCache;
u8 *genFunctions; static u8 *genFunctions;
u8 *trampolineCache; static u8 *trampolineCache;
u8 *trampolineCodePtr; u8 *trampolineCodePtr;
#define INVALID_EXIT 0xFFFFFFFF #define INVALID_EXIT 0xFFFFFFFF
void LinkBlockExits(int i); void LinkBlockExits(int i);
@ -55,15 +55,14 @@ namespace Jit64
MAX_NUM_BLOCKS = 65536, MAX_NUM_BLOCKS = 65536,
}; };
u8 **blockCodePointers; // cut these in half and force below 2GB? static u8 **blockCodePointers; // cut these in half and force below 2GB?
std::multimap<u32, int> links_to; static std::multimap<u32, int> links_to;
JitBlock *blocks;
int numBlocks;
static JitBlock *blocks;
static int numBlocks;
//stats //stats
int numFlushes; static int numFlushes;
void PrintStats() void PrintStats()
{ {

View File

@ -27,10 +27,8 @@
#include "../../HW/SerialInterface.h" #include "../../HW/SerialInterface.h"
#include "../../Core.h" #include "../../Core.h"
namespace Jit64 namespace Jit64
{ {
void Jit64Core::Init() void Jit64Core::Init()
{ {
InitCache(); InitCache();

View File

@ -14,6 +14,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h"
#include "../PowerPC.h" #include "../PowerPC.h"
#include "../PPCTables.h" #include "../PPCTables.h"
#include "x64Emitter.h" #include "x64Emitter.h"
@ -23,6 +25,9 @@
#include "JitCache.h" #include "JitCache.h"
#include "JitAsm.h" #include "JitAsm.h"
// The branches are known good, or at least reasonably good.
// No need for a disable-mechanism.
using namespace Gen; using namespace Gen;
namespace Jit64 namespace Jit64
{ {

View File

@ -24,6 +24,9 @@
#include "JitCache.h" #include "JitCache.h"
#include "JitRegCache.h" #include "JitRegCache.h"
// #define INSTRUCTION_START Default(inst); return;
#define INSTRUCTION_START
namespace Jit64 namespace Jit64
{ {
const u64 GC_ALIGNED16(psSignBits2[2]) = {0x8000000000000000ULL, 0x8000000000000000ULL}; const u64 GC_ALIGNED16(psSignBits2[2]) = {0x8000000000000000ULL, 0x8000000000000000ULL};
@ -46,7 +49,7 @@ namespace Jit64
} }
else if (a != d && b != d) else if (a != d && b != d)
{ {
//sources different from d, can use rather quick solution // Sources different from d, can use rather quick solution
fpr.LoadToX64(d, !dupe); fpr.LoadToX64(d, !dupe);
MOVSD(fpr.RX(d), fpr.R(a)); MOVSD(fpr.RX(d), fpr.R(a));
fpr.GetReadyForOp(d, b); fpr.GetReadyForOp(d, b);
@ -59,7 +62,7 @@ namespace Jit64
MOVSD(fpr.RX(d), fpr.R(a)); MOVSD(fpr.RX(d), fpr.R(a));
op(fpr.RX(d), Gen::R(XMM0)); op(fpr.RX(d), Gen::R(XMM0));
} }
else //Other combo, must use two temps :( else // Other combo, must use two temps :(
{ {
MOVSD(XMM0, fpr.R(a)); MOVSD(XMM0, fpr.R(a));
MOVSD(XMM1, fpr.R(b)); MOVSD(XMM1, fpr.R(b));
@ -76,6 +79,7 @@ namespace Jit64
void fp_arith_s(UGeckoInstruction inst) void fp_arith_s(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
bool dupe = inst.OPCD == 59; bool dupe = inst.OPCD == 59;
switch (inst.SUBOP5) switch (inst.SUBOP5)
{ {
@ -94,11 +98,9 @@ namespace Jit64
} }
} }
void fmaddXX(UGeckoInstruction inst) void fmaddXX(UGeckoInstruction inst)
{ {
LOG(DYNA_REC, "Got one %08x", js.compilerPC); INSTRUCTION_START;
int a = inst.FA; int a = inst.FA;
int b = inst.FB; int b = inst.FB;
int c = inst.FC; int c = inst.FC;
@ -128,14 +130,15 @@ namespace Jit64
break; break;
} }
fpr.LoadToX64(d, false); fpr.LoadToX64(d, false);
//YES it is necessary to dupe :( //YES it is necessary to dupe the result :(
//TODO : analysis - does the top reg get used? //TODO : analysis - does the top reg get used? If so, dupe, if not, don't.
MOVDDUP(fpr.RX(d), Gen::R(XMM0)); //can also be done with SHUF MOVDDUP(fpr.RX(d), Gen::R(XMM0));
fpr.UnlockAll(); fpr.UnlockAll();
} }
void fcmpx(UGeckoInstruction inst) void fcmpx(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
if (jo.fpAccurateFlags) if (jo.fpAccurateFlags)
{ {
Default(inst); Default(inst);

View File

@ -14,6 +14,7 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "../PowerPC.h" #include "../PowerPC.h"
#include "../PPCTables.h" #include "../PPCTables.h"
#include "x64Emitter.h" #include "x64Emitter.h"
@ -23,16 +24,16 @@
#include "JitRegCache.h" #include "JitRegCache.h"
#include "JitAsm.h" #include "JitAsm.h"
#define OLD // #define INSTRUCTION_START Default(inst); return;
//#define OLD Default(inst); return; #define INSTRUCTION_START
namespace Jit64 namespace Jit64
{ {
typedef u32 (*Operation)(u32 a, u32 b); typedef u32 (*Operation)(u32 a, u32 b);
u32 Add(u32 a, u32 b) {return a+b;} u32 Add(u32 a, u32 b) {return a + b;}
u32 Or (u32 a, u32 b) {return a|b;} u32 Or (u32 a, u32 b) {return a | b;}
u32 And(u32 a, u32 b) {return a&b;} u32 And(u32 a, u32 b) {return a & b;}
u32 Xor(u32 a, u32 b) {return a^b;} u32 Xor(u32 a, u32 b) {return a ^ b;}
void regimmop(int d, int a, bool binary, u32 value, Operation doop, void(*op)(int, const OpArg&, const OpArg&), bool Rc = false) void regimmop(int d, int a, bool binary, u32 value, Operation doop, void(*op)(int, const OpArg&, const OpArg&), bool Rc = false)
{ {
@ -78,19 +79,20 @@ namespace Jit64
void reg_imm(UGeckoInstruction inst) void reg_imm(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int d = inst.RD, a = inst.RA, s = inst.RS; int d = inst.RD, a = inst.RA, s = inst.RS;
switch (inst.OPCD) switch (inst.OPCD)
{ {
case 14: regimmop(d,a,false,(u32)(s32)inst.SIMM_16,Add,ADD); break; //addi case 14: regimmop(d, a, false, (u32)(s32)inst.SIMM_16, Add, ADD); break; //addi
case 15: regimmop(d,a,false,(u32)inst.SIMM_16<<16,Add,ADD); break; //addis case 15: regimmop(d, a, false, (u32)inst.SIMM_16 << 16, Add, ADD); break; //addis
case 24: case 24:
if (a == 0 && s == 0 && inst.UIMM == 0) //check for nop if (a == 0 && s == 0 && inst.UIMM == 0) //check for nop
{NOP();return;} //make the nop visible.. or turn to int3? we shouldn't get nops {NOP(); return;} //make the nop visible.. or turn to int3? we shouldn't get nops
regimmop(a,s,true,inst.UIMM,Or,OR); regimmop(a, s, true, inst.UIMM, Or, OR);
break;//ori break;//ori
case 25: regimmop(a,s,true,inst.UIMM<<16,Or,OR); break;//oris case 25: regimmop(a, s, true, inst.UIMM << 16, Or, OR, false); break;//oris
case 28: regimmop(a,s,true,inst.UIMM,And,AND,true); break; case 28: regimmop(a, s, true, inst.UIMM, And, AND, true); break;
case 29: regimmop(a,s,true,inst.UIMM<<16,And,AND,true); break; case 29: regimmop(a, s, true, inst.UIMM << 16, And, AND, true); break;
case 12: //addic case 12: //addic
case 13: //addic_rc case 13: //addic_rc
case 26: //xori case 26: //xori
@ -104,6 +106,7 @@ namespace Jit64
// unsigned // unsigned
void cmpli(UGeckoInstruction inst) void cmpli(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
u32 uimm = inst.UIMM; u32 uimm = inst.UIMM;
int crf = inst.CRFD; int crf = inst.CRFD;
@ -152,7 +155,7 @@ namespace Jit64
// signed // signed
void cmpi(UGeckoInstruction inst) void cmpi(UGeckoInstruction inst)
{ {
OLD; INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
s32 simm = (s32)(s16)inst.UIMM; s32 simm = (s32)(s16)inst.UIMM;
int crf = inst.CRFD; int crf = inst.CRFD;
@ -180,6 +183,7 @@ namespace Jit64
// signed // signed
void cmp(UGeckoInstruction inst) void cmp(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int b = inst.RB; int b = inst.RB;
int crf = inst.CRFD; int crf = inst.CRFD;
@ -209,6 +213,7 @@ namespace Jit64
// unsigned // unsigned
void cmpl(UGeckoInstruction inst) void cmpl(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int b = inst.RB; int b = inst.RB;
int crf = inst.CRFD; int crf = inst.CRFD;
@ -237,6 +242,7 @@ namespace Jit64
void orx(UGeckoInstruction inst) void orx(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int s = inst.RS; int s = inst.RS;
int b = inst.RB; int b = inst.RB;
@ -271,6 +277,7 @@ namespace Jit64
void andx(UGeckoInstruction inst) void andx(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA, s = inst.RS, b = inst.RB; int a = inst.RA, s = inst.RS, b = inst.RB;
if (a != s && a != b) { if (a != s && a != b) {
gpr.LoadToX64(a, false, true); gpr.LoadToX64(a, false, true);
@ -291,6 +298,7 @@ namespace Jit64
void extsbx(UGeckoInstruction inst) void extsbx(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA, s = inst.RS; int a = inst.RA, s = inst.RS;
gpr.LoadToX64(a, a == s, true); gpr.LoadToX64(a, a == s, true);
gpr.KillImmediate(s); gpr.KillImmediate(s);
@ -304,6 +312,7 @@ namespace Jit64
void extshx(UGeckoInstruction inst) void extshx(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA, s = inst.RS; int a = inst.RA, s = inst.RS;
gpr.LoadToX64(a, a == s, true); gpr.LoadToX64(a, a == s, true);
gpr.KillImmediate(s); gpr.KillImmediate(s);
@ -316,6 +325,7 @@ namespace Jit64
void subfic(UGeckoInstruction inst) void subfic(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA, d = inst.RD; int a = inst.RA, d = inst.RD;
gpr.FlushR(ECX); gpr.FlushR(ECX);
gpr.LockX(ECX); gpr.LockX(ECX);
@ -341,6 +351,7 @@ namespace Jit64
void subfx(UGeckoInstruction inst) void subfx(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
gpr.Lock(a, b, d); gpr.Lock(a, b, d);
if (d != a && d != b) { if (d != a && d != b) {
@ -361,6 +372,7 @@ namespace Jit64
void mulli(UGeckoInstruction inst) void mulli(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA, d = inst.RD; int a = inst.RA, d = inst.RD;
gpr.FlushR(EDX); gpr.FlushR(EDX);
gpr.LockX(EDX); gpr.LockX(EDX);
@ -380,6 +392,7 @@ namespace Jit64
void mullwx(UGeckoInstruction inst) void mullwx(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
gpr.FlushR(EDX); gpr.FlushR(EDX);
gpr.LockX(EDX); gpr.LockX(EDX);
@ -403,6 +416,7 @@ namespace Jit64
void mulhwux(UGeckoInstruction inst) void mulhwux(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
gpr.FlushR(EDX); gpr.FlushR(EDX);
gpr.LockX(EDX); gpr.LockX(EDX);
@ -469,6 +483,7 @@ namespace Jit64
void addx(UGeckoInstruction inst) void addx(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
_assert_msg_(DYNA_REC, !inst.OE, "Add - OE enabled :("); _assert_msg_(DYNA_REC, !inst.OE, "Add - OE enabled :(");
@ -519,6 +534,7 @@ namespace Jit64
// This can be optimized // This can be optimized
void addex(UGeckoInstruction inst) void addex(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
gpr.FlushR(ECX); gpr.FlushR(ECX);
gpr.LockX(ECX); gpr.LockX(ECX);
@ -546,6 +562,7 @@ namespace Jit64
void rlwinmx(UGeckoInstruction inst) void rlwinmx(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int s = inst.RS; int s = inst.RS;
if (gpr.R(a).IsImm() || gpr.R(s).IsImm()) if (gpr.R(a).IsImm() || gpr.R(s).IsImm())
@ -596,7 +613,7 @@ namespace Jit64
void rlwimix(UGeckoInstruction inst) void rlwimix(UGeckoInstruction inst)
{ {
OLD; INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int s = inst.RS; int s = inst.RS;
if (gpr.R(a).IsImm() || gpr.R(s).IsImm()) if (gpr.R(a).IsImm() || gpr.R(s).IsImm())
@ -628,6 +645,7 @@ namespace Jit64
void rlwnmx(UGeckoInstruction inst) void rlwnmx(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, s = inst.RS; int a = inst.RA, b = inst.RB, s = inst.RS;
if (gpr.R(a).IsImm()) if (gpr.R(a).IsImm())
{ {
@ -657,6 +675,7 @@ namespace Jit64
void srwx(UGeckoInstruction inst) void srwx(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
// BUGGY? // BUGGY?
Default(inst); return; Default(inst); return;
int a = inst.RA; int a = inst.RA;
@ -690,6 +709,7 @@ namespace Jit64
// another crazy instruction :( // another crazy instruction :(
void srawix(UGeckoInstruction inst) void srawix(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int s = inst.RS; int s = inst.RS;
int amount = inst.SH; int amount = inst.SH;
@ -731,6 +751,7 @@ namespace Jit64
void cntlzwx(UGeckoInstruction inst) void cntlzwx(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int s = inst.RS; int s = inst.RS;
if (gpr.R(a).IsImm() || gpr.R(s).IsImm() || s == a) if (gpr.R(a).IsImm() || gpr.R(s).IsImm() || s == a)

View File

@ -18,6 +18,8 @@
// TODO(ector): Tons of pshufb optimization of the loads/stores, for SSSE3+, possibly SSE4, only. // TODO(ector): Tons of pshufb optimization of the loads/stores, for SSSE3+, possibly SSE4, only.
// Should give a very noticable speed boost to paired single heavy code. // Should give a very noticable speed boost to paired single heavy code.
#include "Common.h"
#include "../PowerPC.h" #include "../PowerPC.h"
#include "../../Core.h" #include "../../Core.h"
#include "../../HW/GPFifo.h" #include "../../HW/GPFifo.h"
@ -33,13 +35,13 @@
#include "JitAsm.h" #include "JitAsm.h"
#include "JitRegCache.h" #include "JitRegCache.h"
#define OLD // #define INSTRUCTION_START Default(inst); return;
//#define OLD Default(inst); return; #define INSTRUCTION_START
#ifdef _M_IX86 #ifdef _M_IX86
#define BIT32OLD Default(inst); return; #define DISABLE_32BIT Default(inst); return;
#else #else
#define BIT32OLD ; #define DISABLE_32BIT ;
#endif #endif
namespace Jit64 namespace Jit64
@ -81,6 +83,7 @@ namespace Jit64
void lbzx(UGeckoInstruction inst) void lbzx(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int a = inst.RA, b = inst.RB, d = inst.RD; int a = inst.RA, b = inst.RB, d = inst.RD;
gpr.Lock(a, b, d); gpr.Lock(a, b, d);
if (b == d || a == d) if (b == d || a == d)
@ -97,6 +100,7 @@ namespace Jit64
void lXz(UGeckoInstruction inst) void lXz(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int d = inst.RD; int d = inst.RD;
int a = inst.RA; int a = inst.RA;
@ -171,7 +175,7 @@ namespace Jit64
void lfs(UGeckoInstruction inst) void lfs(UGeckoInstruction inst)
{ {
// BIT32OLD; INSTRUCTION_START;
int d = inst.RD; int d = inst.RD;
int a = inst.RA; int a = inst.RA;
if (!a) if (!a)
@ -211,7 +215,8 @@ namespace Jit64
void lfd(UGeckoInstruction inst) void lfd(UGeckoInstruction inst)
{ {
BIT32OLD; INSTRUCTION_START;
DISABLE_32BIT;
int d = inst.RD; int d = inst.RD;
int a = inst.RA; int a = inst.RA;
if (!a) if (!a)
@ -235,8 +240,8 @@ namespace Jit64
void stfd(UGeckoInstruction inst) void stfd(UGeckoInstruction inst)
{ {
BIT32OLD; INSTRUCTION_START;
OLD; DISABLE_32BIT;
int s = inst.RS; int s = inst.RS;
int a = inst.RA; int a = inst.RA;
if (!a) if (!a)
@ -259,8 +264,8 @@ namespace Jit64
void stfs(UGeckoInstruction inst) void stfs(UGeckoInstruction inst)
{ {
BIT32OLD; INSTRUCTION_START;
OLD; DISABLE_32BIT;
bool update = inst.OPCD & 1; bool update = inst.OPCD & 1;
int s = inst.RS; int s = inst.RS;
int a = inst.RA; int a = inst.RA;
@ -301,10 +306,8 @@ namespace Jit64
void lfsx(UGeckoInstruction inst) void lfsx(UGeckoInstruction inst)
{ {
#ifdef _M_IX86 INSTRUCTION_START;
Default(inst); DISABLE_32BIT;
return;
#endif
fpr.Lock(inst.RS); fpr.Lock(inst.RS);
fpr.LoadToX64(inst.RS, false, true); fpr.LoadToX64(inst.RS, false, true);
MOV(32, R(EAX), gpr.R(inst.RB)); MOV(32, R(EAX), gpr.R(inst.RB));
@ -321,10 +324,8 @@ namespace Jit64
// Zero cache line. // Zero cache line.
void dcbz(UGeckoInstruction inst) void dcbz(UGeckoInstruction inst)
{ {
#ifdef _M_IX86 INSTRUCTION_START;
Default(inst); DISABLE_32BIT;
return;
#endif
MOV(32, R(EAX), gpr.R(inst.RB)); MOV(32, R(EAX), gpr.R(inst.RB));
if (inst.RA) if (inst.RA)
ADD(32, R(EAX), gpr.R(inst.RA)); ADD(32, R(EAX), gpr.R(inst.RA));
@ -336,6 +337,7 @@ namespace Jit64
void stX(UGeckoInstruction inst) void stX(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int s = inst.RS; int s = inst.RS;
int a = inst.RA; int a = inst.RA;
@ -471,6 +473,7 @@ namespace Jit64
// A few games use these heavily. // A few games use these heavily.
void lmw(UGeckoInstruction inst) void lmw(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
Default(inst); Default(inst);
return; return;
/// BUGGY /// BUGGY
@ -496,6 +499,7 @@ namespace Jit64
void stmw(UGeckoInstruction inst) void stmw(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
Default(inst); Default(inst);
return; return;
/* /*

View File

@ -18,6 +18,8 @@
// TODO(ector): Tons of pshufb optimization of the loads/stores, for SSSE3+, possibly SSE4, only. // TODO(ector): Tons of pshufb optimization of the loads/stores, for SSSE3+, possibly SSE4, only.
// Should give a very noticable speed boost to paired single heavy code. // Should give a very noticable speed boost to paired single heavy code.
#include "Common.h"
#include "../PowerPC.h" #include "../PowerPC.h"
#include "../../Core.h" #include "../../Core.h"
#include "../../HW/GPFifo.h" #include "../../HW/GPFifo.h"
@ -33,13 +35,13 @@
#include "JitAsm.h" #include "JitAsm.h"
#include "JitRegCache.h" #include "JitRegCache.h"
#define OLD // #define INSTRUCTION_START Default(inst); return;
//#define OLD Default(inst); return; #define INSTRUCTION_START
#ifdef _M_IX86 #ifdef _M_IX86
#define BIT32OLD Default(inst); return; #define DISABLE_32BIT Default(inst); return;
#else #else
#define BIT32OLD ; #define DISABLE_32BIT ;
#endif #endif
namespace Jit64 { namespace Jit64 {
@ -47,7 +49,7 @@ namespace Jit64 {
static double GC_ALIGNED16(psTemp[2]) = {1.0, 1.0}; static double GC_ALIGNED16(psTemp[2]) = {1.0, 1.0};
static u64 GC_ALIGNED16(temp64); static u64 GC_ALIGNED16(temp64);
static u32 GC_ALIGNED16(temp32); static u32 GC_ALIGNED16(temp32);
static u32 temp;
// TODO(ector): Improve 64-bit version // TODO(ector): Improve 64-bit version
void WriteDual32(u64 value, u32 address) void WriteDual32(u64 value, u32 address)
@ -56,7 +58,7 @@ void WriteDual32(u64 value, u32 address)
Memory::Write_U32((u32)value, address + 4); Memory::Write_U32((u32)value, address + 4);
} }
const double m_quantizeTableD[] = static const double m_quantizeTableD[] =
{ {
(1 << 0), (1 << 1), (1 << 2), (1 << 3), (1 << 0), (1 << 1), (1 << 2), (1 << 3),
(1 << 4), (1 << 5), (1 << 6), (1 << 7), (1 << 4), (1 << 5), (1 << 6), (1 << 7),
@ -76,7 +78,7 @@ const double m_quantizeTableD[] =
1.0 / (1 << 4), 1.0 / (1 << 3), 1.0 / (1 << 2), 1.0 / (1 << 1), 1.0 / (1 << 4), 1.0 / (1 << 3), 1.0 / (1 << 2), 1.0 / (1 << 1),
}; };
const double m_dequantizeTableD[] = static const double m_dequantizeTableD[] =
{ {
1.0 / (1 << 0), 1.0 / (1 << 1), 1.0 / (1 << 2), 1.0 / (1 << 3), 1.0 / (1 << 0), 1.0 / (1 << 1), 1.0 / (1 << 2), 1.0 / (1 << 3),
1.0 / (1 << 4), 1.0 / (1 << 5), 1.0 / (1 << 6), 1.0 / (1 << 7), 1.0 / (1 << 4), 1.0 / (1 << 5), 1.0 / (1 << 6), 1.0 / (1 << 7),
@ -98,11 +100,10 @@ const double m_dequantizeTableD[] =
// The big problem is likely instructions that set the quantizers in the same block. // 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. // We will have to break block after quantizers are written to.
u32 temp;
void psq_st(UGeckoInstruction inst) void psq_st(UGeckoInstruction inst)
{ {
BIT32OLD; INSTRUCTION_START;
OLD; DISABLE_32BIT;
if (js.blockSetsQuantizers || !Core::GetStartupParameter().bOptimizeQuantizers) if (js.blockSetsQuantizers || !Core::GetStartupParameter().bOptimizeQuantizers)
{ {
Default(inst); Default(inst);
@ -112,7 +113,7 @@ void psq_st(UGeckoInstruction inst)
const EQuantizeType stType = static_cast<EQuantizeType>(gqr.ST_TYPE); const EQuantizeType stType = static_cast<EQuantizeType>(gqr.ST_TYPE);
int stScale = gqr.ST_SCALE; int stScale = gqr.ST_SCALE;
bool update = inst.OPCD == 61; bool update = inst.OPCD == 61;
if (update || !inst.RA || inst.W) if (!inst.RA || inst.W)
{ {
// PanicAlert(inst.RA ? "W" : "inst"); // PanicAlert(inst.RA ? "W" : "inst");
Default(inst); Default(inst);
@ -223,8 +224,8 @@ void psq_st(UGeckoInstruction inst)
void psq_l(UGeckoInstruction inst) void psq_l(UGeckoInstruction inst)
{ {
BIT32OLD; INSTRUCTION_START;
OLD; DISABLE_32BIT;
if (js.blockSetsQuantizers || !Core::GetStartupParameter().bOptimizeQuantizers) if (js.blockSetsQuantizers || !Core::GetStartupParameter().bOptimizeQuantizers)
{ {
Default(inst); Default(inst);
@ -234,7 +235,7 @@ void psq_l(UGeckoInstruction inst)
const EQuantizeType ldType = static_cast<EQuantizeType>(gqr.LD_TYPE); const EQuantizeType ldType = static_cast<EQuantizeType>(gqr.LD_TYPE);
int ldScale = gqr.LD_SCALE; int ldScale = gqr.LD_SCALE;
bool update = inst.OPCD == 57; bool update = inst.OPCD == 57;
if (update || !inst.RA || inst.W) if (!inst.RA || inst.W)
{ {
// 0 1 during load // 0 1 during load
//PanicAlert("ld:%i %i", ldType, (int)inst.W); //PanicAlert("ld:%i %i", ldType, (int)inst.W);

View File

@ -14,6 +14,9 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h"
#include "../PowerPC.h" #include "../PowerPC.h"
#include "../PPCTables.h" #include "../PPCTables.h"
#include "x64Emitter.h" #include "x64Emitter.h"
@ -29,18 +32,24 @@
// ps_madds1 // ps_madds1
//#define OLD Default(inst); return; // #define INSTRUCTION_START Default(inst); return;
#define OLD #define INSTRUCTION_START
#ifdef _M_IX86
#define DISABLE_32BIT Default(inst); return;
#else
#define DISABLE_32BIT ;
#endif
namespace Jit64 namespace Jit64
{ {
const u64 GC_ALIGNED16(psSignBits[2]) = {0x8000000000000000ULL, 0x8000000000000000ULL}; static const u64 GC_ALIGNED16(psSignBits[2]) = {0x8000000000000000ULL, 0x8000000000000000ULL};
const u64 GC_ALIGNED16(psAbsMask[2]) = {0x7FFFFFFFFFFFFFFFULL, 0x7FFFFFFFFFFFFFFFULL}; static const u64 GC_ALIGNED16(psAbsMask[2]) = {0x7FFFFFFFFFFFFFFFULL, 0x7FFFFFFFFFFFFFFFULL};
const double GC_ALIGNED16(psOneOne[2]) = {1.0, 1.0}; static const double GC_ALIGNED16(psOneOne[2]) = {1.0, 1.0};
void ps_sign(UGeckoInstruction inst) void ps_sign(UGeckoInstruction inst)
{ {
OLD; INSTRUCTION_START;
int d = inst.FD; int d = inst.FD;
int b = inst.FB; int b = inst.FB;
@ -73,6 +82,7 @@ namespace Jit64
void ps_rsqrte(UGeckoInstruction inst) void ps_rsqrte(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
int d = inst.FD; int d = inst.FD;
int b = inst.FB; int b = inst.FB;
fpr.Lock(d, b); fpr.Lock(d, b);
@ -143,7 +153,7 @@ namespace Jit64
void ps_arith(UGeckoInstruction inst) void ps_arith(UGeckoInstruction inst)
{ {
OLD; INSTRUCTION_START;
switch (inst.SUBOP5) switch (inst.SUBOP5)
{ {
case 18: tri_op(inst.FD, inst.FA, inst.FB, false, &DIVPD); break; //div case 18: tri_op(inst.FD, inst.FA, inst.FB, false, &DIVPD); break; //div
@ -164,7 +174,7 @@ namespace Jit64
//TODO: find easy cases and optimize them, do a breakout like ps_arith //TODO: find easy cases and optimize them, do a breakout like ps_arith
void ps_mergeXX(UGeckoInstruction inst) void ps_mergeXX(UGeckoInstruction inst)
{ {
OLD; INSTRUCTION_START;
int d = inst.FD; int d = inst.FD;
int a = inst.FA; int a = inst.FA;
int b = inst.FB; int b = inst.FB;
@ -202,7 +212,7 @@ namespace Jit64
//TODO: add optimized cases //TODO: add optimized cases
void ps_maddXX(UGeckoInstruction inst) void ps_maddXX(UGeckoInstruction inst)
{ {
OLD; INSTRUCTION_START;
int a = inst.FA; int a = inst.FA;
int b = inst.FB; int b = inst.FB;
int c = inst.FC; int c = inst.FC;
@ -243,6 +253,7 @@ namespace Jit64
void ps_mulsX(UGeckoInstruction inst) void ps_mulsX(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
Default(inst); Default(inst);
return; return;

View File

@ -14,6 +14,9 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h"
#include "../../CoreTiming.h" #include "../../CoreTiming.h"
#include "../../HW/SystemTimers.h" #include "../../HW/SystemTimers.h"
#include "../PowerPC.h" #include "../PowerPC.h"
@ -24,10 +27,20 @@
#include "JitCache.h" #include "JitCache.h"
#include "JitRegCache.h" #include "JitRegCache.h"
// #define INSTRUCTION_START Default(inst); return;
#define INSTRUCTION_START
#ifdef _M_IX86
#define DISABLE_32BIT Default(inst); return;
#else
#define DISABLE_32BIT ;
#endif
namespace Jit64 namespace Jit64
{ {
void mtspr(UGeckoInstruction inst) void mtspr(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
u32 iIndex = (inst.SPRU << 5) | (inst.SPRL & 0x1F); u32 iIndex = (inst.SPRU << 5) | (inst.SPRL & 0x1F);
int d = inst.RD; int d = inst.RD;
@ -65,6 +78,7 @@ namespace Jit64
void mfspr(UGeckoInstruction inst) void mfspr(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
u32 iIndex = (inst.SPRU << 5) | (inst.SPRL & 0x1F); u32 iIndex = (inst.SPRU << 5) | (inst.SPRL & 0x1F);
int d = inst.RD; int d = inst.RD;
switch (iIndex) switch (iIndex)
@ -87,12 +101,14 @@ namespace Jit64
void mtmsr(UGeckoInstruction inst) void mtmsr(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
gpr.LoadToX64(inst.RS); gpr.LoadToX64(inst.RS);
MOV(32, M(&MSR), gpr.R(inst.RS)); MOV(32, M(&MSR), gpr.R(inst.RS));
} }
void mfmsr(UGeckoInstruction inst) void mfmsr(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
//Privileged? //Privileged?
gpr.LoadToX64(inst.RD, false); gpr.LoadToX64(inst.RD, false);
MOV(32, gpr.R(inst.RD), M(&MSR)); MOV(32, gpr.R(inst.RD), M(&MSR));
@ -100,6 +116,7 @@ namespace Jit64
void mftb(UGeckoInstruction inst) void mftb(UGeckoInstruction inst)
{ {
INSTRUCTION_START;
mfspr(inst); mfspr(inst);
} }
} }

View File

@ -14,8 +14,10 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include <algorithm> #include <algorithm>
#include "Common.h"
#include "PPCTables.h" #include "PPCTables.h"
#include "Interpreter/Interpreter.h" #include "Interpreter/Interpreter.h"
@ -38,20 +40,21 @@ struct GekkoOPTemplate
int runCount; int runCount;
}; };
// The eventual goal is to be able to constify as much as possible in this file.
// Currently, the main obstacle is runCount above.
static GekkoOPInfo *m_infoTable[64];
static GekkoOPInfo *m_infoTable4[1024];
static GekkoOPInfo *m_infoTable19[1024];
static GekkoOPInfo *m_infoTable31[1024];
static GekkoOPInfo *m_infoTable59[32];
static GekkoOPInfo *m_infoTable63[1024];
GekkoOPInfo *m_infoTable[64]; static _recompilerInstruction dynaOpTable[64];
GekkoOPInfo *m_infoTable4[1024]; static _recompilerInstruction dynaOpTable4[1024];
GekkoOPInfo *m_infoTable19[1024]; static _recompilerInstruction dynaOpTable19[1024];
GekkoOPInfo *m_infoTable31[1024]; static _recompilerInstruction dynaOpTable31[1024];
GekkoOPInfo *m_infoTable59[32]; static _recompilerInstruction dynaOpTable59[32];
GekkoOPInfo *m_infoTable63[1024]; static _recompilerInstruction dynaOpTable63[1024];
_recompilerInstruction dynaOpTable[64];
_recompilerInstruction dynaOpTable4[1024];
_recompilerInstruction dynaOpTable19[1024];
_recompilerInstruction dynaOpTable31[1024];
_recompilerInstruction dynaOpTable59[32];
_recompilerInstruction dynaOpTable63[1024];
void DynaRunTable4(UGeckoInstruction _inst) {dynaOpTable4 [_inst.SUBOP10](_inst);} void DynaRunTable4(UGeckoInstruction _inst) {dynaOpTable4 [_inst.SUBOP10](_inst);}
void DynaRunTable19(UGeckoInstruction _inst) {dynaOpTable19[_inst.SUBOP10](_inst);} void DynaRunTable19(UGeckoInstruction _inst) {dynaOpTable19[_inst.SUBOP10](_inst);}
@ -59,9 +62,8 @@ void DynaRunTable31(UGeckoInstruction _inst) {dynaOpTable31[_inst.SUBOP10](_inst
void DynaRunTable59(UGeckoInstruction _inst) {dynaOpTable59[_inst.SUBOP5 ](_inst);} void DynaRunTable59(UGeckoInstruction _inst) {dynaOpTable59[_inst.SUBOP5 ](_inst);}
void DynaRunTable63(UGeckoInstruction _inst) {dynaOpTable63[_inst.SUBOP10](_inst);} void DynaRunTable63(UGeckoInstruction _inst) {dynaOpTable63[_inst.SUBOP10](_inst);}
GekkoOPInfo *m_allInstructions[2048]; static GekkoOPInfo *m_allInstructions[2048];
int m_numInstructions; static int m_numInstructions;
GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst) GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst)
{ {

View File

@ -84,4 +84,4 @@ void BreakPointDlg::OnOK(wxCommandEvent& /*event*/)
void BreakPointDlg::OnCancel(wxCommandEvent& /*event*/) void BreakPointDlg::OnCancel(wxCommandEvent& /*event*/)
{ {
Close(); Close();
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8,00" Version="8.00"
Name="VideoCommon" Name="VideoCommon"
ProjectGUID="{E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}" ProjectGUID="{E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}"
RootNamespace="VideoCommon" RootNamespace="VideoCommon"
@ -405,10 +405,6 @@
RelativePath=".\Src\CPMemory.h" RelativePath=".\Src\CPMemory.h"
> >
</File> </File>
<File
RelativePath=".\Src\GPUInterface.h"
>
</File>
<File <File
RelativePath=".\Src\LookUpTables.cpp" RelativePath=".\Src\LookUpTables.cpp"
> >

View File

@ -28,7 +28,7 @@
#include "PixelShaderManager.h" #include "PixelShaderManager.h"
// State translation lookup tables // State translation lookup tables
const GLenum glSrcFactors[8] = static const GLenum glSrcFactors[8] =
{ {
GL_ZERO, GL_ZERO,
GL_ONE, GL_ONE,
@ -40,13 +40,13 @@ const GLenum glSrcFactors[8] =
GL_ONE_MINUS_DST_ALPHA GL_ONE_MINUS_DST_ALPHA
}; };
const GLenum glDestFactors[8] = { static const GLenum glDestFactors[8] = {
GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR,
GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA }; GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA };
const GLenum glCmpFuncs[8] = { GL_NEVER, GL_LESS, GL_EQUAL, GL_LEQUAL, GL_GREATER, GL_NOTEQUAL, GL_GEQUAL, GL_ALWAYS }; static const GLenum glCmpFuncs[8] = { GL_NEVER, GL_LESS, GL_EQUAL, GL_LEQUAL, GL_GREATER, GL_NOTEQUAL, GL_GEQUAL, GL_ALWAYS };
const GLenum glLogicOpCodes[16] = { static const GLenum glLogicOpCodes[16] = {
GL_CLEAR, GL_SET, GL_COPY, GL_COPY_INVERTED, GL_NOOP, GL_INVERT, GL_AND, GL_NAND, GL_CLEAR, GL_SET, GL_COPY, GL_COPY_INVERTED, GL_NOOP, GL_INVERT, GL_AND, GL_NAND,
GL_OR, GL_NOR, GL_XOR, GL_EQUIV, GL_AND_REVERSE, GL_AND_INVERTED, GL_OR_REVERSE, GL_OR_INVERTED }; GL_OR, GL_NOR, GL_XOR, GL_EQUIV, GL_AND_REVERSE, GL_AND_INVERTED, GL_OR_REVERSE, GL_OR_INVERTED };

View File

@ -28,8 +28,8 @@
FifoReader fifo; FifoReader fifo;
static u8 *videoBuffer; static u8 *videoBuffer;
int size = 0; static int size = 0;
int readptr = 0; static int readptr = 0;
void Fifo_Init() void Fifo_Init()
{ {

View File

@ -32,7 +32,7 @@ u32 s_nTargetWidth = 0, s_nTargetHeight = 0;
u32 g_AAx = 0, g_AAy = 0; u32 g_AAx = 0, g_AAy = 0;
#ifndef _WIN32 #ifndef _WIN32
GLWindow GLWin; static GLWindow GLWin;
#endif #endif
#ifdef _WIN32 #ifdef _WIN32

View File

@ -576,7 +576,7 @@ void DVProfClear()
#ifdef _WIN32 #ifdef _WIN32
// The one for Linux is in Linux/Linux.cpp // The one for Linux is in Linux/Linux.cpp
HANDLE hConsole = NULL; static HANDLE hConsole = NULL;
void OpenConsole() { void OpenConsole() {
COORD csize; COORD csize;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo; CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
@ -605,7 +605,7 @@ void CloseConsole() {
#endif #endif
FILE* pfLog = NULL; static FILE* pfLog = NULL;
void __Log(const char *fmt, ...) void __Log(const char *fmt, ...)
{ {
char* Msg = (char*)alloca(strlen(fmt)+512); char* Msg = (char*)alloca(strlen(fmt)+512);

View File

@ -41,7 +41,7 @@ bool WriteAlphaTest(char *&p);
const float epsilon = 1.0f/255.0f; const float epsilon = 1.0f/255.0f;
const char *tevKSelTableC[] = // KCSEL static const char *tevKSelTableC[] = // KCSEL
{ {
"1.0f,1.0f,1.0f", //1 = 0x00 "1.0f,1.0f,1.0f", //1 = 0x00
"0.875,0.875,0.875",//7_8 = 0x01 "0.875,0.875,0.875",//7_8 = 0x01
@ -77,7 +77,7 @@ const char *tevKSelTableC[] = // KCSEL
I_KCOLORS"[3].aaa",//K3_A = 0x1F I_KCOLORS"[3].aaa",//K3_A = 0x1F
}; };
const char *tevKSelTableA[] = // KASEL static const char *tevKSelTableA[] = // KASEL
{ {
"1.0f", //1 = 0x00 "1.0f", //1 = 0x00
"0.875f",//7_8 = 0x01 "0.875f",//7_8 = 0x01
@ -113,7 +113,7 @@ const char *tevKSelTableA[] = // KASEL
I_KCOLORS"[3].a",//K3_A = 0x1F I_KCOLORS"[3].a",//K3_A = 0x1F
}; };
const char *tevScaleTable[] = // CS static const char *tevScaleTable[] = // CS
{ {
"1.0f", //SCALE_1 "1.0f", //SCALE_1
"2.0f", //SCALE_2 "2.0f", //SCALE_2
@ -121,7 +121,7 @@ const char *tevScaleTable[] = // CS
"0.5f",//DIVIDE_2 "0.5f",//DIVIDE_2
}; };
const char *tevBiasTable[] = // TB static const char *tevBiasTable[] = // TB
{ {
"", //ZERO, "", //ZERO,
"+0.5f", //ADDHALF, "+0.5f", //ADDHALF,
@ -129,19 +129,19 @@ const char *tevBiasTable[] = // TB
"", "",
}; };
const char *tevOpTable[] = { // TEV static const char *tevOpTable[] = { // TEV
"+", //TEVOP_ADD = 0, "+", //TEVOP_ADD = 0,
"-", //TEVOP_SUB = 1, "-", //TEVOP_SUB = 1,
}; };
const char *tevCompOpTable[] = { ">", "==" }; static const char *tevCompOpTable[] = { ">", "==" };
#define TEVCMP_R8 0 #define TEVCMP_R8 0
#define TEVCMP_GR16 1 #define TEVCMP_GR16 1
#define TEVCMP_BGR24 2 #define TEVCMP_BGR24 2
#define TEVCMP_RGB8 3 #define TEVCMP_RGB8 3
const char *tevCInputTable[] = // CC static const char *tevCInputTable[] = // CC
{ {
"prev.rgb", //CPREV, "prev.rgb", //CPREV,
"prev.aaa", //APREV, "prev.aaa", //APREV,
@ -165,7 +165,8 @@ const char *tevCInputTable[] = // CC
"PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR",
"PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR",
}; };
const char *tevCInputTable2[] = // CC
static const char *tevCInputTable2[] = // CC
{ {
"prev", //CPREV, "prev", //CPREV,
"(prev.aaa)", //APREV, "(prev.aaa)", //APREV,
@ -190,7 +191,7 @@ const char *tevCInputTable2[] = // CC
"PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR",
}; };
const char *tevAInputTable[] = // CA static const char *tevAInputTable[] = // CA
{ {
"prev.a", //APREV, "prev.a", //APREV,
"c0.a", //A0, "c0.a", //A0,
@ -206,7 +207,7 @@ const char *tevAInputTable[] = // CA
"PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR",
}; };
const char *tevAInputTable2[] = // CA static const char *tevAInputTable2[] = // CA
{ {
"prev", //APREV, "prev", //APREV,
"c0", //A0, "c0", //A0,
@ -222,7 +223,7 @@ const char *tevAInputTable2[] = // CA
"PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR", "PADERROR",
}; };
const char *tevRasTable[] = static const char *tevRasTable[] =
{ {
"colors[0]", "colors[0]",
"colors[1]", "colors[1]",
@ -234,27 +235,28 @@ const char *tevRasTable[] =
"float4(0,0,0,0)", // zero "float4(0,0,0,0)", // zero
}; };
const char *alphaRef[2] = static const char *alphaRef[2] =
{ {
I_ALPHA"[0].x", I_ALPHA"[0].x",
I_ALPHA"[0].y" I_ALPHA"[0].y"
}; };
const char *tevTexFunc[] = { "tex2D", "texRECT" }; static const char *tevTexFunc[] = { "tex2D", "texRECT" };
const char *tevCOutputTable[] = { "prev.rgb", "c0.rgb", "c1.rgb", "c2.rgb" }; static const char *tevCOutputTable[] = { "prev.rgb", "c0.rgb", "c1.rgb", "c2.rgb" };
const char *tevAOutputTable[] = { "prev.a", "c0.a", "c1.a", "c2.a" }; static const char *tevAOutputTable[] = { "prev.a", "c0.a", "c1.a", "c2.a" };
const char* tevIndAlphaSel[] = {"", "x", "y", "z"}; static const char* tevIndAlphaSel[] = {"", "x", "y", "z"};
const char* tevIndAlphaScale[] = {"", "*32","*16","*8"}; static const char* tevIndAlphaScale[] = {"", "*32","*16","*8"};
const char* tevIndBiasField[] = {"", "x", "y", "xy", "z", "xz", "yz", "xyz"}; // indexed by bias static const char* tevIndBiasField[] = {"", "x", "y", "xy", "z", "xz", "yz", "xyz"}; // indexed by bias
const char* tevIndBiasAdd[] = {"-128.0f", "1.0f", "1.0f", "1.0f" }; // indexed by fmt static const char* tevIndBiasAdd[] = {"-128.0f", "1.0f", "1.0f", "1.0f" }; // indexed by fmt
const char* tevIndWrapStart[] = {"0", "256", "128", "64", "32", "16", "0.001" }; static const char* tevIndWrapStart[] = {"0", "256", "128", "64", "32", "16", "0.001" };
const char* tevIndFmtScale[] = {"255.0f", "31.0f", "15.0f", "8.0f" }; static const char* tevIndFmtScale[] = {"255.0f", "31.0f", "15.0f", "8.0f" };
#define WRITE p+=sprintf #define WRITE p+=sprintf
const char *swapColors = "rgba"; static const char *swapColors = "rgba";
char swapModeTable[4][5]; static char swapModeTable[4][5];
static char text[16384];
void BuildSwapModeTable() void BuildSwapModeTable()
{ {
@ -269,7 +271,6 @@ void BuildSwapModeTable()
} }
} }
static char text[16384];
char *GeneratePixelShader(u32 texture_mask, bool has_zbuffer_target, bool bRenderZToCol0) char *GeneratePixelShader(u32 texture_mask, bool has_zbuffer_target, bool bRenderZToCol0)
{ {
DVSTARTPROFILE(); DVSTARTPROFILE();

View File

@ -47,13 +47,13 @@ static vector< pair<int, int> > s_vStoredPrimitives; // every element, mode and
static void (*fnSetupVertexPointers)() = NULL; static void (*fnSetupVertexPointers)() = NULL;
//these don't need to be saved //these don't need to be saved
float posScale; static float posScale;
float tcScale[8]; static float tcScale[8];
int colElements[2]; static int colElements[2];
float tcScaleU[8]; static float tcScaleU[8];
float tcScaleV[8]; static float tcScaleV[8];
int tcIndex; static int tcIndex;
int colIndex; static int colIndex;
#ifndef _WIN32 #ifndef _WIN32
#undef inline #undef inline
#define inline #define inline
@ -473,7 +473,6 @@ void VertexLoader::ProcessFormat()
u8 *old_code_ptr = GetWritableCodePtr(); u8 *old_code_ptr = GetWritableCodePtr();
SetCodePtr(m_compiledCode); SetCodePtr(m_compiledCode);
Util::EmitPrologue(6); Util::EmitPrologue(6);
//INT3();
int offset = 0; int offset = 0;
// Position // Position

View File

@ -32,6 +32,7 @@ int bound(int i)
{ {
return (i>255)?255:((i<0)?0:i); return (i>255)?255:((i<0)?0:i);
} }
void yuv2rgb(int y, int u, int v, int &r, int &g, int &b) void yuv2rgb(int y, int u, int v, int &r, int &g, int &b)
{ {
b = bound((76283*(y - 16) + 132252*(u - 128))>>16); b = bound((76283*(y - 16) + 132252*(u - 128))>>16);