blob: e924c60efb945796be098d138ec8fcede51b897c [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"
bsalomon6df86402015-06-01 10:41:49 -070013#include "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:
bsalomon@google.combcce8922013-03-25 15:38:39 +000029 SK_DECLARE_INST_COUNT(GrGLCaps)
30
egdaniel8dc7c3a2015-04-16 11:22:42 -070031 typedef GrGLStencilAttachment::Format StencilFormat;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000032
33 /**
34 * The type of MSAA for FBOs supported. Different extensions have different
35 * semantics of how / when a resolve is performed.
36 */
37 enum MSFBOType {
38 /**
39 * no support for MSAA FBOs
40 */
rmistry@google.comfbfcd562012-08-23 18:09:54 +000041 kNone_MSFBOType = 0,
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000042 /**
skia.committer@gmail.com6fc1b492013-09-06 07:01:45 +000043 * GL3.0-style MSAA FBO (GL_ARB_framebuffer_object).
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000044 */
bsalomon@google.com347c3822013-05-01 20:10:01 +000045 kDesktop_ARB_MSFBOType,
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000046 /**
47 * earlier GL_EXT_framebuffer* extensions
48 */
bsalomon@google.com347c3822013-05-01 20:10:01 +000049 kDesktop_EXT_MSFBOType,
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000050 /**
commit-bot@chromium.orga8e5a062013-09-05 23:44:09 +000051 * Similar to kDesktop_ARB but with additional restrictions on glBlitFramebuffer.
52 */
53 kES_3_0_MSFBOType,
54 /**
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000055 * GL_APPLE_framebuffer_multisample ES extension
56 */
bsalomon@google.com347c3822013-05-01 20:10:01 +000057 kES_Apple_MSFBOType,
bsalomon@google.comf3a60c02013-03-19 19:06:09 +000058 /**
bsalomon@google.com347c3822013-05-01 20:10:01 +000059 * GL_IMG_multisampled_render_to_texture. This variation does not have MSAA renderbuffers.
60 * Instead the texture is multisampled when bound to the FBO and then resolved automatically
61 * when read. It also defines an alternate value for GL_MAX_SAMPLES (which we call
62 * GR_GL_MAX_SAMPLES_IMG).
bsalomon@google.comf3a60c02013-03-19 19:06:09 +000063 */
bsalomon@google.com347c3822013-05-01 20:10:01 +000064 kES_IMG_MsToTexture_MSFBOType,
65 /**
66 * GL_EXT_multisampled_render_to_texture. Same as the IMG one above but uses the standard
67 * GL_MAX_SAMPLES value.
68 */
69 kES_EXT_MsToTexture_MSFBOType,
bsalomon@google.com6b0cf022013-05-03 13:35:14 +000070
skia.committer@gmail.comecc9d282013-05-04 07:01:15 +000071 kLast_MSFBOType = kES_EXT_MsToTexture_MSFBOType
bsalomon@google.com6b0cf022013-05-03 13:35:14 +000072 };
73
commit-bot@chromium.org52ffbf62014-04-02 16:19:33 +000074 enum InvalidateFBType {
75 kNone_InvalidateFBType,
76 kDiscard_InvalidateFBType, //<! glDiscardFramebuffer()
77 kInvalidate_InvalidateFBType, //<! glInvalidateFramebuffer()
78
79 kLast_InvalidateFBType = kInvalidate_InvalidateFBType
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000080 };
81
commit-bot@chromium.org160b4782014-05-05 12:32:37 +000082 enum MapBufferType {
83 kNone_MapBufferType,
84 kMapBuffer_MapBufferType, // glMapBuffer()
85 kMapBufferRange_MapBufferType, // glMapBufferRange()
86 kChromium_MapBufferType, // GL_CHROMIUM_map_sub
87
88 kLast_MapBufferType = kChromium_MapBufferType,
89 };
90
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000091 /**
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000092 * Initializes the GrGLCaps to the set of features supported in the current
93 * OpenGL context accessible via ctxInfo.
94 */
bsalomon682c2692015-05-22 14:01:46 -070095 GrGLCaps(const GrContextOptions& contextOptions, const GrGLContextInfo& ctxInfo,
96 const GrGLInterface* glInterface);
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000097
98 /**
99 * Call to note that a color config has been verified as a valid color
100 * attachment. This may save future calls to glCheckFramebufferStatus
101 * using isConfigVerifiedColorAttachment().
102 */
103 void markConfigAsValidColorAttachment(GrPixelConfig config) {
104 fVerifiedColorConfigs.markVerified(config);
105 }
106
107 /**
108 * Call to check whether a config has been verified as a valid color
109 * attachment.
110 */
111 bool isConfigVerifiedColorAttachment(GrPixelConfig config) const {
112 return fVerifiedColorConfigs.isVerified(config);
113 }
114
115 /**
116 * Call to note that a color config / stencil format pair passed
117 * FBO status check. We may skip calling glCheckFramebufferStatus for
118 * this combination in the future using
119 * isColorConfigAndStencilFormatVerified().
120 */
121 void markColorConfigAndStencilFormatAsVerified(
122 GrPixelConfig config,
egdaniel8dc7c3a2015-04-16 11:22:42 -0700123 const GrGLStencilAttachment::Format& format);
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000124
125 /**
126 * Call to check whether color config / stencil format pair has already
127 * passed FBO status check.
128 */
129 bool isColorConfigAndStencilFormatVerified(
130 GrPixelConfig config,
egdaniel8dc7c3a2015-04-16 11:22:42 -0700131 const GrGLStencilAttachment::Format& format) const;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000132
133 /**
134 * Reports the type of MSAA FBO support.
135 */
136 MSFBOType msFBOType() const { return fMSFBOType; }
137
138 /**
bsalomon@google.com347c3822013-05-01 20:10:01 +0000139 * Does the supported MSAA FBO extension have MSAA renderbuffers?
140 */
141 bool usesMSAARenderBuffers() const {
142 return kNone_MSFBOType != fMSFBOType &&
143 kES_IMG_MsToTexture_MSFBOType != fMSFBOType &&
144 kES_EXT_MsToTexture_MSFBOType != fMSFBOType;
145 }
146
147 /**
148 * Is the MSAA FBO extension one where the texture is multisampled when bound to an FBO and
149 * then implicitly resolved when read.
150 */
151 bool usesImplicitMSAAResolve() const {
152 return kES_IMG_MsToTexture_MSFBOType == fMSFBOType ||
153 kES_EXT_MsToTexture_MSFBOType == fMSFBOType;
154 }
155
vbuzinov08b4d292015-04-01 06:29:49 -0700156 bool fbMixedSamplesSupport() const { return fFBMixedSamplesSupport; }
157
commit-bot@chromium.org52ffbf62014-04-02 16:19:33 +0000158 InvalidateFBType invalidateFBType() const { return fInvalidateFBType; }
159
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000160 /// What type of buffer mapping is supported?
161 MapBufferType mapBufferType() const { return fMapBufferType; }
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000162
163 /**
164 * Gets an array of legal stencil formats. These formats are not guaranteed
165 * to be supported by the driver but are legal GLenum names given the GL
166 * version and extensions supported.
167 */
168 const SkTArray<StencilFormat, true>& stencilFormats() const {
169 return fStencilFormats;
170 }
171
172 /// The maximum number of fragment uniform vectors (GLES has min. 16).
173 int maxFragmentUniformVectors() const { return fMaxFragmentUniformVectors; }
174
commit-bot@chromium.orga15f7e52013-06-05 23:29:25 +0000175 /// maximum number of attribute values per vertex
bsalomon@google.com60da4172012-06-01 19:25:00 +0000176 int maxVertexAttributes() const { return fMaxVertexAttributes; }
177
commit-bot@chromium.orga15f7e52013-06-05 23:29:25 +0000178 /// maximum number of texture units accessible in the fragment shader.
179 int maxFragmentTextureUnits() const { return fMaxFragmentTextureUnits; }
180
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000181 /// ES requires an extension to support RGBA8 in RenderBufferStorage
182 bool rgba8RenderbufferSupport() const { return fRGBA8RenderbufferSupport; }
183
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000184 /**
185 * Depending on the ES extensions present the BGRA external format may
186 * correspond either a BGRA or RGBA internalFormat. On desktop GL it is
187 * RGBA.
188 */
189 bool bgraIsInternalFormat() const { return fBGRAIsInternalFormat; }
190
191 /// GL_ARB_texture_swizzle support
192 bool textureSwizzleSupport() const { return fTextureSwizzleSupport; }
193
194 /// Is there support for GL_UNPACK_ROW_LENGTH
195 bool unpackRowLengthSupport() const { return fUnpackRowLengthSupport; }
196
197 /// Is there support for GL_UNPACK_FLIP_Y
198 bool unpackFlipYSupport() const { return fUnpackFlipYSupport; }
199
200 /// Is there support for GL_PACK_ROW_LENGTH
201 bool packRowLengthSupport() const { return fPackRowLengthSupport; }
202
203 /// Is there support for GL_PACK_REVERSE_ROW_ORDER
204 bool packFlipYSupport() const { return fPackFlipYSupport; }
205
206 /// Is there support for texture parameter GL_TEXTURE_USAGE
207 bool textureUsageSupport() const { return fTextureUsageSupport; }
208
209 /// Is there support for glTexStorage
210 bool texStorageSupport() const { return fTexStorageSupport; }
211
robertphillips@google.com443e5a52012-04-30 20:01:21 +0000212 /// Is there support for GL_RED and GL_R8
213 bool textureRedSupport() const { return fTextureRedSupport; }
214
bsalomon@google.come76b7cc2012-06-18 12:47:06 +0000215 /// Is GL_ARB_IMAGING supported
216 bool imagingSupport() const { return fImagingSupport; }
217
bsalomon@google.com706f6682012-10-23 14:53:55 +0000218 /// Is GL_ARB_fragment_coord_conventions supported?
219 bool fragCoordConventionsSupport() const { return fFragCoordsConventionSupport; }
220
bsalomon@google.com07631cf2013-03-05 14:14:58 +0000221 /// Is there support for Vertex Array Objects?
222 bool vertexArrayObjectSupport() const { return fVertexArrayObjectSupport; }
223
jvanverth3f801cb2014-12-16 09:49:38 -0800224 /// Is there support for ES2 compatability?
225 bool ES2CompatibilitySupport() const { return fES2CompatibilitySupport; }
226
cdalton0edea2c2015-05-21 08:27:44 -0700227 /// Can we call glDisable(GL_MULTISAMPLE)?
228 bool multisampleDisableSupport() const { return fMultisampleDisableSupport; }
229
bsalomon@google.com07631cf2013-03-05 14:14:58 +0000230 /// Use indices or vertices in CPU arrays rather than VBOs for dynamic content.
bsalomon@google.com96966a52013-02-21 16:34:21 +0000231 bool useNonVBOVertexAndIndexDynamicData() const {
232 return fUseNonVBOVertexAndIndexDynamicData;
233 }
234
bsalomon@google.com07631cf2013-03-05 14:14:58 +0000235 /// Does ReadPixels support the provided format/type combo?
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000236 bool readPixelsSupported(const GrGLInterface* intf,
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000237 GrGLenum format,
piotaixre4b23142014-10-02 10:57:53 -0700238 GrGLenum type,
239 GrGLenum currFboFormat) const;
skia.committer@gmail.com631cdcb2013-03-01 12:12:55 +0000240
bsalomon@google.com2b1b8c02013-02-28 22:06:02 +0000241 bool isCoreProfile() const { return fIsCoreProfile; }
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000242
commit-bot@chromium.org3628ad92013-08-30 19:43:47 +0000243
robertphillips@google.com56ce48a2013-10-31 21:44:25 +0000244 bool fullClearIsFree() const { return fFullClearIsFree; }
245
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000246 /**
247 * Returns a string containing the caps info.
248 */
mtklein36352bf2015-03-25 18:17:31 -0700249 SkString dump() const override;
commit-bot@chromium.orgbeb8b3a2014-04-15 15:37:51 +0000250
commit-bot@chromium.org6e7ddaa2014-05-30 13:55:58 +0000251 /**
252 * LATC can appear under one of three possible names. In order to know
253 * which GL internal format to use, we need to keep track of which name
254 * we found LATC under. The default is LATC.
255 */
256 enum LATCAlias {
257 kLATC_LATCAlias,
258 kRGTC_LATCAlias,
259 k3DC_LATCAlias
260 };
261
262 LATCAlias latcAlias() const { return fLATCAlias; }
263
jvanverthe9c0fc62015-04-29 11:18:05 -0700264 GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fShaderCaps.get()); }
265
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000266private:
cdalton4cd67132015-06-10 19:23:46 -0700267 void init(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterface*);
bsalomon424cc262015-05-22 10:37:30 -0700268
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000269 /**
270 * Maintains a bit per GrPixelConfig. It is used to avoid redundantly
271 * performing glCheckFrameBufferStatus for the same config.
272 */
273 struct VerifiedColorConfigs {
274 VerifiedColorConfigs() {
275 this->reset();
276 }
277
278 void reset() {
279 for (int i = 0; i < kNumUints; ++i) {
280 fVerifiedColorConfigs[i] = 0;
281 }
282 }
283
bsalomon@google.comb8eb2e82013-03-28 13:46:42 +0000284 static const int kNumUints = (kGrPixelConfigCnt + 31) / 32;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000285 uint32_t fVerifiedColorConfigs[kNumUints];
286
287 void markVerified(GrPixelConfig config) {
288#if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT
289 return;
290#endif
291 int u32Idx = config / 32;
292 int bitIdx = config % 32;
293 fVerifiedColorConfigs[u32Idx] |= 1 << bitIdx;
294 }
295
296 bool isVerified(GrPixelConfig config) const {
297#if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT
298 return false;
299#endif
300 int u32Idx = config / 32;
301 int bitIdx = config % 32;
302 return SkToBool(fVerifiedColorConfigs[u32Idx] & (1 << bitIdx));
303 }
304 };
305
commit-bot@chromium.org73880512013-10-14 15:33:45 +0000306 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*);
307 void initStencilFormats(const GrGLContextInfo&);
commit-bot@chromium.org6b7938f2013-10-15 14:18:16 +0000308 // This must be called after initFSAASupport().
commit-bot@chromium.org73880512013-10-14 15:33:45 +0000309 void initConfigRenderableTable(const GrGLContextInfo&);
commit-bot@chromium.org6e7ddaa2014-05-30 13:55:58 +0000310 void initConfigTexturableTable(const GrGLContextInfo&, const GrGLInterface*);
commit-bot@chromium.org42dc8132014-05-27 19:26:59 +0000311
bsalomon17168df2014-12-09 09:00:49 -0800312 bool doReadPixelsSupported(const GrGLInterface* intf, GrGLenum format, GrGLenum type) const;
piotaixre4b23142014-10-02 10:57:53 -0700313
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000314 // tracks configs that have been verified to pass the FBO completeness when
315 // used as a color attachment
316 VerifiedColorConfigs fVerifiedColorConfigs;
317
318 SkTArray<StencilFormat, true> fStencilFormats;
319 // tracks configs that have been verified to pass the FBO completeness when
320 // used as a color attachment when a particular stencil format is used
321 // as a stencil attachment.
322 SkTArray<VerifiedColorConfigs, true> fStencilVerifiedColorConfigs;
323
324 int fMaxFragmentUniformVectors;
bsalomon@google.com60da4172012-06-01 19:25:00 +0000325 int fMaxVertexAttributes;
commit-bot@chromium.orga15f7e52013-06-05 23:29:25 +0000326 int fMaxFragmentTextureUnits;
bsalomon@google.com60da4172012-06-01 19:25:00 +0000327
commit-bot@chromium.org52ffbf62014-04-02 16:19:33 +0000328 MSFBOType fMSFBOType;
commit-bot@chromium.org52ffbf62014-04-02 16:19:33 +0000329 InvalidateFBType fInvalidateFBType;
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000330 MapBufferType fMapBufferType;
commit-bot@chromium.org6e7ddaa2014-05-30 13:55:58 +0000331 LATCAlias fLATCAlias;
bsalomon@google.com6b0cf022013-05-03 13:35:14 +0000332
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000333 bool fRGBA8RenderbufferSupport : 1;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000334 bool fBGRAIsInternalFormat : 1;
335 bool fTextureSwizzleSupport : 1;
336 bool fUnpackRowLengthSupport : 1;
337 bool fUnpackFlipYSupport : 1;
338 bool fPackRowLengthSupport : 1;
339 bool fPackFlipYSupport : 1;
340 bool fTextureUsageSupport : 1;
341 bool fTexStorageSupport : 1;
robertphillips@google.com443e5a52012-04-30 20:01:21 +0000342 bool fTextureRedSupport : 1;
bsalomon@google.come76b7cc2012-06-18 12:47:06 +0000343 bool fImagingSupport : 1;
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000344 bool fTwoFormatLimit : 1;
bsalomon@google.com706f6682012-10-23 14:53:55 +0000345 bool fFragCoordsConventionSupport : 1;
bsalomon@google.com07631cf2013-03-05 14:14:58 +0000346 bool fVertexArrayObjectSupport : 1;
jvanverth3f801cb2014-12-16 09:49:38 -0800347 bool fES2CompatibilitySupport : 1;
cdalton0edea2c2015-05-21 08:27:44 -0700348 bool fMultisampleDisableSupport : 1;
bsalomon@google.com96966a52013-02-21 16:34:21 +0000349 bool fUseNonVBOVertexAndIndexDynamicData : 1;
bsalomon@google.com2b1b8c02013-02-28 22:06:02 +0000350 bool fIsCoreProfile : 1;
robertphillips@google.com56ce48a2013-10-31 21:44:25 +0000351 bool fFullClearIsFree : 1;
vbuzinov08b4d292015-04-01 06:29:49 -0700352 bool fFBMixedSamplesSupport : 1;
joshualitt58162332014-08-01 06:44:53 -0700353
mtklein2aa1f7e2015-02-20 12:35:32 -0800354 struct ReadPixelsSupportedFormat {
355 GrGLenum fFormat;
356 GrGLenum fType;
357 GrGLenum fFboFormat;
piotaixre4b23142014-10-02 10:57:53 -0700358
mtklein2aa1f7e2015-02-20 12:35:32 -0800359 bool operator==(const ReadPixelsSupportedFormat& rhs) const {
360 return fFormat == rhs.fFormat
361 && fType == rhs.fType
362 && fFboFormat == rhs.fFboFormat;
piotaixre4b23142014-10-02 10:57:53 -0700363 }
piotaixre4b23142014-10-02 10:57:53 -0700364 };
mtklein02f46cf2015-03-20 13:48:42 -0700365 mutable SkTHashMap<ReadPixelsSupportedFormat, bool> fReadPixelsSupportedCache;
piotaixre4b23142014-10-02 10:57:53 -0700366
bsalomon4b91f762015-05-19 09:29:46 -0700367 typedef GrCaps INHERITED;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000368};
369
jvanverthe9c0fc62015-04-29 11:18:05 -0700370class GrGLSLCaps : public GrShaderCaps {
371public:
372 SK_DECLARE_INST_COUNT(GrGLSLCaps)
373
374 /**
cdalton8917d622015-05-06 13:40:21 -0700375 * Indicates how GLSL must interact with advanced blend equations. The KHR extension requires
376 * special layout qualifiers in the fragment shader.
377 */
378 enum AdvBlendEqInteraction {
379 kNotSupported_AdvBlendEqInteraction, //<! No _blend_equation_advanced extension
380 kAutomatic_AdvBlendEqInteraction, //<! No interaction required
381 kGeneralEnable_AdvBlendEqInteraction, //<! layout(blend_support_all_equations) out
382 kSpecificEnables_AdvBlendEqInteraction, //<! Specific layout qualifiers per equation
383
384 kLast_AdvBlendEqInteraction = kSpecificEnables_AdvBlendEqInteraction
385 };
386
387 /**
jvanverthe9c0fc62015-04-29 11:18:05 -0700388 * Initializes the GrGLSLCaps to the set of features supported in the current
389 * OpenGL context accessible via ctxInfo.
390 */
bsalomon4ee6bd82015-05-27 13:23:23 -0700391 GrGLSLCaps(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterface*,
392 const GrGLCaps&);
jvanverthe9c0fc62015-04-29 11:18:05 -0700393
394 /**
395 * Some helper functions for encapsulating various extensions to read FB Buffer on openglES
396 *
397 * TODO(joshualitt) On desktop opengl 4.2+ we can achieve something similar to this effect
398 */
399 bool fbFetchSupport() const { return fFBFetchSupport; }
400
401 bool fbFetchNeedsCustomOutput() const { return fFBFetchNeedsCustomOutput; }
402
403 const char* fbFetchColorName() const { return fFBFetchColorName; }
404
405 const char* fbFetchExtensionString() const { return fFBFetchExtensionString; }
406
407 bool dropsTileOnZeroDivide() const { return fDropsTileOnZeroDivide; }
408
cdalton8917d622015-05-06 13:40:21 -0700409 AdvBlendEqInteraction advBlendEqInteraction() const { return fAdvBlendEqInteraction; }
410
411 bool mustEnableAdvBlendEqs() const {
412 return fAdvBlendEqInteraction >= kGeneralEnable_AdvBlendEqInteraction;
413 }
414
415 bool mustEnableSpecificAdvBlendEqs() const {
416 return fAdvBlendEqInteraction == kSpecificEnables_AdvBlendEqInteraction;
417 }
bsalomon6df86402015-06-01 10:41:49 -0700418
419 bool mustDeclareFragmentShaderOutput() const {
420 return fGLSLGeneration > k110_GrGLSLGeneration;
421 }
422
423 GrGLSLGeneration generation() const { return fGLSLGeneration; }
cdalton8917d622015-05-06 13:40:21 -0700424
jvanverthe9c0fc62015-04-29 11:18:05 -0700425 /**
426 * Returns a string containing the caps info.
427 */
428 SkString dump() const override;
429
430private:
431 // Must be called after fGeometryShaderSupport is initialized.
432 void initShaderPrecisionTable(const GrGLContextInfo&, const GrGLInterface*);
433
bsalomon6df86402015-06-01 10:41:49 -0700434 GrGLSLGeneration fGLSLGeneration;
435
jvanverthe9c0fc62015-04-29 11:18:05 -0700436 bool fDropsTileOnZeroDivide : 1;
437 bool fFBFetchSupport : 1;
438 bool fFBFetchNeedsCustomOutput : 1;
439
440 const char* fFBFetchColorName;
441 const char* fFBFetchExtensionString;
442
cdalton8917d622015-05-06 13:40:21 -0700443 AdvBlendEqInteraction fAdvBlendEqInteraction;
444
cdalton4cd67132015-06-10 19:23:46 -0700445 friend class GrGLCaps; // For initialization.
446
jvanverthe9c0fc62015-04-29 11:18:05 -0700447 typedef GrShaderCaps INHERITED;
448};
449
jvanverthcfc18862015-04-28 08:48:20 -0700450
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000451#endif