diff options
author | Brian Ho <brian@brkho.com> | 2020-04-24 08:51:04 -0700 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-06-22 14:35:45 +0000 |
commit | eefdca2e2f5a558e02102c1f6e1736b61acc67b2 (patch) | |
tree | 42dd120416bbc44fb6f91805d26ca85479715c2f | |
parent | ff16e72545bdcf26ae02475d90f911d31518928e (diff) |
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>
-rw-r--r-- | src/freedreno/vulkan/tu_pipeline.c | 16 | ||||
-rw-r--r-- | src/freedreno/vulkan/tu_util.h | 3 |
2 files changed, 18 insertions, 1 deletions
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 @@ -1930,6 +1930,21 @@ tu_pipeline_static_state(struct tu_pipeline *pipeline, struct tu_cs *cs, } 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]; |