LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/sksl/ir - SkSLModifiers.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 43 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright 2016 Google Inc.
       3             :  *
       4             :  * Use of this source code is governed by a BSD-style license that can be
       5             :  * found in the LICENSE file.
       6             :  */
       7             : 
       8             : #ifndef SKSL_MODIFIERS
       9             : #define SKSL_MODIFIERS
      10             : 
      11             : #include "SkSLLayout.h"
      12             : 
      13             : namespace SkSL {
      14             : 
      15             : /**
      16             :  * A set of modifier keywords (in, out, uniform, etc.) appearing before a declaration.
      17             :  */
      18             : struct Modifiers {
      19             :     enum Flag {
      20             :         kNo_Flag            =    0,
      21             :         kConst_Flag         =    1,
      22             :         kIn_Flag            =    2,
      23             :         kOut_Flag           =    4,
      24             :         kLowp_Flag          =    8,
      25             :         kMediump_Flag       =   16,
      26             :         kHighp_Flag         =   32,
      27             :         kUniform_Flag       =   64,
      28             :         kFlat_Flag          =  128,
      29             :         kNoPerspective_Flag =  256,
      30             :         kReadOnly_Flag      =  512,
      31             :         kWriteOnly_Flag     = 1024,
      32             :         kCoherent_Flag      = 2048,
      33             :         kVolatile_Flag      = 4096,
      34             :         kRestrict_Flag      = 8192
      35             :     };
      36             : 
      37           0 :     Modifiers()
      38           0 :     : fLayout(Layout())
      39           0 :     , fFlags(0) {}
      40             : 
      41           0 :     Modifiers(Layout& layout, int flags)
      42           0 :     : fLayout(layout)
      43           0 :     , fFlags(flags) {}
      44             : 
      45           0 :     String description() const {
      46           0 :         String result = fLayout.description();
      47           0 :         if (fFlags & kUniform_Flag) {
      48           0 :             result += "uniform ";
      49             :         }
      50           0 :         if (fFlags & kConst_Flag) {
      51           0 :             result += "const ";
      52             :         }
      53           0 :         if (fFlags & kLowp_Flag) {
      54           0 :             result += "lowp ";
      55             :         }
      56           0 :         if (fFlags & kMediump_Flag) {
      57           0 :             result += "mediump ";
      58             :         }
      59           0 :         if (fFlags & kHighp_Flag) {
      60           0 :             result += "highp ";
      61             :         }
      62           0 :         if (fFlags & kFlat_Flag) {
      63           0 :             result += "flat ";
      64             :         }
      65           0 :         if (fFlags & kNoPerspective_Flag) {
      66           0 :             result += "noperspective ";
      67             :         }
      68           0 :         if (fFlags & kReadOnly_Flag) {
      69           0 :             result += "readonly ";
      70             :         }
      71           0 :         if (fFlags & kWriteOnly_Flag) {
      72           0 :             result += "writeonly ";
      73             :         }
      74           0 :         if (fFlags & kCoherent_Flag) {
      75           0 :             result += "coherent ";
      76             :         }
      77           0 :         if (fFlags & kVolatile_Flag) {
      78           0 :             result += "volatile ";
      79             :         }
      80           0 :         if (fFlags & kRestrict_Flag) {
      81           0 :             result += "restrict ";
      82             :         }
      83             : 
      84           0 :         if ((fFlags & kIn_Flag) && (fFlags & kOut_Flag)) {
      85           0 :             result += "inout ";
      86           0 :         } else if (fFlags & kIn_Flag) {
      87           0 :             result += "in ";
      88           0 :         } else if (fFlags & kOut_Flag) {
      89           0 :             result += "out ";
      90             :         }
      91             : 
      92           0 :         return result;
      93             :     }
      94             : 
      95           0 :     bool operator==(const Modifiers& other) const {
      96           0 :         return fLayout == other.fLayout && fFlags == other.fFlags;
      97             :     }
      98             : 
      99           0 :     bool operator!=(const Modifiers& other) const {
     100           0 :         return !(*this == other);
     101             :     }
     102             : 
     103             :     Layout fLayout;
     104             :     int fFlags;
     105             : };
     106             : 
     107             : } // namespace
     108             : 
     109             : #endif

Generated by: LCOV version 1.13