diff --git a/CMakeLists.txt b/CMakeLists.txt
index 42717c496d..6cdb79be4c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -233,6 +233,7 @@ endif()
option(YUZU_USE_BUNDLED_OPENSSL "Download bundled OpenSSL build" ${DEFAULT_YUZU_USE_BUNDLED_OPENSSL})
+# TODO(crueter): CPM this
if (ANDROID AND YUZU_DOWNLOAD_ANDROID_VVL)
AddJsonPackage(vulkan-validation-layers)
diff --git a/docs/user/Graphics.md b/docs/user/Graphics.md
index ad359b9049..4d3b1da3c7 100644
--- a/docs/user/Graphics.md
+++ b/docs/user/Graphics.md
@@ -44,6 +44,10 @@ Various graphical filters exist - each of them aimed at a specific target/image
- **MMPX**: Nearest-neighbour filter aimed at providing higher pixel-art quality.
- **Pros**: Offers decent pixel-art upscaling.
- **Cons**: Only works for pixel-art.
+- **SGSR**: Uses Snapdragon Studios Game Super Resolution to enhance image quality (similar to FSR, but for Adreno devices).
+ - **Pros**: Optimized for Adreno devices.
+ - **Cons**: Doesn't play nicely with non-Adreno devices.
+- **SGSR Edge**: Almost the same pipeline as SGSR, but with improved edge detection.
### Anisotropy values
diff --git a/src/android/app/src/main/res/values/arrays.xml b/src/android/app/src/main/res/values/arrays.xml
index 99838b98cc..f3a2a069e7 100644
--- a/src/android/app/src/main/res/values/arrays.xml
+++ b/src/android/app/src/main/res/values/arrays.xml
@@ -240,6 +240,8 @@
- @string/scaling_filter_bspline
- @string/scaling_filter_mitchell
- @string/scaling_filter_spline1
+ - @string/scaling_filter_sgsr
+ - @string/scaling_filter_sgsr_edge
@@ -256,6 +258,8 @@
- 10
- 11
- 12
+ - 13
+ - 14
diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml
index d42fb37d58..42cdf91380 100644
--- a/src/android/app/src/main/res/values/strings.xml
+++ b/src/android/app/src/main/res/values/strings.xml
@@ -466,8 +466,8 @@
Resolution (Handheld/Docked)
VSync mode
Window adapting filter
- FSR sharpness
- Determines how sharpened the image will look while using FSR\'s dynamic contrast
+ FSR/SGSR sharpness
+ Determines how sharpened the image will look while using FSR or SGSR filters
Anti-aliasing method
Optimize SPIRV output
Optimizes compiled shaders to improve GPU efficiency, but may introduce longer loading times and initial slowdowns.
@@ -1074,6 +1074,8 @@
B-Spline
Mitchell
MMPX
+ Snapdragon GSR
+ Snapdragon GSR EdgeDir
None
diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h
index 638be4127f..60a194a35d 100644
--- a/src/common/settings_enums.h
+++ b/src/common/settings_enums.h
@@ -143,7 +143,7 @@ ENUM(ConfirmStop, Ask_Always, Ask_Based_On_Game, Ask_Never);
ENUM(FullscreenMode, Borderless, Exclusive);
ENUM(NvdecEmulation, Off, Cpu, Gpu);
ENUM(ResolutionSetup, Res1_4X, Res1_2X, Res3_4X, Res1X, Res5_4X, Res3_2X, Res2X, Res3X, Res4X, Res5X, Res6X, Res7X, Res8X);
-ENUM(ScalingFilter, NearestNeighbor, Bilinear, Bicubic, Gaussian, Lanczos, ScaleForce, Fsr, Area, ZeroTangent, BSpline, Mitchell, Spline1, Mmpx, MaxEnum);
+ENUM(ScalingFilter, NearestNeighbor, Bilinear, Bicubic, Gaussian, Lanczos, ScaleForce, Fsr, Area, ZeroTangent, BSpline, Mitchell, Spline1, Mmpx, Sgsr, SgsrEdge, MaxEnum);
ENUM(AntiAliasing, None, Fxaa, Smaa, MaxEnum);
ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch);
ENUM(ConsoleMode, Handheld, Docked);
diff --git a/src/qt_common/config/shared_translation.cpp b/src/qt_common/config/shared_translation.cpp
index 5e0c0d8b44..ed998aee41 100644
--- a/src/qt_common/config/shared_translation.cpp
+++ b/src/qt_common/config/shared_translation.cpp
@@ -149,7 +149,7 @@ std::unique_ptr InitializeTranslations(QObject* parent) {
"Options lower than 1X can cause artifacts."));
INSERT(Settings, scaling_filter, tr("Window Adapting Filter:"), QString());
INSERT(Settings, fsr_sharpening_slider, tr("FSR Sharpness:"),
- tr("Determines how sharpened the image will look using FSR's dynamic contrast."));
+ tr("Determines how sharpened the image will look using FSR's or SGSR's dynamic contrast."));
INSERT(Settings, anti_aliasing, tr("Anti-Aliasing Method:"),
tr("The anti-aliasing method to use.\nSMAA offers the best quality.\nFXAA "
"can produce a more stable picture in lower resolutions."));
@@ -493,6 +493,8 @@ std::unique_ptr ComboboxEnumeration(QObject* parent) {
PAIR(ScalingFilter, BSpline, tr("B-Spline")),
PAIR(ScalingFilter, Mitchell, tr("Mitchell")),
PAIR(ScalingFilter, Spline1, tr("Spline-1")),
+ PAIR(ScalingFilter, Sgsr, tr("Snapdragon Game Super Resolution")),
+ PAIR(ScalingFilter, SgsrEdge, tr("Snapdragon Game Super Resolution EdgeDir")),
}});
translations->insert({Settings::EnumMetadata::Index(),
{
diff --git a/src/qt_common/config/shared_translation.h b/src/qt_common/config/shared_translation.h
index 6529c7bf40..c34b5162c4 100644
--- a/src/qt_common/config/shared_translation.h
+++ b/src/qt_common/config/shared_translation.h
@@ -53,6 +53,8 @@ static const std::map scaling_filter_texts_map
{Settings::ScalingFilter::Fsr, QStringLiteral(QT_TRANSLATE_NOOP("MainWindow", "FSR"))},
{Settings::ScalingFilter::Area, QStringLiteral(QT_TRANSLATE_NOOP("MainWindow", "Area"))},
{Settings::ScalingFilter::Mmpx, QStringLiteral(QT_TRANSLATE_NOOP("MainWindow", "MMPX"))},
+ {Settings::ScalingFilter::Sgsr, QStringLiteral(QT_TRANSLATE_NOOP("MainWindow", "SGSR"))},
+ {Settings::ScalingFilter::SgsrEdge, QStringLiteral(QT_TRANSLATE_NOOP("MainWindow", "SGSR EdgeDir"))},
};
static const std::map use_docked_mode_texts_map = {
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt
index 362b068656..07683dcbeb 100644
--- a/src/video_core/CMakeLists.txt
+++ b/src/video_core/CMakeLists.txt
@@ -131,6 +131,8 @@ add_library(video_core STATIC
renderer_vulkan/present/present_push_constants.h
renderer_vulkan/present/smaa.cpp
renderer_vulkan/present/smaa.h
+ renderer_vulkan/present/sgsr.cpp
+ renderer_vulkan/present/sgsr.h
renderer_vulkan/present/util.cpp
renderer_vulkan/present/util.h
renderer_vulkan/present/window_adapt_pass.cpp
diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt
index 60b399ccba..9e8d76b104 100644
--- a/src/video_core/host_shaders/CMakeLists.txt
+++ b/src/video_core/host_shaders/CMakeLists.txt
@@ -76,6 +76,11 @@ set(SHADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/vulkan_quad_indexed.comp
${CMAKE_CURRENT_SOURCE_DIR}/vulkan_turbo_mode.comp
${CMAKE_CURRENT_SOURCE_DIR}/vulkan_uint8.comp
+
+ # Snapdragon Game Super Resolution
+ ${CMAKE_CURRENT_SOURCE_DIR}/sgsr1_shader.vert
+ ${CMAKE_CURRENT_SOURCE_DIR}/sgsr1_shader_mobile.frag
+ ${CMAKE_CURRENT_SOURCE_DIR}/sgsr1_shader_mobile_edge_direction.frag
)
if (PLATFORM_HAIKU)
@@ -90,7 +95,7 @@ if ("${GLSLANGVALIDATOR}" STREQUAL "GLSLANGVALIDATOR-NOTFOUND")
message(FATAL_ERROR "Required program `glslangValidator` not found.")
endif()
-set(GLSL_FLAGS "")
+set(GLSL_FLAGS "-DUseUniformBlock=1")
set(SPIR_V_VERSION "spirv1.3")
set(QUIET_FLAG "--quiet")
diff --git a/src/video_core/host_shaders/sgsr1_shader.vert b/src/video_core/host_shaders/sgsr1_shader.vert
new file mode 100644
index 0000000000..820beb26de
--- /dev/null
+++ b/src/video_core/host_shaders/sgsr1_shader.vert
@@ -0,0 +1,18 @@
+// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#version 450
+
+layout( push_constant ) uniform constants {
+ highp vec4 ViewportInfo[1];
+ highp vec2 ResizeFactor;
+ highp float EdgeSharpness;
+};
+layout(location = 0) out highp vec2 texcoord;
+
+void main() {
+ float x = float((gl_VertexIndex & 1) << 2);
+ float y = float((gl_VertexIndex & 2) << 1);
+ gl_Position = vec4(x - 1.0f, y - 1.0f, 0.0, 1.0f);
+ texcoord = vec2(x, y) * ResizeFactor * 0.5;
+}
diff --git a/src/video_core/host_shaders/sgsr1_shader_mobile.frag b/src/video_core/host_shaders/sgsr1_shader_mobile.frag
new file mode 100644
index 0000000000..a03144f606
--- /dev/null
+++ b/src/video_core/host_shaders/sgsr1_shader_mobile.frag
@@ -0,0 +1,116 @@
+// SPDX-FileCopyrightText: Copyright (c) 2025, Qualcomm Innovation Center, Inc. All rights reserved.
+// SPDX-License-Identifier: BSD-3-Clause
+
+#version 460 core
+
+//precision mediump float;
+//precision highp int;
+#define highp
+#define mediump
+
+// Operation modes: RGBA -> 1, RGBY -> 3, LERP -> 4
+#define OperationMode 1
+#define EdgeThreshold 8.0/255.0
+// #define EdgeSharpness 2.0
+// #define UseUniformBlock
+
+#if defined(UseUniformBlock)
+layout( push_constant ) uniform constants {
+ highp vec4 ViewportInfo[1];
+ highp vec2 ResizeFactor;
+ highp float EdgeSharpness;
+};
+layout(set = 0, binding = 0) uniform mediump sampler2D ps0;
+#else
+uniform highp vec4 ViewportInfo[1];
+uniform mediump sampler2D ps0;
+#endif
+
+layout(location=0) in highp vec2 in_TEXCOORD0;
+layout(location=0) out vec4 out_Target0;
+
+float fastLanczos2(float x) {
+ float wA = x-4.0;
+ float wB = x*wA-wA;
+ wA *= wA;
+ return wB*wA;
+}
+
+vec2 weightY(float dx, float dy,float c, float std) {
+ float x = ((dx*dx)+(dy* dy))* 0.55 + clamp(abs(c)*std, 0.0, 1.0);
+ float w = fastLanczos2(x);
+ return vec2(w, w * c);
+}
+
+void main() {
+ vec4 color;
+ if(OperationMode == 1)
+ color.xyz = textureLod(ps0, in_TEXCOORD0.xy, 0.0).xyz;
+ else
+ color.xyzw = textureLod(ps0, in_TEXCOORD0.xy, 0.0).xyzw;
+
+ highp float xCenter = abs(in_TEXCOORD0.x + -0.5);
+ highp float yCenter = abs(in_TEXCOORD0.y + -0.5);
+
+ //todo: config the SR region based on needs
+ //if ( OperationMode!=4 && xCenter*xCenter+yCenter*yCenter<=0.4 * 0.4)
+ if ( OperationMode!=4) {
+ highp vec2 imgCoord = ((in_TEXCOORD0.xy * ViewportInfo[0].zw) + vec2(-0.5, 0.5));
+ highp vec2 imgCoordPixel = floor(imgCoord);
+ highp vec2 coord = imgCoordPixel * ViewportInfo[0].xy;
+ vec2 pl = imgCoord - imgCoordPixel;
+ vec4 left = textureGather(ps0, coord, OperationMode);
+ float edgeVote = abs(left.z - left.y) + abs(color[OperationMode] - left.y) + abs(color[OperationMode] - left.z) ;
+ if(edgeVote > EdgeThreshold) {
+ coord.x += ViewportInfo[0].x;
+
+ highp vec2 IR_highp_vec2_0 = coord + vec2(ViewportInfo[0].x, 0.0);
+ vec4 right = textureGather(ps0, IR_highp_vec2_0, OperationMode);
+ vec4 upDown;
+ highp vec2 IR_highp_vec2_1 = coord + vec2(0.0, -ViewportInfo[0].y);
+ upDown.xy = textureGather(ps0, IR_highp_vec2_1, OperationMode).wz;
+ highp vec2 IR_highp_vec2_2 = coord + vec2(0.0, ViewportInfo[0].y);
+ upDown.zw = textureGather(ps0, IR_highp_vec2_2, OperationMode).yx;
+
+ float mean = (left.y+left.z+right.x+right.w)*0.25;
+ left = left - vec4(mean);
+ right = right - vec4(mean);
+ upDown = upDown - vec4(mean);
+ color.w =color[OperationMode] - mean;
+
+ float sum = (((((abs(left.x)+abs(left.y))+abs(left.z))+abs(left.w))+(((abs(right.x)+abs(right.y))+abs(right.z))+abs(right.w)))+(((abs(upDown.x)+abs(upDown.y))+abs(upDown.z))+abs(upDown.w)));
+ float std = 2.181818/sum;
+
+ vec2 aWY = weightY(pl.x, pl.y+1.0, upDown.x,std);
+ aWY += weightY(pl.x-1.0, pl.y+1.0, upDown.y,std);
+ aWY += weightY(pl.x-1.0, pl.y-2.0, upDown.z,std);
+ aWY += weightY(pl.x, pl.y-2.0, upDown.w,std);
+ aWY += weightY(pl.x+1.0, pl.y-1.0, left.x,std);
+ aWY += weightY(pl.x, pl.y-1.0, left.y,std);
+ aWY += weightY(pl.x, pl.y, left.z,std);
+ aWY += weightY(pl.x+1.0, pl.y, left.w,std);
+ aWY += weightY(pl.x-1.0, pl.y-1.0, right.x,std);
+ aWY += weightY(pl.x-2.0, pl.y-1.0, right.y,std);
+ aWY += weightY(pl.x-2.0, pl.y, right.z,std);
+ aWY += weightY(pl.x-1.0, pl.y, right.w,std);
+
+ float finalY = aWY.y/aWY.x;
+
+ float maxY = max(max(left.y,left.z),max(right.x,right.w));
+ float minY = min(min(left.y,left.z),min(right.x,right.w));
+ finalY = clamp(EdgeSharpness*finalY, minY, maxY);
+
+ float deltaY = finalY -color.w;
+
+ //smooth high contrast input
+ deltaY = clamp(deltaY, -23.0 / 255.0, 23.0 / 255.0);
+
+ color.x = clamp((color.x+deltaY),0.0,1.0);
+ color.y = clamp((color.y+deltaY),0.0,1.0);
+ color.z = clamp((color.z+deltaY),0.0,1.0);
+ }
+ }
+
+ color.w = 1.0; //assume alpha channel is not used
+ out_Target0.xyzw = color;
+}
\ No newline at end of file
diff --git a/src/video_core/host_shaders/sgsr1_shader_mobile_edge_direction.frag b/src/video_core/host_shaders/sgsr1_shader_mobile_edge_direction.frag
new file mode 100644
index 0000000000..686e39a6d0
--- /dev/null
+++ b/src/video_core/host_shaders/sgsr1_shader_mobile_edge_direction.frag
@@ -0,0 +1,149 @@
+// SPDX-FileCopyrightText: Copyright (c) 2025, Qualcomm Innovation Center, Inc. All rights reserved.
+// SPDX-License-Identifier: BSD-3-Clause
+
+#version 460 core
+
+//precision mediump float;
+//precision highp int;
+#define highp
+#define mediump
+
+// Operation modes: RGBA -> 1, RGBY -> 3, LERP -> 4
+#define OperationMode 1
+// If set, will use edge direction to improve visual quality
+// Expect a minimal cost increase
+#define UseEdgeDirection 1
+#define EdgeThreshold 8.0/255.0
+// #define EdgeSharpness 2.0
+// #define UseUniformBlock
+
+#if defined(UseUniformBlock)
+layout( push_constant ) uniform constants {
+ highp vec4 ViewportInfo[1];
+ highp vec2 ResizeFactor;
+ highp float EdgeSharpness;
+};
+layout(set = 0, binding = 0) uniform mediump sampler2D ps0;
+#else
+uniform highp vec4 ViewportInfo[1];
+uniform mediump sampler2D ps0;
+#endif
+
+layout(location=0) in highp vec2 in_TEXCOORD0;
+layout(location=0) out vec4 out_Target0;
+
+float fastLanczos2(float x) {
+ float wA = x-4.0;
+ float wB = x*wA-wA;
+ wA *= wA;
+ return wB*wA;
+}
+
+#if defined(UseEdgeDirection)
+vec2 weightY(float dx, float dy, float c, vec3 data)
+#else
+vec2 weightY(float dx, float dy, float c, float data)
+#endif
+{
+#if defined(UseEdgeDirection)
+ float std = data.x;
+ vec2 dir = data.yz;
+
+ float edgeDis = ((dx*dir.y)+(dy*dir.x));
+ float x = (((dx*dx)+(dy*dy))+((edgeDis*edgeDis)*((clamp(((c*c)*std),0.0,1.0)*0.7)+-1.0)));
+#else
+ float std = data;
+ float x = ((dx*dx)+(dy* dy))* 0.55 + clamp(abs(c)*std, 0.0, 1.0);
+#endif
+
+ float w = fastLanczos2(x);
+ return vec2(w, w * c);
+}
+
+vec2 edgeDirection(vec4 left, vec4 right) {
+ vec2 dir;
+ float RxLz = (right.x + (-left.z));
+ float RwLy = (right.w + (-left.y));
+ vec2 delta;
+ delta.x = (RxLz + RwLy);
+ delta.y = (RxLz + (-RwLy));
+ float lengthInv = inversesqrt((delta.x * delta.x+ 3.075740e-05) + (delta.y * delta.y));
+ dir.x = (delta.x * lengthInv);
+ dir.y = (delta.y * lengthInv);
+ return dir;
+}
+
+void main() {
+ vec4 color;
+ if(OperationMode == 1)
+ color.xyz = textureLod(ps0, in_TEXCOORD0.xy, 0.0).xyz;
+ else
+ color.xyzw = textureLod(ps0, in_TEXCOORD0.xy, 0.0).xyzw;
+
+ highp float xCenter = abs(in_TEXCOORD0.x + -0.5);
+ highp float yCenter = abs(in_TEXCOORD0.y + -0.5);
+
+ //todo: config the SR region based on needs
+ //if ( OperationMode!=4 && xCenter*xCenter+yCenter*yCenter<=0.4 * 0.4)
+ if ( OperationMode!=4) {
+ highp vec2 imgCoord = ((in_TEXCOORD0.xy*ViewportInfo[0].zw)+vec2(-0.5,0.5));
+ highp vec2 imgCoordPixel = floor(imgCoord);
+ highp vec2 coord = (imgCoordPixel*ViewportInfo[0].xy);
+ vec2 pl = imgCoord - imgCoordPixel;
+ vec4 left = textureGather(ps0, coord, OperationMode);
+ float edgeVote = abs(left.z - left.y) + abs(color[OperationMode] - left.y) + abs(color[OperationMode] - left.z) ;
+ if(edgeVote > EdgeThreshold) {
+ coord.x += ViewportInfo[0].x;
+
+ highp vec2 IR_highp_vec2_0 = coord + vec2(ViewportInfo[0].x, 0.0);
+ vec4 right = textureGather(ps0, IR_highp_vec2_0, OperationMode);
+ vec4 upDown;
+ highp vec2 IR_highp_vec2_1 = coord + vec2(0.0, -ViewportInfo[0].y);
+ upDown.xy = textureGather(ps0, IR_highp_vec2_1, OperationMode).wz;
+ highp vec2 IR_highp_vec2_2 = coord + vec2(0.0, ViewportInfo[0].y);
+ upDown.zw = textureGather(ps0, IR_highp_vec2_2, OperationMode).yx;
+
+ float mean = (left.y+left.z+right.x+right.w)*0.25;
+ left = left - vec4(mean);
+ right = right - vec4(mean);
+ upDown = upDown - vec4(mean);
+ color.w =color[OperationMode] - mean;
+
+ float sum = (((((abs(left.x)+abs(left.y))+abs(left.z))+abs(left.w))+(((abs(right.x)+abs(right.y))+abs(right.z))+abs(right.w)))+(((abs(upDown.x)+abs(upDown.y))+abs(upDown.z))+abs(upDown.w)));
+ float sumMean = 1.014185e+01/sum;
+ float std = (sumMean*sumMean);
+
+#if defined(UseEdgeDirection)
+ vec3 data = vec3(std, edgeDirection(left, right));
+#else
+ float data = std;
+#endif
+ vec2 aWY = weightY(pl.x, pl.y+1.0, upDown.x,data);
+ aWY += weightY(pl.x-1.0, pl.y+1.0, upDown.y,data);
+ aWY += weightY(pl.x-1.0, pl.y-2.0, upDown.z,data);
+ aWY += weightY(pl.x, pl.y-2.0, upDown.w,data);
+ aWY += weightY(pl.x+1.0, pl.y-1.0, left.x,data);
+ aWY += weightY(pl.x, pl.y-1.0, left.y,data);
+ aWY += weightY(pl.x, pl.y, left.z,data);
+ aWY += weightY(pl.x+1.0, pl.y, left.w,data);
+ aWY += weightY(pl.x-1.0, pl.y-1.0, right.x,data);
+ aWY += weightY(pl.x-2.0, pl.y-1.0, right.y,data);
+ aWY += weightY(pl.x-2.0, pl.y, right.z,data);
+ aWY += weightY(pl.x-1.0, pl.y, right.w,data);
+
+ float finalY = aWY.y/aWY.x;
+ float maxY = max(max(left.y,left.z),max(right.x,right.w));
+ float minY = min(min(left.y,left.z),min(right.x,right.w));
+ float deltaY = clamp(EdgeSharpness*finalY, minY, maxY) -color.w;
+
+ //smooth high contrast input
+ deltaY = clamp(deltaY, -23.0 / 255.0, 23.0 / 255.0);
+
+ color.x = clamp((color.x+deltaY),0.0,1.0);
+ color.y = clamp((color.y+deltaY),0.0,1.0);
+ color.z = clamp((color.z+deltaY),0.0,1.0);
+ }
+ }
+ color.w = 1.0; //assume alpha channel is not used
+ out_Target0.xyzw = color;
+}
\ No newline at end of file
diff --git a/src/video_core/renderer_opengl/gl_blit_screen.cpp b/src/video_core/renderer_opengl/gl_blit_screen.cpp
index 4b75e1b949..23e5eb7481 100644
--- a/src/video_core/renderer_opengl/gl_blit_screen.cpp
+++ b/src/video_core/renderer_opengl/gl_blit_screen.cpp
@@ -1,4 +1,4 @@
-// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
+// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2024 Torzu Emulator Project
@@ -115,6 +115,8 @@ void BlitScreen::CreateWindowAdapt() {
window_adapt = MakeMmpx(device);
break;
case Settings::ScalingFilter::Fsr:
+ case Settings::ScalingFilter::Sgsr:
+ case Settings::ScalingFilter::SgsrEdge:
case Settings::ScalingFilter::Bilinear:
default:
window_adapt = MakeBilinear(device);
diff --git a/src/video_core/renderer_vulkan/present/layer.cpp b/src/video_core/renderer_vulkan/present/layer.cpp
index b462c672cc..e20473d2af 100644
--- a/src/video_core/renderer_vulkan/present/layer.cpp
+++ b/src/video_core/renderer_vulkan/present/layer.cpp
@@ -15,6 +15,7 @@
#include "common/settings.h"
#include "video_core/framebuffer_config.h"
#include "video_core/renderer_vulkan/present/fsr.h"
+#include "video_core/renderer_vulkan/present/sgsr.h"
#include "video_core/renderer_vulkan/present/fxaa.h"
#include "video_core/renderer_vulkan/present/layer.h"
#include "video_core/renderer_vulkan/present/present_push_constants.h"
@@ -63,7 +64,11 @@ Layer::Layer(const Device& device_, MemoryAllocator& memory_allocator_, Schedule
CreateDescriptorPool();
CreateDescriptorSets(layout);
if (filters.get_scaling_filter() == Settings::ScalingFilter::Fsr) {
- fsr.emplace(device, memory_allocator, image_count, output_size);
+ sr_filter.emplace(device, memory_allocator, image_count, output_size);
+ } else if (filters.get_scaling_filter() == Settings::ScalingFilter::Sgsr) {
+ sr_filter.emplace(device, memory_allocator, image_count, output_size, false);
+ } else if (filters.get_scaling_filter() == Settings::ScalingFilter::SgsrEdge) {
+ sr_filter.emplace(device, memory_allocator, image_count, output_size, true);
}
}
@@ -114,9 +119,12 @@ void Layer::ConfigureDraw(PresentPushConstants* out_push_constants,
.height = scaled_height,
};
- if (fsr) {
+ if (auto* fsr = std::get_if(&sr_filter)) {
source_image_view = fsr->Draw(scheduler, image_index, source_image, source_image_view, render_extent, crop_rect);
crop_rect = {0, 0, 1, 1};
+ } else if (auto* sgsr = std::get_if(&sr_filter)) {
+ source_image_view = sgsr->Draw(scheduler, image_index, source_image, source_image_view, render_extent, crop_rect);
+ crop_rect = {0, 0, 1, 1};
}
SetMatrixData(*out_push_constants, layout);
diff --git a/src/video_core/renderer_vulkan/present/layer.h b/src/video_core/renderer_vulkan/present/layer.h
index d38b81823e..47a6a69218 100644
--- a/src/video_core/renderer_vulkan/present/layer.h
+++ b/src/video_core/renderer_vulkan/present/layer.h
@@ -13,6 +13,7 @@
#include "video_core/host1x/gpu_device_memory_manager.h"
#include "video_core/vulkan_common/vulkan_wrapper.h"
#include "video_core/renderer_vulkan/present/fsr.h"
+#include "video_core/renderer_vulkan/present/sgsr.h"
#include "video_core/renderer_vulkan/present/fxaa.h"
#include "video_core/renderer_vulkan/present/smaa.h"
@@ -95,7 +96,7 @@ private:
Settings::AntiAliasing anti_alias_setting{};
std::variant anti_alias{};
- std::optional fsr{};
+ std::variant sr_filter{};
std::vector resource_ticks{};
};
diff --git a/src/video_core/renderer_vulkan/present/sgsr.cpp b/src/video_core/renderer_vulkan/present/sgsr.cpp
new file mode 100644
index 0000000000..3589083f00
--- /dev/null
+++ b/src/video_core/renderer_vulkan/present/sgsr.cpp
@@ -0,0 +1,144 @@
+// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "common/common_types.h"
+#include "common/div_ceil.h"
+#include "common/settings.h"
+
+//#include "video_core/sgsr.h"
+#include "video_core/host_shaders/sgsr1_shader_mobile_frag_spv.h"
+#include "video_core/host_shaders/sgsr1_shader_mobile_edge_direction_frag_spv.h"
+#include "video_core/host_shaders/sgsr1_shader_vert_spv.h"
+#include "video_core/renderer_vulkan/present/sgsr.h"
+#include "video_core/renderer_vulkan/present/util.h"
+#include "video_core/renderer_vulkan/vk_scheduler.h"
+#include "video_core/renderer_vulkan/vk_shader_util.h"
+#include "video_core/vulkan_common/vulkan_device.h"
+
+namespace Vulkan {
+
+using PushConstants = std::array;
+
+SGSR::SGSR(const Device& device, MemoryAllocator& memory_allocator, size_t image_count, VkExtent2D extent, bool edge_dir)
+ : m_device{device}, m_memory_allocator{memory_allocator}
+ , m_image_count{image_count}, m_extent{extent}
+ , m_edge_dir{edge_dir}
+{
+ // Not finished yet initializing at ctor time?
+ m_dynamic_images.resize(m_image_count);
+ for (auto& images : m_dynamic_images) {
+ images.images[0] = CreateWrappedImage(m_memory_allocator, m_extent, VK_FORMAT_R16G16B16A16_SFLOAT);
+ images.image_views[0] = CreateWrappedImageView(m_device, images.images[0], VK_FORMAT_R16G16B16A16_SFLOAT);
+ }
+
+ m_renderpass = CreateWrappedRenderPass(m_device, VK_FORMAT_R16G16B16A16_SFLOAT);
+ for (auto& images : m_dynamic_images)
+ images.framebuffers[0] = CreateWrappedFramebuffer(m_device, m_renderpass, images.image_views[0], m_extent);
+
+ m_sampler = CreateBilinearSampler(m_device);
+ m_vert_shader = BuildShader(m_device, SGSR1_SHADER_VERT_SPV);
+ m_stage_shader[0] = m_edge_dir
+ ? BuildShader(m_device, SGSR1_SHADER_MOBILE_EDGE_DIRECTION_FRAG_SPV)
+ : BuildShader(m_device, SGSR1_SHADER_MOBILE_FRAG_SPV);
+ // 2 descriptors, 2 descriptor sets per invocation
+ m_descriptor_pool = CreateWrappedDescriptorPool(m_device, SGSR_STAGE_COUNT * m_image_count, SGSR_STAGE_COUNT * m_image_count);
+ m_descriptor_set_layout = CreateWrappedDescriptorSetLayout(m_device, {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER});
+
+ std::vector layouts(SGSR_STAGE_COUNT, *m_descriptor_set_layout);
+ for (auto& images : m_dynamic_images)
+ images.descriptor_sets = CreateWrappedDescriptorSets(m_descriptor_pool, layouts);
+
+ const VkPushConstantRange range{
+ .stageFlags = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT,
+ .offset = 0,
+ .size = sizeof(PushConstants),
+ };
+ VkPipelineLayoutCreateInfo ci{
+ .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
+ .pNext = nullptr,
+ .flags = 0,
+ .setLayoutCount = 1,
+ .pSetLayouts = m_descriptor_set_layout.address(),
+ .pushConstantRangeCount = 1,
+ .pPushConstantRanges = &range,
+ };
+ m_pipeline_layout = m_device.GetLogical().CreatePipelineLayout(ci);
+ m_stage_pipeline[0] = CreateWrappedPipeline(m_device, m_renderpass, m_pipeline_layout, std::tie(m_vert_shader, m_stage_shader[0]));
+}
+
+void SGSR::UpdateDescriptorSets(VkImageView image_view, size_t image_index) {
+ Images& images = m_dynamic_images[image_index];
+ std::vector image_infos;
+ std::vector updates;
+ image_infos.reserve(1);
+ updates.push_back(CreateWriteDescriptorSet(image_infos, *m_sampler, image_view, images.descriptor_sets[0], 0));
+ m_device.GetLogical().UpdateDescriptorSets(updates, {});
+}
+
+void SGSR::UploadImages(Scheduler& scheduler) {
+ if (!m_images_ready) {
+ scheduler.Record([&](vk::CommandBuffer cmdbuf) {
+ for (auto& image : m_dynamic_images) {
+ ClearColorImage(cmdbuf, *image.images[0]);
+ }
+ });
+ scheduler.Finish();
+ m_images_ready = true;
+ }
+}
+
+VkImageView SGSR::Draw(Scheduler& scheduler, size_t image_index, VkImage source_image, VkImageView source_image_view, VkExtent2D input_image_extent, const Common::Rectangle& crop_rect) {
+ Images& images = m_dynamic_images[image_index];
+ auto const stage0_image = *images.images[0];
+ auto const stage0_descriptor_set = images.descriptor_sets[0];
+ auto const stage0_framebuffer = *images.framebuffers[0];
+ auto const stage0_pipeline = *m_stage_pipeline[0];
+
+ VkPipelineLayout pipeline_layout = *m_pipeline_layout;
+ VkRenderPass renderpass = *m_renderpass;
+ VkExtent2D extent = m_extent;
+
+ const f32 input_image_width = f32(input_image_extent.width);
+ const f32 input_image_height = f32(input_image_extent.height);
+ const f32 viewport_width = (crop_rect.right - crop_rect.left) * input_image_width;
+ const f32 viewport_height = (crop_rect.bottom - crop_rect.top) * input_image_height;
+ // expected [0, 2]
+ const f32 sharpening = f32(Settings::values.fsr_sharpening_slider.GetValue()) / 100.0f;
+
+ // p = (tex * viewport) / input = [0,n] (normalized texcoords)
+ // p * input = [0,1024], [0,768]
+ // layout( push_constant ) uniform constants {
+ // highp vec4 ViewportInfo[1];
+ // highp vec2 ResizeFactor;
+ // highp float EdgeSharpness;
+ // };
+ PushConstants viewport_con{};
+ viewport_con[0] = std::bit_cast(1.f / viewport_width);
+ viewport_con[1] = std::bit_cast(1.f / viewport_height);
+ viewport_con[2] = std::bit_cast(viewport_width);
+ viewport_con[3] = std::bit_cast(viewport_height);
+ viewport_con[4] = std::bit_cast(viewport_width / input_image_width);
+ viewport_con[5] = std::bit_cast(viewport_height / input_image_height);
+ viewport_con[6] = std::bit_cast(sharpening);
+
+ UploadImages(scheduler);
+ UpdateDescriptorSets(source_image_view, image_index);
+
+ scheduler.RequestOutsideRenderPassOperationContext();
+ scheduler.Record([=](vk::CommandBuffer cmdbuf) {
+ TransitionImageLayout(cmdbuf, source_image, VK_IMAGE_LAYOUT_GENERAL);
+ TransitionImageLayout(cmdbuf, stage0_image, VK_IMAGE_LAYOUT_GENERAL);
+ BeginRenderPass(cmdbuf, renderpass, stage0_framebuffer, extent);
+ cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, stage0_pipeline);
+ cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout, 0, stage0_descriptor_set, {});
+ cmdbuf.PushConstants(pipeline_layout,
+ VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT,
+ viewport_con);
+ cmdbuf.Draw(3, 1, 0, 0);
+ cmdbuf.EndRenderPass();
+ TransitionImageLayout(cmdbuf, stage0_image, VK_IMAGE_LAYOUT_GENERAL);
+ });
+ return *images.image_views[0];
+}
+
+} // namespace Vulkan
diff --git a/src/video_core/renderer_vulkan/present/sgsr.h b/src/video_core/renderer_vulkan/present/sgsr.h
new file mode 100644
index 0000000000..d6362c361d
--- /dev/null
+++ b/src/video_core/renderer_vulkan/present/sgsr.h
@@ -0,0 +1,50 @@
+// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#pragma once
+
+#include "common/math_util.h"
+#include "video_core/vulkan_common/vulkan_memory_allocator.h"
+#include "video_core/vulkan_common/vulkan_wrapper.h"
+
+namespace Vulkan {
+
+class Device;
+class Scheduler;
+
+class SGSR {
+public:
+ static constexpr size_t SGSR_STAGE_COUNT = 1;
+ explicit SGSR(const Device& device, MemoryAllocator& memory_allocator, size_t image_count, VkExtent2D extent, bool edge_dir);
+ VkImageView Draw(Scheduler& scheduler, size_t image_index, VkImage source_image, VkImageView source_image_view, VkExtent2D input_image_extent, const Common::Rectangle& crop_rect);
+private:
+ void Initialize();
+ void UploadImages(Scheduler& scheduler);
+ void UpdateDescriptorSets(VkImageView image_view, size_t image_index);
+
+ const Device& m_device;
+ MemoryAllocator& m_memory_allocator;
+ const size_t m_image_count;
+ const VkExtent2D m_extent;
+
+ vk::DescriptorPool m_descriptor_pool;
+ vk::DescriptorSetLayout m_descriptor_set_layout;
+ vk::PipelineLayout m_pipeline_layout;
+ vk::ShaderModule m_vert_shader;
+ std::array m_stage_shader;
+ std::array m_stage_pipeline;
+ vk::RenderPass m_renderpass;
+ vk::Sampler m_sampler;
+
+ struct Images {
+ vk::DescriptorSets descriptor_sets;
+ std::array images;
+ std::array image_views;
+ std::array framebuffers;
+ };
+ std::vector m_dynamic_images;
+ bool m_images_ready{};
+ bool m_edge_dir{};
+};
+
+} // namespace Vulkan
diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp
index bb7eb9bdaa..a742e4073c 100644
--- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp
+++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp
@@ -73,6 +73,8 @@ void BlitScreen::SetWindowAdaptPass() {
window_adapt = MakeMmpx(device, swapchain_view_format);
break;
case Settings::ScalingFilter::Fsr:
+ case Settings::ScalingFilter::Sgsr:
+ case Settings::ScalingFilter::SgsrEdge:
case Settings::ScalingFilter::Bilinear:
default:
window_adapt = MakeBilinear(device, swapchain_view_format);
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp
index 54835aea5a..6ae71d2368 100644
--- a/src/yuzu/configuration/configure_graphics.cpp
+++ b/src/yuzu/configuration/configure_graphics.cpp
@@ -265,7 +265,7 @@ void ConfigureGraphics::Setup(const ConfigurationShared::Builder& builder) {
// FSR needs a reversed slider and a 0.5 multiplier
return builder.BuildWidget(
setting, apply_funcs, ConfigurationShared::RequestType::ReverseSlider, true,
- 0.5f, nullptr, tr("%", "FSR sharpening percentage (e.g. 50%)"));
+ 0.5f, nullptr, tr("%", "FSR/SGSR sharpening percentage (e.g. 50%)"));
} else {
return builder.BuildWidget(setting, apply_funcs);
}
diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp
index 2e7cef0953..d22be2ec67 100644
--- a/src/yuzu/main_window.cpp
+++ b/src/yuzu/main_window.cpp
@@ -4394,8 +4394,7 @@ void MainWindow::UpdateAPIText() {
void MainWindow::UpdateFilterText() {
const auto filter = Settings::values.scaling_filter.GetValue();
const auto filter_text = ConfigurationShared::scaling_filter_texts_map.find(filter)->second;
- filter_status_button->setText(filter == Settings::ScalingFilter::Fsr ? tr("FSR")
- : filter_text.toUpper());
+ filter_status_button->setText(filter_text.toUpper());
}
void MainWindow::UpdateAAText() {