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,7 +168,8 @@ DrawParams MakeDrawParams(const Tegra::Engines::Maxwell3D::DrawManager::State& d
return params; return params;
} }
bool SupportsPrimitiveRestart(VkPrimitiveTopology topology) { bool IsPrimitiveRestartSupported(const Device& device, VkPrimitiveTopology topology) {
auto const supports_primitive_restart = [](VkPrimitiveTopology topology) {
switch (topology) { switch (topology) {
case VK_PRIMITIVE_TOPOLOGY_POINT_LIST: case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
case VK_PRIMITIVE_TOPOLOGY_LINE_LIST: case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
@ -180,14 +181,9 @@ bool SupportsPrimitiveRestart(VkPrimitiveTopology topology) {
default: default:
return true; return true;
} }
} };
return ((topology != VK_PRIMITIVE_TOPOLOGY_PATCH_LIST && device.IsTopologyListPrimitiveRestartSupported())
bool IsPrimitiveRestartSupported(const Device& device, VkPrimitiveTopology topology) { || supports_primitive_restart(topology) || (topology == VK_PRIMITIVE_TOPOLOGY_PATCH_LIST && device.IsPatchListPrimitiveRestartSupported()));
return ((topology != VK_PRIMITIVE_TOPOLOGY_PATCH_LIST &&
device.IsTopologyListPrimitiveRestartSupported()) ||
SupportsPrimitiveRestart(topology) ||
(topology == VK_PRIMITIVE_TOPOLOGY_PATCH_LIST &&
device.IsPatchListPrimitiveRestartSupported()));
} }
} // Anonymous namespace } // Anonymous namespace