Commit ba72f9a9 by Yuly Novikov Committed by Commit Bot

Avoid calling debug annotator during D3D shader compilation

In Renderer11::compileToExecutable and HLSLCompiler::compileToBinary. Because they are called from a worker thread, there are problems with D3D debug annotator being accessed from multiple threads. Previous fix to guard annotator accesses by a mutex reduced flakiness, but not completely, maybe due to a D3D erroneously thinking there is multithreaded access while there is none. Bug: angleproject:3780 Change-Id: I8beea76b6d21f3378462992bbfab916c9db6b1ef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1742642 Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent abce77a6
...@@ -219,15 +219,12 @@ angle::Result HLSLCompiler::compileToBinary(d3d::Context *context, ...@@ -219,15 +219,12 @@ angle::Result HLSLCompiler::compileToBinary(d3d::Context *context,
#endif #endif
ASSERT(mD3DCompileFunc); ASSERT(mD3DCompileFunc);
#if !defined(ANGLE_ENABLE_WINDOWS_STORE) #if !defined(ANGLE_ENABLE_WINDOWS_STORE) && defined(ANGLE_ENABLE_DEBUG_TRACE)
if (gl::DebugAnnotationsActive())
{
std::string sourcePath = getTempPath(); std::string sourcePath = getTempPath();
std::ostringstream stream; std::ostringstream stream;
stream << "#line 2 \"" << sourcePath << "\"\n\n" << hlsl; stream << "#line 2 \"" << sourcePath << "\"\n\n" << hlsl;
std::string sourceText = stream.str(); std::string sourceText = stream.str();
writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size()); writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size());
}
#endif #endif
const D3D_SHADER_MACRO *macros = overrideMacros ? overrideMacros : nullptr; const D3D_SHADER_MACRO *macros = overrideMacros ? overrideMacros : nullptr;
......
...@@ -2773,14 +2773,12 @@ angle::Result Renderer11::compileToExecutable(d3d::Context *context, ...@@ -2773,14 +2773,12 @@ angle::Result Renderer11::compileToExecutable(d3d::Context *context,
UINT flags = D3DCOMPILE_OPTIMIZATION_LEVEL2; UINT flags = D3DCOMPILE_OPTIMIZATION_LEVEL2;
if (gl::DebugAnnotationsActive()) #if defined(ANGLE_ENABLE_DEBUG_TRACE)
{ # ifndef NDEBUG
#ifndef NDEBUG
flags = D3DCOMPILE_SKIP_OPTIMIZATION; flags = D3DCOMPILE_SKIP_OPTIMIZATION;
#endif # endif // NDEBUG
flags |= D3DCOMPILE_DEBUG; flags |= D3DCOMPILE_DEBUG;
} #endif // defined(ANGLE_ENABLE_DEBUG_TRACE)
if (workarounds.enableIEEEStrictness) if (workarounds.enableIEEEStrictness)
flags |= D3DCOMPILE_IEEE_STRICTNESS; flags |= D3DCOMPILE_IEEE_STRICTNESS;
......
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