diff options
Diffstat (limited to 'src/video_core')
-rw-r--r-- | src/video_core/debug_utils/debug_utils.cpp | 6 | ||||
-rw-r--r-- | src/video_core/rasterizer.cpp | 21 |
2 files changed, 24 insertions, 3 deletions
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index 0beb72e6b..795449423 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp @@ -333,9 +333,9 @@ const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const Texture // Interleave the lower 3 bits of each coordinate to get the intra-block offsets, which are // arranged in a Z-order curve. More details on the bit manipulation at: // https://fgiesen.wordpress.com/2009/12/13/decoding-morton-codes/ - unsigned int i = (x | (y << 8)) & 0x0707; // ---- -210 - i = (i ^ (i << 2)) & 0x1313; // ---2 --10 - i = (i ^ (i << 1)) & 0x1515; // ---2 -1-0 + unsigned int i = (x & 7) | ((y & 7) << 8); // ---- -210 + i = (i ^ (i << 2)) & 0x1313; // ---2 --10 + i = (i ^ (i << 1)) & 0x1515; // ---2 -1-0 i = (i | (i >> 7)) & 0x3F; if (info.format != Regs::TextureFormat::ETC1 && 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 @@ #include "common/math_util.h" #include "math.h" +#include "color.h" #include "pica.h" #include "rasterizer.h" #include "vertex_shader.h" @@ -37,6 +38,14 @@ static void DrawPixel(int x, int y, const Math::Vec4<u8>& color) { break; } + case registers.framebuffer.RGBA4: + { + u8* pixel = color_buffer + (x + y * registers.framebuffer.GetWidth()) * 2; + pixel[1] = (color.r() & 0xF0) | (color.g() >> 4); + pixel[0] = (color.b() & 0xF0) | (color.a() >> 4); + break; + } + default: LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format); UNIMPLEMENTED(); @@ -60,6 +69,18 @@ static const Math::Vec4<u8> GetPixel(int x, int y) { ret.a() = pixel[0]; return ret; } + + case registers.framebuffer.RGBA4: + { + Math::Vec4<u8> ret; + u8* pixel = color_buffer + (x + y * registers.framebuffer.GetWidth()) * 2; + ret.r() = Color::Convert4To8(pixel[1] >> 4); + ret.g() = Color::Convert4To8(pixel[1] & 0x0F); + ret.b() = Color::Convert4To8(pixel[0] >> 4); + ret.a() = Color::Convert4To8(pixel[0] & 0x0F); + return ret; + } + default: LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format); UNIMPLEMENTED(); |