LCOV - code coverage report
Current view: top level - gfx/skia/skia/include/gpu - GrTypesPriv.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 102 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 20 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright 2013 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 GrTypesPriv_DEFINED
       9             : #define GrTypesPriv_DEFINED
      10             : 
      11             : #include <chrono>
      12             : #include "GrTypes.h"
      13             : #include "SkRefCnt.h"
      14             : 
      15             : #ifdef MOZ_SKIA
      16             : #include "mozilla/TimeStamp.h"
      17             : 
      18             : struct GrStdSteadyClock
      19             : {
      20             :     typedef mozilla::TimeStamp time_point;
      21             : 
      22           0 :     static time_point now() {
      23           0 :         return mozilla::TimeStamp::NowLoRes();
      24             :     }
      25             : };
      26             : 
      27             : static inline GrStdSteadyClock::time_point
      28           0 : operator-(GrStdSteadyClock::time_point t, std::chrono::milliseconds ms) {
      29           0 :     return t - mozilla::TimeDuration::FromMilliseconds(ms.count());
      30             : }
      31             : 
      32             : #else
      33             : 
      34             : // The old libstdc++ uses the draft name "monotonic_clock" rather than "steady_clock". This might
      35             : // not actually be monotonic, depending on how libstdc++ was built. However, this is only currently
      36             : // used for idle resource purging so it shouldn't cause a correctness problem.
      37             : #if defined(__GLIBCXX__) && (__GLIBCXX__ < 20130000)
      38             : using GrStdSteadyClock = std::chrono::monotonic_clock;
      39             : #else
      40             : using GrStdSteadyClock = std::chrono::steady_clock;
      41             : #endif
      42             : 
      43             : #endif
      44             : 
      45             : /** This enum indicates the type of antialiasing to be performed. */
      46             : enum class GrAAType : unsigned {
      47             :     /** No antialiasing */
      48             :     kNone,
      49             :     /** Use fragment shader code to compute a fractional pixel coverage. */
      50             :     kCoverage,
      51             :     /** Use normal MSAA. */
      52             :     kMSAA,
      53             :     /**
      54             :      * Use "mixed samples" MSAA such that the stencil buffer is multisampled but the color buffer is
      55             :      * not.
      56             :      */
      57             :     kMixedSamples
      58             : };
      59             : 
      60           0 : static inline bool GrAATypeIsHW(GrAAType type) {
      61           0 :     switch (type) {
      62             :         case GrAAType::kNone:
      63           0 :             return false;
      64             :         case GrAAType::kCoverage:
      65           0 :             return false;
      66             :         case GrAAType::kMSAA:
      67           0 :             return true;
      68             :         case GrAAType::kMixedSamples:
      69           0 :             return true;
      70             :     }
      71           0 :     SkFAIL("Unknown AA Type");
      72           0 :     return false;
      73             : }
      74             : 
      75             : /**
      76             :  * Types of shader-language-specific boxed variables we can create. (Currently only GrGLShaderVars,
      77             :  * but should be applicable to other shader languages.)
      78             :  */
      79             : enum GrSLType {
      80             :     kVoid_GrSLType,
      81             :     kBool_GrSLType,
      82             :     kInt_GrSLType,
      83             :     kUint_GrSLType,
      84             :     kFloat_GrSLType,
      85             :     kVec2f_GrSLType,
      86             :     kVec3f_GrSLType,
      87             :     kVec4f_GrSLType,
      88             :     kVec2i_GrSLType,
      89             :     kVec3i_GrSLType,
      90             :     kVec4i_GrSLType,
      91             :     kMat22f_GrSLType,
      92             :     kMat33f_GrSLType,
      93             :     kMat44f_GrSLType,
      94             :     kTexture2DSampler_GrSLType,
      95             :     kITexture2DSampler_GrSLType,
      96             :     kTextureExternalSampler_GrSLType,
      97             :     kTexture2DRectSampler_GrSLType,
      98             :     kBufferSampler_GrSLType,
      99             :     kTexture2D_GrSLType,
     100             :     kSampler_GrSLType,
     101             :     kImageStorage2D_GrSLType,
     102             :     kIImageStorage2D_GrSLType,
     103             : };
     104             : 
     105             : enum GrShaderType {
     106             :     kVertex_GrShaderType,
     107             :     kGeometry_GrShaderType,
     108             :     kFragment_GrShaderType,
     109             : 
     110             :     kLastkFragment_GrShaderType = kFragment_GrShaderType
     111             : };
     112             : static const int kGrShaderTypeCount = kLastkFragment_GrShaderType + 1;
     113             : 
     114             : enum GrShaderFlags {
     115             :     kNone_GrShaderFlags = 0,
     116             :     kVertex_GrShaderFlag = 1 << kVertex_GrShaderType,
     117             :     kGeometry_GrShaderFlag = 1 << kGeometry_GrShaderType,
     118             :     kFragment_GrShaderFlag = 1 << kFragment_GrShaderType
     119             : };
     120           0 : GR_MAKE_BITFIELD_OPS(GrShaderFlags);
     121             : 
     122             : enum class GrDrawFace {
     123             :     kInvalid = -1,
     124             : 
     125             :     kBoth,
     126             :     kCCW,
     127             :     kCW,
     128             : };
     129             : 
     130             : /**
     131             :  * Precisions of shader language variables. Not all shading languages support precisions or actually
     132             :  * vary the internal precision based on the qualifiers. These currently only apply to float types (
     133             :  * including float vectors and matrices).
     134             :  */
     135             : enum GrSLPrecision {
     136             :     kLow_GrSLPrecision,
     137             :     kMedium_GrSLPrecision,
     138             :     kHigh_GrSLPrecision,
     139             : 
     140             :     // Default precision is a special tag that means "whatever the default for the program/type
     141             :     // combination is". In other words, it maps to the empty string in shader code. There are some
     142             :     // scenarios where kDefault is not allowed (as the default precision for a program, or for
     143             :     // varyings, for example).
     144             :     kDefault_GrSLPrecision,
     145             : 
     146             :     // We only consider the "real" precisions here
     147             :     kLast_GrSLPrecision = kHigh_GrSLPrecision,
     148             : };
     149             : 
     150             : static const int kGrSLPrecisionCount = kLast_GrSLPrecision + 1;
     151             : 
     152             : /** Is the shading language type float (including vectors/matrices)? */
     153           0 : static inline bool GrSLTypeIsFloatType(GrSLType type) {
     154           0 :     switch (type) {
     155             :         case kFloat_GrSLType:
     156             :         case kVec2f_GrSLType:
     157             :         case kVec3f_GrSLType:
     158             :         case kVec4f_GrSLType:
     159             :         case kMat22f_GrSLType:
     160             :         case kMat33f_GrSLType:
     161             :         case kMat44f_GrSLType:
     162           0 :             return true;
     163             : 
     164             :         case kVoid_GrSLType:
     165             :         case kTexture2DSampler_GrSLType:
     166             :         case kITexture2DSampler_GrSLType:
     167             :         case kTextureExternalSampler_GrSLType:
     168             :         case kTexture2DRectSampler_GrSLType:
     169             :         case kBufferSampler_GrSLType:
     170             :         case kBool_GrSLType:
     171             :         case kInt_GrSLType:
     172             :         case kUint_GrSLType:
     173             :         case kVec2i_GrSLType:
     174             :         case kVec3i_GrSLType:
     175             :         case kVec4i_GrSLType:
     176             :         case kTexture2D_GrSLType:
     177             :         case kSampler_GrSLType:
     178             :         case kImageStorage2D_GrSLType:
     179             :         case kIImageStorage2D_GrSLType:
     180           0 :             return false;
     181             :     }
     182           0 :     SkFAIL("Unexpected type");
     183           0 :     return false;
     184             : }
     185             : 
     186             : static inline bool GrSLTypeIs2DCombinedSamplerType(GrSLType type) {
     187             :     switch (type) {
     188             :         case kTexture2DSampler_GrSLType:
     189             :         case kITexture2DSampler_GrSLType:
     190             :         case kTextureExternalSampler_GrSLType:
     191             :         case kTexture2DRectSampler_GrSLType:
     192             :             return true;
     193             : 
     194             :         case kVoid_GrSLType:
     195             :         case kFloat_GrSLType:
     196             :         case kVec2f_GrSLType:
     197             :         case kVec3f_GrSLType:
     198             :         case kVec4f_GrSLType:
     199             :         case kVec2i_GrSLType:
     200             :         case kVec3i_GrSLType:
     201             :         case kVec4i_GrSLType:
     202             :         case kMat22f_GrSLType:
     203             :         case kMat33f_GrSLType:
     204             :         case kMat44f_GrSLType:
     205             :         case kBufferSampler_GrSLType:
     206             :         case kInt_GrSLType:
     207             :         case kUint_GrSLType:
     208             :         case kBool_GrSLType:
     209             :         case kTexture2D_GrSLType:
     210             :         case kSampler_GrSLType:
     211             :         case kImageStorage2D_GrSLType:
     212             :         case kIImageStorage2D_GrSLType:
     213             :             return false;
     214             :     }
     215             :     SkFAIL("Unexpected type");
     216             :     return false;
     217             : }
     218             : 
     219           0 : static inline bool GrSLTypeIsCombinedSamplerType(GrSLType type) {
     220           0 :     switch (type) {
     221             :         case kTexture2DSampler_GrSLType:
     222             :         case kITexture2DSampler_GrSLType:
     223             :         case kTextureExternalSampler_GrSLType:
     224             :         case kTexture2DRectSampler_GrSLType:
     225             :         case kBufferSampler_GrSLType:
     226           0 :             return true;
     227             : 
     228             :         case kVoid_GrSLType:
     229             :         case kFloat_GrSLType:
     230             :         case kVec2f_GrSLType:
     231             :         case kVec3f_GrSLType:
     232             :         case kVec4f_GrSLType:
     233             :         case kVec2i_GrSLType:
     234             :         case kVec3i_GrSLType:
     235             :         case kVec4i_GrSLType:
     236             :         case kMat22f_GrSLType:
     237             :         case kMat33f_GrSLType:
     238             :         case kMat44f_GrSLType:
     239             :         case kInt_GrSLType:
     240             :         case kUint_GrSLType:
     241             :         case kBool_GrSLType:
     242             :         case kTexture2D_GrSLType:
     243             :         case kSampler_GrSLType:
     244             :         case kImageStorage2D_GrSLType:
     245             :         case kIImageStorage2D_GrSLType:
     246           0 :             return false;
     247             :     }
     248           0 :     SkFAIL("Unexpected type");
     249           0 :     return false;
     250             : }
     251             : 
     252           0 : static inline bool GrSLTypeIsImageStorage(GrSLType type) {
     253           0 :     switch (type) {
     254             :         case kImageStorage2D_GrSLType:
     255             :         case kIImageStorage2D_GrSLType:
     256           0 :             return true;
     257             : 
     258             :         case kVoid_GrSLType:
     259             :         case kFloat_GrSLType:
     260             :         case kVec2f_GrSLType:
     261             :         case kVec3f_GrSLType:
     262             :         case kVec4f_GrSLType:
     263             :         case kVec2i_GrSLType:
     264             :         case kVec3i_GrSLType:
     265             :         case kVec4i_GrSLType:
     266             :         case kMat22f_GrSLType:
     267             :         case kMat33f_GrSLType:
     268             :         case kMat44f_GrSLType:
     269             :         case kInt_GrSLType:
     270             :         case kUint_GrSLType:
     271             :         case kBool_GrSLType:
     272             :         case kTexture2D_GrSLType:
     273             :         case kSampler_GrSLType:
     274             :         case kTexture2DSampler_GrSLType:
     275             :         case kITexture2DSampler_GrSLType:
     276             :         case kTextureExternalSampler_GrSLType:
     277             :         case kTexture2DRectSampler_GrSLType:
     278             :         case kBufferSampler_GrSLType:
     279           0 :             return false;
     280             :     }
     281           0 :     SkFAIL("Unexpected type");
     282           0 :     return false;
     283             : }
     284             : 
     285           0 : static inline bool GrSLTypeAcceptsPrecision(GrSLType type) {
     286           0 :     switch (type) {
     287             :         case kInt_GrSLType:
     288             :         case kUint_GrSLType:
     289             :         case kFloat_GrSLType:
     290             :         case kVec2f_GrSLType:
     291             :         case kVec3f_GrSLType:
     292             :         case kVec4f_GrSLType:
     293             :         case kVec2i_GrSLType:
     294             :         case kVec3i_GrSLType:
     295             :         case kVec4i_GrSLType:
     296             :         case kMat22f_GrSLType:
     297             :         case kMat33f_GrSLType:
     298             :         case kMat44f_GrSLType:
     299             :         case kTexture2DSampler_GrSLType:
     300             :         case kITexture2DSampler_GrSLType:
     301             :         case kTextureExternalSampler_GrSLType:
     302             :         case kTexture2DRectSampler_GrSLType:
     303             :         case kBufferSampler_GrSLType:
     304             :         case kTexture2D_GrSLType:
     305             :         case kSampler_GrSLType:
     306             :         case kImageStorage2D_GrSLType:
     307             :         case kIImageStorage2D_GrSLType:
     308           0 :             return true;
     309             : 
     310             :         case kVoid_GrSLType:
     311             :         case kBool_GrSLType:
     312           0 :             return false;
     313             :     }
     314           0 :     SkFAIL("Unexpected type");
     315           0 :     return false;
     316             : }
     317             : 
     318             : //////////////////////////////////////////////////////////////////////////////
     319             : 
     320             : /**
     321             :  * Types used to describe format of vertices in arrays.
     322             :   */
     323             : enum GrVertexAttribType {
     324             :     kFloat_GrVertexAttribType = 0,
     325             :     kVec2f_GrVertexAttribType,
     326             :     kVec3f_GrVertexAttribType,
     327             :     kVec4f_GrVertexAttribType,
     328             : 
     329             :     kVec2i_GrVertexAttribType,   // vector of 2 32-bit ints
     330             :     kVec3i_GrVertexAttribType,   // vector of 3 32-bit ints
     331             :     kVec4i_GrVertexAttribType,   // vector of 4 32-bit ints
     332             : 
     333             :     kUByte_GrVertexAttribType,   // unsigned byte, e.g. coverage
     334             :     kVec4ub_GrVertexAttribType,  // vector of 4 unsigned bytes, e.g. colors
     335             : 
     336             :     kVec2us_GrVertexAttribType,   // vector of 2 shorts, e.g. texture coordinates
     337             : 
     338             :     kInt_GrVertexAttribType,
     339             :     kUint_GrVertexAttribType,
     340             : 
     341             :     kLast_GrVertexAttribType = kUint_GrVertexAttribType
     342             : };
     343             : static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1;
     344             : 
     345             : 
     346             : /**
     347             :  * Returns the size of the attrib type in bytes.
     348             :  */
     349           0 : static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) {
     350           0 :     switch (type) {
     351             :         case kFloat_GrVertexAttribType:
     352           0 :             return sizeof(float);
     353             :         case kVec2f_GrVertexAttribType:
     354           0 :             return 2*sizeof(float);
     355             :         case kVec3f_GrVertexAttribType:
     356           0 :             return 3*sizeof(float);
     357             :         case kVec4f_GrVertexAttribType:
     358           0 :             return 4*sizeof(float);
     359             :         case kVec2i_GrVertexAttribType:
     360           0 :             return 2*sizeof(int32_t);
     361             :         case kVec3i_GrVertexAttribType:
     362           0 :             return 3*sizeof(int32_t);
     363             :         case kVec4i_GrVertexAttribType:
     364           0 :             return 4*sizeof(int32_t);
     365             :         case kUByte_GrVertexAttribType:
     366           0 :             return 1*sizeof(char);
     367             :         case kVec4ub_GrVertexAttribType:
     368           0 :             return 4*sizeof(char);
     369             :         case kVec2us_GrVertexAttribType:
     370           0 :             return 2*sizeof(int16_t);
     371             :         case kInt_GrVertexAttribType:
     372           0 :             return sizeof(int32_t);
     373             :         case kUint_GrVertexAttribType:
     374           0 :             return sizeof(uint32_t);
     375             :     }
     376           0 :     SkFAIL("Unexpected attribute type");
     377           0 :     return 0;
     378             : }
     379             : 
     380             : /**
     381             :  * Is the attrib type integral?
     382             :  */
     383           0 : static inline bool GrVertexAttribTypeIsIntType(GrVertexAttribType type) {
     384           0 :     switch (type) {
     385             :         case kFloat_GrVertexAttribType:
     386           0 :             return false;
     387             :         case kVec2f_GrVertexAttribType:
     388           0 :             return false;
     389             :         case kVec3f_GrVertexAttribType:
     390           0 :             return false;
     391             :         case kVec4f_GrVertexAttribType:
     392           0 :             return false;
     393             :         case kVec2i_GrVertexAttribType:
     394           0 :             return true;
     395             :         case kVec3i_GrVertexAttribType:
     396           0 :             return true;
     397             :         case kVec4i_GrVertexAttribType:
     398           0 :             return true;
     399             :         case kUByte_GrVertexAttribType:
     400           0 :             return false;
     401             :         case kVec4ub_GrVertexAttribType:
     402           0 :             return false;
     403             :         case kVec2us_GrVertexAttribType:
     404           0 :             return false;
     405             :         case kInt_GrVertexAttribType:
     406           0 :             return true;
     407             :         case kUint_GrVertexAttribType:
     408           0 :             return true;
     409             :     }
     410           0 :     SkFAIL("Unexpected attribute type");
     411           0 :     return false;
     412             : }
     413             : 
     414             : /**
     415             :  * converts a GrVertexAttribType to a GrSLType
     416             :  */
     417           0 : static inline GrSLType GrVertexAttribTypeToSLType(GrVertexAttribType type) {
     418           0 :     switch (type) {
     419             :         case kUByte_GrVertexAttribType:
     420             :         case kFloat_GrVertexAttribType:
     421           0 :             return kFloat_GrSLType;
     422             :         case kVec2us_GrVertexAttribType:
     423             :         case kVec2f_GrVertexAttribType:
     424           0 :             return kVec2f_GrSLType;
     425             :         case kVec3f_GrVertexAttribType:
     426           0 :             return kVec3f_GrSLType;
     427             :         case kVec4ub_GrVertexAttribType:
     428             :         case kVec4f_GrVertexAttribType:
     429           0 :             return kVec4f_GrSLType;
     430             :         case kVec2i_GrVertexAttribType:
     431           0 :             return kVec2i_GrSLType;
     432             :         case kVec3i_GrVertexAttribType:
     433           0 :             return kVec3i_GrSLType;
     434             :         case kVec4i_GrVertexAttribType:
     435           0 :             return kVec4i_GrSLType;
     436             :         case kInt_GrVertexAttribType:
     437           0 :             return kInt_GrSLType;
     438             :         case kUint_GrVertexAttribType:
     439           0 :             return kUint_GrSLType;
     440             :     }
     441           0 :     SkFAIL("Unsupported type conversion");
     442           0 :     return kVoid_GrSLType;
     443             : }
     444             : 
     445             : //////////////////////////////////////////////////////////////////////////////
     446             : 
     447             : enum class GrImageStorageFormat {
     448             :     kRGBA8,
     449             :     kRGBA8i,
     450             :     kRGBA16f,
     451             :     kRGBA32f,
     452             : };
     453             : 
     454             : /**
     455             :  * Describes types of caching and compiler optimizations allowed for certain variable types
     456             :  * (currently only image storages).
     457             :  **/
     458             : enum class GrSLMemoryModel {
     459             :     /** No special restrctions on memory accesses or compiler optimizations */
     460             :     kNone,
     461             :     /** Cache coherent across shader invocations */
     462             :     kCoherent,
     463             :     /**
     464             :      * Disallows compiler from eliding loads or stores that appear redundant in a single
     465             :      * invocation. Implies coherent.
     466             :      */
     467             :     kVolatile
     468             : };
     469             : 
     470             : /**
     471             :  * If kYes then the memory backing the varialble is only accessed via the variable. This is
     472             :  * currently only used with image storages.
     473             :  */
     474             : enum class GrSLRestrict {
     475             :     kYes,
     476             :     kNo,
     477             : };
     478             : 
     479             : //////////////////////////////////////////////////////////////////////////////
     480             : 
     481             : /**
     482             : * We have coverage effects that clip rendering to the edge of some geometric primitive.
     483             : * This enum specifies how that clipping is performed. Not all factories that take a
     484             : * GrProcessorEdgeType will succeed with all values and it is up to the caller to check for
     485             : * a NULL return.
     486             : */
     487             : enum GrPrimitiveEdgeType {
     488             :     kFillBW_GrProcessorEdgeType,
     489             :     kFillAA_GrProcessorEdgeType,
     490             :     kInverseFillBW_GrProcessorEdgeType,
     491             :     kInverseFillAA_GrProcessorEdgeType,
     492             :     kHairlineAA_GrProcessorEdgeType,
     493             : 
     494             :     kLast_GrProcessorEdgeType = kHairlineAA_GrProcessorEdgeType
     495             : };
     496             : 
     497             : static const int kGrProcessorEdgeTypeCnt = kLast_GrProcessorEdgeType + 1;
     498             : 
     499           0 : static inline bool GrProcessorEdgeTypeIsFill(const GrPrimitiveEdgeType edgeType) {
     500           0 :     return (kFillAA_GrProcessorEdgeType == edgeType || kFillBW_GrProcessorEdgeType == edgeType);
     501             : }
     502             : 
     503           0 : static inline bool GrProcessorEdgeTypeIsInverseFill(const GrPrimitiveEdgeType edgeType) {
     504           0 :     return (kInverseFillAA_GrProcessorEdgeType == edgeType ||
     505           0 :             kInverseFillBW_GrProcessorEdgeType == edgeType);
     506             : }
     507             : 
     508           0 : static inline bool GrProcessorEdgeTypeIsAA(const GrPrimitiveEdgeType edgeType) {
     509           0 :     return (kFillBW_GrProcessorEdgeType != edgeType && kInverseFillBW_GrProcessorEdgeType != edgeType);
     510             : }
     511             : 
     512           0 : static inline GrPrimitiveEdgeType GrInvertProcessorEdgeType(const GrPrimitiveEdgeType edgeType) {
     513           0 :     switch (edgeType) {
     514             :         case kFillBW_GrProcessorEdgeType:
     515           0 :             return kInverseFillBW_GrProcessorEdgeType;
     516             :         case kFillAA_GrProcessorEdgeType:
     517           0 :             return kInverseFillAA_GrProcessorEdgeType;
     518             :         case kInverseFillBW_GrProcessorEdgeType:
     519           0 :             return kFillBW_GrProcessorEdgeType;
     520             :         case kInverseFillAA_GrProcessorEdgeType:
     521           0 :             return kFillAA_GrProcessorEdgeType;
     522             :         case kHairlineAA_GrProcessorEdgeType:
     523           0 :             SkFAIL("Hairline fill isn't invertible.");
     524             :     }
     525           0 :     return kFillAA_GrProcessorEdgeType; // suppress warning.
     526             : }
     527             : 
     528             : /**
     529             :  * Indicates the type of pending IO operations that can be recorded for gpu resources.
     530             :  */
     531             : enum GrIOType {
     532             :     kRead_GrIOType,
     533             :     kWrite_GrIOType,
     534             :     kRW_GrIOType
     535             : };
     536             : 
     537             : /**
     538             : * Indicates the type of data that a GPU buffer will be used for.
     539             : */
     540             : enum GrBufferType {
     541             :     kVertex_GrBufferType,
     542             :     kIndex_GrBufferType,
     543             :     kTexel_GrBufferType,
     544             :     kDrawIndirect_GrBufferType,
     545             :     kXferCpuToGpu_GrBufferType,
     546             :     kXferGpuToCpu_GrBufferType,
     547             : 
     548             :     kLast_GrBufferType = kXferGpuToCpu_GrBufferType
     549             : };
     550             : static const int kGrBufferTypeCount = kLast_GrBufferType + 1;
     551             : 
     552           0 : static inline bool GrBufferTypeIsVertexOrIndex(GrBufferType type) {
     553           0 :     SkASSERT(type >= 0 && type < kGrBufferTypeCount);
     554           0 :     return type <= kIndex_GrBufferType;
     555             : 
     556             :     GR_STATIC_ASSERT(0 == kVertex_GrBufferType);
     557             :     GR_STATIC_ASSERT(1 == kIndex_GrBufferType);
     558             : }
     559             : 
     560             : /**
     561             : * Provides a performance hint regarding the frequency at which a data store will be accessed.
     562             : */
     563             : enum GrAccessPattern {
     564             :     /** Data store will be respecified repeatedly and used many times. */
     565             :     kDynamic_GrAccessPattern,
     566             :     /** Data store will be specified once and used many times. (Thus disqualified from caching.) */
     567             :     kStatic_GrAccessPattern,
     568             :     /** Data store will be specified once and used at most a few times. (Also can't be cached.) */
     569             :     kStream_GrAccessPattern,
     570             : 
     571             :     kLast_GrAccessPattern = kStream_GrAccessPattern
     572             : };
     573             : 
     574             : 
     575             : #ifdef SK_DEBUG
     576             : // Takes a pointer to a GrCaps, and will suppress prints if required
     577             : #define GrCapsDebugf(caps, ...)         \
     578             :     if (!(caps)->suppressPrints()) {    \
     579             :         SkDebugf(__VA_ARGS__);          \
     580             :     }
     581             : #else
     582             : #define GrCapsDebugf(caps, ...)
     583             : #endif
     584             : 
     585             : /**
     586             :  * Specifies if the holder owns the backend, OpenGL or Vulkan, object.
     587             :  */
     588             : enum class GrBackendObjectOwnership : bool {
     589             :     /** Holder does not destroy the backend object. */
     590             :     kBorrowed = false,
     591             :     /** Holder destroys the backend object. */
     592             :     kOwned = true
     593             : };
     594             : 
     595           0 : template <typename T> T * const * sk_sp_address_as_pointer_address(sk_sp<T> const * sp) {
     596             :     static_assert(sizeof(T*) == sizeof(sk_sp<T>), "sk_sp not expected size.");
     597           0 :     return reinterpret_cast<T * const *>(sp);
     598             : }
     599             : 
     600             : /*
     601             :  * Object for CPU-GPU synchronization
     602             :  */
     603             : typedef uint64_t GrFence;
     604             : 
     605             : #endif

Generated by: LCOV version 1.13