mirror of
https://github.com/utmapp/angle.git
synced 2026-12-01 14:00:09 -10:00
Revert "Compile the D3D11 VS and PS on separate threads at GL link time"
Causing a high-volume crashe in Chrome.
This reverts commit 434953e200.
BUG=470695
Change-Id: I2062c706ab6ca6b4c3117685df67c33572518da5
Reviewed-on: https://chromium-review.googlesource.com/262704
Reviewed-by: Jamie Madill <[email protected]>
Tested-by: Jamie Madill <[email protected]>
This commit is contained in:
1 parent
e842eabd0d
commit
e4ea202af6
3 files changed
+9
-55
No files matched your search
@@ -29,8 +29,7 @@ size_t FormatStringIntoVector(const char *fmt, va_list vararg, std::vector<char>
|
||||
|
||||
std::string FormatString(const char *fmt, va_list vararg)
|
||||
{
|
||||
// Note: this needs to be thread-safe, since the D3D11 renderer uses some multithreading
|
||||
std::vector<char> buffer(512);
|
||||
static std::vector<char> buffer(512);
|
||||
|
||||
size_t len = FormatStringIntoVector(fmt, vararg, buffer);
|
||||
return std::string(&buffer[0], len);
|
||||
|
||||
@@ -37,9 +37,4 @@
|
||||
#define ANGLE_SHADER_DEBUG_INFO ANGLE_DISABLED
|
||||
#endif
|
||||
|
||||
// Should we compile the D3D vertex and pixel shaders on separate threads at glLinkProgram() time?
|
||||
#if !defined(ANGLE_MULTITHREADED_D3D_SHADER_COMPILE)
|
||||
#define ANGLE_MULTITHREADED_D3D_SHADER_COMPILE ANGLE_ENABLED
|
||||
#endif
|
||||
|
||||
#endif // LIBANGLE_FEATURES_H_
|
||||
@@ -20,14 +20,6 @@
|
||||
#include "libANGLE/renderer/d3d/ShaderExecutableD3D.h"
|
||||
#include "libANGLE/renderer/d3d/VertexDataManager.h"
|
||||
|
||||
#if ANGLE_MULTITHREADED_D3D_SHADER_COMPILE == ANGLE_ENABLED
|
||||
// We do not want to set _HAS_EXCEPTIONS=1 for Clang builds, nor turn on exception handlers.
|
||||
// We therefore must disable C4530 to allow <future> to compile.
|
||||
#pragma warning(disable: 4530) // C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
|
||||
#include <eh.h> // To allow <future> to compile when _HAS_EXCEPTIONS=0.
|
||||
#include <future> // For std::async
|
||||
#endif // ANGLE_MULTITHREADED_D3D_SHADER_COMPILE == ANGLE_ENABLED
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
@@ -954,7 +946,6 @@ gl::Error ProgramD3D::getVertexExecutableForInputLayout(const gl::VertexFormat i
|
||||
}
|
||||
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);
|
||||
tempInfoLog.getLog(tempInfoLog.getLength(), NULL, &tempCharBuffer[0]);
|
||||
ERR("Error compiling dynamic vertex executable:\n%s\n", &tempCharBuffer[0]);
|
||||
@@ -970,49 +961,18 @@ LinkResult ProgramD3D::compileProgramExecutables(gl::InfoLog &infoLog, gl::Shade
|
||||
ShaderD3D *vertexShaderD3D = ShaderD3D::makeShaderD3D(vertexShader->getImplementation());
|
||||
ShaderD3D *fragmentShaderD3D = ShaderD3D::makeShaderD3D(fragmentShader->getImplementation());
|
||||
|
||||
gl::Error vertexShaderResult(GL_NO_ERROR);
|
||||
gl::InfoLog tempVertexShaderInfoLog;
|
||||
|
||||
#if ANGLE_MULTITHREADED_D3D_SHADER_COMPILE == ANGLE_ENABLED
|
||||
// Use an async task to begin compiling the vertex shader asynchronously on its own task.
|
||||
std::future<ShaderExecutableD3D*> vertexShaderTask = std::async([this, vertexShader, &tempVertexShaderInfoLog, &vertexShaderResult]()
|
||||
gl::VertexFormat defaultInputLayout[gl::MAX_VERTEX_ATTRIBS];
|
||||
GetDefaultInputLayoutFromShader(vertexShader->getActiveAttributes(), defaultInputLayout);
|
||||
ShaderExecutableD3D *defaultVertexExecutable = NULL;
|
||||
gl::Error error = getVertexExecutableForInputLayout(defaultInputLayout, &defaultVertexExecutable, &infoLog);
|
||||
if (error.isError())
|
||||
{
|
||||
#endif // ANGLE_MULTITHREADED_D3D_SHADER_COMPILE
|
||||
return LinkResult(false, error);
|
||||
}
|
||||
|
||||
gl::VertexFormat defaultInputLayout[gl::MAX_VERTEX_ATTRIBS];
|
||||
GetDefaultInputLayoutFromShader(vertexShader->getActiveAttributes(), defaultInputLayout);
|
||||
ShaderExecutableD3D *defaultVertexExecutable = NULL;
|
||||
vertexShaderResult = getVertexExecutableForInputLayout(defaultInputLayout, &defaultVertexExecutable, &tempVertexShaderInfoLog);
|
||||
|
||||
#if ANGLE_MULTITHREADED_D3D_SHADER_COMPILE == ANGLE_ENABLED
|
||||
return defaultVertexExecutable;
|
||||
});
|
||||
#endif // ANGLE_MULTITHREADED_D3D_SHADER_COMPILE
|
||||
|
||||
// Continue to compile the pixel shader on the main thread
|
||||
std::vector<GLenum> defaultPixelOutput = GetDefaultOutputLayoutFromShader(getPixelShaderKey());
|
||||
ShaderExecutableD3D *defaultPixelExecutable = NULL;
|
||||
gl::Error error = getPixelExecutableForOutputLayout(defaultPixelOutput, &defaultPixelExecutable, &infoLog);
|
||||
|
||||
#if ANGLE_MULTITHREADED_D3D_SHADER_COMPILE == ANGLE_ENABLED
|
||||
// Call .get() on the vertex shader compilation. This waits until the task is complete before returning
|
||||
ShaderExecutableD3D *defaultVertexExecutable = vertexShaderTask.get();
|
||||
#endif // ANGLE_MULTITHREADED_D3D_SHADER_COMPILE
|
||||
|
||||
// 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 (vertexShaderResult.isError())
|
||||
{
|
||||
return LinkResult(false, vertexShaderResult);
|
||||
}
|
||||
|
||||
// If the pixel shader compilation failed, then return error
|
||||
error = getPixelExecutableForOutputLayout(defaultPixelOutput, &defaultPixelExecutable, &infoLog);
|
||||
if (error.isError())
|
||||
{
|
||||
return LinkResult(false, error);
|
||||
|
||||
Reference in new issue
Block a user