diff --git a/src/d3d9/d3d9_interface.cpp b/src/d3d9/d3d9_interface.cpp index 46ec5d65401..6f2a39295c6 100644 --- a/src/d3d9/d3d9_interface.cpp +++ b/src/d3d9/d3d9_interface.cpp @@ -4,6 +4,7 @@ #include "d3d9_caps.h" #include "d3d9_device.h" #include "d3d9_bridge.h" +#include "d3d9_shader_validator.h" #include "../util/util_singleton.h" @@ -67,6 +68,8 @@ namespace dxvk { SetProcessDPIAware(); } #endif + + D3D9ShaderValidator::SetValidateShaderInputCount(m_d3d9Options.validateShaderInputCount); } diff --git a/src/d3d9/d3d9_options.cpp b/src/d3d9/d3d9_options.cpp index e535d610c5e..de7d9b40c0d 100644 --- a/src/d3d9/d3d9_options.cpp +++ b/src/d3d9/d3d9_options.cpp @@ -76,6 +76,7 @@ namespace dxvk { this->clampNegativeLodBias = config.getOption ("d3d9.clampNegativeLodBias", false); this->countLosableResources = config.getOption ("d3d9.countLosableResources", true); this->reproducibleCommandStream = config.getOption ("d3d9.reproducibleCommandStream", false); + this->validateShaderInputCount = config.getOption ("d3d9.validateShaderInputCount", false); // D3D8 options this->drefScaling = config.getOption ("d3d8.scaleDref", 0); diff --git a/src/d3d9/d3d9_options.h b/src/d3d9/d3d9_options.h index 7339f8cbb2f..743a5b675be 100644 --- a/src/d3d9/d3d9_options.h +++ b/src/d3d9/d3d9_options.h @@ -153,6 +153,9 @@ namespace dxvk { /// can negatively affect performance. bool reproducibleCommandStream; + // Validate shader input count for PS 3.0 in D3D9ShaderValidator + bool validateShaderInputCount; + /// Enable depth texcoord Z (Dref) scaling (D3D8 quirk) int32_t drefScaling; }; diff --git a/src/d3d9/d3d9_shader_validator.cpp b/src/d3d9/d3d9_shader_validator.cpp index a4f983e53ba..e7bfb669642 100644 --- a/src/d3d9/d3d9_shader_validator.cpp +++ b/src/d3d9/d3d9_shader_validator.cpp @@ -77,7 +77,7 @@ namespace dxvk { }*/ // a maximum of 10 inputs are supported with PS 3.0 (validation required by The Void) - if (m_isPixelShader && m_majorVersion == 3) { + if (s_validateShaderInputCount && m_isPixelShader && m_majorVersion == 3) { switch (instContext.instruction.opcode) { case DxsoOpcode::Comment: case DxsoOpcode::Def: @@ -202,4 +202,9 @@ namespace dxvk { return E_FAIL; } + + // s_validateShaderInputCount will be parsed and set appropriately based + // on config options whenever a D3D9InterfaceEx type object is created + bool D3D9ShaderValidator::s_validateShaderInputCount = false; + } \ No newline at end of file diff --git a/src/d3d9/d3d9_shader_validator.h b/src/d3d9/d3d9_shader_validator.h index eff743dc1ad..2df6df457da 100644 --- a/src/d3d9/d3d9_shader_validator.h +++ b/src/d3d9/d3d9_shader_validator.h @@ -76,6 +76,10 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE End(); + static void SetValidateShaderInputCount (bool value) { + s_validateShaderInputCount = value; + } + private: HRESULT ValidateHeader(const char* pFile, UINT Line, const DWORD* pdwInst, DWORD cdw); @@ -89,6 +93,8 @@ namespace dxvk { D3D9ShaderValidatorMessage MessageID, const std::string& Message); + static bool s_validateShaderInputCount; + bool m_isPixelShader = false; uint32_t m_majorVersion = 0; uint32_t m_minorVersion = 0; diff --git a/src/util/config/config.cpp b/src/util/config/config.cpp index 95b15e3abd5..c2fcbe56306 100644 --- a/src/util/config/config.cpp +++ b/src/util/config/config.cpp @@ -1011,6 +1011,11 @@ namespace dxvk { { R"(\\DS\.exe$)", {{ { "d3d9.textureMemory", "0" }, }} }, + /* The Void - Crashes in several locations * + * without shader input count validations */ + { R"(\\The Void\\bin\\win32\\Game\.exe$)", {{ + { "d3d9.validateShaderInputCount", "True" }, + }} }, /**********************************************/ /* D3D8 GAMES */