diff options
Diffstat (limited to 'src/citra_qt/debugger')
| -rw-r--r-- | src/citra_qt/debugger/graphics/graphics_cmdlists.cpp | 10 | ||||
| -rw-r--r-- | src/citra_qt/debugger/graphics/graphics_surface.cpp | 20 |
2 files changed, 16 insertions, 14 deletions
diff --git a/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp index f5a2ec761..ee79f0edf 100644 --- a/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp +++ b/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp | |||
| @@ -20,13 +20,14 @@ | |||
| 20 | #include "video_core/debug_utils/debug_utils.h" | 20 | #include "video_core/debug_utils/debug_utils.h" |
| 21 | #include "video_core/pica.h" | 21 | #include "video_core/pica.h" |
| 22 | #include "video_core/pica_state.h" | 22 | #include "video_core/pica_state.h" |
| 23 | #include "video_core/texture/texture_decode.h" | ||
| 23 | 24 | ||
| 24 | namespace { | 25 | namespace { |
| 25 | QImage LoadTexture(const u8* src, const Pica::DebugUtils::TextureInfo& info) { | 26 | QImage LoadTexture(const u8* src, const Pica::Texture::TextureInfo& info) { |
| 26 | QImage decoded_image(info.width, info.height, QImage::Format_ARGB32); | 27 | QImage decoded_image(info.width, info.height, QImage::Format_ARGB32); |
| 27 | for (int y = 0; y < info.height; ++y) { | 28 | for (int y = 0; y < info.height; ++y) { |
| 28 | for (int x = 0; x < info.width; ++x) { | 29 | for (int x = 0; x < info.width; ++x) { |
| 29 | Math::Vec4<u8> color = Pica::DebugUtils::LookupTexture(src, x, y, info, true); | 30 | Math::Vec4<u8> color = Pica::Texture::LookupTexture(src, x, y, info, true); |
| 30 | decoded_image.setPixel(x, y, qRgba(color.r(), color.g(), color.b(), color.a())); | 31 | decoded_image.setPixel(x, y, qRgba(color.r(), color.g(), color.b(), color.a())); |
| 31 | } | 32 | } |
| 32 | } | 33 | } |
| @@ -36,9 +37,10 @@ QImage LoadTexture(const u8* src, const Pica::DebugUtils::TextureInfo& info) { | |||
| 36 | 37 | ||
| 37 | class TextureInfoWidget : public QWidget { | 38 | class TextureInfoWidget : public QWidget { |
| 38 | public: | 39 | public: |
| 39 | TextureInfoWidget(const u8* src, const Pica::DebugUtils::TextureInfo& info, | 40 | TextureInfoWidget(const u8* src, const Pica::Texture::TextureInfo& info, |
| 40 | QWidget* parent = nullptr) | 41 | QWidget* parent = nullptr) |
| 41 | : QWidget(parent) { | 42 | : QWidget(parent) { |
| 43 | |||
| 42 | QLabel* image_widget = new QLabel; | 44 | QLabel* image_widget = new QLabel; |
| 43 | QPixmap image_pixmap = QPixmap::fromImage(LoadTexture(src, info)); | 45 | QPixmap image_pixmap = QPixmap::fromImage(LoadTexture(src, info)); |
| 44 | image_pixmap = image_pixmap.scaled(200, 100, Qt::KeepAspectRatio, Qt::SmoothTransformation); | 46 | image_pixmap = image_pixmap.scaled(200, 100, Qt::KeepAspectRatio, Qt::SmoothTransformation); |
| @@ -160,7 +162,7 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) { | |||
| 160 | const auto config = texture.config; | 162 | const auto config = texture.config; |
| 161 | const auto format = texture.format; | 163 | const auto format = texture.format; |
| 162 | 164 | ||
| 163 | const auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format); | 165 | const auto info = Pica::Texture::TextureInfo::FromPicaRegister(config, format); |
| 164 | const u8* src = Memory::GetPhysicalPointer(config.GetPhysicalAddress()); | 166 | const u8* src = Memory::GetPhysicalPointer(config.GetPhysicalAddress()); |
| 165 | new_info_widget = new TextureInfoWidget(src, info); | 167 | new_info_widget = new TextureInfoWidget(src, info); |
| 166 | } | 168 | } |
diff --git a/src/citra_qt/debugger/graphics/graphics_surface.cpp b/src/citra_qt/debugger/graphics/graphics_surface.cpp index 4efd95d3c..bd82b00d4 100644 --- a/src/citra_qt/debugger/graphics/graphics_surface.cpp +++ b/src/citra_qt/debugger/graphics/graphics_surface.cpp | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include "core/memory.h" | 18 | #include "core/memory.h" |
| 19 | #include "video_core/pica.h" | 19 | #include "video_core/pica.h" |
| 20 | #include "video_core/pica_state.h" | 20 | #include "video_core/pica_state.h" |
| 21 | #include "video_core/texture/texture_decode.h" | ||
| 21 | #include "video_core/utils.h" | 22 | #include "video_core/utils.h" |
| 22 | 23 | ||
| 23 | SurfacePicture::SurfacePicture(QWidget* parent, GraphicsSurfaceWidget* surface_widget_) | 24 | SurfacePicture::SurfacePicture(QWidget* parent, GraphicsSurfaceWidget* surface_widget_) |
| @@ -512,7 +513,7 @@ void GraphicsSurfaceWidget::OnUpdate() { | |||
| 512 | } | 513 | } |
| 513 | 514 | ||
| 514 | const auto texture = Pica::g_state.regs.GetTextures()[texture_index]; | 515 | const auto texture = Pica::g_state.regs.GetTextures()[texture_index]; |
| 515 | auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(texture.config, texture.format); | 516 | auto info = Pica::Texture::TextureInfo::FromPicaRegister(texture.config, texture.format); |
| 516 | 517 | ||
| 517 | surface_address = info.physical_address; | 518 | surface_address = info.physical_address; |
| 518 | surface_width = info.width; | 519 | surface_width = info.width; |
| @@ -567,28 +568,27 @@ void GraphicsSurfaceWidget::OnUpdate() { | |||
| 567 | 568 | ||
| 568 | surface_picture_label->show(); | 569 | surface_picture_label->show(); |
| 569 | 570 | ||
| 570 | unsigned nibbles_per_pixel = GraphicsSurfaceWidget::NibblesPerPixel(surface_format); | ||
| 571 | unsigned stride = nibbles_per_pixel * surface_width / 2; | ||
| 572 | |||
| 573 | // We handle depth formats here because DebugUtils only supports TextureFormats | ||
| 574 | if (surface_format <= Format::MaxTextureFormat) { | 571 | if (surface_format <= Format::MaxTextureFormat) { |
| 575 | |||
| 576 | // Generate a virtual texture | 572 | // Generate a virtual texture |
| 577 | Pica::DebugUtils::TextureInfo info; | 573 | Pica::Texture::TextureInfo info; |
| 578 | info.physical_address = surface_address; | 574 | info.physical_address = surface_address; |
| 579 | info.width = surface_width; | 575 | info.width = surface_width; |
| 580 | info.height = surface_height; | 576 | info.height = surface_height; |
| 581 | info.format = static_cast<Pica::Regs::TextureFormat>(surface_format); | 577 | info.format = static_cast<Pica::Regs::TextureFormat>(surface_format); |
| 582 | info.stride = stride; | 578 | info.SetDefaultStride(); |
| 583 | 579 | ||
| 584 | for (unsigned int y = 0; y < surface_height; ++y) { | 580 | for (unsigned int y = 0; y < surface_height; ++y) { |
| 585 | for (unsigned int x = 0; x < surface_width; ++x) { | 581 | for (unsigned int x = 0; x < surface_width; ++x) { |
| 586 | Math::Vec4<u8> color = Pica::DebugUtils::LookupTexture(buffer, x, y, info, true); | 582 | Math::Vec4<u8> color = Pica::Texture::LookupTexture(buffer, x, y, info, true); |
| 587 | decoded_image.setPixel(x, y, qRgba(color.r(), color.g(), color.b(), color.a())); | 583 | decoded_image.setPixel(x, y, qRgba(color.r(), color.g(), color.b(), color.a())); |
| 588 | } | 584 | } |
| 589 | } | 585 | } |
| 590 | |||
| 591 | } else { | 586 | } else { |
| 587 | // We handle depth formats here because DebugUtils only supports TextureFormats | ||
| 588 | |||
| 589 | // TODO(yuriks): Convert to newer tile-based addressing | ||
| 590 | unsigned nibbles_per_pixel = GraphicsSurfaceWidget::NibblesPerPixel(surface_format); | ||
| 591 | unsigned stride = nibbles_per_pixel * surface_width / 2; | ||
| 592 | 592 | ||
| 593 | ASSERT_MSG(nibbles_per_pixel >= 2, | 593 | ASSERT_MSG(nibbles_per_pixel >= 2, |
| 594 | "Depth decoder only supports formats with at least one byte per pixel"); | 594 | "Depth decoder only supports formats with at least one byte per pixel"); |