From 59900d7f00b14681acfc7ef5e8d1e18d53664e1c Mon Sep 17 00:00:00 2001 From: gdkchan Date: Fri, 9 Jul 2021 00:09:07 -0300 Subject: Unscale textureSize when resolution scaling is used (#2441) * Unscale textureSize when resolution scaling is used * Fix textureSize on compute * Flag texture size as needing res scale values too --- .../CodeGen/Glsl/HelperFunctions/TexelFetchScale_cp.glsl | 10 ++++++++++ .../CodeGen/Glsl/HelperFunctions/TexelFetchScale_fp.glsl | 10 ++++++++++ 2 files changed, 20 insertions(+) (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions') diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_cp.glsl b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_cp.glsl index 88d18246..abc3f428 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_cp.glsl +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_cp.glsl @@ -6,4 +6,14 @@ return inputVec; } return ivec2(vec2(inputVec) * scale); +} + +int Helper_TextureSizeUnscale(int size, int samplerIndex) +{ + float scale = cp_renderScale[samplerIndex]; + if (scale == 1.0) + { + return size; + } + return int(float(size) / scale); } \ No newline at end of file diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_fp.glsl b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_fp.glsl index 2e166a4b..c13e2368 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_fp.glsl +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/TexelFetchScale_fp.glsl @@ -13,4 +13,14 @@ { return ivec2(vec2(inputVec) * scale); } +} + +int Helper_TextureSizeUnscale(int size, int samplerIndex) +{ + float scale = abs(fp_renderScale[1 + samplerIndex]); + if (scale == 1.0) + { + return size; + } + return int(float(size) / scale); } \ No newline at end of file -- cgit v1.2.3