radv: Allow setting the domain origin in tess.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Thu, 5 Oct 2017 23:10:11 +0000 (01:10 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Thu, 5 Oct 2017 23:41:29 +0000 (01:41 +0200)
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_pipeline.c

index 5800f297074f5f2590846abd1b8d1adfe691beec..95a00cb357dfcf0d14b3265bdf92495b24369cc7 100644 (file)
@@ -1542,11 +1542,19 @@ calculate_tess_state(struct radv_pipeline *pipeline,
                break;
        }
 
+       bool ccw = tes->info.tes.ccw;
+       const VkPipelineTessellationDomainOriginStateCreateInfoKHR *domain_origin_state =
+                     vk_find_struct_const(pCreateInfo->pTessellationState,
+                                          PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO_KHR);
+
+       if (domain_origin_state && domain_origin_state->domainOrigin != VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT_KHR)
+               ccw = !ccw;
+
        if (tes->info.tes.point_mode)
                topology = V_028B6C_OUTPUT_POINT;
        else if (tes->info.tes.primitive_mode == GL_ISOLINES)
                topology = V_028B6C_OUTPUT_LINE;
-       else if (tes->info.tes.ccw)
+       else if (ccw)
                topology = V_028B6C_OUTPUT_TRIANGLE_CW;
        else
                topology = V_028B6C_OUTPUT_TRIANGLE_CCW;