Mesa (master): turnip: Parse tess state and support PATCH primtype

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 22 14:58:15 UTC 2020


Module: Mesa
Branch: master
Commit: eefdca2e2f5a558e02102c1f6e1736b61acc67b2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=eefdca2e2f5a558e02102c1f6e1736b61acc67b2

Author: Brian Ho <brian at brkho.com>
Date:   Fri Apr 24 08:51:04 2020 -0700

turnip: Parse tess state and support PATCH primtype

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 | 16 ++++++++++++++++
 src/freedreno/vulkan/tu_util.h     |  3 ++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c
index 6093881217e..e6442575af5 100644
--- a/src/freedreno/vulkan/tu_pipeline.c
+++ b/src/freedreno/vulkan/tu_pipeline.c
@@ -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);
diff --git a/src/freedreno/vulkan/tu_util.h b/src/freedreno/vulkan/tu_util.h
index 18462c83562..c34cd689ac7 100644
--- a/src/freedreno/vulkan/tu_util.h
+++ b/src/freedreno/vulkan/tu_util.h
@@ -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];



More information about the mesa-commit mailing list