blob: a650348a13ba9d629616d3032ac5d512492638e1 [file] [log] [blame]
bsalomon@google.comf7fa8062012-02-14 14:09:57 +00001/*
2 * Copyright 2012 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
9#ifndef GrGLCaps_DEFINED
10#define GrGLCaps_DEFINED
11
bsalomoneb1cb5c2015-05-22 08:01:09 -070012#include "GrCaps.h"
jvanverthcba99b82015-06-24 06:59:57 -070013#include "glsl/GrGLSL.h"
egdaniel8dc7c3a2015-04-16 11:22:42 -070014#include "GrGLStencilAttachment.h"
piotaixre4b23142014-10-02 10:57:53 -070015#include "SkChecksum.h"
mtklein2aa1f7e2015-02-20 12:35:32 -080016#include "SkTHash.h"
robertphillips@google.coma2d71482012-08-01 20:08:47 +000017#include "SkTArray.h"
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000018
19class GrGLContextInfo;
jvanverthe9c0fc62015-04-29 11:18:05 -070020class GrGLSLCaps;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000021
22/**
23 * Stores some capabilities of a GL context. Most are determined by the GL
24 * version and the extensions string. It also tracks formats that have passed
25 * the FBO completeness test.
26 */
bsalomon4b91f762015-05-19 09:29:46 -070027class GrGLCaps : public GrCaps {
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000028public:
egdaniel8dc7c3a2015-04-16 11:22:42 -070029 typedef GrGLStencilAttachment::Format StencilFormat;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000030
bsalomon30447372015-12-21 09:03:05 -080031 /** Provides information about the mappiing from GrPixelConfig to GL formats. */
32 struct ConfigFormats {
33 ConfigFormats() {
34 // Inits to known bad GL enum values.
35 memset(this, 0xAB, sizeof(ConfigFormats));
36 }
37 GrGLenum fBaseInternalFormat;
38 GrGLenum fSizedInternalFormat;
39 GrGLenum fExternalFormat;
40 GrGLenum fExternalType;
41
42 // The <format> parameter to use for glTexImage and glTexSubImage.
43 // This is usually the same as fExternalFormat except for kSRGBA on some GL contexts.
44 GrGLenum fExternalFormatForTexImage;
45 // Either the base or sized internal format depending on the GL and config.
46 GrGLenum fInternalFormatTexImage;
47 };
48
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000049 /**
50 * The type of MSAA for FBOs supported. Different extensions have different
51 * semantics of how / when a resolve is performed.
52 */
53 enum MSFBOType {
54 /**
55 * no support for MSAA FBOs
56 */
rmistry@google.comfbfcd562012-08-23 18:09:54 +000057 kNone_MSFBOType = 0,
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000058 /**
skia.committer@gmail.com6fc1b492013-09-06 07:01:45 +000059 * GL3.0-style MSAA FBO (GL_ARB_framebuffer_object).
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000060 */
bsalomon@google.com347c3822013-05-01 20:10:01 +000061 kDesktop_ARB_MSFBOType,
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000062 /**
63 * earlier GL_EXT_framebuffer* extensions
64 */
bsalomon@google.com347c3822013-05-01 20:10:01 +000065 kDesktop_EXT_MSFBOType,
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000066 /**
commit-bot@chromium.orga8e5a062013-09-05 23:44:09 +000067 * Similar to kDesktop_ARB but with additional restrictions on glBlitFramebuffer.
68 */
69 kES_3_0_MSFBOType,
70 /**
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000071 * GL_APPLE_framebuffer_multisample ES extension
72 */
bsalomon@google.com347c3822013-05-01 20:10:01 +000073 kES_Apple_MSFBOType,
bsalomon@google.comf3a60c02013-03-19 19:06:09 +000074 /**
bsalomon@google.com347c3822013-05-01 20:10:01 +000075 * GL_IMG_multisampled_render_to_texture. This variation does not have MSAA renderbuffers.
76 * Instead the texture is multisampled when bound to the FBO and then resolved automatically
77 * when read. It also defines an alternate value for GL_MAX_SAMPLES (which we call
78 * GR_GL_MAX_SAMPLES_IMG).
bsalomon@google.comf3a60c02013-03-19 19:06:09 +000079 */
bsalomon@google.com347c3822013-05-01 20:10:01 +000080 kES_IMG_MsToTexture_MSFBOType,
81 /**
82 * GL_EXT_multisampled_render_to_texture. Same as the IMG one above but uses the standard
83 * GL_MAX_SAMPLES value.
84 */
85 kES_EXT_MsToTexture_MSFBOType,
vbuzinovdded6962015-06-12 08:59:45 -070086 /**
87 * GL_NV_framebuffer_mixed_samples.
88 */
89 kMixedSamples_MSFBOType,
bsalomon@google.com6b0cf022013-05-03 13:35:14 +000090
vbuzinovdded6962015-06-12 08:59:45 -070091 kLast_MSFBOType = kMixedSamples_MSFBOType
bsalomon@google.com6b0cf022013-05-03 13:35:14 +000092 };
93
commit-bot@chromium.org52ffbf62014-04-02 16:19:33 +000094 enum InvalidateFBType {
95 kNone_InvalidateFBType,
96 kDiscard_InvalidateFBType, //<! glDiscardFramebuffer()
97 kInvalidate_InvalidateFBType, //<! glInvalidateFramebuffer()
98
99 kLast_InvalidateFBType = kInvalidate_InvalidateFBType
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000100 };
101
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000102 enum MapBufferType {
103 kNone_MapBufferType,
104 kMapBuffer_MapBufferType, // glMapBuffer()
105 kMapBufferRange_MapBufferType, // glMapBufferRange()
106 kChromium_MapBufferType, // GL_CHROMIUM_map_sub
107
108 kLast_MapBufferType = kChromium_MapBufferType,
109 };
110
jvanverthd7a2c1f2015-12-07 07:36:44 -0800111 enum TransferBufferType {
112 kNone_TransferBufferType,
113 kPBO_TransferBufferType, // ARB_pixel_buffer_object
114 kChromium_TransferBufferType, // CHROMIUM_pixel_transfer_buffer_object
115
116 kLast_TransferBufferType = kChromium_TransferBufferType,
117 };
118
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000119 /**
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000120 * Initializes the GrGLCaps to the set of features supported in the current
121 * OpenGL context accessible via ctxInfo.
122 */
bsalomon682c2692015-05-22 14:01:46 -0700123 GrGLCaps(const GrContextOptions& contextOptions, const GrGLContextInfo& ctxInfo,
124 const GrGLInterface* glInterface);
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000125
bsalomon41e4384e2016-01-08 09:12:44 -0800126 bool isConfigTexturable(GrPixelConfig config) const override {
127 SkASSERT(kGrPixelConfigCnt > config);
128 return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kTextureable_Flag);
129 }
130
131 bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const override {
132 SkASSERT(kGrPixelConfigCnt > config);
133 if (withMSAA) {
134 return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kRenderableWithMSAA_Flag);
135 } else {
136 return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kRenderable_Flag);
137 }
138 }
139
bsalomon30447372015-12-21 09:03:05 -0800140 /** Returns conversions to various GL format parameters for a GrPixelCfonig. */
141 const ConfigFormats& configGLFormats(GrPixelConfig config) const {
142 return fConfigTable[config].fFormats;
143 }
144
bsalomon30447372015-12-21 09:03:05 -0800145 /**
146 * Gets an array of legal stencil formats. These formats are not guaranteed
147 * to be supported by the driver but are legal GLenum names given the GL
148 * version and extensions supported.
149 */
150 const SkTArray<StencilFormat, true>& stencilFormats() const {
151 return fStencilFormats;
152 }
153
154 /**
155 * Has a stencil format index been found for the config (or we've found that no format works).
156 */
157 bool hasStencilFormatBeenDeterminedForConfig(GrPixelConfig config) const {
158 return fConfigTable[config].fStencilFormatIndex != ConfigInfo::kUnknown_StencilIndex;
159 }
160
161 /**
162 * Gets the stencil format index for the config. This assumes
163 * hasStencilFormatBeenDeterminedForConfig has already been checked. Returns a value < 0 if
164 * no stencil format is supported with the config. Otherwise, returned index refers to the array
165 * returned by stencilFormats().
166 */
167 int getStencilFormatIndexForConfig(GrPixelConfig config) const {
168 SkASSERT(this->hasStencilFormatBeenDeterminedForConfig(config));
169 return fConfigTable[config].fStencilFormatIndex;
170 }
171
172 /**
173 * If index is >= 0 this records an index into stencilFormats() as the best stencil format for
174 * the config. If < 0 it records that the config has no supported stencil format index.
175 */
176 void setStencilFormatIndexForConfig(GrPixelConfig config, int index) {
177 SkASSERT(!this->hasStencilFormatBeenDeterminedForConfig(config));
178 if (index < 0) {
179 fConfigTable[config].fStencilFormatIndex = ConfigInfo::kUnsupported_StencilFormatIndex;
180 } else {
181 fConfigTable[config].fStencilFormatIndex = index;
182 }
183 }
184
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000185 /**
186 * Call to note that a color config has been verified as a valid color
187 * attachment. This may save future calls to glCheckFramebufferStatus
188 * using isConfigVerifiedColorAttachment().
189 */
190 void markConfigAsValidColorAttachment(GrPixelConfig config) {
bsalomon480e8c02015-12-21 13:44:18 -0800191 fConfigTable[config].fFlags |= ConfigInfo::kVerifiedColorAttachment_Flag;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000192 }
193
194 /**
195 * Call to check whether a config has been verified as a valid color
196 * attachment.
197 */
198 bool isConfigVerifiedColorAttachment(GrPixelConfig config) const {
bsalomon480e8c02015-12-21 13:44:18 -0800199 return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kVerifiedColorAttachment_Flag);
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000200 }
201
202 /**
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000203 * Reports the type of MSAA FBO support.
204 */
205 MSFBOType msFBOType() const { return fMSFBOType; }
206
207 /**
bsalomon@google.com347c3822013-05-01 20:10:01 +0000208 * Does the supported MSAA FBO extension have MSAA renderbuffers?
209 */
210 bool usesMSAARenderBuffers() const {
211 return kNone_MSFBOType != fMSFBOType &&
212 kES_IMG_MsToTexture_MSFBOType != fMSFBOType &&
vbuzinovdded6962015-06-12 08:59:45 -0700213 kES_EXT_MsToTexture_MSFBOType != fMSFBOType &&
214 kMixedSamples_MSFBOType != fMSFBOType;
bsalomon@google.com347c3822013-05-01 20:10:01 +0000215 }
216
217 /**
218 * Is the MSAA FBO extension one where the texture is multisampled when bound to an FBO and
219 * then implicitly resolved when read.
220 */
221 bool usesImplicitMSAAResolve() const {
222 return kES_IMG_MsToTexture_MSFBOType == fMSFBOType ||
223 kES_EXT_MsToTexture_MSFBOType == fMSFBOType;
224 }
225
commit-bot@chromium.org52ffbf62014-04-02 16:19:33 +0000226 InvalidateFBType invalidateFBType() const { return fInvalidateFBType; }
227
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000228 /// What type of buffer mapping is supported?
229 MapBufferType mapBufferType() const { return fMapBufferType; }
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000230
jvanverthd7a2c1f2015-12-07 07:36:44 -0800231 /// What type of transfer buffer is supported?
232 TransferBufferType transferBufferType() const { return fTransferBufferType; }
233
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000234 /// The maximum number of fragment uniform vectors (GLES has min. 16).
235 int maxFragmentUniformVectors() const { return fMaxFragmentUniformVectors; }
236
commit-bot@chromium.orga15f7e52013-06-05 23:29:25 +0000237 /// maximum number of attribute values per vertex
bsalomon@google.com60da4172012-06-01 19:25:00 +0000238 int maxVertexAttributes() const { return fMaxVertexAttributes; }
239
commit-bot@chromium.orga15f7e52013-06-05 23:29:25 +0000240 /// maximum number of texture units accessible in the fragment shader.
241 int maxFragmentTextureUnits() const { return fMaxFragmentTextureUnits; }
242
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000243 /**
244 * Depending on the ES extensions present the BGRA external format may
bsalomon41e4384e2016-01-08 09:12:44 -0800245 * correspond to either a BGRA or RGBA internalFormat. On desktop GL it is
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000246 * RGBA.
247 */
bsalomon41e4384e2016-01-08 09:12:44 -0800248 bool bgraIsInternalFormat() const;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000249
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000250 /// Is there support for GL_UNPACK_ROW_LENGTH
251 bool unpackRowLengthSupport() const { return fUnpackRowLengthSupport; }
252
253 /// Is there support for GL_UNPACK_FLIP_Y
254 bool unpackFlipYSupport() const { return fUnpackFlipYSupport; }
255
256 /// Is there support for GL_PACK_ROW_LENGTH
257 bool packRowLengthSupport() const { return fPackRowLengthSupport; }
258
259 /// Is there support for GL_PACK_REVERSE_ROW_ORDER
260 bool packFlipYSupport() const { return fPackFlipYSupport; }
261
262 /// Is there support for texture parameter GL_TEXTURE_USAGE
263 bool textureUsageSupport() const { return fTextureUsageSupport; }
264
265 /// Is there support for glTexStorage
266 bool texStorageSupport() const { return fTexStorageSupport; }
267
robertphillips@google.com443e5a52012-04-30 20:01:21 +0000268 /// Is there support for GL_RED and GL_R8
269 bool textureRedSupport() const { return fTextureRedSupport; }
270
bsalomon@google.come76b7cc2012-06-18 12:47:06 +0000271 /// Is GL_ARB_IMAGING supported
272 bool imagingSupport() const { return fImagingSupport; }
273
bsalomon@google.com07631cf2013-03-05 14:14:58 +0000274 /// Is there support for Vertex Array Objects?
275 bool vertexArrayObjectSupport() const { return fVertexArrayObjectSupport; }
276
cdalton626e1ff2015-06-12 13:56:46 -0700277 /// Is there support for GL_EXT_direct_state_access?
278 bool directStateAccessSupport() const { return fDirectStateAccessSupport; }
279
280 /// Is there support for GL_KHR_debug?
281 bool debugSupport() const { return fDebugSupport; }
282
jvanverth3f801cb2014-12-16 09:49:38 -0800283 /// Is there support for ES2 compatability?
284 bool ES2CompatibilitySupport() const { return fES2CompatibilitySupport; }
285
cdaltond4727922015-11-10 12:49:06 -0800286 /// Can we call glDisable(GL_MULTISAMPLE)?
287 bool multisampleDisableSupport() const {
288 return fMultisampleDisableSupport;
289 }
290
bsalomon@google.com07631cf2013-03-05 14:14:58 +0000291 /// Use indices or vertices in CPU arrays rather than VBOs for dynamic content.
bsalomon@google.com96966a52013-02-21 16:34:21 +0000292 bool useNonVBOVertexAndIndexDynamicData() const {
293 return fUseNonVBOVertexAndIndexDynamicData;
294 }
295
bsalomon@google.com07631cf2013-03-05 14:14:58 +0000296 /// Does ReadPixels support the provided format/type combo?
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000297 bool readPixelsSupported(const GrGLInterface* intf,
bsalomon7928ef62016-01-05 10:26:39 -0800298 GrPixelConfig readConfig,
299 GrPixelConfig currFBOConfig) const;
skia.committer@gmail.com631cdcb2013-03-01 12:12:55 +0000300
bsalomon@google.com2b1b8c02013-02-28 22:06:02 +0000301 bool isCoreProfile() const { return fIsCoreProfile; }
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000302
joshualittc1f56b52015-06-22 12:31:31 -0700303 bool bindFragDataLocationSupport() const { return fBindFragDataLocationSupport; }
304
joshualitt7bdd70a2015-10-01 06:28:11 -0700305 bool bindUniformLocationSupport() const { return fBindUniformLocationSupport; }
306
bsalomon7ea33f52015-11-22 14:51:00 -0800307 /// Are textures with GL_TEXTURE_EXTERNAL_OES type supported.
308 bool externalTextureSupport() const { return fExternalTextureSupport; }
309
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000310 /**
bsalomon16921ec2015-07-30 15:34:56 -0700311 * Is there support for enabling/disabling sRGB writes for sRGB-capable color attachments?
312 * If false this does not mean sRGB is not supported but rather that if it is supported
313 * it cannot be turned off for configs that support it.
314 */
315 bool srgbWriteControl() const { return fSRGBWriteControl; }
316
317 /**
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000318 * Returns a string containing the caps info.
319 */
mtklein36352bf2015-03-25 18:17:31 -0700320 SkString dump() const override;
commit-bot@chromium.orgbeb8b3a2014-04-15 15:37:51 +0000321
bsalomon88c7b982015-07-31 11:20:16 -0700322 bool rgba8888PixelsOpsAreSlow() const { return fRGBA8888PixelsOpsAreSlow; }
323 bool partialFBOReadIsSlow() const { return fPartialFBOReadIsSlow; }
324
egdanielf5294392015-10-21 07:14:17 -0700325 const GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fShaderCaps.get()); }
jvanverthe9c0fc62015-04-29 11:18:05 -0700326
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000327private:
cdalton4cd67132015-06-10 19:23:46 -0700328 void init(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterface*);
egdaniel05ded892015-10-26 07:38:05 -0700329 void initGLSL(const GrGLContextInfo&);
kkinnunencfe62e32015-07-01 02:58:50 -0700330 bool hasPathRenderingSupport(const GrGLContextInfo&, const GrGLInterface*);
bsalomon424cc262015-05-22 10:37:30 -0700331
egdanielb7e7d572015-11-04 04:23:53 -0800332 void onApplyOptionsOverrides(const GrContextOptions& options) override;
333
commit-bot@chromium.org73880512013-10-14 15:33:45 +0000334 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*);
cdalton1dd05422015-06-12 09:01:18 -0700335 void initBlendEqationSupport(const GrGLContextInfo&);
commit-bot@chromium.org73880512013-10-14 15:33:45 +0000336 void initStencilFormats(const GrGLContextInfo&);
commit-bot@chromium.org6b7938f2013-10-15 14:18:16 +0000337 // This must be called after initFSAASupport().
bsalomon41e4384e2016-01-08 09:12:44 -0800338 void initConfigTable(const GrGLContextInfo&, const GrGLInterface* gli);
commit-bot@chromium.org42dc8132014-05-27 19:26:59 +0000339
jvanverthcba99b82015-06-24 06:59:57 -0700340 void initShaderPrecisionTable(const GrGLContextInfo& ctxInfo,
341 const GrGLInterface* intf,
342 GrGLSLCaps* glslCaps);
343
egdanielb7e7d572015-11-04 04:23:53 -0800344 void initConfigSwizzleTable(const GrGLContextInfo& ctxInfo, GrGLSLCaps* glslCaps);
345
bsalomon30447372015-12-21 09:03:05 -0800346
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000347 SkTArray<StencilFormat, true> fStencilFormats;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000348
349 int fMaxFragmentUniformVectors;
bsalomon@google.com60da4172012-06-01 19:25:00 +0000350 int fMaxVertexAttributes;
commit-bot@chromium.orga15f7e52013-06-05 23:29:25 +0000351 int fMaxFragmentTextureUnits;
bsalomon@google.com60da4172012-06-01 19:25:00 +0000352
commit-bot@chromium.org52ffbf62014-04-02 16:19:33 +0000353 MSFBOType fMSFBOType;
commit-bot@chromium.org52ffbf62014-04-02 16:19:33 +0000354 InvalidateFBType fInvalidateFBType;
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000355 MapBufferType fMapBufferType;
jvanverthd7a2c1f2015-12-07 07:36:44 -0800356 TransferBufferType fTransferBufferType;
bsalomon@google.com6b0cf022013-05-03 13:35:14 +0000357
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000358 bool fUnpackRowLengthSupport : 1;
359 bool fUnpackFlipYSupport : 1;
360 bool fPackRowLengthSupport : 1;
361 bool fPackFlipYSupport : 1;
362 bool fTextureUsageSupport : 1;
363 bool fTexStorageSupport : 1;
robertphillips@google.com443e5a52012-04-30 20:01:21 +0000364 bool fTextureRedSupport : 1;
bsalomon@google.come76b7cc2012-06-18 12:47:06 +0000365 bool fImagingSupport : 1;
bsalomon@google.com07631cf2013-03-05 14:14:58 +0000366 bool fVertexArrayObjectSupport : 1;
cdalton626e1ff2015-06-12 13:56:46 -0700367 bool fDirectStateAccessSupport : 1;
368 bool fDebugSupport : 1;
jvanverth3f801cb2014-12-16 09:49:38 -0800369 bool fES2CompatibilitySupport : 1;
cdaltond4727922015-11-10 12:49:06 -0800370 bool fMultisampleDisableSupport : 1;
bsalomon@google.com96966a52013-02-21 16:34:21 +0000371 bool fUseNonVBOVertexAndIndexDynamicData : 1;
bsalomon@google.com2b1b8c02013-02-28 22:06:02 +0000372 bool fIsCoreProfile : 1;
joshualittc1f56b52015-06-22 12:31:31 -0700373 bool fBindFragDataLocationSupport : 1;
bsalomon16921ec2015-07-30 15:34:56 -0700374 bool fSRGBWriteControl : 1;
bsalomon88c7b982015-07-31 11:20:16 -0700375 bool fRGBA8888PixelsOpsAreSlow : 1;
376 bool fPartialFBOReadIsSlow : 1;
joshualitt7bdd70a2015-10-01 06:28:11 -0700377 bool fBindUniformLocationSupport : 1;
bsalomon7ea33f52015-11-22 14:51:00 -0800378 bool fExternalTextureSupport : 1;
joshualitt58162332014-08-01 06:44:53 -0700379
bsalomon7928ef62016-01-05 10:26:39 -0800380 /** Number type of the components (with out considering number of bits.) */
381 enum FormatType {
382 kNormalizedFixedPoint_FormatType,
383 kFloat_FormatType,
384 };
385
386 struct ReadPixelsFormat {
387 ReadPixelsFormat() : fFormat(0), fType(0) {}
388 GrGLenum fFormat;
389 GrGLenum fType;
390 };
391
bsalomon30447372015-12-21 09:03:05 -0800392 struct ConfigInfo {
bsalomon7928ef62016-01-05 10:26:39 -0800393 ConfigInfo() : fStencilFormatIndex(kUnknown_StencilIndex), fFlags(0) {}
bsalomon30447372015-12-21 09:03:05 -0800394
395 ConfigFormats fFormats;
396
bsalomon7928ef62016-01-05 10:26:39 -0800397 FormatType fFormatType;
398
399 // On ES contexts there are restrictions on type type/format that may be used for
400 // ReadPixels. One is implicitly specified by the current FBO's format. The other is
401 // queryable. This stores the queried option (lazily).
402 ReadPixelsFormat fSecondReadPixelsFormat;
403
bsalomon30447372015-12-21 09:03:05 -0800404 enum {
405 // This indicates that a stencil format has not yet been determined for the config.
406 kUnknown_StencilIndex = -1,
407 // This indicates that there is no supported stencil format for the config.
408 kUnsupported_StencilFormatIndex = -2
409 };
bsalomon480e8c02015-12-21 13:44:18 -0800410
411 // Index fStencilFormats.
412 int fStencilFormatIndex;
413
414 enum {
bsalomon41e4384e2016-01-08 09:12:44 -0800415 kVerifiedColorAttachment_Flag = 0x1,
416 kTextureable_Flag = 0x2,
417 kRenderable_Flag = 0x4,
418 kRenderableWithMSAA_Flag = 0x8,
bsalomon480e8c02015-12-21 13:44:18 -0800419 };
420 uint32_t fFlags;
bsalomon30447372015-12-21 09:03:05 -0800421 };
422
423 ConfigInfo fConfigTable[kGrPixelConfigCnt];
424
bsalomon4b91f762015-05-19 09:29:46 -0700425 typedef GrCaps INHERITED;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000426};
427
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000428#endif