1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/compiler/DetectDiscontinuity.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,52 @@ 1.4 +// 1.5 +// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 1.6 +// Use of this source code is governed by a BSD-style license that can be 1.7 +// found in the LICENSE file. 1.8 +// 1.9 +// Contains analysis utilities for dealing with HLSL's lack of support for 1.10 +// the use of intrinsic functions which (implicitly or explicitly) compute 1.11 +// gradients of functions with discontinuities. 1.12 +// 1.13 + 1.14 +#ifndef COMPILER_DETECTDISCONTINUITY_H_ 1.15 +#define COMPILER_DETECTDISCONTINUITY_H_ 1.16 + 1.17 +#include "compiler/intermediate.h" 1.18 + 1.19 +namespace sh 1.20 +{ 1.21 +// Checks whether a loop can run for a variable number of iterations 1.22 +class DetectLoopDiscontinuity : public TIntermTraverser 1.23 +{ 1.24 + public: 1.25 + bool traverse(TIntermNode *node); 1.26 + 1.27 + protected: 1.28 + bool visitBranch(Visit visit, TIntermBranch *node); 1.29 + bool visitLoop(Visit visit, TIntermLoop *loop); 1.30 + bool visitAggregate(Visit visit, TIntermAggregate *node); 1.31 + 1.32 + int mLoopDepth; 1.33 + bool mLoopDiscontinuity; 1.34 +}; 1.35 + 1.36 +bool containsLoopDiscontinuity(TIntermNode *node); 1.37 + 1.38 +// Checks for intrinsic functions which compute gradients 1.39 +class DetectGradientOperation : public TIntermTraverser 1.40 +{ 1.41 + public: 1.42 + bool traverse(TIntermNode *node); 1.43 + 1.44 + protected: 1.45 + bool visitUnary(Visit visit, TIntermUnary *node); 1.46 + bool visitAggregate(Visit visit, TIntermAggregate *node); 1.47 + 1.48 + bool mGradientOperation; 1.49 +}; 1.50 + 1.51 +bool containsGradientOperation(TIntermNode *node); 1.52 + 1.53 +} 1.54 + 1.55 +#endif // COMPILER_DETECTDISCONTINUITY_H_