diff options
| author | 2015-02-22 14:54:56 -0500 | |
|---|---|---|
| committer | 2015-02-22 14:54:56 -0500 | |
| commit | 89a71eb6a45a7a764da1b48fd7da34e9dde50418 (patch) | |
| tree | 08ed5f34ea8e1c12214937575b4d8bc90bf34df1 /src/core/hw/gpu.cpp | |
| parent | Merge pull request #597 from bunnei/fix-color-component-order (diff) | |
| parent | GPU: Add support for more framebuffer formats in display transfers. (diff) | |
| download | yuzu-89a71eb6a45a7a764da1b48fd7da34e9dde50418.tar.gz yuzu-89a71eb6a45a7a764da1b48fd7da34e9dde50418.tar.xz yuzu-89a71eb6a45a7a764da1b48fd7da34e9dde50418.zip | |
Merge pull request #471 from archshift/pp3ports3
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 536672924..880023529 100644 --- a/src/core/hw/gpu.cpp +++ b/src/core/hw/gpu.cpp | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | #include "video_core/command_processor.h" | 20 | #include "video_core/command_processor.h" |
| 21 | #include "video_core/video_core.h" | 21 | #include "video_core/video_core.h" |
| 22 | #include <video_core/color.h> | ||
| 22 | 23 | ||
| 23 | 24 | ||
| 24 | namespace GPU { | 25 | namespace GPU { |
| @@ -140,6 +141,26 @@ inline void Write(u32 addr, const T data) { | |||
| 140 | break; | 141 | break; |
| 141 | } | 142 | } |
| 142 | 143 | ||
| 144 | case Regs::PixelFormat::RGB5A1: | ||
| 145 | { | ||
| 146 | u16 srcval = *(u16*)(source_pointer + x * 4 * pixel_skip + y * config.input_width * 4 * pixel_skip); | ||
| 147 | source_color.r = Color::Convert5To8((srcval >> 11) & 0x1F); // red | ||
| 148 | source_color.g = Color::Convert5To8((srcval >> 6) & 0x1F); // green | ||
| 149 | source_color.b = Color::Convert5To8((srcval >> 1) & 0x1F); // blue | ||
| 150 | source_color.a = Color::Convert1To8(srcval & 0x1); // alpha | ||
| 151 | break; | ||
| 152 | } | ||
| 153 | |||
| 154 | case Regs::PixelFormat::RGBA4: | ||
| 155 | { | ||
| 156 | u16 srcval = *(u16*)(source_pointer + x * 4 * pixel_skip + y * config.input_width * 4 * pixel_skip); | ||
| 157 | source_color.r = Color::Convert4To8((srcval >> 12) & 0xF); // red | ||
| 158 | source_color.g = Color::Convert4To8((srcval >> 8) & 0xF); // green | ||
| 159 | source_color.b = Color::Convert4To8((srcval >> 4) & 0xF); // blue | ||
| 160 | source_color.a = Color::Convert4To8( srcval & 0xF); // alpha | ||
| 161 | break; | ||
| 162 | } | ||
| 163 | |||
| 143 | default: | 164 | default: |
| 144 | LOG_ERROR(HW_GPU, "Unknown source framebuffer format %x", config.input_format.Value()); | 165 | LOG_ERROR(HW_GPU, "Unknown source framebuffer format %x", config.input_format.Value()); |
| 145 | break; | 166 | break; |
| @@ -166,6 +187,22 @@ inline void Write(u32 addr, const T data) { | |||
| 166 | break; | 187 | break; |
| 167 | } | 188 | } |
| 168 | 189 | ||
| 190 | case Regs::PixelFormat::RGB5A1: | ||
| 191 | { | ||
| 192 | u16* dstptr = (u16*)(dest_pointer + x * 2 + y * config.output_width * 2); | ||
| 193 | *dstptr = ((source_color.r >> 3) << 11) | ((source_color.g >> 3) << 6) | ||
| 194 | | ((source_color.b >> 3) << 1) | ( source_color.a >> 7); | ||
| 195 | break; | ||
| 196 | } | ||
| 197 | |||
| 198 | case Regs::PixelFormat::RGBA4: | ||
| 199 | { | ||
| 200 | u16* dstptr = (u16*)(dest_pointer + x * 2 + y * config.output_width * 2); | ||
| 201 | *dstptr = ((source_color.r >> 4) << 12) | ((source_color.g >> 4) << 8) | ||
| 202 | | ((source_color.b >> 4) << 4) | ( source_color.a >> 4); | ||
| 203 | break; | ||
| 204 | } | ||
| 205 | |||
| 169 | default: | 206 | default: |
| 170 | LOG_ERROR(HW_GPU, "Unknown destination framebuffer format %x", config.output_format.Value()); | 207 | LOG_ERROR(HW_GPU, "Unknown destination framebuffer format %x", config.output_format.Value()); |
| 171 | break; | 208 | break; |