[d3d11] Re-implemented shader read

This commit is contained in:
Philip Rebohle 2017-12-10 12:21:33 +01:00
parent b4493d90d8
commit 89ec199c34
3 changed files with 29 additions and 0 deletions

View File

@ -35,6 +35,22 @@ namespace dxvk {
m_shader->dump(std::ofstream(str::format(baseName, ".spv"),
std::ios_base::binary | std::ios_base::trunc));
}
// If requested by the user, replace
// the shader with another file.
const std::string readPath
= env::getEnvVar(L"DXVK_SHADER_READ_PATH");
if (readPath.size() != 0) {
const std::string baseName = str::format(readPath, "/",
ConstructFileName(ComputeShaderHash(pShaderBytecode, BytecodeLength),
module.version().type()));
m_shader->read(std::ifstream(
str::format(baseName, ".spv"),
std::ios_base::binary));
}
}

View File

@ -88,4 +88,9 @@ namespace dxvk {
m_code.store(std::move(outputStream));
}
void DxvkShader::read(std::istream&& inputStream) {
m_code = SpirvCodeBuffer(std::move(inputStream));
}
}

View File

@ -105,6 +105,14 @@ namespace dxvk {
*/
void dump(std::ostream&& outputStream) const;
/**
* \brief Reads SPIR-V shader
*
* Can be used to replace the compiled SPIR-V code.
* \param [in] inputStream Stream to read from
*/
void read(std::istream&& inputStream);
private:
VkShaderStageFlagBits m_stage;