From eefdca2e2f5a558e02102c1f6e1736b61acc67b2 Mon Sep 17 00:00:00 2001 From: Brian Ho Date: Fri, 24 Apr 2020 08:51:04 -0700 Subject: turnip: Parse tess state and support PATCH primtype This commit adds support for VK_PRIMITIVE_TOPOLOGY_PATCH_LIST primitive topologies. Part-of: --- src/freedreno/vulkan/tu_pipeline.c | 16 ++++++++++++++++ src/freedreno/vulkan/tu_util.h | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src') 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]; -- cgit v1.2.3