[util] Add a config option for shader register index validations

This commit is contained in:
WinterSnowfall 2024-12-22 00:18:40 +02:00
parent 150cb0d4c7
commit 92fc317c29
No known key found for this signature in database
6 changed files with 24 additions and 3 deletions

View file

@ -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::SetValidateInputRegisterIndex(m_d3d9Options.validateInputRegisterIndex);
}

View file

@ -76,6 +76,7 @@ namespace dxvk {
this->clampNegativeLodBias = config.getOption<bool> ("d3d9.clampNegativeLodBias", false);
this->countLosableResources = config.getOption<bool> ("d3d9.countLosableResources", true);
this->reproducibleCommandStream = config.getOption<bool> ("d3d9.reproducibleCommandStream", false);
this->validateInputRegisterIndex = config.getOption<bool> ("d3d9.validateInputRegisterIndex", false);
// D3D8 options
this->drefScaling = config.getOption<int32_t> ("d3d8.scaleDref", 0);

View file

@ -153,6 +153,9 @@ namespace dxvk {
/// can negatively affect performance.
bool reproducibleCommandStream;
// Validate input register index for PS 3.0 in D3D9ShaderValidator
bool validateInputRegisterIndex;
/// Enable depth texcoord Z (Dref) scaling (D3D8 quirk)
int32_t drefScaling;
};

View file

@ -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_validateInputRegisterIndex && m_isPixelShader && m_majorVersion == 3) {
switch (instContext.instruction.opcode) {
case DxsoOpcode::Comment:
case DxsoOpcode::Def:
@ -193,8 +193,6 @@ namespace dxvk {
if (m_callback)
m_callback(pFile, Line, Unknown, MessageID, Message.c_str(), m_userData);
// TODO: Consider switching this to debug, once we're
// confident the implementation doesn't cause any issues
Logger::warn(Message);
m_state = D3D9ShaderValidatorState::Error;
@ -202,4 +200,9 @@ namespace dxvk {
return E_FAIL;
}
// s_validateInputRegisterIndex will be parsed and set appropriately based
// on config options whenever a D3D9InterfaceEx type object is created
bool D3D9ShaderValidator::s_validateInputRegisterIndex = false;
}

View file

@ -76,6 +76,10 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE End();
static void SetValidateInputRegisterIndex (bool value) {
s_validateInputRegisterIndex = 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_validateInputRegisterIndex;
bool m_isPixelShader = false;
uint32_t m_majorVersion = 0;
uint32_t m_minorVersion = 0;

View file

@ -1021,6 +1021,11 @@ namespace dxvk {
{ R"(\\(AH3LM|AALib)\.exe$)", {{
{ "d3d9.maxFrameRate", "60" },
}} },
/* The Void - Crashes in several locations *
* without input register index validations */
{ R"(\\The Void\\bin\\win32\\Game\.exe$)", {{
{ "d3d9.validateInputRegisterIndex", "True" },
}} },
/**********************************************/
/* D3D8 GAMES */