fixup primitive restart

This commit is contained in:
lizzie 2026-05-26 22:50:13 +00:00
parent 860db04e85
commit d59f0704e5
2 changed files with 27 additions and 29 deletions

View file

@ -79,16 +79,18 @@ VkStencilOpState GetStencilFaceState(const StencilFace& face) {
} }
bool SupportsPrimitiveRestart(VkPrimitiveTopology topology) { bool SupportsPrimitiveRestart(VkPrimitiveTopology topology) {
static constexpr std::array unsupported_topologies{ switch (topology) {
VK_PRIMITIVE_TOPOLOGY_POINT_LIST, case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
VK_PRIMITIVE_TOPOLOGY_LINE_LIST, case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY, case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY, case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
VK_PRIMITIVE_TOPOLOGY_PATCH_LIST, case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
// VK_PRIMITIVE_TOPOLOGY_QUAD_LIST_EXT, // case VK_PRIMITIVE_TOPOLOGY_QUAD_LIST_EXT:
}; return false;
return std::ranges::find(unsupported_topologies, topology) == unsupported_topologies.end(); default:
return true;
}
} }
bool IsLine(VkPrimitiveTopology topology) { bool IsLine(VkPrimitiveTopology topology) {

View file

@ -168,26 +168,22 @@ DrawParams MakeDrawParams(const Tegra::Engines::Maxwell3D::DrawManager::State& d
return params; return params;
} }
bool SupportsPrimitiveRestart(VkPrimitiveTopology topology) {
switch (topology) {
case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
return false;
default:
return true;
}
}
bool IsPrimitiveRestartSupported(const Device& device, VkPrimitiveTopology topology) { bool IsPrimitiveRestartSupported(const Device& device, VkPrimitiveTopology topology) {
return ((topology != VK_PRIMITIVE_TOPOLOGY_PATCH_LIST && auto const supports_primitive_restart = [](VkPrimitiveTopology topology) {
device.IsTopologyListPrimitiveRestartSupported()) || switch (topology) {
SupportsPrimitiveRestart(topology) || case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
(topology == VK_PRIMITIVE_TOPOLOGY_PATCH_LIST && case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
device.IsPatchListPrimitiveRestartSupported())); case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
return false;
default:
return true;
}
};
return ((topology != VK_PRIMITIVE_TOPOLOGY_PATCH_LIST && device.IsTopologyListPrimitiveRestartSupported())
|| supports_primitive_restart(topology) || (topology == VK_PRIMITIVE_TOPOLOGY_PATCH_LIST && device.IsPatchListPrimitiveRestartSupported()));
} }
} // Anonymous namespace } // Anonymous namespace