copy this on an empty file, scale “default” and apply
#version 450
/*
Smart Integer Scaling
Copyright (C) 2018-2022 guest(r) - [email protected]
Split by DariusG
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
layout(push_constant) uniform Push
{
mat4 MVP;
vec4 SourceSize;
vec4 OriginalSize;
vec4 OutputSize;
uint FrameCount;
float TATE;
float IOS;
float OVERSCALE;
} params;
#pragma parameter TATE " TATE Mode" 0.0 0.0 1.0 1.0
#define TATE params.TATE // Screen orientation
#pragma parameter IOS " Integer Scaling: Odd:Y, Even:'X'+Y" 0.0 0.0 4.0 1.0
#define IOS params.IOS // Smart Integer Scaling
#pragma parameter OVERSCALE "Overscale" 0.0 0.0 1.0 1.0
#define OVERSCALE params.OVERSCALE
#define SourceSize params.SourceSize
#define TEX0 vTexCoord
#define OutputSize params.OutputSize
layout(std140, set = 0, binding = 0) uniform UBO
{
mat4 MVP;
} global;
#pragma stage vertex
layout(location = 0) in vec4 Position;
layout(location = 1) in vec2 TexCoord;
layout(location = 0) out vec2 vTexCoord;
void main()
{
gl_Position = global.MVP * Position;
vTexCoord = TexCoord * 1.00001;
}
#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 1) uniform sampler2D Source;
vec2 Overscan(vec2 pos, float dx, float dy){
pos=pos*2.0-1.0;
pos*=vec2(dx,dy);
return pos*0.5+0.5;
}
void main()
{
vec2 texcoord = TEX0.xy;
if (IOS > 0.0)
{
vec2 ofactor = OutputSize.xy/params.OriginalSize.xy;
vec2 intfactor = (IOS < 2.5) ? floor(ofactor) : ceil(ofactor);
vec2 diff = ofactor/intfactor;
float scan = mix(diff.y, diff.x, TATE);
texcoord = Overscan(texcoord, scan, scan);
if (IOS == 1.0 || IOS == 3.0) texcoord = mix(vec2(TEX0.x, texcoord.y), vec2(texcoord.x, TEX0.y), TATE);
}
vec4 res = texture(Source, texcoord);
FragColor = res;
}