From 17fcd406fcf68059ee5c0e940d42e9bcdcd32842 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Mon, 5 Sep 2011 22:04:28 +0200 Subject: Merge some scissor rect related code to VideoCommon. --- Source/Core/VideoCommon/Src/BPStructs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/Src/BPStructs.cpp') diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index 42b5b2212a..cee68327f5 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -162,7 +162,7 @@ void BPWritten(const BPCmd& bp) case BPMEM_SCISSORTL: // Scissor Rectable Top, Left case BPMEM_SCISSORBR: // Scissor Rectable Bottom, Right case BPMEM_SCISSOROFFSET: // Scissor Offset - SetScissor(bp); + SetScissor(); break; case BPMEM_LINEPTWIDTH: // Line Width SetLineWidth(bp); -- cgit v1.2.3 From 852fe9c4bebb992aa91d7ba107ca15688ca87221 Mon Sep 17 00:00:00 2001 From: crudelios Date: Wed, 26 Oct 2011 01:19:10 +0100 Subject: Added proper Bounding Box support. Should fix most graphical issues with Paper Mario: TTYD and Super Paper Mario. Fixes issue 360. Since only those two games seem to require BBox support, and as per ector's suggestion, BBox is only enabled for those two games. BBoxes and Display List Caches don't get along too well, causing Paper Mario: TTYD to hang during certain effects where BBoxes are used. For now, I disabled DList Cache for the Paper Mario games, hopefully both will be compatible in the future. --- Source/Core/VideoCommon/Src/BPStructs.cpp | 44 +++++++++++++++---------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'Source/Core/VideoCommon/Src/BPStructs.cpp') diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index cee68327f5..d5909fdd95 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -257,9 +257,8 @@ void BPWritten(const BPCmd& bp) // We should be able to get away with deactivating the current bbox tracking // here. Not sure if there's a better spot to put this. // the number of lines copied is determined by the y scale * source efb height -#ifdef BBOX_SUPPORT + PixelEngine::bbox_active = false; -#endif float yScale; if (PE_copy.scale_invert) @@ -400,28 +399,29 @@ void BPWritten(const BPCmd& bp) case BPMEM_CLEARBBOX1: case BPMEM_CLEARBBOX2: { -#ifdef BBOX_SUPPORT - // which is which? these are GUESSES! - if (bp.address == BPMEM_CLEARBBOX1) { - int right = bp.newvalue >> 10; - int left = bp.newvalue & 0x3ff; + if(g_ActiveConfig.bUseBBox) + { + // which is which? these are GUESSES! + if (bp.address == BPMEM_CLEARBBOX1) { + int right = bp.newvalue >> 10; + int left = bp.newvalue & 0x3ff; - // We should only set these if bbox is calculated properly. - PixelEngine::bbox[0] = left; - PixelEngine::bbox[1] = right; - PixelEngine::bbox_active = true; - // WARN_LOG(VIDEO, "ClearBBox LR: %i, %08x - %i, %i", bp.address, bp.newvalue, left, right); - } else { - int bottom = bp.newvalue >> 10; - int top = bp.newvalue & 0x3ff; - - // We should only set these if bbox is calculated properly. - PixelEngine::bbox[2] = top; - PixelEngine::bbox[3] = bottom; - PixelEngine::bbox_active = true; - // WARN_LOG(VIDEO, "ClearBBox TB: %i, %08x - %i, %i", bp.address, bp.newvalue, top, bottom); + // We should only set these if bbox is calculated properly. + PixelEngine::bbox[0] = left; + PixelEngine::bbox[1] = right; + PixelEngine::bbox_active = true; + // WARN_LOG(VIDEO, "ClearBBox LR: %i, %08x - %i, %i", bp.address, bp.newvalue, left, right); + } else { + int bottom = bp.newvalue >> 10; + int top = bp.newvalue & 0x3ff; + + // We should only set these if bbox is calculated properly. + PixelEngine::bbox[2] = top; + PixelEngine::bbox[3] = bottom; + PixelEngine::bbox_active = true; + // WARN_LOG(VIDEO, "ClearBBox TB: %i, %08x - %i, %i", bp.address, bp.newvalue, top, bottom); + } } -#endif } break; case BPMEM_TEXINVALIDATE: // Used, if game has manual control the Texture Cache, which we don't allow -- cgit v1.2.3 From dd551814c9c160c1dd33ed0f29e722e73fb43eca Mon Sep 17 00:00:00 2001 From: crudelios Date: Fri, 28 Oct 2011 21:12:12 +0100 Subject: Bounding Box bugfixes. - Fixes all (I hope) BBox-related unknown pointer crashes. - Fixes wrong BBox values with Frame Skip on (and the resulting unknown pointer crashes). - Fixes a small oversight on the change I made to the ISO Properties dialog. This should also be a (very very little) bit faster than the previous version. --- Source/Core/VideoCommon/Src/BPStructs.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoCommon/Src/BPStructs.cpp') diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index d5909fdd95..d06f1de8b9 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -37,6 +37,8 @@ u32 mapTexAddress; bool mapTexFound; int numWrites; +extern volatile bool g_bSkipCurrentFrame; + static const float s_gammaLUT[] = { 1.0f, @@ -401,7 +403,11 @@ void BPWritten(const BPCmd& bp) { if(g_ActiveConfig.bUseBBox) { - // which is which? these are GUESSES! + // Don't compute bounding box if this frame is being skipped! + // Wrong but valid values are better than bogus values... + if(g_bSkipCurrentFrame) + break; + if (bp.address == BPMEM_CLEARBBOX1) { int right = bp.newvalue >> 10; int left = bp.newvalue & 0x3ff; @@ -410,7 +416,6 @@ void BPWritten(const BPCmd& bp) PixelEngine::bbox[0] = left; PixelEngine::bbox[1] = right; PixelEngine::bbox_active = true; - // WARN_LOG(VIDEO, "ClearBBox LR: %i, %08x - %i, %i", bp.address, bp.newvalue, left, right); } else { int bottom = bp.newvalue >> 10; int top = bp.newvalue & 0x3ff; @@ -419,7 +424,6 @@ void BPWritten(const BPCmd& bp) PixelEngine::bbox[2] = top; PixelEngine::bbox[3] = bottom; PixelEngine::bbox_active = true; - // WARN_LOG(VIDEO, "ClearBBox TB: %i, %08x - %i, %i", bp.address, bp.newvalue, top, bottom); } } } -- cgit v1.2.3 From dabb35afce2539b312935d2fcfe264018d24dbec Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sun, 29 Jan 2012 21:17:22 +0100 Subject: Prepare texture preloading support --- Source/Core/VideoCommon/Src/BPStructs.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'Source/Core/VideoCommon/Src/BPStructs.cpp') diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index d06f1de8b9..6cb102555b 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -30,6 +30,7 @@ #include "VertexLoader.h" #include "VertexShaderManager.h" #include "Thread.h" +#include "HW/Memmap.h" using namespace BPFunctions; @@ -301,14 +302,14 @@ void BPWritten(const BPCmd& bp) // TODO - figure out a cleaner way. if (GetConfig(CONFIG_ISWII)) - ptr = GetPointer(bpmem.tlutXferSrc << 5); + ptr = GetPointer(bpmem.tmem_config.tlut_src << 5); else - ptr = GetPointer((bpmem.tlutXferSrc & 0xFFFFF) << 5); + ptr = GetPointer((bpmem.tmem_config.tlut_src & 0xFFFFF) << 5); if (ptr) memcpy_gc(texMem + tlutTMemAddr, ptr, tlutXferCount); else - PanicAlert("Invalid palette pointer %08x %08x %08x", bpmem.tlutXferSrc, bpmem.tlutXferSrc << 5, (bpmem.tlutXferSrc & 0xFFFFF)<< 5); + PanicAlert("Invalid palette pointer %08x %08x %08x", bpmem.tmem_config.tlut_src, bpmem.tmem_config.tlut_src << 5, (bpmem.tmem_config.tlut_src & 0xFFFFF)<< 5); // TODO(ector) : kill all textures that use this palette // Not sure if it's a good idea, though. For now, we hash texture palettes @@ -466,14 +467,22 @@ void BPWritten(const BPCmd& bp) DEBUG_LOG(VIDEO, "Uknown BP Reg 0x57: %08x", bp.newvalue); break; - case BPMEM_UNKNOWN_60: - case BPMEM_UNKNOWN_61: - case BPMEM_UNKNOWN_62: - // Cases added due to: http://code.google.com/p/dolphin-emu/issues/detail?id=360#c90 - // Are these related to BBox? + case BPMEM_PRELOAD_ADDR: + case BPMEM_PRELOAD_TMEMEVEN: + case BPMEM_PRELOAD_TMEMODD: // Used when PRELOAD_MODE is set break; - case BPMEM_TEXMODESYNC: // Always set to 0 when GX_TexModeSync() is called. + case BPMEM_PRELOAD_MODE: // Set to 0 when GX_TexModeSync() is called. + // if this is different from 0, manual TMEM management is used. + if (bp.newvalue != 0) + { + // NOTE(neobrain): Apparently tmemodd doesn't affect hardware behavior at all (libogc uses it just as a buffer and switches its contents with tmemeven whenever this is called) + BPS_TmemConfig& tmem_cfg = bpmem.tmem_config; + u8* ram_ptr = Memory::GetPointer(tmem_cfg.preload_addr << 5); + u32 tmem_addr = tmem_cfg.preload_tmem_even * TMEM_LINE_SIZE; + u32 size = tmem_cfg.preload_tile_info.count * 32; + memcpy(texMem + tmem_addr, ram_ptr, size); + } break; // ------------------------------------------------ -- cgit v1.2.3