From: Mikko Rasa Date: Fri, 11 Mar 2022 12:53:32 +0000 (+0200) Subject: Change front face logic on Vulkan to match the OpenGL backend X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=9c62dbb21e979d23c2e7cf0aff3746402718c7b2 Change front face logic on Vulkan to match the OpenGL backend Front face is always set, not only when face cull is enabled. Since we pretend that NDC has the same orientation as on OpenGL, face winding gets inverted. This will probably produce incorrect results if anything rendering to a swapchain image relies on winding. --- diff --git a/source/backends/vulkan/pipelinestate_backend.cpp b/source/backends/vulkan/pipelinestate_backend.cpp index 4f50c77e..e4321509 100644 --- a/source/backends/vulkan/pipelinestate_backend.cpp +++ b/source/backends/vulkan/pipelinestate_backend.cpp @@ -173,16 +173,11 @@ void VulkanPipelineState::fill_creation_info(vector &buffer) const raster_info->depthClampEnable = VK_FALSE; raster_info->rasterizerDiscardEnable = VK_FALSE; raster_info->polygonMode = VK_POLYGON_MODE_FILL; + raster_info->frontFace = (self.front_face==CLOCKWISE ? VK_FRONT_FACE_COUNTER_CLOCKWISE : VK_FRONT_FACE_CLOCKWISE); if(self.face_cull==NO_CULL || self.front_face==NON_MANIFOLD) - { raster_info->cullMode = VK_CULL_MODE_NONE; - raster_info->frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; - } else - { raster_info->cullMode = (self.face_cull==CULL_FRONT ? VK_CULL_MODE_FRONT_BIT : VK_CULL_MODE_BACK_BIT); - raster_info->frontFace = (self.front_face==CLOCKWISE ? VK_FRONT_FACE_CLOCKWISE : VK_FRONT_FACE_COUNTER_CLOCKWISE); - } raster_info->depthBiasEnable = VK_FALSE; raster_info->depthBiasConstantFactor = 0.0f; raster_info->depthBiasClamp = 0.0f;