diff options
Diffstat (limited to 'src/video_core/rasterizer.cpp')
| -rw-r--r-- | src/video_core/rasterizer.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index a7bb0612f..8c370781a 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp | |||
| @@ -51,6 +51,16 @@ static void DrawPixel(int x, int y, const Math::Vec4<u8>& color) { | |||
| 51 | break; | 51 | break; |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | case registers.framebuffer.RGBA5551: | ||
| 55 | { | ||
| 56 | u16_le* pixel = (u16_le*)(color_buffer + dst_offset); | ||
| 57 | *pixel = (Color::Convert8To5(color.r()) << 11) | | ||
| 58 | (Color::Convert8To5(color.g()) << 6) | | ||
| 59 | (Color::Convert8To5(color.b()) << 1) | | ||
| 60 | Color::Convert8To1(color.a()); | ||
| 61 | break; | ||
| 62 | } | ||
| 63 | |||
| 54 | default: | 64 | default: |
| 55 | LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format.Value()); | 65 | LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format.Value()); |
| 56 | UNIMPLEMENTED(); | 66 | UNIMPLEMENTED(); |
| @@ -66,11 +76,11 @@ static const Math::Vec4<u8> GetPixel(int x, int y) { | |||
| 66 | const u32 coarse_y = y & ~7; | 76 | const u32 coarse_y = y & ~7; |
| 67 | u32 bytes_per_pixel = GPU::Regs::BytesPerPixel(GPU::Regs::PixelFormat(registers.framebuffer.color_format.Value())); | 77 | u32 bytes_per_pixel = GPU::Regs::BytesPerPixel(GPU::Regs::PixelFormat(registers.framebuffer.color_format.Value())); |
| 68 | u32 src_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * registers.framebuffer.width * bytes_per_pixel; | 78 | u32 src_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * registers.framebuffer.width * bytes_per_pixel; |
| 79 | Math::Vec4<u8> ret; | ||
| 69 | 80 | ||
| 70 | switch (registers.framebuffer.color_format) { | 81 | switch (registers.framebuffer.color_format) { |
| 71 | case registers.framebuffer.RGBA8: | 82 | case registers.framebuffer.RGBA8: |
| 72 | { | 83 | { |
| 73 | Math::Vec4<u8> ret; | ||
| 74 | u8* pixel = color_buffer + src_offset; | 84 | u8* pixel = color_buffer + src_offset; |
| 75 | ret.r() = pixel[3]; | 85 | ret.r() = pixel[3]; |
| 76 | ret.g() = pixel[2]; | 86 | ret.g() = pixel[2]; |
| @@ -81,7 +91,6 @@ static const Math::Vec4<u8> GetPixel(int x, int y) { | |||
| 81 | 91 | ||
| 82 | case registers.framebuffer.RGBA4: | 92 | case registers.framebuffer.RGBA4: |
| 83 | { | 93 | { |
| 84 | Math::Vec4<u8> ret; | ||
| 85 | u8* pixel = color_buffer + src_offset; | 94 | u8* pixel = color_buffer + src_offset; |
| 86 | ret.r() = Color::Convert4To8(pixel[1] >> 4); | 95 | ret.r() = Color::Convert4To8(pixel[1] >> 4); |
| 87 | ret.g() = Color::Convert4To8(pixel[1] & 0x0F); | 96 | ret.g() = Color::Convert4To8(pixel[1] & 0x0F); |
| @@ -90,6 +99,16 @@ static const Math::Vec4<u8> GetPixel(int x, int y) { | |||
| 90 | return ret; | 99 | return ret; |
| 91 | } | 100 | } |
| 92 | 101 | ||
| 102 | case registers.framebuffer.RGBA5551: | ||
| 103 | { | ||
| 104 | u16_le pixel = *(u16_le*)(color_buffer + src_offset); | ||
| 105 | ret.r() = Color::Convert5To8((pixel >> 11) & 0x1F); | ||
| 106 | ret.g() = Color::Convert5To8((pixel >> 6) & 0x1F); | ||
| 107 | ret.b() = Color::Convert5To8((pixel >> 1) & 0x1F); | ||
| 108 | ret.a() = Color::Convert1To8(pixel & 0x1); | ||
| 109 | return ret; | ||
| 110 | } | ||
| 111 | |||
| 93 | default: | 112 | default: |
| 94 | LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format.Value()); | 113 | LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format.Value()); |
| 95 | UNIMPLEMENTED(); | 114 | UNIMPLEMENTED(); |