From 02d12d180de030f07d667e0eb8fde17d3beda281 Mon Sep 17 00:00:00 2001 From: s2s <12202580+standard-two-simplex@users.noreply.github.com> Date: Tue, 27 Apr 2021 21:54:42 +0200 Subject: [PATCH] Change heuristic when using non-multiple-of-native rendering resolutions. The games behave unpredictably at random rendering resolutions, so a simpler heuritic is used. Fixes #2482 --- .../GLSL/glsl_CombinerProgramUniformFactory.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactory.cpp b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactory.cpp index 8c66d66f..a98cf58a 100644 --- a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactory.cpp +++ b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactory.cpp @@ -244,18 +244,20 @@ public: float scale[2] = { 0.0f, 0.0f }; if (config.graphics2D.enableNativeResTexrects != 0) { scale[0] = scale[1] = 1.0f; - } else if (config.frameBufferEmulation.nativeResFactor != 0) { - scale[0] = scale[1] = static_cast(config.frameBufferEmulation.nativeResFactor); } else { - scale[0] = dwnd().getScaleX(); - scale[1] = dwnd().getScaleY(); + scale[0] = scale[1] = static_cast(config.frameBufferEmulation.nativeResFactor); } for (int t = 0; t < 2; t++) { const CachedTexture* _pTexture = textureCache().current[t]; if (_pTexture != nullptr) { - texCoordOffset[t][0] = (gDP.lastTexRectInfo.dsdx >= 0.0f ? -0.5f / scale[0] : -1.0f + 0.5f / scale[0]) * gDP.lastTexRectInfo.dsdx * _pTexture->hdRatioS; - texCoordOffset[t][1] = (gDP.lastTexRectInfo.dtdy >= 0.0f ? -0.5f / scale[1] : -1.0f + 0.5f / scale[1]) * gDP.lastTexRectInfo.dtdy * _pTexture->hdRatioT; + if (config.frameBufferEmulation.nativeResFactor != 0) { + texCoordOffset[t][0] = (gDP.lastTexRectInfo.dsdx >= 0.0f ? -0.5f / scale[0] : -1.0f + 0.5f / scale[0]) * gDP.lastTexRectInfo.dsdx * _pTexture->hdRatioS; + texCoordOffset[t][1] = (gDP.lastTexRectInfo.dtdy >= 0.0f ? -0.5f / scale[1] : -1.0f + 0.5f / scale[1]) * gDP.lastTexRectInfo.dtdy * _pTexture->hdRatioT; + } else { + texCoordOffset[t][0] = (gDP.lastTexRectInfo.dsdx >= 0.0f ? 0.0f : -1.0f) * gDP.lastTexRectInfo.dsdx * _pTexture->hdRatioS; + texCoordOffset[t][1] = (gDP.lastTexRectInfo.dtdy >= 0.0f ? 0.0f : -1.0f) * gDP.lastTexRectInfo.dtdy * _pTexture->hdRatioT; + } } } }