Commit f7ed7054 by Geoff Lang

Move the code that writes the temporary shader file to the shader compiler.

BUG=angle:755 Change-Id: I5fdc3ae112ea3f59694a22da6199b99a568ed0a1 Reviewed-on: https://chromium-review.googlesource.com/219530Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 3935e51d
......@@ -87,6 +87,13 @@ ID3DBlob *HLSLCompiler::compileToBinary(gl::InfoLog &infoLog, const std::string
{
ASSERT(mD3DCompilerModule && mD3DCompileFunc);
if (gl::perfActive())
{
std::string sourcePath = getTempPath();
std::string sourceText = FormatString("#line 2 \"%s\"\n\n%s", sourcePath.c_str(), hlsl.c_str());
writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size());
}
for (size_t i = 0; i < configs.size(); ++i)
{
ID3DBlob *errorMessage = NULL;
......
......@@ -2398,10 +2398,6 @@ ShaderExecutable *Renderer11::compileToExecutable(gl::InfoLog &infoLog, const st
#endif
flags |= D3DCOMPILE_DEBUG;
std::string sourcePath = getTempPath();
std::string sourceText = std::string("#line 2 \"") + sourcePath + std::string("\"\n\n") + std::string(shaderHLSL);
writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size());
}
// Sometimes D3DCompile will fail with the default compilation flags for complicated shaders when it would otherwise pass with alternative options.
......
......@@ -2950,10 +2950,6 @@ ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const std
#endif
flags |= D3DCOMPILE_DEBUG;
std::string sourcePath = getTempPath();
std::string sourceText = std::string("#line 2 \"") + sourcePath + std::string("\"\n\n") + std::string(shaderHLSL);
writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size());
}
// Sometimes D3DCompile will fail with the default compilation flags for complicated shaders when it would otherwise pass with alternative options.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment