Просмотр исходного кода

vk_graphics_pipeline: Guard against non-tessellation pipelines using patches

ReinUsesLisp 5 лет назад
Родитель
Сommit
5b1b06f11e
1 измененных файлов с 8 добавлено и 2 удалено
  1. 8 2
      src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp

+ 8 - 2
src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp

@@ -345,12 +345,18 @@ void GraphicsPipeline::MakePipeline(const Device& device, VkRenderPass render_pa
     if (!vertex_binding_divisors.empty()) {
     if (!vertex_binding_divisors.empty()) {
         vertex_input_ci.pNext = &input_divisor_ci;
         vertex_input_ci.pNext = &input_divisor_ci;
     }
     }
-    const auto input_assembly_topology = MaxwellToVK::PrimitiveTopology(device, state.topology);
+    auto input_assembly_topology = MaxwellToVK::PrimitiveTopology(device, state.topology);
+    if (input_assembly_topology == VK_PRIMITIVE_TOPOLOGY_PATCH_LIST) {
+        if (!spv_modules[1] && !spv_modules[2]) {
+            LOG_WARNING(Render_Vulkan, "Patch topology used without tessellation, using points");
+            input_assembly_topology = VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
+        }
+    }
     const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci{
     const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci{
         .sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
         .sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
         .pNext = nullptr,
         .pNext = nullptr,
         .flags = 0,
         .flags = 0,
-        .topology = MaxwellToVK::PrimitiveTopology(device, state.topology),
+        .topology = input_assembly_topology,
         .primitiveRestartEnable = state.primitive_restart_enable != 0 &&
         .primitiveRestartEnable = state.primitive_restart_enable != 0 &&
                                   SupportsPrimitiveRestart(input_assembly_topology),
                                   SupportsPrimitiveRestart(input_assembly_topology),
     };
     };