mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2024-12-24 17:51:21 -08:00
Merge pull request #605 from bunnei/rasterize-rgba4
rasterizer: Add support for RGBA4 framebuffer format.
This commit is contained in:
commit
efcd77a544
@ -8,6 +8,7 @@
|
|||||||
#include "common/math_util.h"
|
#include "common/math_util.h"
|
||||||
|
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
#include "color.h"
|
||||||
#include "pica.h"
|
#include "pica.h"
|
||||||
#include "rasterizer.h"
|
#include "rasterizer.h"
|
||||||
#include "vertex_shader.h"
|
#include "vertex_shader.h"
|
||||||
@ -37,6 +38,14 @@ static void DrawPixel(int x, int y, const Math::Vec4<u8>& color) {
|
|||||||
break;
|
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:
|
default:
|
||||||
LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format);
|
LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format);
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
@ -60,6 +69,18 @@ static const Math::Vec4<u8> GetPixel(int x, int y) {
|
|||||||
ret.a() = pixel[0];
|
ret.a() = pixel[0];
|
||||||
return ret;
|
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:
|
default:
|
||||||
LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format);
|
LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format);
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
|
Loading…
Reference in New Issue
Block a user