mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Add Sharp Bilinear Upscale post shader, thanks Silent
This commit is contained in:
parent
41eeb491e7
commit
7fa668fc35
@ -243,3 +243,8 @@ SettingDefaultValue1=0.4
|
|||||||
SettingMaxValue1=0.8
|
SettingMaxValue1=0.8
|
||||||
SettingMinValue1=0.3
|
SettingMinValue1=0.3
|
||||||
SettingStep1=0.05
|
SettingStep1=0.05
|
||||||
|
[UpscaleSharpBilinear]
|
||||||
|
Name=Sharp Bilinear Upscaler
|
||||||
|
Fragment=upscale_sharp_bilinear.fsh
|
||||||
|
Vertex=upscale_sharp_bilinear.vsh
|
||||||
|
OutputResolution=True
|
25
assets/shaders/upscale_sharp_bilinear.fsh
Normal file
25
assets/shaders/upscale_sharp_bilinear.fsh
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifdef GL_ES
|
||||||
|
#extension GL_OES_standard_derivatives : enable
|
||||||
|
precision mediump float;
|
||||||
|
precision mediump int;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uniform sampler2D sampler0;
|
||||||
|
varying vec2 v_position;
|
||||||
|
|
||||||
|
uniform vec2 u_texelDelta; // (1.0 / bufferWidth, 1.0 / bufferHeight)
|
||||||
|
uniform vec2 u_pixelDelta; // (1.0 / targetWidth, 1.0 / targetHeight)
|
||||||
|
|
||||||
|
// Returns pixel sharpened to nearest pixel boundary.
|
||||||
|
vec2 sharpSample(vec4 texSize, vec2 coord) {
|
||||||
|
vec2 boxSize = clamp(fwidth(coord) * texSize.zw, 1e-5, 1.0);
|
||||||
|
coord = coord * texSize.zw - 0.5 * boxSize;
|
||||||
|
vec2 txOffset = smoothstep(vec2(1.0) - boxSize, vec2(1.0), fract(coord));
|
||||||
|
return (floor(coord) + 0.5 + txOffset) * texSize.xy;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec2 sharpPos = sharpSample(vec4(u_texelDelta, 1.0 / u_texelDelta), v_position);
|
||||||
|
vec4 color = texture2D(sampler0, sharpPos);
|
||||||
|
gl_FragColor = color;
|
||||||
|
}
|
9
assets/shaders/upscale_sharp_bilinear.vsh
Normal file
9
assets/shaders/upscale_sharp_bilinear.vsh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
attribute vec4 a_position;
|
||||||
|
attribute vec2 a_texcoord0;
|
||||||
|
|
||||||
|
varying vec2 v_position;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
gl_Position = a_position;
|
||||||
|
v_position = a_texcoord0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user