Merge pull request #12235 from liamwhite/flip-clip

renderer_vulkan: adjust window origin and swizzle independently
This commit is contained in:
liamwhite 2023-12-03 21:59:11 -05:00 committed by GitHub
commit 90e87c40e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -75,14 +75,20 @@ VkViewport GetViewportState(const Device& device, const Maxwell& regs, size_t in
const float width = conv(src.scale_x * 2.0f); const float width = conv(src.scale_x * 2.0f);
float y = conv(src.translate_y - src.scale_y); float y = conv(src.translate_y - src.scale_y);
float height = conv(src.scale_y * 2.0f); float height = conv(src.scale_y * 2.0f);
bool y_negate = regs.window_origin.mode != Maxwell::WindowOrigin::Mode::UpperLeft;
if (!device.IsNvViewportSwizzleSupported()) { const bool lower_left = regs.window_origin.mode != Maxwell::WindowOrigin::Mode::UpperLeft;
y_negate = y_negate != (src.swizzle.y == Maxwell::ViewportSwizzle::NegativeY); const bool y_negate = !device.IsNvViewportSwizzleSupported() &&
src.swizzle.y == Maxwell::ViewportSwizzle::NegativeY;
if (lower_left) {
// Flip by surface clip height
y += conv(static_cast<f32>(regs.surface_clip.height));
height = -height;
} }
if (y_negate) { if (y_negate) {
y += conv(static_cast<f32>(regs.surface_clip.height)); // Flip by viewport height
y += height;
height = -height; height = -height;
} }