Check if shader in READ_PATH exists before using it

Make sure that the replacement shader in the DXVK_SHADER_READ_PATH exists, if not use the generated shader.
This commit is contained in:
Guy1524 2018-01-20 21:20:45 -05:00 committed by GitHub
parent 0b426a0942
commit 5c4e290d72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -46,9 +46,13 @@ namespace dxvk {
// If requested by the user, replace
// the shader with another file.
if (readPath.size() != 0) {
m_shader->read(std::ifstream(
// Check whether the file exists
std::ifstream readStream(
str::format(readPath, "/", m_name, ".spv"),
std::ios_base::binary));
std::ios_base::binary);
if (readStream)
m_shader->read(std::move(readStream));
}
}