LCOV - code coverage report
Current view: top level - gfx/angle/src/compiler/translator - ConstantUnion.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 10 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 11 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //
       2             : // Copyright (c) 2002-2014 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_TRANSLATOR_CONSTANTUNION_H_
       8             : #define COMPILER_TRANSLATOR_CONSTANTUNION_H_
       9             : 
      10             : #include <assert.h>
      11             : 
      12             : #include "compiler/translator/Common.h"
      13             : #include "compiler/translator/BaseTypes.h"
      14             : 
      15             : namespace sh
      16             : {
      17             : 
      18             : class TDiagnostics;
      19             : 
      20             : class TConstantUnion
      21             : {
      22             :   public:
      23           0 :     POOL_ALLOCATOR_NEW_DELETE();
      24             :     TConstantUnion();
      25             : 
      26             :     bool cast(TBasicType newType, const TConstantUnion &constant);
      27             : 
      28           0 :     void setIConst(int i) {iConst = i; type = EbtInt; }
      29           0 :     void setUConst(unsigned int u) { uConst = u; type = EbtUInt; }
      30           0 :     void setFConst(float f) {fConst = f; type = EbtFloat; }
      31           0 :     void setBConst(bool b) {bConst = b; type = EbtBool; }
      32             : 
      33           0 :     int getIConst() const { return iConst; }
      34           0 :     unsigned int getUConst() const { return uConst; }
      35           0 :     float getFConst() const { return fConst; }
      36           0 :     bool getBConst() const { return bConst; }
      37             : 
      38             :     bool operator==(const int i) const;
      39             :     bool operator==(const unsigned int u) const;
      40             :     bool operator==(const float f) const;
      41             :     bool operator==(const bool b) const;
      42             :     bool operator==(const TConstantUnion &constant) const;
      43             :     bool operator!=(const int i) const;
      44             :     bool operator!=(const unsigned int u) const;
      45             :     bool operator!=(const float f) const;
      46             :     bool operator!=(const bool b) const;
      47             :     bool operator!=(const TConstantUnion &constant) const;
      48             :     bool operator>(const TConstantUnion &constant) const;
      49             :     bool operator<(const TConstantUnion &constant) const;
      50             :     static TConstantUnion add(const TConstantUnion &lhs,
      51             :                               const TConstantUnion &rhs,
      52             :                               TDiagnostics *diag,
      53             :                               const TSourceLoc &line);
      54             :     static TConstantUnion sub(const TConstantUnion &lhs,
      55             :                               const TConstantUnion &rhs,
      56             :                               TDiagnostics *diag,
      57             :                               const TSourceLoc &line);
      58             :     static TConstantUnion mul(const TConstantUnion &lhs,
      59             :                               const TConstantUnion &rhs,
      60             :                               TDiagnostics *diag,
      61             :                               const TSourceLoc &line);
      62             :     TConstantUnion operator%(const TConstantUnion &constant) const;
      63             :     static TConstantUnion rshift(const TConstantUnion &lhs,
      64             :                                  const TConstantUnion &rhs,
      65             :                                  TDiagnostics *diag,
      66             :                                  const TSourceLoc &line);
      67             :     static TConstantUnion lshift(const TConstantUnion &lhs,
      68             :                                  const TConstantUnion &rhs,
      69             :                                  TDiagnostics *diag,
      70             :                                  const TSourceLoc &line);
      71             :     TConstantUnion operator&(const TConstantUnion &constant) const;
      72             :     TConstantUnion operator|(const TConstantUnion &constant) const;
      73             :     TConstantUnion operator^(const TConstantUnion &constant) const;
      74             :     TConstantUnion operator&&(const TConstantUnion &constant) const;
      75             :     TConstantUnion operator||(const TConstantUnion &constant) const;
      76             : 
      77           0 :     TBasicType getType() const { return type; }
      78             :   private:
      79             :     union {
      80             :         int iConst;           // used for ivec, scalar ints
      81             :         unsigned int uConst;  // used for uvec, scalar uints
      82             :         bool bConst;          // used for bvec, scalar bools
      83             :         float fConst;         // used for vec, mat, scalar floats
      84             :     };
      85             : 
      86             :     TBasicType type;
      87             : };
      88             : 
      89             : }  // namespace sh
      90             : 
      91             : #endif // COMPILER_TRANSLATOR_CONSTANTUNION_H_

Generated by: LCOV version 1.13