diff options
| author | SND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-07-10 10:29:30 +0000 |
|---|---|---|
| committer | SND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-07-10 10:29:30 +0000 |
| commit | 5ba139a4c3cc15420762bb4a75ca36f7c936213b (patch) | |
| tree | d4313de8bb04b5bc2d545b79650cf1e30f94a188 /libpcsxcore | |
| parent | 0bc644c921fe94e9d83599257bbc59544e83616b (diff) | |
| download | pcsxr-5ba139a4c3cc15420762bb4a75ca36f7c936213b.tar.gz | |
gpu gte acuracy interface.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@68598 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'libpcsxcore')
| -rw-r--r-- | libpcsxcore/gte.c | 27 | ||||
| -rw-r--r-- | libpcsxcore/plugins.c | 3 | ||||
| -rw-r--r-- | libpcsxcore/plugins.h | 2 |
3 files changed, 32 insertions, 0 deletions
diff --git a/libpcsxcore/gte.c b/libpcsxcore/gte.c index 3bc6f11a..be004384 100644 --- a/libpcsxcore/gte.c +++ b/libpcsxcore/gte.c @@ -208,11 +208,22 @@ static inline u32 limE(u32 result) { return result; } +static inline float flimE(float result) { + if (result > 0x1ffff) { + gteFLAG |= (1 << 31) | (1 << 17); + return 0x1ffff; + } + return result; +} + #define F(a) BOUNDS((a), 0x7fffffff, (1 << 31) | (1 << 16), -(s64)0x80000000, (1 << 31) | (1 << 15)) #define limG1(a) LIM((a), 0x3ff, -0x400, (1 << 31) | (1 << 14)) #define limG2(a) LIM((a), 0x3ff, -0x400, (1 << 31) | (1 << 13)) #define limH(a) LIM((a), 0x1000, 0x0000, (1 << 12))
+#define limG1_ia(a) LIM((a), 0x3ffffff, -0x4000000, (1 << 31) | (1 << 14)) +#define limG2_ia(a) LIM((a), 0x3ffffff, -0x4000000, (1 << 31) | (1 << 13)) + #include "gte_divider.h" static inline u32 MFC2(int reg) { @@ -371,6 +382,7 @@ void gteSWC2() { void gteRTPS() { int quotient; + float fquotient; #ifdef GTE_LOG GTE_LOG("GTE RTPS\n"); @@ -393,12 +405,20 @@ void gteRTPS() { gteSX2 = limG1(F((s64)gteOFX + ((s64)gteIR1 * quotient)) >> 16); gteSY2 = limG2(F((s64)gteOFY + ((s64)gteIR2 * quotient)) >> 16); + fquotient = flimE((float)(gteH << 16) / (float)gteSZ3); + GPU_addVertex(gteSX2, + gteSY2, + limG1_ia((s64)gteOFX + (s64)(gteIR1 * fquotient)), // TODO: MAC1 calc instead of IR1. + limG2_ia((s64)gteOFY + (s64)(gteIR2 * fquotient)), // TODO: MAC2 calc instead of IR2. + ((s64)gteSZ3)); // TODO: MAC3 calc instead of SZ3. + gteMAC0 = F((s64)gteDQB + ((s64)gteDQA * quotient)); gteIR0 = limH(gteMAC0 >> 12); } void gteRTPT() { int quotient; + float fquotient; int v; s32 vx, vy, vz; @@ -422,6 +442,13 @@ void gteRTPT() { quotient = limE(DIVIDE(gteH, fSZ(v))); fSX(v) = limG1(F((s64)gteOFX + ((s64)gteIR1 * quotient)) >> 16); fSY(v) = limG2(F((s64)gteOFY + ((s64)gteIR2 * quotient)) >> 16); + + fquotient = flimE((float)(gteH << 16) / (float)fSZ(v)); + GPU_addVertex(fSX(v), + fSY(v), + limG1_ia((s64)gteOFX + (s64)(gteIR1 * fquotient)), // TODO: MAC1 calc instead of IR1. + limG2_ia((s64)gteOFY + (s64)(gteIR2 * fquotient)), // TODO: MAC2 calc instead of IR2. + ((s64)fSZ(v))); // TODO: MAC3 calc instead of fSZ(v). } gteMAC0 = F((s64)gteDQB + ((s64)gteDQA * quotient)); gteIR0 = limH(gteMAC0 >> 12); diff --git a/libpcsxcore/plugins.c b/libpcsxcore/plugins.c index dca6e7b6..28c9c327 100644 --- a/libpcsxcore/plugins.c +++ b/libpcsxcore/plugins.c @@ -54,6 +54,7 @@ GPUregisterCallback GPU_registerCallback; GPUidle GPU_idle;
GPUvisualVibration GPU_visualVibration;
GPUcursor GPU_cursor;
+GPUaddVertex GPU_addVertex;
CDRinit CDR_init;
CDRshutdown CDR_shutdown;
@@ -223,6 +224,7 @@ void CALLBACK GPU__registerCallback(void (CALLBACK *callback)(int)) {} void CALLBACK GPU__idle(void) {}
void CALLBACK GPU__visualVibration(unsigned long iSmall, unsigned long iBig) {}
void CALLBACK GPU__cursor(int player, int x, int y) {}
+void CALLBACK GPU__addVertex(short sx,short sy,s64 fx,s64 fy,s64 fz) {}
#define LoadGpuSym1(dest, name) \
LoadSym(GPU_##dest, GPU##dest, name, TRUE);
@@ -267,6 +269,7 @@ static int LoadGPUplugin(const char *GPUdll) { LoadGpuSym0(idle, "GPUidle");
LoadGpuSym0(visualVibration, "GPUvisualVibration");
LoadGpuSym0(cursor, "GPUcursor");
+ LoadGpuSym0(addVertex, "GPUaddVertex");
LoadGpuSym0(configure, "GPUconfigure");
LoadGpuSym0(test, "GPUtest");
LoadGpuSym0(about, "GPUabout");
diff --git a/libpcsxcore/plugins.h b/libpcsxcore/plugins.h index 4a90c367..cf2dbdff 100644 --- a/libpcsxcore/plugins.h +++ b/libpcsxcore/plugins.h @@ -98,6 +98,7 @@ typedef void (CALLBACK* GPUregisterCallback)(void (CALLBACK *callback)(int)); typedef void (CALLBACK* GPUidle)(void);
typedef void (CALLBACK* GPUvisualVibration)(uint32_t, uint32_t);
typedef void (CALLBACK* GPUcursor)(int, int, int);
+ typedef void (CALLBACK* GPUaddVertex)(short,short,s64,s64,s64);
// GPU function pointers
extern GPUupdateLace GPU_updateLace;
@@ -127,6 +128,7 @@ extern GPUregisterCallback GPU_registerCallback; extern GPUidle GPU_idle;
extern GPUvisualVibration GPU_visualVibration;
extern GPUcursor GPU_cursor;
+extern GPUaddVertex GPU_addVertex;
// CD-ROM Functions
typedef long (CALLBACK* CDRinit)(void);
|
