blob: 0d28e4b1f41e2658974d7b92f9e6aeae8f233331 [file] [log] [blame]
daniel@transgaming.come2095642012-05-31 01:20:20 +00001//
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// Contains analysis utilities for dealing with HLSL's lack of support for
7// the use of intrinsic functions which (implicitly or explicitly) compute
8// gradients of functions with discontinuities.
9//
10
11#include "compiler/DetectDiscontinuity.h"
12
13namespace sh
14{
15bool DetectDiscontinuity::traverse(TIntermNode *node)
16{
17 mDiscontinuity = false;
18 node->traverse(this);
19 return mDiscontinuity;
20}
21
22bool DetectDiscontinuity::visitBranch(Visit visit, TIntermBranch *node)
23{
24 switch (node->getFlowOp())
25 {
26 case EOpKill:
27 break;
28 case EOpBreak:
29 case EOpContinue:
30 mDiscontinuity = true;
31 case EOpReturn:
32 break;
33 default: UNREACHABLE();
34 }
35
36 return !mDiscontinuity;
37}
38}