Currently the presentation code in Dolphin is severely flawed, because there is no way to reliably prevent it from blurring the rendered 3D image due to non-1:1 scaling.
In theory, specifying "window size" as the native resolution is supposed to do that, but in practice that's not guaranteed due to a design flaw in the presentation code.
This manifests for instance when playing Xenoblade Chronicles at 1920x1080, where a 1920x1079 to 1920x1080 scaling is performed, resulting in catastrophically blurring the image.
The reason is that coordinates are scaled using the y * getTargetHeight() / EFB_HEIGHT formula where getTargetHeight() is an integer.
Unfortunately, the fact that getTargetHeight() must be integer means that the size of the 3D rendering region ends up off-by-one.
This patch fixes the issue by storing the "getTargetHeight() / EFB_HEIGHT" value, and similarly for the width, explicitly as a floating-point value
The resulting code is also faster because the division is not performed every time.
The code in CalculateXYScale is also fixed to remove "- 1" operations that seem to be incorrect and don't seem to have any reason for being there.
In theory, specifying "window size" as the native resolution is supposed to do that, but in practice that's not guaranteed due to a design flaw in the presentation code.
This manifests for instance when playing Xenoblade Chronicles at 1920x1080, where a 1920x1079 to 1920x1080 scaling is performed, resulting in catastrophically blurring the image.
The reason is that coordinates are scaled using the y * getTargetHeight() / EFB_HEIGHT formula where getTargetHeight() is an integer.
Unfortunately, the fact that getTargetHeight() must be integer means that the size of the 3D rendering region ends up off-by-one.
This patch fixes the issue by storing the "getTargetHeight() / EFB_HEIGHT" value, and similarly for the width, explicitly as a floating-point value
The resulting code is also faster because the division is not performed every time.
The code in CalculateXYScale is also fixed to remove "- 1" operations that seem to be incorrect and don't seem to have any reason for being there.