diff options
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 { | |||
| 421 | INSERT_PADDING_WORDS(0x6); | 421 | INSERT_PADDING_WORDS(0x6); |
| 422 | 422 | ||
| 423 | u32 depth_format; | 423 | u32 depth_format; |
| 424 | u32 color_format; | 424 | BitField<16, 3, u32> color_format; |
| 425 | 425 | ||
| 426 | INSERT_PADDING_WORDS(0x4); | 426 | INSERT_PADDING_WORDS(0x4); |
| 427 | 427 | ||
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 { | |||
| 20 | static void DrawPixel(int x, int y, const Math::Vec4<u8>& color) { | 20 | static void DrawPixel(int x, int y, const Math::Vec4<u8>& color) { |
| 21 | const PAddr addr = registers.framebuffer.GetColorBufferPhysicalAddress(); | 21 | const PAddr addr = registers.framebuffer.GetColorBufferPhysicalAddress(); |
| 22 | u32* color_buffer = reinterpret_cast<u32*>(Memory::GetPointer(PAddrToVAddr(addr))); | 22 | u32* color_buffer = reinterpret_cast<u32*>(Memory::GetPointer(PAddrToVAddr(addr))); |
| 23 | u32 value = (color.a() << 24) | (color.r() << 16) | (color.g() << 8) | color.b(); | ||
| 24 | 23 | ||
| 25 | // Assuming RGBA8 format until actual framebuffer format handling is implemented | 24 | switch (registers.framebuffer.color_format) { |
| 26 | *(color_buffer + x + y * registers.framebuffer.GetWidth()) = value; | 25 | case registers.framebuffer.RGBA8: |
| 26 | { | ||
| 27 | u32 value = (color.a() << 24) | (color.r() << 16) | (color.g() << 8) | color.b(); | ||
| 28 | *(color_buffer + x + y * registers.framebuffer.GetWidth()) = value; | ||
| 29 | break; | ||
| 30 | } | ||
| 31 | |||
| 32 | default: | ||
| 33 | LOG_CRITICAL(Render_Software, "Unknown framebuffer color format %x", registers.framebuffer.color_format); | ||
| 34 | exit(1); | ||
| 35 | } | ||
| 27 | } | 36 | } |
| 28 | 37 | ||
| 29 | static const Math::Vec4<u8> GetPixel(int x, int y) { | 38 | static const Math::Vec4<u8> GetPixel(int x, int y) { |