Vulkan: Don't enable primitive restart on list topologies

This commit is contained in:
Stenzek 2017-02-18 13:40:32 +10:00
parent 82734fffaa
commit 6965dc0481
1 changed files with 20 additions and 1 deletions

View File

@ -72,6 +72,14 @@ bool ObjectCache::Initialize()
return true; return true;
} }
static bool IsStripPrimitiveTopology(VkPrimitiveTopology topology)
{
return topology == VK_PRIMITIVE_TOPOLOGY_LINE_STRIP ||
topology == VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP ||
topology == VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY ||
topology == VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY;
}
static VkPipelineRasterizationStateCreateInfo static VkPipelineRasterizationStateCreateInfo
GetVulkanRasterizationState(const RasterizationState& state) GetVulkanRasterizationState(const RasterizationState& state)
{ {
@ -185,9 +193,20 @@ VkPipeline ObjectCache::CreatePipeline(const PipelineInfo& info)
nullptr, // const void* pNext nullptr, // const void* pNext
0, // VkPipelineInputAssemblyStateCreateFlags flags 0, // VkPipelineInputAssemblyStateCreateFlags flags
info.primitive_topology, // VkPrimitiveTopology topology info.primitive_topology, // VkPrimitiveTopology topology
VK_TRUE // VkBool32 primitiveRestartEnable VK_FALSE // VkBool32 primitiveRestartEnable
}; };
// See Vulkan spec, section 19:
// If topology is VK_PRIMITIVE_TOPOLOGY_POINT_LIST, VK_PRIMITIVE_TOPOLOGY_LINE_LIST,
// VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY,
// VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY or VK_PRIMITIVE_TOPOLOGY_PATCH_LIST,
// primitiveRestartEnable must be VK_FALSE
if (g_ActiveConfig.backend_info.bSupportsPrimitiveRestart &&
IsStripPrimitiveTopology(info.primitive_topology))
{
input_assembly_state.primitiveRestartEnable = VK_TRUE;
}
// Shaders to stages // Shaders to stages
VkPipelineShaderStageCreateInfo shader_stages[3]; VkPipelineShaderStageCreateInfo shader_stages[3];
uint32_t num_shader_stages = 0; uint32_t num_shader_stages = 0;