[dxvk] Fix tessellation validation

Prevents crashes in case an app tries to use tessellation with
an incorrect primitive topology.
This commit is contained in:
Philip Rebohle 2019-10-11 00:04:06 +02:00
parent 2c974cbe1e
commit e615416b31
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
1 changed files with 7 additions and 4 deletions

View File

@ -457,10 +457,13 @@ namespace dxvk {
if ((providedVertexInputs & m_vsIn) != m_vsIn)
return false;
// If there are no tessellation shaders, we
// obviously cannot use tessellation patches.
if ((state.ia.primitiveTopology() == VK_PRIMITIVE_TOPOLOGY_PATCH_LIST)
&& (m_shaders.tcs == nullptr || m_shaders.tes == nullptr))
// Tessellation shaders and patches must be used together
bool hasPatches = state.ia.primitiveTopology() == VK_PRIMITIVE_TOPOLOGY_PATCH_LIST;
bool hasTcs = m_shaders.tcs != nullptr;
bool hasTes = m_shaders.tes != nullptr;
if (hasPatches != hasTcs || hasPatches != hasTes)
return false;
// Filter out undefined primitive topologies