Use the AST analyses to narrow the usage of [[loop]] and [[unroll]]
These attributes are now used exactly in the loops and ifs
that require them, limiting the number of failed compilations
due to excessive unrolling and flattening.
Also output Lod0 functions only when needed.
Adds unit tests for LOOP, FLATTEN and Lod0 generation.
The patch was tested against the WebGL CTS 1.0.4 for which all the
failures existed prior to this patch and seem to be unrelated to this
change. It also works correctly on the following sites that had trouble
with [[loop]] and [[unroll]]:
* dev.miaumiau.cat/rayTracer "Skull Demo"
* The turbulenz engine particle demo
* Lots of ShaderToy samples (including "Volcanic" and "Metropolis")
* Google Maps Earth mode
* Lots of Chrome Experiments
* Lagoa
* madebyevan.com/webgl-water
* SketchFab
* Unit Tests
BUG=angleproject:937
BUG=395048
Change-Id: I856de9025f10b79781929ec212dbffc2064a940e
Reviewed-on: https://chromium-review.googlesource.com/264791
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/OutputHLSL.h b/src/compiler/translator/OutputHLSL.h
index 62b37c1..461ca8b 100644
--- a/src/compiler/translator/OutputHLSL.h
+++ b/src/compiler/translator/OutputHLSL.h
@@ -170,9 +170,9 @@
int mUniqueIndex; // For creating unique names
- std::vector<ASTMetadataHLSL> mASTAnalyses;
- bool mContainsLoopDiscontinuity;
- bool mContainsAnyLoop;
+ CallDAG mCallDag;
+ MetadataList mASTMetadataList;
+ ASTMetadataHLSL *mCurrentFunctionMetadata;
bool mOutputLod0Function;
bool mInsideDiscontinuousLoop;
int mNestedLoopDepth;