diff options
| author | 2015-02-23 18:24:35 -0500 | |
|---|---|---|
| committer | 2015-02-26 21:17:14 -0500 | |
| commit | c564c21668912b803947adddc166ff1315b218e4 (patch) | |
| tree | df5cf2de4044864e0b6698427d68daacba71937e /src/citra_qt/debugger/graphics_framebuffer.cpp | |
| parent | Merge pull request #612 from yuriks/fix-A4 (diff) | |
| download | yuzu-c564c21668912b803947adddc166ff1315b218e4.tar.gz yuzu-c564c21668912b803947adddc166ff1315b218e4.tar.xz yuzu-c564c21668912b803947adddc166ff1315b218e4.zip | |
GPU: Implemented bits 3 and 1 from the display transfer flags.
Bit 3 is used to specify a raw copy, where no processing is done to the data, seems to behave exactly as a DMA.
Bit 1 is used to specify whether to convert from a tiled format to a linear format or viceversa.
Diffstat (limited to 'src/citra_qt/debugger/graphics_framebuffer.cpp')
| -rw-r--r-- | src/citra_qt/debugger/graphics_framebuffer.cpp | 22 |
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 @@ | |||
| 9 | #include <QPushButton> | 9 | #include <QPushButton> |
| 10 | #include <QSpinBox> | 10 | #include <QSpinBox> |
| 11 | 11 | ||
| 12 | #include "core/hw/gpu.h" | ||
| 12 | #include "video_core/color.h" | 13 | #include "video_core/color.h" |
| 13 | #include "video_core/pica.h" | 14 | #include "video_core/pica.h" |
| 15 | #include "video_core/utils.h" | ||
| 14 | 16 | ||
| 15 | #include "graphics_framebuffer.h" | 17 | #include "graphics_framebuffer.h" |
| 16 | 18 | ||
| @@ -195,16 +197,20 @@ void GraphicsFramebufferWidget::OnUpdate() | |||
| 195 | 197 | ||
| 196 | // TODO: Implement a good way to visualize alpha components! | 198 | // TODO: Implement a good way to visualize alpha components! |
| 197 | // TODO: Unify this decoding code with the texture decoder | 199 | // TODO: Unify this decoding code with the texture decoder |
| 200 | u32 bytes_per_pixel = GPU::Regs::BytesPerPixel(GPU::Regs::PixelFormat(framebuffer_format)); | ||
| 201 | |||
| 198 | switch (framebuffer_format) { | 202 | switch (framebuffer_format) { |
| 199 | case Format::RGBA8: | 203 | case Format::RGBA8: |
| 200 | { | 204 | { |
| 201 | QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32); | 205 | QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32); |
| 202 | u32* color_buffer = (u32*)Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address)); | 206 | u8* color_buffer = Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address)); |
| 203 | for (unsigned int y = 0; y < framebuffer_height; ++y) { | 207 | for (unsigned int y = 0; y < framebuffer_height; ++y) { |
| 204 | for (unsigned int x = 0; x < framebuffer_width; ++x) { | 208 | for (unsigned int x = 0; x < framebuffer_width; ++x) { |
| 205 | u32 value = *(color_buffer + x + y * framebuffer_width); | 209 | const u32 coarse_y = y & ~7; |
| 210 | u32 offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * framebuffer_width * bytes_per_pixel; | ||
| 211 | u8* value = color_buffer + offset; | ||
| 206 | 212 | ||
| 207 | decoded_image.setPixel(x, y, qRgba((value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF, 255/*value >> 24*/)); | 213 | decoded_image.setPixel(x, y, qRgba(value[3], value[2], value[1], 255/*value >> 24*/)); |
| 208 | } | 214 | } |
| 209 | } | 215 | } |
| 210 | pixmap = QPixmap::fromImage(decoded_image); | 216 | pixmap = QPixmap::fromImage(decoded_image); |
| @@ -217,7 +223,9 @@ void GraphicsFramebufferWidget::OnUpdate() | |||
| 217 | u8* color_buffer = Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address)); | 223 | u8* color_buffer = Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address)); |
| 218 | for (unsigned int y = 0; y < framebuffer_height; ++y) { | 224 | for (unsigned int y = 0; y < framebuffer_height; ++y) { |
| 219 | for (unsigned int x = 0; x < framebuffer_width; ++x) { | 225 | for (unsigned int x = 0; x < framebuffer_width; ++x) { |
| 220 | u8* pixel_pointer = color_buffer + x * 3 + y * 3 * framebuffer_width; | 226 | const u32 coarse_y = y & ~7; |
| 227 | u32 offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * framebuffer_width * bytes_per_pixel; | ||
| 228 | u8* pixel_pointer = color_buffer + offset; | ||
| 221 | 229 | ||
| 222 | decoded_image.setPixel(x, y, qRgba(pixel_pointer[0], pixel_pointer[1], pixel_pointer[2], 255/*value >> 24*/)); | 230 | decoded_image.setPixel(x, y, qRgba(pixel_pointer[0], pixel_pointer[1], pixel_pointer[2], 255/*value >> 24*/)); |
| 223 | } | 231 | } |
| @@ -229,10 +237,12 @@ void GraphicsFramebufferWidget::OnUpdate() | |||
| 229 | case Format::RGBA5551: | 237 | case Format::RGBA5551: |
| 230 | { | 238 | { |
| 231 | QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32); | 239 | QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32); |
| 232 | u32* color_buffer = (u32*)Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address)); | 240 | u8* color_buffer = Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address)); |
| 233 | for (unsigned int y = 0; y < framebuffer_height; ++y) { | 241 | for (unsigned int y = 0; y < framebuffer_height; ++y) { |
| 234 | for (unsigned int x = 0; x < framebuffer_width; ++x) { | 242 | for (unsigned int x = 0; x < framebuffer_width; ++x) { |
| 235 | u16 value = *(u16*)(((u8*)color_buffer) + x * 2 + y * framebuffer_width * 2); | 243 | const u32 coarse_y = y & ~7; |
| 244 | u32 offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * framebuffer_width * bytes_per_pixel; | ||
| 245 | u16 value = *(u16*)(color_buffer + offset); | ||
| 236 | u8 r = Color::Convert5To8((value >> 11) & 0x1F); | 246 | u8 r = Color::Convert5To8((value >> 11) & 0x1F); |
| 237 | u8 g = Color::Convert5To8((value >> 6) & 0x1F); | 247 | u8 g = Color::Convert5To8((value >> 6) & 0x1F); |
| 238 | u8 b = Color::Convert5To8((value >> 1) & 0x1F); | 248 | u8 b = Color::Convert5To8((value >> 1) & 0x1F); |