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

          Line data    Source code
       1             : //
       2             : // Copyright (c) 2015 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             : // Cache.h: Implements a cache for various commonly created objects.
       8             : 
       9             : #ifndef COMPILER_TRANSLATOR_CACHE_H_
      10             : #define COMPILER_TRANSLATOR_CACHE_H_
      11             : 
      12             : #include <stdint.h>
      13             : #include <string.h>
      14             : #include <map>
      15             : 
      16             : #include "compiler/translator/Types.h"
      17             : #include "compiler/translator/PoolAlloc.h"
      18             : 
      19             : namespace sh
      20             : {
      21             : 
      22           0 : class TCache
      23             : {
      24             :   public:
      25             : 
      26             :     static void initialize();
      27             :     static void destroy();
      28             : 
      29           0 :     static const TType *getType(TBasicType basicType,
      30             :                                 TPrecision precision)
      31             :     {
      32             :         return getType(basicType, precision, EvqTemporary,
      33           0 :                        1, 1);
      34             :     }
      35           0 :     static const TType *getType(TBasicType basicType,
      36             :                                 unsigned char primarySize = 1,
      37             :                                 unsigned char secondarySize = 1)
      38             :     {
      39           0 :         return getType(basicType, EbpUndefined, EvqGlobal,
      40           0 :                        primarySize, secondarySize);
      41             :     }
      42           0 :     static const TType *getType(TBasicType basicType,
      43             :                                 TQualifier qualifier,
      44             :                                 unsigned char primarySize = 1,
      45             :                                 unsigned char secondarySize = 1)
      46             :     {
      47           0 :         return getType(basicType, EbpUndefined, qualifier,
      48           0 :                        primarySize, secondarySize);
      49             :     }
      50             :     static const TType *getType(TBasicType basicType,
      51             :                                 TPrecision precision,
      52             :                                 TQualifier qualifier,
      53             :                                 unsigned char primarySize,
      54             :                                 unsigned char secondarySize);
      55             : 
      56             :   private:
      57           0 :     TCache()
      58           0 :     {
      59           0 :     }
      60             : 
      61             :     union TypeKey
      62             :     {
      63             :         TypeKey(TBasicType basicType,
      64             :                 TPrecision precision,
      65             :                 TQualifier qualifier,
      66             :                 unsigned char primarySize,
      67             :                 unsigned char secondarySize);
      68             : 
      69             :         typedef uint8_t EnumComponentType;
      70             :         struct
      71             :         {
      72             :             EnumComponentType basicType;
      73             :             EnumComponentType precision;
      74             :             EnumComponentType qualifier;
      75             :             unsigned char primarySize;
      76             :             unsigned char secondarySize;
      77             :         } components;
      78             :         uint64_t value;
      79             : 
      80           0 :         bool operator < (const TypeKey &other) const
      81             :         {
      82           0 :             return value < other.value;
      83             :         }
      84             :     };
      85             :     typedef std::map<TypeKey, const TType*> TypeMap;
      86             : 
      87             :     TypeMap mTypes;
      88             :     TPoolAllocator mAllocator;
      89             : 
      90             :     static TCache *sCache;
      91             : };
      92             : 
      93             : }  // namespace sh
      94             : 
      95             : #endif  // COMPILER_TRANSLATOR_CACHE_H_

Generated by: LCOV version 1.13