Extract HLSL compilation to a method

This commit is contained in:
Anthony Miles 2020-10-27 18:23:33 +13:00 committed by Anthony
parent f44f35f6fa
commit ddc62ad00e
1 changed files with 11 additions and 8 deletions

View File

@ -237,25 +237,26 @@ HRESULT CompileHlsl(const std::string& hlsl, ID3DBlob** ppHostShader, const char
if (FAILED(hRet)) {
LOG_TEST_CASE("Couldn't assemble vertex shader");
//EmuLog(LOG_LEVEL::WARNING, "Couldn't assemble recompiled vertex shader");
}
}
// Determine the log level
auto hlslErrorLogLevel = FAILED(hRet) ? LOG_LEVEL::ERROR2 : LOG_LEVEL::DEBUG;
if (pErrors) {
// Log HLSL compiler errors
// Log errors from the initial compilation
EmuLog(hlslErrorLogLevel, "%s", (char*)(pErrors->GetBufferPointer()));
pErrors->Release();
pErrors = nullptr;
if (pErrorsCompatibility != nullptr) {
pErrorsCompatibility->Release();
pErrorsCompatibility = nullptr;
}
}
LOG_CHECK_ENABLED(LOG_LEVEL::DEBUG)
if (g_bPrintfOn)
// Failure to recompile in compatibility mode ignored for now
if (pErrorsCompatibility != nullptr) {
pErrorsCompatibility->Release();
pErrorsCompatibility = nullptr;
}
LOG_CHECK_ENABLED(LOG_LEVEL::DEBUG) {
if (g_bPrintfOn) {
if (!FAILED(hRet)) {
// Log disassembly
hRet = D3DDisassemble(
@ -270,6 +271,8 @@ HRESULT CompileHlsl(const std::string& hlsl, ID3DBlob** ppHostShader, const char
pErrors->Release();
}
}
}
}
return hRet;
}