From ba7b7522be943aabfe64977db064751ff07a72ee Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Tue, 3 Nov 2015 22:41:38 +1300 Subject: [PATCH] BPStructs: add debug info for texture setup. --- Source/Core/VideoCommon/BPStructs.cpp | 43 ++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index 4e3df7cc00..549ad19b08 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -726,8 +726,9 @@ void GetBPRegInfo(const u8* data, std::string* name, std::string* desc) { const char* no_yes[2] = { "No", "Yes" }; + u8 cmd = data[0]; u32 cmddata = Common::swap32(*(u32*)data) & 0xFFFFFF; - switch (data[0]) + switch (cmd) { // Macro to set the register name and make sure it was written correctly via compile time assertion #define SetRegName(reg) \ @@ -1128,8 +1129,16 @@ void GetBPRegInfo(const u8* data, std::string* name, std::string* desc) case BPMEM_TX_SETIMAGE0_4+1: case BPMEM_TX_SETIMAGE0_4+2: case BPMEM_TX_SETIMAGE0_4+3: - SetRegName(BPMEM_TX_SETIMAGE0); - // TODO: Description + { + SetRegName(BPMEM_TX_SETIMAGE0); + int texnum = (cmd < BPMEM_TX_SETIMAGE0_4) ? cmd - BPMEM_TX_SETIMAGE0 : cmd - BPMEM_TX_SETIMAGE0_4 + 4; + TexImage0 teximg; teximg.hex = cmddata; + *desc = StringFromFormat("Texture Unit: %i\n" + "Width: %i\n" + "Height: %i\n" + "Format: %x\n", + texnum, teximg.width+1, teximg.height+1, teximg.format); + } break; case BPMEM_TX_SETIMAGE1: // 0x8C @@ -1140,8 +1149,17 @@ void GetBPRegInfo(const u8* data, std::string* name, std::string* desc) case BPMEM_TX_SETIMAGE1_4+1: case BPMEM_TX_SETIMAGE1_4+2: case BPMEM_TX_SETIMAGE1_4+3: - SetRegName(BPMEM_TX_SETIMAGE1); - // TODO: Description + { + SetRegName(BPMEM_TX_SETIMAGE1); + int texnum = (cmd < BPMEM_TX_SETIMAGE1_4) ? cmd - BPMEM_TX_SETIMAGE1 : cmd - BPMEM_TX_SETIMAGE1_4 + 4; + TexImage1 teximg; teximg.hex = cmddata; + *desc = StringFromFormat("Texture Unit: %i\n" + "Even TMEM Offset: %x\n" + "Even TMEM Width: %i\n" + "Even TMEM Height: %i\n" + "Cache is manually managed: %s\n", + texnum, teximg.tmem_even, teximg.cache_width, teximg.cache_height, no_yes[teximg.image_type]); + } break; case BPMEM_TX_SETIMAGE2: // 0x90 @@ -1152,8 +1170,16 @@ void GetBPRegInfo(const u8* data, std::string* name, std::string* desc) case BPMEM_TX_SETIMAGE2_4+1: case BPMEM_TX_SETIMAGE2_4+2: case BPMEM_TX_SETIMAGE2_4+3: - SetRegName(BPMEM_TX_SETIMAGE2); - // TODO: Description + { + SetRegName(BPMEM_TX_SETIMAGE2); + int texnum = (cmd < BPMEM_TX_SETIMAGE2_4) ? cmd - BPMEM_TX_SETIMAGE2 : cmd - BPMEM_TX_SETIMAGE2_4 + 4; + TexImage2 teximg; teximg.hex = cmddata; + *desc = StringFromFormat("Texture Unit: %i\n" + "Odd TMEM Offset: %x\n" + "Odd TMEM Width: %i\n" + "Odd TMEM Height: %i\n", + texnum, teximg.tmem_odd, teximg.cache_width, teximg.cache_height); + } break; case BPMEM_TX_SETIMAGE3: // 0x94 @@ -1166,8 +1192,9 @@ void GetBPRegInfo(const u8* data, std::string* name, std::string* desc) case BPMEM_TX_SETIMAGE3_4+3: { SetRegName(BPMEM_TX_SETIMAGE3); + int texnum = (cmd < BPMEM_TX_SETIMAGE3_4) ? cmd - BPMEM_TX_SETIMAGE3 : cmd - BPMEM_TX_SETIMAGE3_4 + 4; TexImage3 teximg; teximg.hex = cmddata; - *desc = StringFromFormat("Source address (32 byte aligned): 0x%06X", teximg.image_base << 5); + *desc = StringFromFormat("Texture %i source address (32 byte aligned): 0x%06X", texnum, teximg.image_base << 5); } break;