Implemented new restrictions on nesting of structs in WebGL shaders.
Added previously missing check for embedded structs; even though these
attempts would be caught by an underlying GLSL compiler, the shader
validator should not let them through.
BUG=http://code.google.com/p/angleproject/issues/detail?id=235
TEST=WebGL conformance tests
Review URL: http://codereview.appspot.com/5327046
git-svn-id: https://angleproject.googlecode.com/svn/trunk@809 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/SymbolTable.cpp b/src/compiler/SymbolTable.cpp
index 02817d4..e6695d6 100644
--- a/src/compiler/SymbolTable.cpp
+++ b/src/compiler/SymbolTable.cpp
@@ -13,6 +13,8 @@
#include <stdio.h>
+#include <algorithm>
+
//
// TType helper function needs a place to live.
//
@@ -71,6 +73,20 @@
return structureSize;
}
+void TType::computeDeepestStructNesting()
+{
+ if (!getStruct()) {
+ return;
+ }
+
+ int maxNesting = 0;
+ for (TTypeList::const_iterator tl = getStruct()->begin(); tl != getStruct()->end(); ++tl) {
+ maxNesting = std::max(maxNesting, ((*tl).type)->getDeepestStructNesting());
+ }
+
+ deepestStructNesting = 1 + maxNesting;
+}
+
//
// Dump functions.
//