diff options
author | Jaebaek Seo <duke.acacia@gmail.com> | 2019-01-28 16:47:49 -0500 |
---|---|---|
committer | dan sinclair <dj2@everburning.com> | 2019-01-28 16:47:49 -0500 |
commit | 115c15a12834f093bdfc5bd51846a737db6fe2b9 (patch) | |
tree | d085d12cfcef8c5f44db2b5f33c6789e34a2acde /src/vulkan/graphics_pipeline.cc | |
parent | 970ba7a99eba1cd8d8a1ea10e4525db8b93fd284 (diff) | |
download | amber-115c15a12834f093bdfc5bd51846a737db6fe2b9.tar.gz |
Vulkan: support tessellation control/eval shader (#249)
Fixes #236
Diffstat (limited to 'src/vulkan/graphics_pipeline.cc')
-rw-r--r-- | src/vulkan/graphics_pipeline.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/vulkan/graphics_pipeline.cc b/src/vulkan/graphics_pipeline.cc index 0397646..f9866cd 100644 --- a/src/vulkan/graphics_pipeline.cc +++ b/src/vulkan/graphics_pipeline.cc @@ -259,8 +259,14 @@ Result GraphicsPipeline::CreateVkGraphicsPipeline( viewport_info.pScissors = &scissor; auto shader_stage_info = GetShaderStageInfo(); - for (auto& info : shader_stage_info) + bool is_tessellation_needed = false; + for (auto& info : shader_stage_info) { info.pName = GetEntryPointName(info.stage); + if (info.stage == VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT || + info.stage == VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT) { + is_tessellation_needed = true; + } + } VkPipelineMultisampleStateCreateInfo multisampleInfo = { VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, /* sType */ @@ -284,6 +290,13 @@ Result GraphicsPipeline::CreateVkGraphicsPipeline( pipeline_info.pRasterizationState = &kDefaultRasterizationInfo; pipeline_info.pMultisampleState = &multisampleInfo; + VkPipelineTessellationStateCreateInfo tess_info = {}; + if (is_tessellation_needed) { + tess_info.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO; + tess_info.patchControlPoints = patch_control_points_; + pipeline_info.pTessellationState = &tess_info; + } + VkPipelineDepthStencilStateCreateInfo depthstencil_info; if (depth_stencil_format_ != VK_FORMAT_UNDEFINED) { depthstencil_info = GetPipelineDepthStencilInfo(); |