diff options
| author | 2015-02-24 19:14:18 -0500 | |
|---|---|---|
| committer | 2015-02-24 19:58:33 -0500 | |
| commit | ed255ebaecbfa57258b70dfb1e7da3f0cd2c1e58 (patch) | |
| tree | 81b7381809d03016e374542d9b3d4e332b164b7f /src/video_core/rasterizer.cpp | |
| parent | Merge pull request #595 from linkmauve/new-3ds-input (diff) | |
| download | yuzu-ed255ebaecbfa57258b70dfb1e7da3f0cd2c1e58.tar.gz yuzu-ed255ebaecbfa57258b70dfb1e7da3f0cd2c1e58.tar.xz yuzu-ed255ebaecbfa57258b70dfb1e7da3f0cd2c1e58.zip | |
Rasterizer: Add support for RGBA4 framebuffer format.
Diffstat (limited to 'src/video_core/rasterizer.cpp')
| -rw-r--r-- | src/video_core/rasterizer.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index 17f8f70ca..24dc37856 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include "common/math_util.h" | 8 | #include "common/math_util.h" |
| 9 | 9 | ||
| 10 | #include "math.h" | 10 | #include "math.h" |
| 11 | #include "color.h" | ||
| 11 | #include "pica.h" | 12 | #include "pica.h" |
| 12 | #include "rasterizer.h" | 13 | #include "rasterizer.h" |
| 13 | #include "vertex_shader.h" | 14 | #include "vertex_shader.h" |
| @@ -37,6 +38,14 @@ static void DrawPixel(int x, int y, const Math::Vec4<u8>& color) { | |||
| 37 | break; | 38 | break; |
| 38 | } | 39 | } |
| 39 | 40 | ||
| 41 | case registers.framebuffer.RGBA4: | ||
| 42 | { | ||
| 43 | u8* pixel = color_buffer + (x + y * registers.framebuffer.GetWidth()) * 2; | ||
| 44 | pixel[1] = (color.r() & 0xF0) | (color.g() >> 4); | ||
| 45 | pixel[0] = (color.b() & 0xF0) | (color.a() >> 4); | ||
| 46 | break; | ||
| 47 | } | ||
| 48 | |||
| 40 | default: | 49 | default: |
| 41 | LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format); | 50 | LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format); |
| 42 | UNIMPLEMENTED(); | 51 | UNIMPLEMENTED(); |
| @@ -60,6 +69,18 @@ static const Math::Vec4<u8> GetPixel(int x, int y) { | |||
| 60 | ret.a() = pixel[0]; | 69 | ret.a() = pixel[0]; |
| 61 | return ret; | 70 | return ret; |
| 62 | } | 71 | } |
| 72 | |||
| 73 | case registers.framebuffer.RGBA4: | ||
| 74 | { | ||
| 75 | Math::Vec4<u8> ret; | ||
| 76 | u8* pixel = color_buffer + (x + y * registers.framebuffer.GetWidth()) * 2; | ||
| 77 | ret.r() = Color::Convert4To8(pixel[1] >> 4); | ||
| 78 | ret.g() = Color::Convert4To8(pixel[1] & 0x0F); | ||
| 79 | ret.b() = Color::Convert4To8(pixel[0] >> 4); | ||
| 80 | ret.a() = Color::Convert4To8(pixel[0] & 0x0F); | ||
| 81 | return ret; | ||
| 82 | } | ||
| 83 | |||
| 63 | default: | 84 | default: |
| 64 | LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format); | 85 | LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format); |
| 65 | UNIMPLEMENTED(); | 86 | UNIMPLEMENTED(); |