summaryrefslogtreecommitdiff
path: root/src/core/hw/gpu.cpp
diff options
context:
space:
mode:
authorGravatar Tony Wasserka2014-12-28 23:28:58 +0100
committerGravatar Tony Wasserka2014-12-31 16:32:55 +0100
commit18a5e888bbeda989aba6576e7dd7e2b6c09b45ea (patch)
tree7f3fad5c0c5a78a171a5818fcc5df067423f63ff /src/core/hw/gpu.cpp
parentPica/Rasterizer: Implement backface culling. (diff)
downloadyuzu-18a5e888bbeda989aba6576e7dd7e2b6c09b45ea.tar.gz
yuzu-18a5e888bbeda989aba6576e7dd7e2b6c09b45ea.tar.xz
yuzu-18a5e888bbeda989aba6576e7dd7e2b6c09b45ea.zip
GPU: Pseudo-implement horizontal scaling.
It's not really known how this actually works. Some testing has shown that this probably performs no filtering, and common usage in games suggests it's not actually resizing the image at all. However, this patch does seem to fix some homebrew showing quasi-duplicated images while still keeping other applications in a working state.
Diffstat (limited to 'src/core/hw/gpu.cpp')
-rw-r--r--src/core/hw/gpu.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp
index dd619cb16..0ff6c6cde 100644
--- a/src/core/hw/gpu.cpp
+++ b/src/core/hw/gpu.cpp
@@ -94,11 +94,15 @@ inline void Write(u32 addr, const T data) {
94 int r, g, b, a; 94 int r, g, b, a;
95 } source_color = { 0, 0, 0, 0 }; 95 } source_color = { 0, 0, 0, 0 };
96 96
97 // Cheap emulation of horizontal scaling: Just skip each second pixel of the
98 // input framebuffer. We keep track of this in the pixel_skip variable.
99 unsigned pixel_skip = (config.scale_horizontally != 0) ? 2 : 1;
100
97 switch (config.input_format) { 101 switch (config.input_format) {
98 case Regs::PixelFormat::RGBA8: 102 case Regs::PixelFormat::RGBA8:
99 { 103 {
100 // TODO: Most likely got the component order messed up. 104 // TODO: Most likely got the component order messed up.
101 u8* srcptr = source_pointer + x * 4 + y * config.input_width * 4; 105 u8* srcptr = source_pointer + x * 4 * pixel_skip + y * config.input_width * 4 * pixel_skip;
102 source_color.r = srcptr[0]; // blue 106 source_color.r = srcptr[0]; // blue
103 source_color.g = srcptr[1]; // green 107 source_color.g = srcptr[1]; // green
104 source_color.b = srcptr[2]; // red 108 source_color.b = srcptr[2]; // red