aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGamer64 <gamer64@noreply.localhost>2025-06-29 17:07:14 +0000
committerBix <bix@bixed.xyz>2025-06-29 17:07:14 +0000
commitcac4345db9aa78f1752b22c32cec6ca940ac9e67 (patch)
treec526ff12ea00bc375ce44547abd07fa5c63188a3 /src
parent43a22546cf929f23a5c594211ee6957dde091938 (diff)
[vk] Sample Shading Option .
This seems to improve some games graphics and it may be helpful for MSAA, at the cost of reducing a bit the performance. Co-authored-by: Gamer64 <76565986+Gamer64ytb@users.noreply.github.com> Co-authored-by: crueter <swurl@swurl.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/235 Co-authored-by: Gamer64 <gamer64@noreply.localhost> Co-committed-by: Gamer64 <gamer64@noreply.localhost>
Diffstat (limited to 'src')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt1
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt7
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt1
-rw-r--r--src/android/app/src/main/res/values/strings.xml2
-rw-r--r--src/common/settings.h1
-rw-r--r--src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp5
-rw-r--r--src/yuzu/configuration/shared_translation.cpp7
7 files changed, 23 insertions, 1 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt
index 4c527163c8..cdfbe88152 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt
@@ -27,6 +27,7 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
RENDERER_DEBUG("debug"),
RENDERER_PROVOKING_VERTEX("provoking_vertex"),
RENDERER_DESCRIPTOR_INDEXING("descriptor_indexing"),
+ RENDERER_SAMPLE_SHADING("sample_shading"),
PICTURE_IN_PICTURE("picture_in_picture"),
USE_CUSTOM_RTC("custom_rtc_enabled"),
BLACK_BACKGROUNDS("black_backgrounds"),
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt
index b52355e255..9782aa4d2b 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt
@@ -153,6 +153,13 @@ abstract class SettingsItem(
)
)
put(
+ SwitchSetting(
+ BooleanSetting.RENDERER_SAMPLE_SHADING,
+ titleId = R.string.sample_shading,
+ descriptionId = R.string.sample_shading_description
+ )
+ )
+ put(
SliderSetting(
ShortSetting.RENDERER_SPEED_LIMIT,
titleId = R.string.frame_limit_slider,
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt
index 2337bc5821..f8f381db41 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt
@@ -435,6 +435,7 @@ class SettingsFragmentPresenter(
add(ByteSetting.RENDERER_DYNA_STATE.key)
add(BooleanSetting.RENDERER_PROVOKING_VERTEX.key)
add(BooleanSetting.RENDERER_DESCRIPTOR_INDEXING.key)
+ add(BooleanSetting.RENDERER_SAMPLE_SHADING.key)
add(HeaderSetting(R.string.veil_renderer))
add(BooleanSetting.FRAME_INTERPOLATION.key)
diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml
index d09da35546..7f05e4f985 100644
--- a/src/android/app/src/main/res/values/strings.xml
+++ b/src/android/app/src/main/res/values/strings.xml
@@ -74,6 +74,8 @@
<string name="provoking_vertex_description">Improves lighting and vertex handling in certain games. Only supported on Vulkan 1.0+ GPUs.</string>
<string name="descriptor_indexing">Descriptor Indexing</string>
<string name="descriptor_indexing_description">Improves texture and buffer handling, as well as the Maxwell translation layer. Supported by some Vulkan 1.1 GPUs and all Vulkan 1.2+ GPUs.</string>
+ <string name="sample_shading">Sample Shading</string>
+ <string name="sample_shading_description">Allows the fragment shader to execute per sample in a multi-sampled fragment instead once per fragment. Improves graphics quality at the cost of some performance. Only Vulkan 1.1+ devices support this extension.</string>
<string name="veil_renderer">Renderer</string>
<string name="frame_interpolation">Enhanced Frame Pacing</string>
diff --git a/src/common/settings.h b/src/common/settings.h
index b6e091ab50..e4239a3032 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -509,6 +509,7 @@ struct Values {
SwitchableSetting<bool> provoking_vertex{linkage, false, "provoking_vertex", Category::RendererExtensions};
SwitchableSetting<bool> descriptor_indexing{linkage, false, "descriptor_indexing", Category::RendererExtensions};
+ SwitchableSetting<bool> sample_shading{linkage, false, "sample_shading", Category::RendererExtensions};
Setting<bool> renderer_debug{linkage, false, "debug", Category::RendererDebug};
Setting<bool> renderer_shader_feedback{linkage, false, "shader_feedback",
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
index 4b4331d2f4..ee431bb731 100644
--- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
+++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
@@ -1,3 +1,6 @@
+// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
+// SPDX-License-Identifier: GPL-3.0-or-later
+
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -735,7 +738,7 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
.pNext = nullptr,
.flags = 0,
.rasterizationSamples = MaxwellToVK::MsaaMode(key.state.msaa_mode),
- .sampleShadingEnable = VK_FALSE,
+ .sampleShadingEnable = Settings::values.sample_shading.GetValue() ? VK_TRUE : VK_FALSE,
.minSampleShading = 0.0f,
.pSampleMask = nullptr,
.alphaToCoverageEnable = key.state.alpha_to_coverage_enabled != 0 ? VK_TRUE : VK_FALSE,
diff --git a/src/yuzu/configuration/shared_translation.cpp b/src/yuzu/configuration/shared_translation.cpp
index 28eb2108f8..f4484ce35b 100644
--- a/src/yuzu/configuration/shared_translation.cpp
+++ b/src/yuzu/configuration/shared_translation.cpp
@@ -349,6 +349,13 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent)
tr("Improves texture & buffer handling and the Maxwell translation layer.\n"
"Some Vulkan 1.1+ and all 1.2+ devices support this extension."));
+ INSERT(Settings,
+ sample_shading,
+ tr("Sample Shading"),
+ tr("Allows the fragment shader to execute per sample in a multi-sampled fragment "
+ "instead once per fragment. Improves graphics quality at the cost of some performance.\n"
+ "Only Vulkan 1.1+ devices support this extension."));
+
// Renderer (Debug)
// System