Fix vertex state shader compilation in Spy vs Spy^

This commit is contained in:
Luke Usher 2019-12-19 19:34:46 +00:00
parent 56af31aede
commit f23c9adae1
1 changed files with 22 additions and 4 deletions

View File

@ -1633,8 +1633,7 @@ extern HRESULT EmuRecompileVshFunction
case VERSION_XVS: case VERSION_XVS:
break; break;
case VERSION_XVSS: case VERSION_XVSS:
EmuLog(LOG_LEVEL::WARNING, "Might not support vertex state shaders?"); LOG_TEST_CASE("Might not support vertex state shaders?");
hRet = E_FAIL;
break; break;
case VERSION_XVSW: case VERSION_XVSW:
EmuLog(LOG_LEVEL::WARNING, "Might not support vertex read/write shaders?"); EmuLog(LOG_LEVEL::WARNING, "Might not support vertex read/write shaders?");
@ -1696,10 +1695,29 @@ extern HRESULT EmuRecompileVshFunction
ppRecompiledShader, // out ppRecompiledShader, // out
&pErrors // ppErrorMsgs out &pErrors // ppErrorMsgs out
); );
if (FAILED(hRet)) {
// Attempt to retry in compatibility mode, this allows some vertex-state shaders to compile
// Test Case: Spy vs Spy
flags1 |= D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY;
hRet = D3DCompile(
hlsl_str.c_str(),
hlsl_str.length(),
nullptr, // pSourceName
nullptr, // pDefines
nullptr, // pInclude // TODO precompile x_* HLSL functions?
"main", // shader entry poiint
"vs_3_0", // shader profile
flags1, // flags1
0, // flags2
ppRecompiledShader, // out
&pErrors // ppErrorMsgs out
);
if (FAILED(hRet)) { if (FAILED(hRet)) {
LOG_TEST_CASE("Couldn't assemble recompiled vertex shader"); LOG_TEST_CASE("Couldn't assemble recompiled vertex shader");
//EmuLog(LOG_LEVEL::WARNING, "Couldn't assemble recompiled vertex shader"); //EmuLog(LOG_LEVEL::WARNING, "Couldn't assemble recompiled vertex shader");
} }
}
// Determine the log level // Determine the log level
auto hlslErrorLogLevel = FAILED(hRet) ? LOG_LEVEL::ERROR2 : LOG_LEVEL::DEBUG; auto hlslErrorLogLevel = FAILED(hRet) ? LOG_LEVEL::ERROR2 : LOG_LEVEL::DEBUG;