Swap min and max depth when negative scale is used

Fixes Super Mario 3D All Stars rendering.
This commit is contained in:
Billy Laws 2023-01-29 22:16:46 +00:00
parent 198e9e8e48
commit d659b4f55e

View File

@ -249,9 +249,14 @@ namespace skyline::gpu::interconnect::maxwell3d {
vkViewport.height = -vkViewport.height;
}
// Clamp since we don't yet use VK_EXT_unrestricted_depth_range
vkViewport.minDepth = std::clamp(viewportClip.minZ, 0.0f, 1.0f);
vkViewport.maxDepth = std::clamp(viewportClip.maxZ, 0.0f, 1.0f);
if (viewport.scaleZ < 0.0f)
std::swap(vkViewport.minDepth, vkViewport.maxDepth);
return vkViewport;
}