summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2023-08-28 01:37:40 +0200
committerLiam <byteslice@airmail.cc>2023-09-16 17:59:20 +0200
commitb99f94a7ffab0698f209bf1b39d337940bc40e50 (patch)
treee5d3c3348ea579760276b6d7bb7fd10a98fe0910 /src
parentVulkan: Implement Depth Bias Control (diff)
downloadyuzu-b99f94a7ffab0698f209bf1b39d337940bc40e50.tar
yuzu-b99f94a7ffab0698f209bf1b39d337940bc40e50.tar.gz
yuzu-b99f94a7ffab0698f209bf1b39d337940bc40e50.tar.bz2
yuzu-b99f94a7ffab0698f209bf1b39d337940bc40e50.tar.lz
yuzu-b99f94a7ffab0698f209bf1b39d337940bc40e50.tar.xz
yuzu-b99f94a7ffab0698f209bf1b39d337940bc40e50.tar.zst
yuzu-b99f94a7ffab0698f209bf1b39d337940bc40e50.zip
Diffstat (limited to '')
-rw-r--r--src/common/settings.h2
-rw-r--r--src/core/core.cpp7
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp3
-rw-r--r--src/video_core/vulkan_common/vulkan_device.cpp7
-rw-r--r--src/video_core/vulkan_common/vulkan_device.h3
5 files changed, 20 insertions, 2 deletions
diff --git a/src/common/settings.h b/src/common/settings.h
index 82ec9077e..6f050c89d 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -350,6 +350,8 @@ struct Values {
linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug};
Setting<bool> enable_renderdoc_hotkey{linkage, false, "renderdoc_hotkey",
Category::RendererDebug};
+ // TODO: remove this once AMDVLK supports VK_EXT_depth_bias_control
+ bool renderer_amdvlk_depth_bias_workaround{};
// System
SwitchableSetting<Language, true> language_index{linkage,
diff --git a/src/core/core.cpp b/src/core/core.cpp
index e8300cd05..08cbb8978 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -381,6 +381,10 @@ struct System::Impl {
room_member->SendGameInfo(game_info);
}
+ // Workarounds:
+ // Activate this in Super Smash Brothers Ultimate, it only affects AMD cards using AMDVLK
+ Settings::values.renderer_amdvlk_depth_bias_workaround = program_id == 0x1006A800016E000ULL;
+
status = SystemResultStatus::Success;
return status;
}
@@ -440,6 +444,9 @@ struct System::Impl {
room_member->SendGameInfo(game_info);
}
+ // Workarounds
+ Settings::values.renderer_amdvlk_depth_bias_workaround = false;
+
LOG_DEBUG(Core, "Shutdown OK");
}
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 0201c4d08..59b87807b 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -1050,6 +1050,9 @@ void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D::Regs& regs) {
if (device.IsExtDepthBiasControlSupported()) {
return true;
}
+ if (!Settings::values.renderer_amdvlk_depth_bias_workaround) {
+ return false;
+ }
// the base formulas can be obtained from here:
// https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-output-merger-stage-depth-bias
const double rescale_factor =
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp
index 617417040..835a1338b 100644
--- a/src/video_core/vulkan_common/vulkan_device.cpp
+++ b/src/video_core/vulkan_common/vulkan_device.cpp
@@ -1051,6 +1051,13 @@ void Device::RemoveUnsuitableExtensions() {
RemoveExtensionFeatureIfUnsuitable(extensions.custom_border_color, features.custom_border_color,
VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME);
+ // VK_EXT_depth_bias_control
+ extensions.depth_bias_control =
+ features.depth_bias_control.depthBiasControl &&
+ features.depth_bias_control.leastRepresentableValueForceUnormRepresentation;
+ RemoveExtensionFeatureIfUnsuitable(extensions.depth_bias_control, features.depth_bias_control,
+ VK_EXT_DEPTH_BIAS_CONTROL_EXTENSION_NAME);
+
// VK_EXT_depth_clip_control
extensions.depth_clip_control = features.depth_clip_control.depthClipControl;
RemoveExtensionFeatureIfUnsuitable(extensions.depth_clip_control, features.depth_clip_control,
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h
index 2063f58b5..eb314fe33 100644
--- a/src/video_core/vulkan_common/vulkan_device.h
+++ b/src/video_core/vulkan_common/vulkan_device.h
@@ -456,8 +456,7 @@ public:
/// Returns true if the device supports VK_EXT_depth_bias_control.
bool IsExtDepthBiasControlSupported() const {
- return extensions.depth_bias_control && features.depth_bias_control.depthBiasControl &&
- features.depth_bias_control.leastRepresentableValueForceUnormRepresentation;
+ return extensions.depth_bias_control;
}
/// Returns true if the device supports VK_EXT_shader_viewport_index_layer.