diff options
author | Chia-I Wu <[email protected]> | 2019-02-21 11:07:38 -0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2019-03-11 10:02:13 -0700 |
commit | 1bea6a91cb3d8498c8a7e6985be3585cac94f20a (patch) | |
tree | ed54299062d491c2fbba53363c36c0a99b1d9184 /src/freedreno | |
parent | c584c2e86c3889e39d1f3be71fcefa18a8a5f6ae (diff) |
turnip: parse VkPipelineInputAssemblyStateCreateInfo
Diffstat (limited to 'src/freedreno')
-rw-r--r-- | src/freedreno/vulkan/tu_pipeline.c | 43 | ||||
-rw-r--r-- | src/freedreno/vulkan/tu_private.h | 6 |
2 files changed, 49 insertions, 0 deletions
diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c index 50b3a02e622..b8c76971f89 100644 --- a/src/freedreno/vulkan/tu_pipeline.c +++ b/src/freedreno/vulkan/tu_pipeline.c @@ -75,6 +75,37 @@ tu_dynamic_state_bit(VkDynamicState state) } } +static enum pc_di_primtype +tu6_primtype(VkPrimitiveTopology topology) +{ + switch (topology) { + case VK_PRIMITIVE_TOPOLOGY_POINT_LIST: + return DI_PT_POINTLIST; + case VK_PRIMITIVE_TOPOLOGY_LINE_LIST: + return DI_PT_LINELIST; + case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP: + return DI_PT_LINESTRIP; + case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST: + return DI_PT_TRILIST; + case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP: + return DI_PT_TRILIST; + case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN: + return DI_PT_TRIFAN; + case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY: + return DI_PT_LINE_ADJ; + case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY: + return DI_PT_LINESTRIP_ADJ; + case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY: + return DI_PT_TRI_ADJ; + case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY: + return DI_PT_TRISTRIP_ADJ; + case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST: + default: + unreachable("invalid primitive topology"); + return DI_PT_NONE; + } +} + static VkResult tu_pipeline_builder_create_pipeline(struct tu_pipeline_builder *builder, struct tu_pipeline **out_pipeline) @@ -118,6 +149,17 @@ tu_pipeline_builder_parse_dynamic(struct tu_pipeline_builder *builder, } static void +tu_pipeline_builder_parse_input_assembly(struct tu_pipeline_builder *builder, + struct tu_pipeline *pipeline) +{ + const VkPipelineInputAssemblyStateCreateInfo *ia_info = + builder->create_info->pInputAssemblyState; + + pipeline->ia.primtype = tu6_primtype(ia_info->topology); + pipeline->ia.primitive_restart = ia_info->primitiveRestartEnable; +} + +static void tu_pipeline_finish(struct tu_pipeline *pipeline, struct tu_device *dev, const VkAllocationCallbacks *alloc) @@ -134,6 +176,7 @@ tu_pipeline_builder_build(struct tu_pipeline_builder *builder, return result; tu_pipeline_builder_parse_dynamic(builder, *pipeline); + tu_pipeline_builder_parse_input_assembly(builder, *pipeline); /* we should have reserved enough space upfront such that the CS never * grows diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h index 9a5a1a71701..adaad2dfb02 100644 --- a/src/freedreno/vulkan/tu_private.h +++ b/src/freedreno/vulkan/tu_private.h @@ -985,6 +985,12 @@ struct tu_pipeline bool need_indirect_descriptor_sets; VkShaderStageFlags active_stages; + + struct + { + enum pc_di_primtype primtype; + bool primitive_restart; + } ia; }; struct tu_userdata_info * |