summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
authorGravatar Tony Wasserka2014-08-24 17:23:02 +0200
committerGravatar Tony Wasserka2014-12-09 16:37:34 +0100
commit2793619dcef9fb2f97db5f0258ca950e18fe7f13 (patch)
tree47f0b608ca674d7dce921de2e11b10fc1ca9807a /src/video_core
parentcitra-qt: Add texture viewer to Pica command list. (diff)
downloadyuzu-2793619dcef9fb2f97db5f0258ca950e18fe7f13.tar.gz
yuzu-2793619dcef9fb2f97db5f0258ca950e18fe7f13.tar.xz
yuzu-2793619dcef9fb2f97db5f0258ca950e18fe7f13.zip
citra_qt: Add enhanced texture debugging widgets.
Double-clicking a texture parameter command in the pica command lists will spawn these as a new tab in the pica command list dock area.
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/debug_utils/debug_utils.cpp12
-rw-r--r--src/video_core/debug_utils/debug_utils.h4
-rw-r--r--src/video_core/pica.h15
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
382 return { source_ptr[2], source_ptr[1], source_ptr[0], 255 }; 382 return { source_ptr[2], source_ptr[1], source_ptr[0], 255 };
383} 383}
384 384
385TextureInfo TextureInfo::FromPicaRegister(const Regs::TextureConfig& config,
386 const Regs::TextureFormat& format)
387{
388 TextureInfo info;
389 info.address = config.GetPhysicalAddress();
390 info.width = config.width;
391 info.height = config.height;
392 info.format = format;
393 info.stride = Pica::Regs::BytesPerPixel(info.format) * info.width;
394 return info;
395}
396
385void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) { 397void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) {
386 // NOTE: Permanently enabling this just trashes hard disks for no reason. 398 // NOTE: Permanently enabling this just trashes hard disks for no reason.
387 // Hence, this is currently disabled. 399 // 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);
192std::unique_ptr<PicaTrace> FinishPicaTracing(); 192std::unique_ptr<PicaTrace> FinishPicaTracing();
193 193
194struct TextureInfo { 194struct TextureInfo {
195 unsigned int address;
195 int width; 196 int width;
196 int height; 197 int height;
197 int stride; 198 int stride;
198 Pica::Regs::TextureFormat format; 199 Pica::Regs::TextureFormat format;
200
201 static TextureInfo FromPicaRegister(const Pica::Regs::TextureConfig& config,
202 const Pica::Regs::TextureFormat& format);
199}; 203};
200 204
201const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const TextureInfo& info); 205const 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 {
130 // Seems like they are luminance formats and compressed textures. 130 // Seems like they are luminance formats and compressed textures.
131 }; 131 };
132 132
133 BitField<0, 1, u32> texturing_enable; 133 static unsigned BytesPerPixel(TextureFormat format) {
134 if (format == TextureFormat::RGBA8)
135 return 4;
136 else if (format == TextureFormat::RGB8)
137 return 3;
138 else if (format == TextureFormat::RGBA5551 ||
139 format == TextureFormat::RGB565 ||
140 format == TextureFormat::RGBA4)
141 return 2;
142 else // placeholder
143 return 1;
144 }
145
146 BitField< 0, 1, u32> texturing_enable;
134 TextureConfig texture0; 147 TextureConfig texture0;
135 INSERT_PADDING_WORDS(0x8); 148 INSERT_PADDING_WORDS(0x8);
136 BitField<0, 4, TextureFormat> texture0_format; 149 BitField<0, 4, TextureFormat> texture0_format;