turnip: Parse tess state and support PATCH primtype
authorBrian Ho <brian@brkho.com>
Fri, 24 Apr 2020 15:51:04 +0000 (08:51 -0700)
committerMarge Bot <eric+marge@anholt.net>
Mon, 22 Jun 2020 14:35:45 +0000 (14:35 +0000)
This commit adds support for VK_PRIMITIVE_TOPOLOGY_PATCH_LIST
primitive topologies.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5059>

src/freedreno/vulkan/tu_pipeline.c
src/freedreno/vulkan/tu_util.h

index 6093881217e8973c345c45efd5527463231f894b..e6442575af50e77339efb355e986c04116782259 100644 (file)
@@ -1929,6 +1929,21 @@ tu_pipeline_static_state(struct tu_pipeline *pipeline, struct tu_cs *cs,
    return true;
 }
 
+static void
+tu_pipeline_builder_parse_tessellation(struct tu_pipeline_builder *builder,
+                                       struct tu_pipeline *pipeline)
+{
+   const VkPipelineTessellationStateCreateInfo *tess_info =
+      builder->create_info->pTessellationState;
+
+   if (!tess_info)
+      return;
+
+   assert(pipeline->ia.primtype == DI_PT_PATCHES0);
+   assert(tess_info->patchControlPoints <= 32);
+   pipeline->ia.primtype += tess_info->patchControlPoints;
+}
+
 static void
 tu_pipeline_builder_parse_viewport(struct tu_pipeline_builder *builder,
                                    struct tu_pipeline *pipeline)
@@ -2151,6 +2166,7 @@ tu_pipeline_builder_build(struct tu_pipeline_builder *builder,
    tu_pipeline_builder_parse_shader_stages(builder, *pipeline);
    tu_pipeline_builder_parse_vertex_input(builder, *pipeline);
    tu_pipeline_builder_parse_input_assembly(builder, *pipeline);
+   tu_pipeline_builder_parse_tessellation(builder, *pipeline);
    tu_pipeline_builder_parse_viewport(builder, *pipeline);
    tu_pipeline_builder_parse_rasterization(builder, *pipeline);
    tu_pipeline_builder_parse_depth_stencil(builder, *pipeline);
index 18462c835624cb57319fec19de20510afef084d2..c34cd689ac709b677359dfacb9479beae357f86e 100644 (file)
@@ -124,7 +124,8 @@ tu6_primtype(VkPrimitiveTopology topology)
       [VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY]     = DI_PT_LINESTRIP_ADJ,
       [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY]  = DI_PT_TRI_ADJ,
       [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY] = DI_PT_TRISTRIP_ADJ,
-      [VK_PRIMITIVE_TOPOLOGY_PATCH_LIST] = 0,
+      /* Return PATCH0 and update in tu_pipeline_builder_parse_tessellation */
+      [VK_PRIMITIVE_TOPOLOGY_PATCH_LIST]                    = DI_PT_PATCHES0,
    };
    assert(topology < ARRAY_SIZE(lookup));
    return lookup[topology];