Commit 0e06ea33 by Corentin Wallez

HLSLCompiler: fix an infinite loop when failing to compile

When compiling shaders that produce errors X3531 or X4014 even when macros is nullptr, we would try the same permutation infinitely. BUG=524297 Change-Id: Id2a26ce2a5344bff4566440342adad5031368994 Reviewed-on: https://chromium-review.googlesource.com/296441Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 3cf12ce6
...@@ -228,11 +228,12 @@ gl::Error HLSLCompiler::compileToBinary(gl::InfoLog &infoLog, const std::string ...@@ -228,11 +228,12 @@ gl::Error HLSLCompiler::compileToBinary(gl::InfoLog &infoLog, const std::string
TRACE("\n%s", hlsl.c_str()); TRACE("\n%s", hlsl.c_str());
TRACE("\n%s", message.c_str()); TRACE("\n%s", message.c_str());
if (message.find("error X3531:") != std::string::npos || // "can't unroll loops marked with loop attribute" if ((message.find("error X3531:") != std::string::npos || // "can't unroll loops marked with loop attribute"
message.find("error X4014:") != std::string::npos) // "cannot have gradient operations inside loops with divergent flow control", message.find("error X4014:") != std::string::npos) && // "cannot have gradient operations inside loops with divergent flow control",
// even though it is counter-intuitive to disable unrolling for this error, // even though it is counter-intuitive to disable unrolling for this error,
// some very long shaders have trouble deciding which loops to unroll and // some very long shaders have trouble deciding which loops to unroll and
// turning off forced unrolls allows them to compile properly. // turning off forced unrolls allows them to compile properly.
macros != nullptr)
{ {
macros = nullptr; // Disable [loop] and [flatten] macros = nullptr; // Disable [loop] and [flatten]
......
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