From 42176205ce9ed9aa2408d4042a816fe5cd082519 Mon Sep 17 00:00:00 2001 From: iCatButler Date: Mon, 27 Jun 2016 15:28:33 +0100 Subject: Imporved CPU integration - Change PGXP integration to use wrapper functions - Use modified function lookup tables to call wrappers or default funnctions based on mode - Implement wrappers for interpreter too, recompiler sometimes calls interpreter functions - Add UI elements for selecting CPU modes - Only call precision version of NCLIP in modes where there are not going to be stale vertices in GTE registers - Added support for CP0 co-processor functions - Improve support for CPU functions (still broken in many games) - Improved debug output to show values for inputs before they're modified GPU plugin - Ignore stale vertices (occurs when CPU mode no longer writes to memory) - Add Cyan vertex colouring for stale vertices --- plugins/peopsxgl/pgxp_gpu.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'plugins') diff --git a/plugins/peopsxgl/pgxp_gpu.c b/plugins/peopsxgl/pgxp_gpu.c index 6ea3b41b..b097454e 100644 --- a/plugins/peopsxgl/pgxp_gpu.c +++ b/plugins/peopsxgl/pgxp_gpu.c @@ -278,18 +278,27 @@ int PGXP_GetVertices(unsigned int* addr, void* pOutput, int xOffs, int yOffs) for (unsigned i = 0; i < count; ++i) { - if (primStart && primStart[stride * i].valid) + if (primStart && primStart[stride * i].valid && (primStart[stride * i].value == *(unsigned int*)(&pPrimData[stride * i * 2]))) { pVertex[i].x = (primStart[stride * i].x + xOffs); pVertex[i].y = (primStart[stride * i].y + yOffs); pVertex[i].z = 0.95f; pVertex[i].w = primStart[stride * i].z; pVertex[i].PGXP_flag = 1; + + // Log incorrect vertices + //if (PGXP_tDebug && + // (fabs((float)pPrimData[stride * i * 2] - pVertex[i].x) > debug_tolerance) || + // (fabs((float)pPrimData[(stride * i * 2) + 1] - pVertex[i].y) > debug_tolerance)) + // __Log("GPPV: v:%x (%d, %d) pgxp(%f, %f)|\n", (currentAddr + 1 + (i * stride)) * 4, pPrimData[stride * i * 2], pPrimData[(stride * i * 2) + 1], pVertex[i].x, pVertex[i].y); } else { // Default to low precision vertex data - pVertex[i].PGXP_flag = 2; + if (primStart && primStart[stride * i].valid && primStart[stride * i].value != *(unsigned int*)(&pPrimData[stride * i * 2])) + pVertex[i].PGXP_flag = 6; + else + pVertex[i].PGXP_flag = 2; // Look in cache for valid vertex pCacheVert = PGXP_GetCachedVertex(pPrimData[stride * i * 2], pPrimData[(stride * i * 2) + 1]); @@ -312,8 +321,9 @@ int PGXP_GetVertices(unsigned int* addr, void* pOutput, int xOffs, int yOffs) } } - // if(PGXP_tDebug) - // __Log("GPPV: v:%x (%d, %d)|\n", (currentAddr + 1 + (i * stride))*4, pPrimData[stride * i * 2], pPrimData[(stride * i * 2) + 1]); + // Log unprocessed vertices + //if(PGXP_tDebug) + // __Log("GPPV: v:%x (%d, %d)|\n", (currentAddr + 1 + (i * stride))*4, pPrimData[stride * i * 2], pPrimData[(stride * i * 2) + 1]); } } @@ -332,13 +342,14 @@ int PGXP_GetVertices(unsigned int* addr, void* pOutput, int xOffs, int yOffs) unsigned int PGXP_vDebug = 0; const unsigned int PGXP_maxDebug = 3; -const char red[4] = { 255, 0, 0, 255 }; -const char blue[4] = { 0, 0, 255, 255 }; -const char green[4] = { 0, 255, 0, 255 }; +const char red[4] = { 255, 0, 0, 255 }; +const char blue[4] = { 0, 0, 255, 255 }; +const char green[4] = { 0, 255, 0, 255 }; -const char yellow[4] = { 255, 255, 0, 255 }; -const char magenta[4] = { 255, 0, 255, 255 }; -const char black[4] = { 0, 0, 0, 255 }; +const char yellow[4] = { 255, 255, 0, 255 }; +const char magenta[4] = { 255, 0, 255, 255 }; +const char cyan[4] = { 0, 255, 255, 255 }; +const char black[4] = { 0, 0, 0, 255 }; //void CALLBACK GPUtoggleDebug(void) @@ -380,6 +391,9 @@ void PGXP_colour(OGLVertex* vertex) case 4: pColour = magenta; break; + case 6: + pColour = cyan; + break; default: pColour = black; break; -- cgit v1.2.3