From 92a1395cd01e53cf0939aaa872136ceac01aa7bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 26 Jan 2020 15:30:20 +0100 Subject: [PATCH] Apply viewport before SoftwareTransform so flipping can be checked --- GPU/Vulkan/DrawEngineVulkan.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/GPU/Vulkan/DrawEngineVulkan.cpp b/GPU/Vulkan/DrawEngineVulkan.cpp index b5ca090dc4b6..9a3ee27ed349 100644 --- a/GPU/Vulkan/DrawEngineVulkan.cpp +++ b/GPU/Vulkan/DrawEngineVulkan.cpp @@ -895,6 +895,14 @@ void DrawEngineVulkan::DoFlush() { params.allowSeparateAlphaClear = false; params.provokeFlatFirst = true; + // We need to update the viewport early because it's checked for flipping in SoftwareTransform. + // We don't have a "DrawStateEarly" in vulkan, so... + // TODO: Probably should eventually refactor this and feed the vp size into SoftwareTransform directly (Unknown's idea). + if (gstate_c.IsDirty(DIRTY_VIEWPORTSCISSOR_STATE)) { + gstate_c.vpWidth = gstate.getViewportXScale() * 2.0f; + gstate_c.vpHeight = gstate.getViewportYScale() * 2.0f; + } + int maxIndex = indexGen.MaxIndex(); SoftwareTransform( prim, indexGen.VertexCount(),