diff options
author | Tony Wasserka <NeoBrainX@gmail.com> | 2015-01-02 15:26:50 +0100 |
---|---|---|
committer | Tony Wasserka <NeoBrainX@gmail.com> | 2015-02-18 14:50:28 +0100 |
commit | aaf30ca4ee7cb539722a2928a578a579641987a1 (patch) | |
tree | 9f26da24086fd259c62d4c7306d46d6f96df1131 /src/video_core | |
parent | Pica/Rasterizer: Rasterize actual pixel centers instead of pixel corners. (diff) | |
download | yuzu-aaf30ca4ee7cb539722a2928a578a579641987a1.tar yuzu-aaf30ca4ee7cb539722a2928a578a579641987a1.tar.gz yuzu-aaf30ca4ee7cb539722a2928a578a579641987a1.tar.bz2 yuzu-aaf30ca4ee7cb539722a2928a578a579641987a1.tar.lz yuzu-aaf30ca4ee7cb539722a2928a578a579641987a1.tar.xz yuzu-aaf30ca4ee7cb539722a2928a578a579641987a1.tar.zst yuzu-aaf30ca4ee7cb539722a2928a578a579641987a1.zip |
Diffstat (limited to 'src/video_core')
-rw-r--r-- | src/video_core/pica.h | 2 | ||||
-rw-r--r-- | src/video_core/rasterizer.cpp | 15 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/video_core/pica.h b/src/video_core/pica.h index cf9dc4853..effa61571 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -421,7 +421,7 @@ struct Regs { INSERT_PADDING_WORDS(0x6); u32 depth_format; - u32 color_format; + BitField<16, 3, u32> color_format; INSERT_PADDING_WORDS(0x4); diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index 168a2ada0..27eeb531d 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -20,10 +20,19 @@ namespace Rasterizer { static void DrawPixel(int x, int y, const Math::Vec4<u8>& color) { const PAddr addr = registers.framebuffer.GetColorBufferPhysicalAddress(); u32* color_buffer = reinterpret_cast<u32*>(Memory::GetPointer(PAddrToVAddr(addr))); - u32 value = (color.a() << 24) | (color.r() << 16) | (color.g() << 8) | color.b(); - // Assuming RGBA8 format until actual framebuffer format handling is implemented - *(color_buffer + x + y * registers.framebuffer.GetWidth()) = value; + switch (registers.framebuffer.color_format) { + case registers.framebuffer.RGBA8: + { + u32 value = (color.a() << 24) | (color.r() << 16) | (color.g() << 8) | color.b(); + *(color_buffer + x + y * registers.framebuffer.GetWidth()) = value; + break; + } + + default: + LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format); + exit(1); + } } static const Math::Vec4<u8> GetPixel(int x, int y) { |