[Filters] Use textureSize() instead

As of Cemu 1.15.12b, the textureSrcResolution (textureSrc_Resolution not texture_SrcResolution) uniform used by internal/external resize shaders still gives the native resolution of the game even when a resolution gfx pack is active.
We can just ask for texture resolution ourselves in the shaders as a workaround.
This commit is contained in:
NAVras-Z 2019-08-20 08:07:57 +08:00
parent 01f7fa002f
commit f9066de98d
4 changed files with 8 additions and 4 deletions

View File

@ -4,7 +4,7 @@
in vec2 passUV; in vec2 passUV;
layout(binding=0) uniform sampler2D textureSrc; layout(binding=0) uniform sampler2D textureSrc;
uniform vec2 textureSrcResolution; // uniform vec2 textureSrcResolution;
layout(location = 0) out vec4 colorOut0; layout(location = 0) out vec4 colorOut0;
float weight(float x) float weight(float x)
@ -45,6 +45,7 @@ vec4 weight4(float x)
vec4 DrawBicubic(vec2 f_in) vec4 DrawBicubic(vec2 f_in)
{ {
vec2 textureSrcResolution = vec2( textureSize(textureSrc,0) );
vec2 stepxy = 1.0/textureSrcResolution; vec2 stepxy = 1.0/textureSrcResolution;
vec2 pos = f_in.st + stepxy * 0.5; vec2 pos = f_in.st + stepxy * 0.5;
vec2 f = fract(pos * textureSrcResolution); vec2 f = fract(pos * textureSrcResolution);

View File

@ -3,7 +3,7 @@
in vec2 passUV; in vec2 passUV;
layout(binding=0) uniform sampler2D textureSrc; layout(binding=0) uniform sampler2D textureSrc;
uniform vec2 textureSrcResolution; // uniform vec2 textureSrcResolution;
layout(location = 0) out vec4 colorOut0; layout(location = 0) out vec4 colorOut0;
vec4 cubic(float x) vec4 cubic(float x)
@ -44,5 +44,6 @@ vec4 bcFilter(vec2 texcoord, vec2 texscale)
} }
void main(){ void main(){
vec2 textureSrcResolution = vec2( textureSize(textureSrc,0) );
colorOut0 = vec4(bcFilter(passUV*textureSrcResolution, vec2(1.0,1.0)/textureSrcResolution).rgb,1.0); colorOut0 = vec4(bcFilter(passUV*textureSrcResolution, vec2(1.0,1.0)/textureSrcResolution).rgb,1.0);
} }

View File

@ -4,7 +4,7 @@
in vec2 passUV; in vec2 passUV;
layout(binding=0) uniform sampler2D textureSrc; layout(binding=0) uniform sampler2D textureSrc;
uniform vec2 textureSrcResolution; // uniform vec2 textureSrcResolution;
layout(location = 0) out vec4 colorOut0; layout(location = 0) out vec4 colorOut0;
float weight(float x) float weight(float x)
@ -45,6 +45,7 @@ vec4 weight4(float x)
vec4 DrawBicubic(vec2 f_in) vec4 DrawBicubic(vec2 f_in)
{ {
vec2 textureSrcResolution = vec2( textureSize(textureSrc,0) );
vec2 stepxy = 1.0/textureSrcResolution; vec2 stepxy = 1.0/textureSrcResolution;
vec2 pos = f_in.st + stepxy * 0.5; vec2 pos = f_in.st + stepxy * 0.5;
vec2 f = fract(pos * textureSrcResolution); vec2 f = fract(pos * textureSrcResolution);

View File

@ -30,7 +30,7 @@
in vec2 passUV; in vec2 passUV;
layout(binding=0) uniform sampler2D textureSrc; layout(binding=0) uniform sampler2D textureSrc;
uniform vec2 textureSrcResolution; // uniform vec2 textureSrcResolution;
layout(location = 0) out vec4 colorOut0; layout(location = 0) out vec4 colorOut0;
/* /*
@ -124,5 +124,6 @@ vec4 JINC2_sharp(vec2 texture_size, vec2 texCoord)
void main() void main()
{ {
vec2 textureSrcResolution = vec2( textureSize(textureSrc,0) );
colorOut0 = JINC2_sharp(textureSrcResolution, passUV); colorOut0 = JINC2_sharp(textureSrcResolution, passUV);
} }