]> git.tdb.fi Git - libs/gl.git/commitdiff
Change front face logic on Vulkan to match the OpenGL backend
authorMikko Rasa <tdb@tdb.fi>
Fri, 11 Mar 2022 12:53:32 +0000 (14:53 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 11 Mar 2022 21:29:32 +0000 (23:29 +0200)
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.

source/backends/vulkan/pipelinestate_backend.cpp

index 4f50c77e11b62ed78b736a58fe35ad35dceeee98..e43215091300a25bf4c1f01d5ce8260c0b8df099 100644 (file)
@@ -173,16 +173,11 @@ void VulkanPipelineState::fill_creation_info(vector<char> &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;