1 // 2 // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 #ifndef COMPILER_TIMING_RESTRICT_FRAGMENT_SHADER_TIMING_H_ 8 #define COMPILER_TIMING_RESTRICT_FRAGMENT_SHADER_TIMING_H_ 9 10 #include "compiler/translator/IntermNode.h" 11 #include "compiler/translator/depgraph/DependencyGraph.h" 12 13 class TInfoSinkBase; 14 15 class RestrictFragmentShaderTiming : TDependencyGraphTraverser { 16 public: 17 RestrictFragmentShaderTiming(TInfoSinkBase& sink); 18 void enforceRestrictions(const TDependencyGraph& graph); 19 int numErrors() const { return mNumErrors; } 20 21 virtual void visitArgument(TGraphArgument* parameter); 22 virtual void visitSelection(TGraphSelection* selection); 23 virtual void visitLoop(TGraphLoop* loop); 24 virtual void visitLogicalOp(TGraphLogicalOp* logicalOp); 25 26 private: 27 void beginError(const TIntermNode* node); 28 void validateUserDefinedFunctionCallUsage(const TDependencyGraph& graph); 29 bool isSamplingOp(const TIntermAggregate* intermFunctionCall) const; 30 31 TInfoSinkBase& mSink; 32 int mNumErrors; 33 34 typedef std::set<TString> StringSet; 35 StringSet mSamplingOps; 36 }; 37 38 #endif // COMPILER_TIMING_RESTRICT_FRAGMENT_SHADER_TIMING_H_ 39