From 6c6dd47448a7478884f8856a8543964ab6d981fb Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Thu, 5 Jul 2018 22:04:23 -0700 Subject: Always using negative viewport height in Vulkan to be 100% consistent with Direct3D --- Graphics/GraphicsEngine/interface/DeviceCaps.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/interface/DeviceCaps.h b/Graphics/GraphicsEngine/interface/DeviceCaps.h index 496f3599..aacedfcf 100644 --- a/Graphics/GraphicsEngine/interface/DeviceCaps.h +++ b/Graphics/GraphicsEngine/interface/DeviceCaps.h @@ -149,7 +149,11 @@ namespace Diligent { if (IsVulkanDevice()) { - static constexpr const NDCAttribs NDCAttribsVk {0.0f, 1.0f, 0.5f}; + // Note that Vulkan itself does not invert Y coordinate when transforming + // normalized device Y to window space. However, we use negative viewport + // height which achieves the same effect as in D3D, thererfore we need to + // invert y (see comments in DeviceContextVkImpl::CommitViewports() for details) + static constexpr const NDCAttribs NDCAttribsVk {0.0f, 1.0f, -0.5f}; return NDCAttribsVk; } else if (IsD3DDevice()) -- cgit v1.2.3