summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-02-22 20:54:56 +0100
committerbunnei <bunneidev@gmail.com>2015-02-22 20:54:56 +0100
commit89a71eb6a45a7a764da1b48fd7da34e9dde50418 (patch)
tree08ed5f34ea8e1c12214937575b4d8bc90bf34df1 /src
parentMerge pull request #597 from bunnei/fix-color-component-order (diff)
parentGPU: Add support for more framebuffer formats in display transfers. (diff)
downloadyuzu-89a71eb6a45a7a764da1b48fd7da34e9dde50418.tar
yuzu-89a71eb6a45a7a764da1b48fd7da34e9dde50418.tar.gz
yuzu-89a71eb6a45a7a764da1b48fd7da34e9dde50418.tar.bz2
yuzu-89a71eb6a45a7a764da1b48fd7da34e9dde50418.tar.lz
yuzu-89a71eb6a45a7a764da1b48fd7da34e9dde50418.tar.xz
yuzu-89a71eb6a45a7a764da1b48fd7da34e9dde50418.tar.zst
yuzu-89a71eb6a45a7a764da1b48fd7da34e9dde50418.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/hw/gpu.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp
index 536672924..880023529 100644
--- a/src/core/hw/gpu.cpp
+++ b/src/core/hw/gpu.cpp
@@ -19,6 +19,7 @@
#include "video_core/command_processor.h"
#include "video_core/video_core.h"
+#include <video_core/color.h>
namespace GPU {
@@ -140,6 +141,26 @@ inline void Write(u32 addr, const T data) {
break;
}
+ case Regs::PixelFormat::RGB5A1:
+ {
+ u16 srcval = *(u16*)(source_pointer + x * 4 * pixel_skip + y * config.input_width * 4 * pixel_skip);
+ source_color.r = Color::Convert5To8((srcval >> 11) & 0x1F); // red
+ source_color.g = Color::Convert5To8((srcval >> 6) & 0x1F); // green
+ source_color.b = Color::Convert5To8((srcval >> 1) & 0x1F); // blue
+ source_color.a = Color::Convert1To8(srcval & 0x1); // alpha
+ break;
+ }
+
+ case Regs::PixelFormat::RGBA4:
+ {
+ u16 srcval = *(u16*)(source_pointer + x * 4 * pixel_skip + y * config.input_width * 4 * pixel_skip);
+ source_color.r = Color::Convert4To8((srcval >> 12) & 0xF); // red
+ source_color.g = Color::Convert4To8((srcval >> 8) & 0xF); // green
+ source_color.b = Color::Convert4To8((srcval >> 4) & 0xF); // blue
+ source_color.a = Color::Convert4To8( srcval & 0xF); // alpha
+ break;
+ }
+
default:
LOG_ERROR(HW_GPU, "Unknown source framebuffer format %x", config.input_format.Value());
break;
@@ -166,6 +187,22 @@ inline void Write(u32 addr, const T data) {
break;
}
+ case Regs::PixelFormat::RGB5A1:
+ {
+ u16* dstptr = (u16*)(dest_pointer + x * 2 + y * config.output_width * 2);
+ *dstptr = ((source_color.r >> 3) << 11) | ((source_color.g >> 3) << 6)
+ | ((source_color.b >> 3) << 1) | ( source_color.a >> 7);
+ break;
+ }
+
+ case Regs::PixelFormat::RGBA4:
+ {
+ u16* dstptr = (u16*)(dest_pointer + x * 2 + y * config.output_width * 2);
+ *dstptr = ((source_color.r >> 4) << 12) | ((source_color.g >> 4) << 8)
+ | ((source_color.b >> 4) << 4) | ( source_color.a >> 4);
+ break;
+ }
+
default:
LOG_ERROR(HW_GPU, "Unknown destination framebuffer format %x", config.output_format.Value());
break;