1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 19:24:10 +01:00

[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

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