From 5c4e290d720b0aa68bf1cd158e7780a05abeb522 Mon Sep 17 00:00:00 2001 From: Guy1524 <35645466+Guy1524@users.noreply.github.com> Date: Sat, 20 Jan 2018 21:20:45 -0500 Subject: [PATCH] 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. --- src/d3d11/d3d11_shader.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/d3d11/d3d11_shader.cpp b/src/d3d11/d3d11_shader.cpp index 4e6a5901..f44f8536 100644 --- a/src/d3d11/d3d11_shader.cpp +++ b/src/d3d11/d3d11_shader.cpp @@ -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)); } }