Home | History | Annotate | Download | only in mock
      1 /*
      2  * Copyright 2017 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 GrMockOptions_DEFINED
      9 #define GrMockOptions_DEFINED
     10 
     11 #include "GrTypes.h"
     12 #include "../private/GrTypesPriv.h"
     13 
     14 struct GrMockTextureInfo {
     15     GrPixelConfig fConfig;
     16     int           fID;
     17 };
     18 
     19 /**
     20  * A pointer to this type is used as the GrBackendContext when creating a Mock GrContext. It can be
     21  * used to specify capability options for the mock context. If nullptr is used a default constructed
     22  * GrMockOptions is used.
     23  */
     24 struct GrMockOptions {
     25     GrMockOptions() {
     26         using Renderability = ConfigOptions::Renderability;
     27         // By default RGBA_8888 is textureable and renderable and A8 and RGB565 are texturable.
     28         fConfigOptions[kRGBA_8888_GrPixelConfig].fRenderability = Renderability::kNonMSAA;
     29         fConfigOptions[kRGBA_8888_GrPixelConfig].fTexturable = true;
     30         fConfigOptions[kAlpha_8_GrPixelConfig].fTexturable = true;
     31         fConfigOptions[kAlpha_8_as_Alpha_GrPixelConfig].fTexturable = true;
     32         fConfigOptions[kAlpha_8_as_Red_GrPixelConfig].fTexturable = true;
     33         fConfigOptions[kRGB_565_GrPixelConfig].fTexturable = true;
     34     }
     35 
     36     struct ConfigOptions {
     37         enum Renderability { kNo, kNonMSAA, kMSAA };
     38         Renderability fRenderability;
     39         bool fTexturable = false;
     40     };
     41 
     42     // GPU options.
     43     bool fInstanceAttribSupport = false;
     44     uint32_t fMapBufferFlags = 0;
     45     int fMaxTextureSize = 2048;
     46     int fMaxRenderTargetSize = 2048;
     47     int fMaxVertexAttributes = 16;
     48     ConfigOptions fConfigOptions[kGrPixelConfigCnt];
     49 
     50     // Shader options.
     51     bool fGeometryShaderSupport = false;
     52     bool fTexelBufferSupport = false;
     53     bool fIntegerSupport = false;
     54     bool fFlatInterpolationSupport = false;
     55     int fMaxVertexSamplers = 0;
     56     int fMaxFragmentSamplers = 8;
     57     bool fShaderDerivativeSupport = true;
     58 };
     59 
     60 #endif
     61