Commit 18eeb6db authored by Jonatas Esteves's avatar Jonatas Esteves
Browse files

Add AMD FSR Super Resolution Upscaler

parent a4da0992
shaders = 2
shader0 = shaders/fsr-pass0.slang
filter_linear0 = true
scale_type0 = viewport
scale0 = 1.0
shader1 = shaders/fsr-pass1.slang
filter_linear1 = true
scale_type1 = source
scale1 = 1.0
parameters = "FSR_SHARPENING;FSR_FILMGRAIN"
FSR_SHARPENING = 0.3
FSR_FILMGRAIN = 0.10
This diff is collapsed.
This diff is collapsed.
#version 450
#pragma name FSR_EASU
// FSR - [EASU] EDGE ADAPTIVE SPATIAL UPSAMPLING
// filter_linear0 = true
// scale_type0 = viewport
// scale0 = 1.0
layout(push_constant) uniform Push {
vec4 SourceSize;
vec4 OriginalSize;
vec4 OutputSize;
uint FrameCount;
} params;
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;
}
#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Source;
#define A_GPU 1
#define A_GLSL 1
#include "ffx_a.h"
#define FSR_EASU_F 1
AU4 con0, con1, con2, con3;
AF4 FsrEasuRF(AF2 p) {
return textureGather(Source, p, 0);
}
AF4 FsrEasuGF(AF2 p) {
return textureGather(Source, p, 1);
}
AF4 FsrEasuBF(AF2 p) {
return textureGather(Source, p, 2);
}
#include "ffx_fsr1.h"
void main() {
FsrEasuCon(con0, con1, con2, con3,
params.SourceSize.x, params.SourceSize.y, // Viewport size (top left aligned) in the input image which is to be scaled.
params.SourceSize.x, params.SourceSize.y, // The size of the input image.
params.OutputSize.x, params.OutputSize.y); // The output resolution.
AU2 gxy = AU2(vTexCoord.xy * params.OutputSize.xy); // Integer pixel position in output.
AF3 Gamma2Color = AF3(0, 0, 0);
FsrEasuF(Gamma2Color, gxy, con0, con1, con2, con3);
FragColor = vec4(Gamma2Color, 1.0);
}
#version 450
#pragma name FSR_RCAS
// FSR - [RCAS] ROBUST CONTRAST ADAPTIVE SHARPENING
// filter_linear1 = true
// scale_type1 = source
// scale1 = 1.0
#pragma parameter FSR_SHARPENING "FSR RCAS Sharpening Amount (Lower = Sharper)" 0.2 0.0 2.0 0.1
#pragma parameter FSR_FILMGRAIN "FSR LFGA Film Grain Intensity" 0.10 0.0 1.0 0.02
layout(push_constant) uniform Push {
vec4 SourceSize;
vec4 OriginalSize;
vec4 OutputSize;
uint FrameCount;
float FSR_SHARPENING;
float FSR_FILMGRAIN;
} params;
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;
}
#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Source;
#define A_GPU 1
#define A_GLSL 1
#include "ffx_a.h"
#define FSR_RCAS_F 1
AU4 con0;
AF4 FsrRcasLoadF(ASU2 p) {
return AF4(texelFetch(Source, ASU2(p), 0));
}
void FsrRcasInputF(inout AF1 r, inout AF1 g, inout AF1 b) {}
#include "ffx_fsr1.h"
void main() {
FsrRcasCon(con0, params.FSR_SHARPENING);
AU2 gxy = AU2(vTexCoord.xy * params.OutputSize.xy); // Integer pixel position in output.
AF3 Gamma2Color = AF3(0, 0, 0);
FsrRcasF(Gamma2Color.r, Gamma2Color.g, Gamma2Color.b, gxy, con0);
// FSR - [LFGA] LINEAR FILM GRAIN APPLICATOR
if (params.FSR_FILMGRAIN > 0.0) {
AF1 noise = fract(10000 * sin(((vTexCoord.x + vTexCoord.y * A_2PI) * params.FrameCount)));
FsrLfgaF(Gamma2Color, AF3_(noise - 0.5), params.FSR_FILMGRAIN);
}
FragColor = vec4(Gamma2Color, 1.0);
}
shaders = 6
shader0 = ../stock.slang
filter_linear0 = false
scale_type0 = source
scale0 = 1.0
alias0 = SMAA_Input
shader1 = ../anti-aliasing/shaders/smaa/smaa-pass0.slang
filter_linear1 = true
scale_type1 = source
scale1 = 1.0
shader2 = ../anti-aliasing/shaders/smaa/smaa-pass1.slang
filter_linear2 = true
scale_type2 = source
scale2 = 1.0
shader3 = ../anti-aliasing/shaders/smaa/smaa-pass2.slang
filter_linear3 = true
scale_type3 = source
scale3 = 1.0
textures = "areaTex;searchTex"
areaTex = ../anti-aliasing/shaders/smaa/AreaTex.png
searchTex = ../anti-aliasing/shaders/smaa/SearchTex.png
shader4 = shaders/fsr-pass0.slang
filter_linear4 = true
scale_type4 = viewport
scale4 = 1.0
shader5 = shaders/fsr-pass1.slang
filter_linear5 = true
scale_type5 = source
scale5 = 1.0
parameters = "SMAA_EDT;FSR_SHARPENING;FSR_FILMGRAIN"
SMAA_EDT = 1.0
FSR_SHARPENING = 0.1
FSR_FILMGRAIN = 0.12
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment