diff options
Diffstat (limited to '')
-rw-r--r-- | src/video_core/debug_utils/debug_utils.cpp | 12 | ||||
-rw-r--r-- | src/video_core/debug_utils/debug_utils.h | 4 | ||||
-rw-r--r-- | src/video_core/pica.h | 15 |
3 files changed, 30 insertions, 1 deletions
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index 59909c827..31ce09faf 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp @@ -382,6 +382,18 @@ const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const Texture return { source_ptr[2], source_ptr[1], source_ptr[0], 255 }; } +TextureInfo TextureInfo::FromPicaRegister(const Regs::TextureConfig& config, + const Regs::TextureFormat& format) +{ + TextureInfo info; + info.address = config.GetPhysicalAddress(); + info.width = config.width; + info.height = config.height; + info.format = format; + info.stride = Pica::Regs::BytesPerPixel(info.format) * info.width; + return info; +} + void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) { // NOTE: Permanently enabling this just trashes hard disks for no reason. // Hence, this is currently disabled. diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index bad4c919a..51f14f12f 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h @@ -192,10 +192,14 @@ void OnPicaRegWrite(u32 id, u32 value); std::unique_ptr<PicaTrace> FinishPicaTracing(); struct TextureInfo { + unsigned int address; int width; int height; int stride; Pica::Regs::TextureFormat format; + + static TextureInfo FromPicaRegister(const Pica::Regs::TextureConfig& config, + const Pica::Regs::TextureFormat& format); }; const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const TextureInfo& info); diff --git a/src/video_core/pica.h b/src/video_core/pica.h index 10fa73355..c1f35a011 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -130,7 +130,20 @@ struct Regs { // Seems like they are luminance formats and compressed textures. }; - BitField<0, 1, u32> texturing_enable; + static unsigned BytesPerPixel(TextureFormat format) { + if (format == TextureFormat::RGBA8) + return 4; + else if (format == TextureFormat::RGB8) + return 3; + else if (format == TextureFormat::RGBA5551 || + format == TextureFormat::RGB565 || + format == TextureFormat::RGBA4) + return 2; + else // placeholder + return 1; + } + + BitField< 0, 1, u32> texturing_enable; TextureConfig texture0; INSERT_PADDING_WORDS(0x8); BitField<0, 4, TextureFormat> texture0_format; |