From ee77afb6af884f3861488c8d3dade3eee0002d7f Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 21 Oct 2019 12:10:05 +0200 Subject: [PATCH] [d3d11] Validate shader module capabilities Only create a shader module if the device actually supports the required features. Apparently this is needed for some Unity Engine games. --- src/d3d11/d3d11_device.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp index 61aaca29e..e093f0f2d 100644 --- a/src/d3d11/d3d11_device.cpp +++ b/src/d3d11/d3d11_device.cpp @@ -2049,6 +2049,16 @@ namespace dxvk { if (FAILED(hr)) return hr; + auto shader = commonShader.GetShader(); + + if (shader->hasCapability(spv::CapabilityStencilExportEXT) + && !m_dxvkDevice->extensions().extShaderStencilExport) + return E_INVALIDARG; + + if (shader->hasCapability(spv::CapabilityShaderViewportIndexLayerEXT) + && !m_dxvkDevice->extensions().extShaderViewportIndexLayer) + return E_INVALIDARG; + *pShaderModule = std::move(commonShader); return S_OK; }