gfx/angle/src/compiler/ValidateLimitations.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 //
michael@0 2 // Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
michael@0 3 // Use of this source code is governed by a BSD-style license that can be
michael@0 4 // found in the LICENSE file.
michael@0 5 //
michael@0 6
michael@0 7 #include "GLSLANG/ShaderLang.h"
michael@0 8 #include "compiler/intermediate.h"
michael@0 9
michael@0 10 class TInfoSinkBase;
michael@0 11
michael@0 12 struct TLoopInfo {
michael@0 13 struct TIndex {
michael@0 14 int id; // symbol id.
michael@0 15 } index;
michael@0 16 TIntermLoop* loop;
michael@0 17 };
michael@0 18 typedef TVector<TLoopInfo> TLoopStack;
michael@0 19
michael@0 20 // Traverses intermediate tree to ensure that the shader does not exceed the
michael@0 21 // minimum functionality mandated in GLSL 1.0 spec, Appendix A.
michael@0 22 class ValidateLimitations : public TIntermTraverser {
michael@0 23 public:
michael@0 24 ValidateLimitations(ShShaderType shaderType, TInfoSinkBase& sink);
michael@0 25
michael@0 26 int numErrors() const { return mNumErrors; }
michael@0 27
michael@0 28 virtual bool visitBinary(Visit, TIntermBinary*);
michael@0 29 virtual bool visitUnary(Visit, TIntermUnary*);
michael@0 30 virtual bool visitAggregate(Visit, TIntermAggregate*);
michael@0 31 virtual bool visitLoop(Visit, TIntermLoop*);
michael@0 32
michael@0 33 private:
michael@0 34 void error(TSourceLoc loc, const char *reason, const char* token);
michael@0 35
michael@0 36 bool withinLoopBody() const;
michael@0 37 bool isLoopIndex(const TIntermSymbol* symbol) const;
michael@0 38 bool validateLoopType(TIntermLoop* node);
michael@0 39 bool validateForLoopHeader(TIntermLoop* node, TLoopInfo* info);
michael@0 40 bool validateForLoopInit(TIntermLoop* node, TLoopInfo* info);
michael@0 41 bool validateForLoopCond(TIntermLoop* node, TLoopInfo* info);
michael@0 42 bool validateForLoopExpr(TIntermLoop* node, TLoopInfo* info);
michael@0 43 // Returns true if none of the loop indices is used as the argument to
michael@0 44 // the given function out or inout parameter.
michael@0 45 bool validateFunctionCall(TIntermAggregate* node);
michael@0 46 bool validateOperation(TIntermOperator* node, TIntermNode* operand);
michael@0 47
michael@0 48 // Returns true if indexing does not exceed the minimum functionality
michael@0 49 // mandated in GLSL 1.0 spec, Appendix A, Section 5.
michael@0 50 bool isConstExpr(TIntermNode* node);
michael@0 51 bool isConstIndexExpr(TIntermNode* node);
michael@0 52 bool validateIndexing(TIntermBinary* node);
michael@0 53
michael@0 54 ShShaderType mShaderType;
michael@0 55 TInfoSinkBase& mSink;
michael@0 56 int mNumErrors;
michael@0 57 TLoopStack mLoopStack;
michael@0 58 };
michael@0 59

mercurial