summaryrefslogtreecommitdiff
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp29
1 files changed, 3 insertions, 26 deletions
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 6cfec2e6f..84955bdc8 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -1054,39 +1054,16 @@ void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D::Regs& regs) {
1054 regs.zeta.format == Tegra::DepthFormat::X8Z24_UNORM || 1054 regs.zeta.format == Tegra::DepthFormat::X8Z24_UNORM ||
1055 regs.zeta.format == Tegra::DepthFormat::S8Z24_UNORM || 1055 regs.zeta.format == Tegra::DepthFormat::S8Z24_UNORM ||
1056 regs.zeta.format == Tegra::DepthFormat::V8Z24_UNORM; 1056 regs.zeta.format == Tegra::DepthFormat::V8Z24_UNORM;
1057 bool force_unorm = ([&] { 1057 if (is_d24 && !device.SupportsD24DepthBuffer() && program_id == 0x1006A800016E000ULL) {
1058 if (!is_d24 || device.SupportsD24DepthBuffer()) {
1059 return false;
1060 }
1061 if (device.IsExtDepthBiasControlSupported()) {
1062 return true;
1063 }
1064 // Only activate this in Super Smash Brothers Ultimate 1058 // Only activate this in Super Smash Brothers Ultimate
1065 // Affects AMD cards using AMDVLK
1066 if (program_id != 0x1006A800016E000ULL) {
1067 return false;
1068 }
1069 // the base formulas can be obtained from here: 1059 // the base formulas can be obtained from here:
1070 // https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-output-merger-stage-depth-bias 1060 // https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-output-merger-stage-depth-bias
1071 const double rescale_factor = 1061 const double rescale_factor =
1072 static_cast<double>(1ULL << (32 - 24)) / (static_cast<double>(0x1.ep+127)); 1062 static_cast<double>(1ULL << (32 - 24)) / (static_cast<double>(0x1.ep+127));
1073 units = static_cast<float>(static_cast<double>(units) * rescale_factor); 1063 units = static_cast<float>(static_cast<double>(units) * rescale_factor);
1074 return false; 1064 }
1075 })();
1076 scheduler.Record([constant = units, clamp = regs.depth_bias_clamp, 1065 scheduler.Record([constant = units, clamp = regs.depth_bias_clamp,
1077 factor = regs.slope_scale_depth_bias, force_unorm, 1066 factor = regs.slope_scale_depth_bias](vk::CommandBuffer cmdbuf) {
1078 precise = device.HasExactDepthBiasControl()](vk::CommandBuffer cmdbuf) {
1079 if (force_unorm) {
1080 VkDepthBiasRepresentationInfoEXT info{
1081 .sType = VK_STRUCTURE_TYPE_DEPTH_BIAS_REPRESENTATION_INFO_EXT,
1082 .pNext = nullptr,
1083 .depthBiasRepresentation =
1084 VK_DEPTH_BIAS_REPRESENTATION_LEAST_REPRESENTABLE_VALUE_FORCE_UNORM_EXT,
1085 .depthBiasExact = precise ? VK_TRUE : VK_FALSE,
1086 };
1087 cmdbuf.SetDepthBias(constant, clamp, factor, &info);
1088 return;
1089 }
1090 cmdbuf.SetDepthBias(constant, clamp, factor); 1067 cmdbuf.SetDepthBias(constant, clamp, factor);
1091 }); 1068 });
1092} 1069}