diff options
| author | 2021-10-17 03:49:18 +0200 | |
|---|---|---|
| committer | 2021-10-23 23:46:29 +0200 | |
| commit | ad8afaf1ef0c2f6c9ecb4e3670d4a3e4192ab0a9 (patch) | |
| tree | e93207716a8e07773b4cf61b2d6fe288ec4edec2 /src | |
| parent | Vulkan Rasterizer: Correct DepthBias/PolygonOffset on Vulkan. (diff) | |
| download | yuzu-ad8afaf1ef0c2f6c9ecb4e3670d4a3e4192ab0a9.tar.gz yuzu-ad8afaf1ef0c2f6c9ecb4e3670d4a3e4192ab0a9.tar.xz yuzu-ad8afaf1ef0c2f6c9ecb4e3670d4a3e4192ab0a9.zip | |
Vulran Rasterizer: address feedback.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 04ecc034d..30b47a7a0 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -633,10 +633,12 @@ void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D::Regs& regs) { | |||
| 633 | regs.zeta.format == Tegra::DepthFormat::D24S8_UNORM || | 633 | regs.zeta.format == Tegra::DepthFormat::D24S8_UNORM || |
| 634 | regs.zeta.format == Tegra::DepthFormat::D24C8_UNORM; | 634 | regs.zeta.format == Tegra::DepthFormat::D24C8_UNORM; |
| 635 | if (is_d24 && !device.SupportsD24DepthBuffer()) { | 635 | if (is_d24 && !device.SupportsD24DepthBuffer()) { |
| 636 | const double f = static_cast<double>(1ULL << (32 - 24)) / (static_cast<double>(0x1.ep+127)); | 636 | // the base formulas can be obtained from here: |
| 637 | units = static_cast<float>(static_cast<double>(units) * f); | 637 | // https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-output-merger-stage-depth-bias |
| 638 | const double rescale_factor = | ||
| 639 | static_cast<double>(1ULL << (32 - 24)) / (static_cast<double>(0x1.ep+127)); | ||
| 640 | units = static_cast<float>(static_cast<double>(units) * rescale_factor); | ||
| 638 | } | 641 | } |
| 639 | |||
| 640 | scheduler.Record([constant = units, clamp = regs.polygon_offset_clamp, | 642 | scheduler.Record([constant = units, clamp = regs.polygon_offset_clamp, |
| 641 | factor = regs.polygon_offset_factor](vk::CommandBuffer cmdbuf) { | 643 | factor = regs.polygon_offset_factor](vk::CommandBuffer cmdbuf) { |
| 642 | cmdbuf.SetDepthBias(constant, clamp, factor); | 644 | cmdbuf.SetDepthBias(constant, clamp, factor); |