summaryrefslogtreecommitdiffstats
path: root/src/video_core/host_shaders
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2024-01-15 16:19:02 +0100
committerLiam <byteslice@airmail.cc>2024-01-31 17:27:21 +0100
commit2ed9586130a7b1de6aefc2aede464c4d3430d484 (patch)
tree0982d578a4fe40900ad53386092909f594c2422c /src/video_core/host_shaders
parentrenderer_opengl: move out FSR shader source construction (diff)
downloadyuzu-2ed9586130a7b1de6aefc2aede464c4d3430d484.tar
yuzu-2ed9586130a7b1de6aefc2aede464c4d3430d484.tar.gz
yuzu-2ed9586130a7b1de6aefc2aede464c4d3430d484.tar.bz2
yuzu-2ed9586130a7b1de6aefc2aede464c4d3430d484.tar.lz
yuzu-2ed9586130a7b1de6aefc2aede464c4d3430d484.tar.xz
yuzu-2ed9586130a7b1de6aefc2aede464c4d3430d484.tar.zst
yuzu-2ed9586130a7b1de6aefc2aede464c4d3430d484.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/host_shaders/CMakeLists.txt11
-rw-r--r--src/video_core/host_shaders/fidelityfx_fsr.frag (renamed from src/video_core/host_shaders/fidelityfx_fsr.comp)33
-rw-r--r--src/video_core/host_shaders/vulkan_fidelityfx_fsr.vert13
-rw-r--r--src/video_core/host_shaders/vulkan_fidelityfx_fsr_easu_fp16.frag (renamed from src/video_core/host_shaders/vulkan_fidelityfx_fsr_easu_fp16.comp)2
-rw-r--r--src/video_core/host_shaders/vulkan_fidelityfx_fsr_easu_fp32.frag (renamed from src/video_core/host_shaders/vulkan_fidelityfx_fsr_easu_fp32.comp)2
-rw-r--r--src/video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_fp16.frag (renamed from src/video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_fp16.comp)2
-rw-r--r--src/video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_fp32.frag (renamed from src/video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_fp32.comp)2
7 files changed, 37 insertions, 28 deletions
diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt
index cd2549232..969f21d50 100644
--- a/src/video_core/host_shaders/CMakeLists.txt
+++ b/src/video_core/host_shaders/CMakeLists.txt
@@ -9,7 +9,7 @@ set(FIDELITYFX_FILES
)
set(GLSL_INCLUDES
- fidelityfx_fsr.comp
+ fidelityfx_fsr.frag
${FIDELITYFX_FILES}
)
@@ -56,10 +56,11 @@ set(SHADER_FILES
vulkan_color_clear.frag
vulkan_color_clear.vert
vulkan_depthstencil_clear.frag
- vulkan_fidelityfx_fsr_easu_fp16.comp
- vulkan_fidelityfx_fsr_easu_fp32.comp
- vulkan_fidelityfx_fsr_rcas_fp16.comp
- vulkan_fidelityfx_fsr_rcas_fp32.comp
+ vulkan_fidelityfx_fsr.vert
+ vulkan_fidelityfx_fsr_easu_fp16.frag
+ vulkan_fidelityfx_fsr_easu_fp32.frag
+ vulkan_fidelityfx_fsr_rcas_fp16.frag
+ vulkan_fidelityfx_fsr_rcas_fp32.frag
vulkan_present.frag
vulkan_present.vert
vulkan_present_scaleforce_fp16.frag
diff --git a/src/video_core/host_shaders/fidelityfx_fsr.comp b/src/video_core/host_shaders/fidelityfx_fsr.frag
index f91b1aa9f..a266e1c4e 100644
--- a/src/video_core/host_shaders/fidelityfx_fsr.comp
+++ b/src/video_core/host_shaders/fidelityfx_fsr.frag
@@ -34,7 +34,6 @@ layout( push_constant ) uniform constants {
};
layout(set=0,binding=0) uniform sampler2D InputTexture;
-layout(set=0,binding=1,rgba16f) uniform image2D OutputTexture;
#define A_GPU 1
#define A_GLSL 1
@@ -72,44 +71,40 @@ layout(set=0,binding=1,rgba16f) uniform image2D OutputTexture;
#include "ffx_fsr1.h"
-void CurrFilter(AU2 pos) {
-#if USE_BILINEAR
- AF2 pp = (AF2(pos) * AF2_AU2(Const0.xy) + AF2_AU2(Const0.zw)) * AF2_AU2(Const1.xy) + AF2(0.5, -0.5) * AF2_AU2(Const1.zw);
- imageStore(OutputTexture, ASU2(pos), textureLod(InputTexture, pp, 0.0));
+#if USE_RCAS
+ layout(location = 0) in vec2 frag_texcoord;
#endif
+layout (location = 0) out vec4 frag_color;
+
+void CurrFilter(AU2 pos) {
#if USE_EASU
#ifndef YUZU_USE_FP16
AF3 c;
FsrEasuF(c, pos, Const0, Const1, Const2, Const3);
- imageStore(OutputTexture, ASU2(pos), AF4(c, 1));
+ frag_color = AF4(c, 1.0);
#else
AH3 c;
FsrEasuH(c, pos, Const0, Const1, Const2, Const3);
- imageStore(OutputTexture, ASU2(pos), AH4(c, 1));
+ frag_color = AH4(c, 1.0);
#endif
#endif
#if USE_RCAS
#ifndef YUZU_USE_FP16
AF3 c;
FsrRcasF(c.r, c.g, c.b, pos, Const0);
- imageStore(OutputTexture, ASU2(pos), AF4(c, 1));
+ frag_color = AF4(c, 1.0);
#else
AH3 c;
FsrRcasH(c.r, c.g, c.b, pos, Const0);
- imageStore(OutputTexture, ASU2(pos), AH4(c, 1));
+ frag_color = AH4(c, 1.0);
#endif
#endif
}
-layout(local_size_x=64) in;
void main() {
- // Do remapping of local xy in workgroup for a more PS-like swizzle pattern.
- AU2 gxy = ARmp8x8(gl_LocalInvocationID.x) + AU2(gl_WorkGroupID.x << 4u, gl_WorkGroupID.y << 4u);
- CurrFilter(gxy);
- gxy.x += 8u;
- CurrFilter(gxy);
- gxy.y += 8u;
- CurrFilter(gxy);
- gxy.x -= 8u;
- CurrFilter(gxy);
+#if USE_RCAS
+ CurrFilter(AU2(frag_texcoord * vec2(textureSize(InputTexture, 0))));
+#else
+ CurrFilter(AU2(gl_FragCoord.xy));
+#endif
}
diff --git a/src/video_core/host_shaders/vulkan_fidelityfx_fsr.vert b/src/video_core/host_shaders/vulkan_fidelityfx_fsr.vert
new file mode 100644
index 000000000..6a87a7cac
--- /dev/null
+++ b/src/video_core/host_shaders/vulkan_fidelityfx_fsr.vert
@@ -0,0 +1,13 @@
+// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#version 450
+
+layout(location = 0) out vec2 texcoord;
+
+void main() {
+ float x = float((gl_VertexIndex & 1) << 2);
+ float y = float((gl_VertexIndex & 2) << 1);
+ gl_Position = vec4(x - 1.0, y - 1.0, 0.0, 1.0);
+ texcoord = vec2(x, y) / 2.0;
+}
diff --git a/src/video_core/host_shaders/vulkan_fidelityfx_fsr_easu_fp16.comp b/src/video_core/host_shaders/vulkan_fidelityfx_fsr_easu_fp16.frag
index 00af13726..d369bef06 100644
--- a/src/video_core/host_shaders/vulkan_fidelityfx_fsr_easu_fp16.comp
+++ b/src/video_core/host_shaders/vulkan_fidelityfx_fsr_easu_fp16.frag
@@ -7,4 +7,4 @@
#define YUZU_USE_FP16
#define USE_EASU 1
-#include "fidelityfx_fsr.comp"
+#include "fidelityfx_fsr.frag"
diff --git a/src/video_core/host_shaders/vulkan_fidelityfx_fsr_easu_fp32.comp b/src/video_core/host_shaders/vulkan_fidelityfx_fsr_easu_fp32.frag
index 13d783fa8..6f25ef00f 100644
--- a/src/video_core/host_shaders/vulkan_fidelityfx_fsr_easu_fp32.comp
+++ b/src/video_core/host_shaders/vulkan_fidelityfx_fsr_easu_fp32.frag
@@ -6,4 +6,4 @@
#define USE_EASU 1
-#include "fidelityfx_fsr.comp"
+#include "fidelityfx_fsr.frag"
diff --git a/src/video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_fp16.comp b/src/video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_fp16.frag
index 331549d96..0c953a900 100644
--- a/src/video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_fp16.comp
+++ b/src/video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_fp16.frag
@@ -7,4 +7,4 @@
#define YUZU_USE_FP16
#define USE_RCAS 1
-#include "fidelityfx_fsr.comp"
+#include "fidelityfx_fsr.frag"
diff --git a/src/video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_fp32.comp b/src/video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_fp32.frag
index 013ca0014..02e9a27c6 100644
--- a/src/video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_fp32.comp
+++ b/src/video_core/host_shaders/vulkan_fidelityfx_fsr_rcas_fp32.frag
@@ -6,4 +6,4 @@
#define USE_RCAS 1
-#include "fidelityfx_fsr.comp"
+#include "fidelityfx_fsr.frag"