Commit 9d294c33 by Jamie Madill

Revert "Compile the D3D11 VS and PS on separate threads at GL link time"

Failing compile on Chromium bots: FAILED: ninja -t msvc -e environment.x86 -- C:\b\build\goma/gomacc "C:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\third_party\angle\src\libANGLE\renderer\d3d\libANGLE.ProgramD3D.obj.rsp /c ..\..\third_party\angle\src\libANGLE\renderer\d3d\ProgramD3D.cpp /Foobj\third_party\angle\src\libANGLE\renderer\d3d\libANGLE.ProgramD3D.obj /Fdobj\third_party\angle\src\libANGLE.cc.pdb c:\b\depot_tools\win_toolchain\vs2013_files\vc\include\concrt.h(4774) : error C3861: '__uncaught_exception': identifier not found ninja: build stopped: subcommand failed. This reverts commit 6d51f262. Change-Id: Iebb2843dfbc3795290fbb33e1a111ddad59c3126 Reviewed-on: https://chromium-review.googlesource.com/244792Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 6d51f262
...@@ -43,22 +43,3 @@ std::string FormatString(const char *fmt, ...) ...@@ -43,22 +43,3 @@ std::string FormatString(const char *fmt, ...)
va_end(vararg); va_end(vararg);
return result; return result;
} }
// The D3D11 renderer compiles the pixel and vertex shaders on different threads.
// That code needs to format strings, so we need thread-safe helpers.
std::string FormatStringThreadSafe(const char *fmt, va_list vararg)
{
std::vector<char> buffer(512);
size_t len = FormatStringIntoVector(fmt, vararg, buffer);
return std::string(&buffer[0], len);
}
std::string FormatStringThreadSafe(const char *fmt, ...)
{
va_list vararg;
va_start(vararg, fmt);
std::string result = FormatStringThreadSafe(fmt, vararg);
va_end(vararg);
return result;
}
\ No newline at end of file
...@@ -146,8 +146,6 @@ size_t FormatStringIntoVector(const char *fmt, va_list vararg, std::vector<char> ...@@ -146,8 +146,6 @@ size_t FormatStringIntoVector(const char *fmt, va_list vararg, std::vector<char>
std::string FormatString(const char *fmt, va_list vararg); std::string FormatString(const char *fmt, va_list vararg);
std::string FormatString(const char *fmt, ...); std::string FormatString(const char *fmt, ...);
std::string FormatStringThreadSafe(const char *fmt, va_list vararg);
std::string FormatStringThreadSafe(const char *fmt, ...);
// snprintf is not defined with MSVC prior to to msvc14 // snprintf is not defined with MSVC prior to to msvc14
#if defined(_MSC_VER) && _MSC_VER < 1900 #if defined(_MSC_VER) && _MSC_VER < 1900
......
...@@ -29,9 +29,7 @@ Error::Error(GLenum errorCode, const char *msg, ...) ...@@ -29,9 +29,7 @@ Error::Error(GLenum errorCode, const char *msg, ...)
va_list vararg; va_list vararg;
va_start(vararg, msg); va_start(vararg, msg);
createMessageString(); createMessageString();
*mMessage = FormatString(msg, vararg);
// gl::Errors can be created across multiple threads, so we must make sure they're thread safe.
*mMessage = FormatStringThreadSafe(msg, vararg);
va_end(vararg); va_end(vararg);
} }
...@@ -100,7 +98,7 @@ Error::Error(EGLint errorCode, const char *msg, ...) ...@@ -100,7 +98,7 @@ Error::Error(EGLint errorCode, const char *msg, ...)
va_list vararg; va_list vararg;
va_start(vararg, msg); va_start(vararg, msg);
createMessageString(); createMessageString();
*mMessage = FormatStringThreadSafe(msg, vararg); *mMessage = FormatString(msg, vararg);
va_end(vararg); va_end(vararg);
} }
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include "libANGLE/renderer/d3d/ShaderExecutableD3D.h" #include "libANGLE/renderer/d3d/ShaderExecutableD3D.h"
#include "libANGLE/renderer/d3d/VertexDataManager.h" #include "libANGLE/renderer/d3d/VertexDataManager.h"
#include <future> // For std::async
namespace rx namespace rx
{ {
...@@ -957,7 +955,6 @@ gl::Error ProgramD3D::getVertexExecutableForInputLayout(const gl::VertexFormat i ...@@ -957,7 +955,6 @@ gl::Error ProgramD3D::getVertexExecutableForInputLayout(const gl::VertexFormat i
} }
else if (!infoLog) else if (!infoLog)
{ {
// This isn't thread-safe, so we should ensure that we always pass in an infoLog if using multiple threads.
std::vector<char> tempCharBuffer(tempInfoLog.getLength() + 3); std::vector<char> tempCharBuffer(tempInfoLog.getLength() + 3);
tempInfoLog.getLog(tempInfoLog.getLength(), NULL, &tempCharBuffer[0]); tempInfoLog.getLog(tempInfoLog.getLength(), NULL, &tempCharBuffer[0]);
ERR("Error compiling dynamic vertex executable:\n%s\n", &tempCharBuffer[0]); ERR("Error compiling dynamic vertex executable:\n%s\n", &tempCharBuffer[0]);
...@@ -973,38 +970,18 @@ LinkResult ProgramD3D::compileProgramExecutables(gl::InfoLog &infoLog, gl::Shade ...@@ -973,38 +970,18 @@ LinkResult ProgramD3D::compileProgramExecutables(gl::InfoLog &infoLog, gl::Shade
ShaderD3D *vertexShaderD3D = ShaderD3D::makeShaderD3D(vertexShader->getImplementation()); ShaderD3D *vertexShaderD3D = ShaderD3D::makeShaderD3D(vertexShader->getImplementation());
ShaderD3D *fragmentShaderD3D = ShaderD3D::makeShaderD3D(fragmentShader->getImplementation()); ShaderD3D *fragmentShaderD3D = ShaderD3D::makeShaderD3D(fragmentShader->getImplementation());
gl::Error vertexShaderTaskResult(GL_NO_ERROR); gl::VertexFormat defaultInputLayout[gl::MAX_VERTEX_ATTRIBS];
gl::InfoLog tempVertexShaderInfoLog; GetDefaultInputLayoutFromShader(vertexShader->getActiveAttributes(), defaultInputLayout);
ShaderExecutableD3D *defaultVertexExecutable = NULL;
std::future<ShaderExecutableD3D*> vertexShaderTask = std::async([this, vertexShader, &tempVertexShaderInfoLog, &vertexShaderTaskResult]() gl::Error error = getVertexExecutableForInputLayout(defaultInputLayout, &defaultVertexExecutable, &infoLog);
if (error.isError())
{ {
gl::VertexFormat defaultInputLayout[gl::MAX_VERTEX_ATTRIBS]; return LinkResult(false, error);
GetDefaultInputLayoutFromShader(vertexShader->getActiveAttributes(), defaultInputLayout); }
ShaderExecutableD3D *defaultVertexExecutable = NULL;
vertexShaderTaskResult = getVertexExecutableForInputLayout(defaultInputLayout, &defaultVertexExecutable, &tempVertexShaderInfoLog);
return defaultVertexExecutable;
});
std::vector<GLenum> defaultPixelOutput = GetDefaultOutputLayoutFromShader(getPixelShaderKey()); std::vector<GLenum> defaultPixelOutput = GetDefaultOutputLayoutFromShader(getPixelShaderKey());
ShaderExecutableD3D *defaultPixelExecutable = NULL; ShaderExecutableD3D *defaultPixelExecutable = NULL;
gl::Error error = getPixelExecutableForOutputLayout(defaultPixelOutput, &defaultPixelExecutable, &infoLog); error = getPixelExecutableForOutputLayout(defaultPixelOutput, &defaultPixelExecutable, &infoLog);
ShaderExecutableD3D *defaultVertexExecutable = vertexShaderTask.get();
// Combine the temporary infoLog with the real one
if (tempVertexShaderInfoLog.getLength() > 0)
{
std::vector<char> tempCharBuffer(tempVertexShaderInfoLog.getLength() + 3);
tempVertexShaderInfoLog.getLog(tempVertexShaderInfoLog.getLength(), NULL, &tempCharBuffer[0]);
infoLog.append(&tempCharBuffer[0]);
}
if (vertexShaderTaskResult.isError())
{
return LinkResult(false, vertexShaderTaskResult);
}
// If the pixel shader compilation failed, then return error
if (error.isError()) if (error.isError())
{ {
return LinkResult(false, error); return LinkResult(false, error);
......
...@@ -2659,7 +2659,7 @@ gl::Error Renderer11::compileToExecutable(gl::InfoLog &infoLog, const std::strin ...@@ -2659,7 +2659,7 @@ gl::Error Renderer11::compileToExecutable(gl::InfoLog &infoLog, const std::strin
return gl::Error(GL_INVALID_OPERATION); return gl::Error(GL_INVALID_OPERATION);
} }
std::string profile = FormatStringThreadSafe("%s_%d_%d%s", profileType, getMajorShaderModel(), getMinorShaderModel(), getShaderModelSuffix().c_str()); std::string profile = FormatString("%s_%d_%d%s", profileType, getMajorShaderModel(), getMinorShaderModel(), getShaderModelSuffix().c_str());
UINT flags = D3DCOMPILE_OPTIMIZATION_LEVEL2; UINT flags = D3DCOMPILE_OPTIMIZATION_LEVEL2;
......
...@@ -2678,7 +2678,7 @@ gl::Error Renderer9::compileToExecutable(gl::InfoLog &infoLog, const std::string ...@@ -2678,7 +2678,7 @@ gl::Error Renderer9::compileToExecutable(gl::InfoLog &infoLog, const std::string
} }
unsigned int profileMajorVersion = (getMajorShaderModel() >= 3) ? 3 : 2; unsigned int profileMajorVersion = (getMajorShaderModel() >= 3) ? 3 : 2;
unsigned int profileMinorVersion = 0; unsigned int profileMinorVersion = 0;
std::string profile = FormatStringThreadSafe("%s_%u_%u", profileType, profileMajorVersion, profileMinorVersion); std::string profile = FormatString("%s_%u_%u", profileType, profileMajorVersion, profileMinorVersion);
UINT flags = ANGLE_COMPILE_OPTIMIZATION_LEVEL; UINT flags = ANGLE_COMPILE_OPTIMIZATION_LEVEL;
......
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