diff options
| author | 2016-12-04 05:15:33 -0800 | |
|---|---|---|
| committer | 2016-12-04 05:21:57 -0800 | |
| commit | ba7f21365517ce77dea49b12250629db88f720f3 (patch) | |
| tree | 5c823f1447e7f931a647131f90faa1f9347e89ac | |
| parent | Merge pull request #2259 from JayFoxRox/fix-fallback (diff) | |
| download | yuzu-ba7f21365517ce77dea49b12250629db88f720f3.tar.gz yuzu-ba7f21365517ce77dea49b12250629db88f720f3.tar.xz yuzu-ba7f21365517ce77dea49b12250629db88f720f3.zip | |
OpenGL: Fix DisplayTransfer accel when input width != output width
Fixes #2246, #2261
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 1b734aaa5..c2cd89e54 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -715,7 +715,11 @@ bool RasterizerOpenGL::AccelerateDisplayTransfer(const GPU::Regs::DisplayTransfe | |||
| 715 | 715 | ||
| 716 | CachedSurface src_params; | 716 | CachedSurface src_params; |
| 717 | src_params.addr = config.GetPhysicalInputAddress(); | 717 | src_params.addr = config.GetPhysicalInputAddress(); |
| 718 | src_params.width = config.output_width; | 718 | // It's important to use the correct source input width to properly skip over parts of the input |
| 719 | // image which will be cropped from the output but still affect the stride of the input image. | ||
| 720 | src_params.width = config.input_width; | ||
| 721 | // Using the output's height is fine because we don't read or skip over the remaining part of | ||
| 722 | // the image, and it allows for smaller texture cache lookup rectangles. | ||
| 719 | src_params.height = config.output_height; | 723 | src_params.height = config.output_height; |
| 720 | src_params.is_tiled = !config.input_linear; | 724 | src_params.is_tiled = !config.input_linear; |
| 721 | src_params.pixel_format = CachedSurface::PixelFormatFromGPUPixelFormat(config.input_format); | 725 | src_params.pixel_format = CachedSurface::PixelFormatFromGPUPixelFormat(config.input_format); |
| @@ -736,6 +740,11 @@ bool RasterizerOpenGL::AccelerateDisplayTransfer(const GPU::Regs::DisplayTransfe | |||
| 736 | return false; | 740 | return false; |
| 737 | } | 741 | } |
| 738 | 742 | ||
| 743 | // Adjust the source rectangle to take into account parts of the input lines being cropped | ||
| 744 | if (config.input_width > config.output_width) { | ||
| 745 | src_rect.right -= (config.input_width - config.output_width) * src_surface->res_scale_width; | ||
| 746 | } | ||
| 747 | |||
| 739 | // Require destination surface to have same resolution scale as source to preserve scaling | 748 | // Require destination surface to have same resolution scale as source to preserve scaling |
| 740 | dst_params.res_scale_width = src_surface->res_scale_width; | 749 | dst_params.res_scale_width = src_surface->res_scale_width; |
| 741 | dst_params.res_scale_height = src_surface->res_scale_height; | 750 | dst_params.res_scale_height = src_surface->res_scale_height; |