summaryrefslogtreecommitdiffstats
path: root/src/citra_qt
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2015-02-24 00:24:35 +0100
committerSubv <subv2112@gmail.com>2015-02-27 03:17:14 +0100
commitc564c21668912b803947adddc166ff1315b218e4 (patch)
treedf5cf2de4044864e0b6698427d68daacba71937e /src/citra_qt
parentMerge pull request #612 from yuriks/fix-A4 (diff)
downloadyuzu-c564c21668912b803947adddc166ff1315b218e4.tar
yuzu-c564c21668912b803947adddc166ff1315b218e4.tar.gz
yuzu-c564c21668912b803947adddc166ff1315b218e4.tar.bz2
yuzu-c564c21668912b803947adddc166ff1315b218e4.tar.lz
yuzu-c564c21668912b803947adddc166ff1315b218e4.tar.xz
yuzu-c564c21668912b803947adddc166ff1315b218e4.tar.zst
yuzu-c564c21668912b803947adddc166ff1315b218e4.zip
Diffstat (limited to 'src/citra_qt')
-rw-r--r--src/citra_qt/debugger/graphics_framebuffer.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/citra_qt/debugger/graphics_framebuffer.cpp b/src/citra_qt/debugger/graphics_framebuffer.cpp
index 1ba60021f..574f19cc1 100644
--- a/src/citra_qt/debugger/graphics_framebuffer.cpp
+++ b/src/citra_qt/debugger/graphics_framebuffer.cpp
@@ -9,8 +9,10 @@
#include <QPushButton>
#include <QSpinBox>
+#include "core/hw/gpu.h"
#include "video_core/color.h"
#include "video_core/pica.h"
+#include "video_core/utils.h"
#include "graphics_framebuffer.h"
@@ -195,16 +197,20 @@ void GraphicsFramebufferWidget::OnUpdate()
// TODO: Implement a good way to visualize alpha components!
// TODO: Unify this decoding code with the texture decoder
+ u32 bytes_per_pixel = GPU::Regs::BytesPerPixel(GPU::Regs::PixelFormat(framebuffer_format));
+
switch (framebuffer_format) {
case Format::RGBA8:
{
QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32);
- u32* color_buffer = (u32*)Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address));
+ u8* color_buffer = Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address));
for (unsigned int y = 0; y < framebuffer_height; ++y) {
for (unsigned int x = 0; x < framebuffer_width; ++x) {
- u32 value = *(color_buffer + x + y * framebuffer_width);
+ const u32 coarse_y = y & ~7;
+ u32 offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * framebuffer_width * bytes_per_pixel;
+ u8* value = color_buffer + offset;
- decoded_image.setPixel(x, y, qRgba((value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF, 255/*value >> 24*/));
+ decoded_image.setPixel(x, y, qRgba(value[3], value[2], value[1], 255/*value >> 24*/));
}
}
pixmap = QPixmap::fromImage(decoded_image);
@@ -217,7 +223,9 @@ void GraphicsFramebufferWidget::OnUpdate()
u8* color_buffer = Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address));
for (unsigned int y = 0; y < framebuffer_height; ++y) {
for (unsigned int x = 0; x < framebuffer_width; ++x) {
- u8* pixel_pointer = color_buffer + x * 3 + y * 3 * framebuffer_width;
+ const u32 coarse_y = y & ~7;
+ u32 offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * framebuffer_width * bytes_per_pixel;
+ u8* pixel_pointer = color_buffer + offset;
decoded_image.setPixel(x, y, qRgba(pixel_pointer[0], pixel_pointer[1], pixel_pointer[2], 255/*value >> 24*/));
}
@@ -229,10 +237,12 @@ void GraphicsFramebufferWidget::OnUpdate()
case Format::RGBA5551:
{
QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32);
- u32* color_buffer = (u32*)Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address));
+ u8* color_buffer = Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address));
for (unsigned int y = 0; y < framebuffer_height; ++y) {
for (unsigned int x = 0; x < framebuffer_width; ++x) {
- u16 value = *(u16*)(((u8*)color_buffer) + x * 2 + y * framebuffer_width * 2);
+ const u32 coarse_y = y & ~7;
+ u32 offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * framebuffer_width * bytes_per_pixel;
+ u16 value = *(u16*)(color_buffer + offset);
u8 r = Color::Convert5To8((value >> 11) & 0x1F);
u8 g = Color::Convert5To8((value >> 6) & 0x1F);
u8 b = Color::Convert5To8((value >> 1) & 0x1F);