summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp34
1 files changed, 31 insertions, 3 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp
index e0e27333..732c47e5 100644
--- a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp
@@ -845,10 +845,38 @@ void SwapChainVkImpl::Resize(Uint32 NewWidth, Uint32 NewHeight, SURFACE_TRANSFOR
VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR |
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR |
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR;
- if ((surfCapabilities.currentTransform & Rotate90TransformFlags) != 0)
+
+ if (NewWidth == 0 || NewHeight == 0)
+ {
+ NewWidth = m_SurfaceIdentityExtent.width;
+ NewHeight = m_SurfaceIdentityExtent.height;
+
+ if ((surfCapabilities.currentTransform & Rotate90TransformFlags) != 0)
+ {
+ // Swap to get logical dimensions as input NewWidth and NewHeight are
+ // expected to be logical sizes.
+ std::swap(NewWidth, NewHeight);
+ }
+ }
+
+ if (NewPreTransform == SURFACE_TRANSFORM_OPTIMAL)
{
- // The surface is rotated 90/270 degrees - swap width and height
- std::swap(NewWidth, NewHeight);
+ if ((surfCapabilities.currentTransform & Rotate90TransformFlags) != 0)
+ {
+ // Swap to get physical dimensions
+ std::swap(NewWidth, NewHeight);
+ }
+ }
+ else
+ {
+ // Swap if necessary to get desired sizes after pre-transform
+ if (NewPreTransform == SURFACE_TRANSFORM_ROTATE_90 ||
+ NewPreTransform == SURFACE_TRANSFORM_ROTATE_270 ||
+ NewPreTransform == SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90 ||
+ NewPreTransform == SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270)
+ {
+ std::swap(NewWidth, NewHeight);
+ }
}
}
else