diff options
| author | 2015-01-03 13:37:05 +0100 | |
|---|---|---|
| committer | 2015-02-18 14:50:28 +0100 | |
| commit | 087edcfbec86ba730d55c4fdbbf65097a8cfb8e4 (patch) | |
| tree | 3bd9d4ab608ca25736414eda8f81cae0de6668dd /src | |
| parent | Pica/TextureUnit: Implement mirrored repeating texture wrapping. (diff) | |
| download | yuzu-087edcfbec86ba730d55c4fdbbf65097a8cfb8e4.tar.gz yuzu-087edcfbec86ba730d55c4fdbbf65097a8cfb8e4.tar.xz yuzu-087edcfbec86ba730d55c4fdbbf65097a8cfb8e4.zip | |
Pica/OutputMerger: Fix flipped framebuffers.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/rasterizer.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index f788122d8..9cad5f9b6 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp | |||
| @@ -21,6 +21,10 @@ 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 | 23 | ||
| 24 | // Similarly to textures, the render framebuffer is laid out from bottom to top, too. | ||
| 25 | // NOTE: The framebuffer height register contains the actual FB height minus one. | ||
| 26 | y = (registers.framebuffer.height - y); | ||
| 27 | |||
| 24 | switch (registers.framebuffer.color_format) { | 28 | switch (registers.framebuffer.color_format) { |
| 25 | case registers.framebuffer.RGBA8: | 29 | case registers.framebuffer.RGBA8: |
| 26 | { | 30 | { |
| @@ -39,6 +43,8 @@ static const Math::Vec4<u8> GetPixel(int x, int y) { | |||
| 39 | const PAddr addr = registers.framebuffer.GetColorBufferPhysicalAddress(); | 43 | const PAddr addr = registers.framebuffer.GetColorBufferPhysicalAddress(); |
| 40 | u32* color_buffer_u32 = reinterpret_cast<u32*>(Memory::GetPointer(PAddrToVAddr(addr))); | 44 | u32* color_buffer_u32 = reinterpret_cast<u32*>(Memory::GetPointer(PAddrToVAddr(addr))); |
| 41 | 45 | ||
| 46 | y = (registers.framebuffer.height - y); | ||
| 47 | |||
| 42 | u32 value = *(color_buffer_u32 + x + y * registers.framebuffer.GetWidth()); | 48 | u32 value = *(color_buffer_u32 + x + y * registers.framebuffer.GetWidth()); |
| 43 | Math::Vec4<u8> ret; | 49 | Math::Vec4<u8> ret; |
| 44 | ret.a() = value >> 24; | 50 | ret.a() = value >> 24; |
| @@ -52,6 +58,8 @@ static u32 GetDepth(int x, int y) { | |||
| 52 | const PAddr addr = registers.framebuffer.GetDepthBufferPhysicalAddress(); | 58 | const PAddr addr = registers.framebuffer.GetDepthBufferPhysicalAddress(); |
| 53 | u16* depth_buffer = reinterpret_cast<u16*>(Memory::GetPointer(PAddrToVAddr(addr))); | 59 | u16* depth_buffer = reinterpret_cast<u16*>(Memory::GetPointer(PAddrToVAddr(addr))); |
| 54 | 60 | ||
| 61 | y = (registers.framebuffer.height - y); | ||
| 62 | |||
| 55 | // Assuming 16-bit depth buffer format until actual format handling is implemented | 63 | // Assuming 16-bit depth buffer format until actual format handling is implemented |
| 56 | return *(depth_buffer + x + y * registers.framebuffer.GetWidth()); | 64 | return *(depth_buffer + x + y * registers.framebuffer.GetWidth()); |
| 57 | } | 65 | } |
| @@ -60,6 +68,8 @@ static void SetDepth(int x, int y, u16 value) { | |||
| 60 | const PAddr addr = registers.framebuffer.GetDepthBufferPhysicalAddress(); | 68 | const PAddr addr = registers.framebuffer.GetDepthBufferPhysicalAddress(); |
| 61 | u16* depth_buffer = reinterpret_cast<u16*>(Memory::GetPointer(PAddrToVAddr(addr))); | 69 | u16* depth_buffer = reinterpret_cast<u16*>(Memory::GetPointer(PAddrToVAddr(addr))); |
| 62 | 70 | ||
| 71 | y = (registers.framebuffer.height - y); | ||
| 72 | |||
| 63 | // Assuming 16-bit depth buffer format until actual format handling is implemented | 73 | // Assuming 16-bit depth buffer format until actual format handling is implemented |
| 64 | *(depth_buffer + x + y * registers.framebuffer.GetWidth()) = value; | 74 | *(depth_buffer + x + y * registers.framebuffer.GetWidth()) = value; |
| 65 | } | 75 | } |