diff options
| author | 2015-01-02 15:29:36 +0100 | |
|---|---|---|
| committer | 2015-02-22 11:48:02 -0800 | |
| commit | 23c6764b2b33666f4d05fcd81b71cddfacc957c4 (patch) | |
| tree | b06034070e94b4816f49c4bbcb5a143207a3b699 /src/core/hw/gpu.cpp | |
| parent | Merge pull request #452 from darkf/mingwagain (diff) | |
| download | yuzu-23c6764b2b33666f4d05fcd81b71cddfacc957c4.tar.gz yuzu-23c6764b2b33666f4d05fcd81b71cddfacc957c4.tar.xz yuzu-23c6764b2b33666f4d05fcd81b71cddfacc957c4.zip | |
GPU: Add support for more framebuffer formats in display transfers.
Diffstat (limited to 'src/core/hw/gpu.cpp')
| -rw-r--r-- | src/core/hw/gpu.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp index 3b730a0de..947365dad 100644 --- a/src/core/hw/gpu.cpp +++ b/src/core/hw/gpu.cpp | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | 18 | ||
| 19 | #include "video_core/command_processor.h" | 19 | #include "video_core/command_processor.h" |
| 20 | #include "video_core/video_core.h" | 20 | #include "video_core/video_core.h" |
| 21 | #include <video_core/color.h> | ||
| 21 | 22 | ||
| 22 | 23 | ||
| 23 | namespace GPU { | 24 | namespace GPU { |
| @@ -113,6 +114,26 @@ inline void Write(u32 addr, const T data) { | |||
| 113 | break; | 114 | break; |
| 114 | } | 115 | } |
| 115 | 116 | ||
| 117 | case Regs::PixelFormat::RGB5A1: | ||
| 118 | { | ||
| 119 | u16 srcval = *(u16*)(source_pointer + x * 4 * pixel_skip + y * config.input_width * 4 * pixel_skip); | ||
| 120 | source_color.r = Color::Convert5To8((srcval >> 11) & 0x1F); // red | ||
| 121 | source_color.g = Color::Convert5To8((srcval >> 6) & 0x1F); // green | ||
| 122 | source_color.b = Color::Convert5To8((srcval >> 1) & 0x1F); // blue | ||
| 123 | source_color.a = Color::Convert1To8(srcval & 0x1); // alpha | ||
| 124 | break; | ||
| 125 | } | ||
| 126 | |||
| 127 | case Regs::PixelFormat::RGBA4: | ||
| 128 | { | ||
| 129 | u16 srcval = *(u16*)(source_pointer + x * 4 * pixel_skip + y * config.input_width * 4 * pixel_skip); | ||
| 130 | source_color.r = Color::Convert4To8((srcval >> 12) & 0xF); // red | ||
| 131 | source_color.g = Color::Convert4To8((srcval >> 8) & 0xF); // green | ||
| 132 | source_color.b = Color::Convert4To8((srcval >> 4) & 0xF); // blue | ||
| 133 | source_color.a = Color::Convert4To8( srcval & 0xF); // alpha | ||
| 134 | break; | ||
| 135 | } | ||
| 136 | |||
| 116 | default: | 137 | default: |
| 117 | LOG_ERROR(HW_GPU, "Unknown source framebuffer format %x", config.input_format.Value()); | 138 | LOG_ERROR(HW_GPU, "Unknown source framebuffer format %x", config.input_format.Value()); |
| 118 | break; | 139 | break; |
| @@ -140,6 +161,22 @@ inline void Write(u32 addr, const T data) { | |||
| 140 | break; | 161 | break; |
| 141 | } | 162 | } |
| 142 | 163 | ||
| 164 | case Regs::PixelFormat::RGB5A1: | ||
| 165 | { | ||
| 166 | u16* dstptr = (u16*)(dest_pointer + x * 2 + y * config.output_width * 2); | ||
| 167 | *dstptr = ((source_color.r >> 3) << 11) | ((source_color.g >> 3) << 6) | ||
| 168 | | ((source_color.b >> 3) << 1) | ( source_color.a >> 7); | ||
| 169 | break; | ||
| 170 | } | ||
| 171 | |||
| 172 | case Regs::PixelFormat::RGBA4: | ||
| 173 | { | ||
| 174 | u16* dstptr = (u16*)(dest_pointer + x * 2 + y * config.output_width * 2); | ||
| 175 | *dstptr = ((source_color.r >> 4) << 12) | ((source_color.g >> 4) << 8) | ||
| 176 | | ((source_color.b >> 4) << 4) | ( source_color.a >> 4); | ||
| 177 | break; | ||
| 178 | } | ||
| 179 | |||
| 143 | default: | 180 | default: |
| 144 | LOG_ERROR(HW_GPU, "Unknown destination framebuffer format %x", config.output_format.Value()); | 181 | LOG_ERROR(HW_GPU, "Unknown destination framebuffer format %x", config.output_format.Value()); |
| 145 | break; | 182 | break; |