Check that the incoming type to a default precision qualifier statement is valid.
Fixes new WebGL conformance tests
shader-with-illegal-default-precision.frag.html and
shader-with-illegal-default-precision.vert.html per
http://www.khronos.org/bugzilla/show_bug.cgi?id=781 . Also ran WebGL
1.0.1 conformance tests; no regressions.
BUG=none
Review URL: https://codereview.appspot.com/7302043
git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1958 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/SymbolTable.h b/src/compiler/SymbolTable.h
index a89499e..bb7f198 100644
--- a/src/compiler/SymbolTable.h
+++ b/src/compiler/SymbolTable.h
@@ -323,10 +323,16 @@
void dump(TInfoSink &infoSink) const;
void copyTable(const TSymbolTable& copyOf);
- void setDefaultPrecision( TBasicType type, TPrecision prec ){
- if( type != EbtFloat && type != EbtInt ) return; // Only set default precision for int/float
+ bool setDefaultPrecision( const TPublicType& type, TPrecision prec ){
+ if (IsSampler(type.type))
+ return true; // Skip sampler types for the time being
+ if (type.type != EbtFloat && type.type != EbtInt)
+ return false; // Only set default precision for int/float
+ if (type.size != 1 || type.matrix || type.array)
+ return false; // Not allowed to set for aggregate types
int indexOfLastElement = static_cast<int>(precisionStack.size()) - 1;
- precisionStack[indexOfLastElement][type] = prec; // Uses map operator [], overwrites the current value
+ precisionStack[indexOfLastElement][type.type] = prec; // Uses map operator [], overwrites the current value
+ return true;
}
// Searches down the precisionStack for a precision qualifier for the specified TBasicType