Add analysis utility to detect discontinuities.

TRAC #20737 Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@1120 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent a54f5186
......@@ -161,6 +161,8 @@
],
'sources': [
'compiler/CodeGenGLSL.cpp',
'compiler/DetectDiscontinuity.cpp',
'compiler/DetectDiscontinuity.h',
'compiler/OutputESSL.cpp',
'compiler/OutputESSL.h',
'compiler/OutputGLSLBase.cpp',
......
//
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Contains analysis utilities for dealing with HLSL's lack of support for
// the use of intrinsic functions which (implicitly or explicitly) compute
// gradients of functions with discontinuities.
//
#include "compiler/DetectDiscontinuity.h"
namespace sh
{
bool DetectDiscontinuity::traverse(TIntermNode *node)
{
mDiscontinuity = false;
node->traverse(this);
return mDiscontinuity;
}
bool DetectDiscontinuity::visitBranch(Visit visit, TIntermBranch *node)
{
switch (node->getFlowOp())
{
case EOpKill:
break;
case EOpBreak:
case EOpContinue:
mDiscontinuity = true;
case EOpReturn:
break;
default: UNREACHABLE();
}
return !mDiscontinuity;
}
}
//
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Contains analysis utilities for dealing with HLSL's lack of support for
// the use of intrinsic functions which (implicitly or explicitly) compute
// gradients of functions with discontinuities.
//
#ifndef COMPILER_DETECTDISCONTINUITY_H_
#define COMPILER_DETECTDISCONTINUITY_H_
#include "compiler/intermediate.h"
namespace sh
{
class DetectDiscontinuity : public TIntermTraverser
{
public:
bool traverse(TIntermNode *node);
protected:
bool visitBranch(Visit visit, TIntermBranch *node);
bool mDiscontinuity;
};
bool containsDiscontinuity(TIntermNode *node)
{
DetectDiscontinuity detectDiscontinuity;
return detectDiscontinuity.traverse(node);
}
}
#endif // COMPILER_DETECTDISCONTINUITY_H_
......@@ -51,9 +51,9 @@
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="4"
DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702"
DebugInformationFormat="4"
WarnAsError="true"
DebugInformationFormat="4"
DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702"
/>
<Tool
Name="VCManagedResourceCompilerTool"
......@@ -117,9 +117,9 @@
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702"
DebugInformationFormat="3"
WarnAsError="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4512;4702"
/>
<Tool
Name="VCManagedResourceCompilerTool"
......@@ -295,6 +295,10 @@
>
</File>
<File
RelativePath=".\DetectDiscontinuity.cpp"
>
</File>
<File
RelativePath=".\OutputHLSL.cpp"
>
</File>
......@@ -317,6 +321,10 @@
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\DetectDiscontinuity.h"
>
</File>
<File
RelativePath=".\OutputHLSL.h"
>
</File>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment