Invariant related processing.
* Fix a bug in PreProcessor for STDGL pragma.
* Record all invariant settings and set them in ShaderVariable.
* Write #pragma STDGL invariant(all) in GL
BUG=angle:776
TEST=https://www.khronos.org/registry/webgl/sdk/tests/conformance/glsl/misc/shaders-with-invariance.html
Change-Id: Ie28b75480deed79f0c9f26e3b98f1778d1290182
Reviewed-on: https://chromium-review.googlesource.com/223610
Tested-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/util.h b/src/compiler/translator/util.h
index 241e2cc..fb53087 100644
--- a/src/compiler/translator/util.h
+++ b/src/compiler/translator/util.h
@@ -24,6 +24,8 @@
// Return false if overflow happens.
extern bool atoi_clamp(const char *str, int *value);
+class TSymbolTable;
+
namespace sh
{
@@ -38,7 +40,7 @@
class GetVariableTraverser
{
public:
- GetVariableTraverser() {}
+ GetVariableTraverser(const TSymbolTable &symbolTable);
template <typename VarT>
void traverse(const TType &type, const TString &name, std::vector<VarT> *output);
@@ -48,6 +50,14 @@
virtual void visitVariable(ShaderVariable *newVar) {}
private:
+ // Helper function called by traverse() to fill specific fields
+ // for attributes/varyings/uniforms.
+ template <typename VarT>
+ void setTypeSpecificInfo(
+ const TType &type, const TString &name, VarT *variable) {}
+
+ const TSymbolTable &mSymbolTable;
+
DISALLOW_COPY_AND_ASSIGN(GetVariableTraverser);
};