summaryrefslogtreecommitdiff
path: root/src/video_core/host_shaders
diff options
context:
space:
mode:
authorGravatar Liam2024-01-15 10:19:02 -0500
committerGravatar Liam2024-01-31 11:27:21 -0500
commit2ed9586130a7b1de6aefc2aede464c4d3430d484 (patch)
tree0982d578a4fe40900ad53386092909f594c2422c /src/video_core/host_shaders
parentrenderer_opengl: move out FSR shader source construction (diff)
downloadyuzu-2ed9586130a7b1de6aefc2aede464c4d3430d484.tar.gz
yuzu-2ed9586130a7b1de6aefc2aede464c4d3430d484.tar.xz
yuzu-2ed9586130a7b1de6aefc2aede464c4d3430d484.zip
renderer_vulkan: convert FSR to graphics pipeline
Diffstat (limited to 'src/video_core/host_shaders')
-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
9) 9)
10 10
11set(GLSL_INCLUDES 11set(GLSL_INCLUDES
12 fidelityfx_fsr.comp 12 fidelityfx_fsr.frag
13 ${FIDELITYFX_FILES} 13 ${FIDELITYFX_FILES}
14) 14)
15 15
@@ -56,10 +56,11 @@ set(SHADER_FILES
56 vulkan_color_clear.frag 56 vulkan_color_clear.frag
57 vulkan_color_clear.vert 57 vulkan_color_clear.vert
58 vulkan_depthstencil_clear.frag 58 vulkan_depthstencil_clear.frag
59 vulkan_fidelityfx_fsr_easu_fp16.comp 59 vulkan_fidelityfx_fsr.vert
60 vulkan_fidelityfx_fsr_easu_fp32.comp 60 vulkan_fidelityfx_fsr_easu_fp16.frag
61 vulkan_fidelityfx_fsr_rcas_fp16.comp 61 vulkan_fidelityfx_fsr_easu_fp32.frag
62 vulkan_fidelityfx_fsr_rcas_fp32.comp 62 vulkan_fidelityfx_fsr_rcas_fp16.frag
63 vulkan_fidelityfx_fsr_rcas_fp32.frag
63 vulkan_present.frag 64 vulkan_present.frag
64 vulkan_present.vert 65 vulkan_present.vert
65 vulkan_present_scaleforce_fp16.frag 66 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 {
34}; 34};
35 35
36layout(set=0,binding=0) uniform sampler2D InputTexture; 36layout(set=0,binding=0) uniform sampler2D InputTexture;
37layout(set=0,binding=1,rgba16f) uniform image2D OutputTexture;
38 37
39#define A_GPU 1 38#define A_GPU 1
40#define A_GLSL 1 39#define A_GLSL 1
@@ -72,44 +71,40 @@ layout(set=0,binding=1,rgba16f) uniform image2D OutputTexture;
72 71
73#include "ffx_fsr1.h" 72#include "ffx_fsr1.h"
74 73
75void CurrFilter(AU2 pos) { 74#if USE_RCAS
76#if USE_BILINEAR 75 layout(location = 0) in vec2 frag_texcoord;
77 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);
78 imageStore(OutputTexture, ASU2(pos), textureLod(InputTexture, pp, 0.0));
79#endif 76#endif
77layout (location = 0) out vec4 frag_color;
78
79void CurrFilter(AU2 pos) {
80#if USE_EASU 80#if USE_EASU
81 #ifndef YUZU_USE_FP16 81 #ifndef YUZU_USE_FP16
82 AF3 c; 82 AF3 c;
83 FsrEasuF(c, pos, Const0, Const1, Const2, Const3); 83 FsrEasuF(c, pos, Const0, Const1, Const2, Const3);
84 imageStore(OutputTexture, ASU2(pos), AF4(c, 1)); 84 frag_color = AF4(c, 1.0);
85 #else 85 #else
86 AH3 c; 86 AH3 c;
87 FsrEasuH(c, pos, Const0, Const1, Const2, Const3); 87 FsrEasuH(c, pos, Const0, Const1, Const2, Const3);
88 imageStore(OutputTexture, ASU2(pos), AH4(c, 1)); 88 frag_color = AH4(c, 1.0);
89 #endif 89 #endif
90#endif 90#endif
91#if USE_RCAS 91#if USE_RCAS
92 #ifndef YUZU_USE_FP16 92 #ifndef YUZU_USE_FP16
93 AF3 c; 93 AF3 c;
94 FsrRcasF(c.r, c.g, c.b, pos, Const0); 94 FsrRcasF(c.r, c.g, c.b, pos, Const0);
95 imageStore(OutputTexture, ASU2(pos), AF4(c, 1)); 95 frag_color = AF4(c, 1.0);
96 #else 96 #else
97 AH3 c; 97 AH3 c;
98 FsrRcasH(c.r, c.g, c.b, pos, Const0); 98 FsrRcasH(c.r, c.g, c.b, pos, Const0);
99 imageStore(OutputTexture, ASU2(pos), AH4(c, 1)); 99 frag_color = AH4(c, 1.0);
100 #endif 100 #endif
101#endif 101#endif
102} 102}
103 103
104layout(local_size_x=64) in;
105void main() { 104void main() {
106 // Do remapping of local xy in workgroup for a more PS-like swizzle pattern. 105#if USE_RCAS
107 AU2 gxy = ARmp8x8(gl_LocalInvocationID.x) + AU2(gl_WorkGroupID.x << 4u, gl_WorkGroupID.y << 4u); 106 CurrFilter(AU2(frag_texcoord * vec2(textureSize(InputTexture, 0))));
108 CurrFilter(gxy); 107#else
109 gxy.x += 8u; 108 CurrFilter(AU2(gl_FragCoord.xy));
110 CurrFilter(gxy); 109#endif
111 gxy.y += 8u;
112 CurrFilter(gxy);
113 gxy.x -= 8u;
114 CurrFilter(gxy);
115} 110}
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 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#version 450
5
6layout(location = 0) out vec2 texcoord;
7
8void main() {
9 float x = float((gl_VertexIndex & 1) << 2);
10 float y = float((gl_VertexIndex & 2) << 1);
11 gl_Position = vec4(x - 1.0, y - 1.0, 0.0, 1.0);
12 texcoord = vec2(x, y) / 2.0;
13}
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 @@
7#define YUZU_USE_FP16 7#define YUZU_USE_FP16
8#define USE_EASU 1 8#define USE_EASU 1
9 9
10#include "fidelityfx_fsr.comp" 10#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 @@
6 6
7#define USE_EASU 1 7#define USE_EASU 1
8 8
9#include "fidelityfx_fsr.comp" 9#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 @@
7#define YUZU_USE_FP16 7#define YUZU_USE_FP16
8#define USE_RCAS 1 8#define USE_RCAS 1
9 9
10#include "fidelityfx_fsr.comp" 10#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 @@
6 6
7#define USE_RCAS 1 7#define USE_RCAS 1
8 8
9#include "fidelityfx_fsr.comp" 9#include "fidelityfx_fsr.frag"