summaryrefslogtreecommitdiff
path: root/src/citra_qt/debugger/graphics/graphics_surface.cpp
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2017-02-04 12:59:33 -0800
committerGravatar GitHub2017-02-04 12:59:33 -0800
commit18c981b99606b40897d8bc2da218e34509873246 (patch)
tree7b95528950ba5644b07c3c9340ebdadb0c41db3d /src/citra_qt/debugger/graphics/graphics_surface.cpp
parentchanged the WIN32 macro in microprofileui (#2528) (diff)
parentPica/Texture: Move part of ETC1 decoding to new file and cleanups (diff)
downloadyuzu-18c981b99606b40897d8bc2da218e34509873246.tar.gz
yuzu-18c981b99606b40897d8bc2da218e34509873246.tar.xz
yuzu-18c981b99606b40897d8bc2da218e34509873246.zip
Merge pull request #2414 from yuriks/texture-decode
Texture decoding cleanups
Diffstat (limited to 'src/citra_qt/debugger/graphics/graphics_surface.cpp')
-rw-r--r--src/citra_qt/debugger/graphics/graphics_surface.cpp20
1 files changed, 10 insertions, 10 deletions
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
23SurfacePicture::SurfacePicture(QWidget* parent, GraphicsSurfaceWidget* surface_widget_) 24SurfacePicture::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");