blob: 04c2c3c72012f13b105ad2e188699249337d7031 [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#include "GrGLCaps.h"
robertphillips@google.com6177e692013-02-28 20:16:25 +000010#include "GrGLContext.h"
bsalomon@google.comc9668ec2012-04-11 18:16:41 +000011#include "SkTSearch.h"
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000012
13GrGLCaps::GrGLCaps() {
14 this->reset();
15}
16
17void GrGLCaps::reset() {
18 fVerifiedColorConfigs.reset();
19 fStencilFormats.reset();
20 fStencilVerifiedColorConfigs.reset();
21 fMSFBOType = kNone_MSFBOType;
bsalomon@google.comc9668ec2012-04-11 18:16:41 +000022 fCoverageAAType = kNone_CoverageAAType;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000023 fMaxFragmentUniformVectors = 0;
bsalomon@google.com60da4172012-06-01 19:25:00 +000024 fMaxVertexAttributes = 0;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000025 fRGBA8RenderbufferSupport = false;
26 fBGRAFormatSupport = false;
27 fBGRAIsInternalFormat = false;
28 fTextureSwizzleSupport = false;
29 fUnpackRowLengthSupport = false;
30 fUnpackFlipYSupport = false;
31 fPackRowLengthSupport = false;
32 fPackFlipYSupport = false;
33 fTextureUsageSupport = false;
34 fTexStorageSupport = false;
robertphillips@google.com443e5a52012-04-30 20:01:21 +000035 fTextureRedSupport = false;
bsalomon@google.come76b7cc2012-06-18 12:47:06 +000036 fImagingSupport = false;
robertphillips@google.com1d89c932012-06-27 19:31:41 +000037 fTwoFormatLimit = false;
bsalomon@google.com706f6682012-10-23 14:53:55 +000038 fFragCoordsConventionSupport = false;
bsalomon@google.com07631cf2013-03-05 14:14:58 +000039 fVertexArrayObjectSupport = false;
bsalomon@google.com96966a52013-02-21 16:34:21 +000040 fUseNonVBOVertexAndIndexDynamicData = false;
bsalomon@google.com2b1b8c02013-02-28 22:06:02 +000041 fIsCoreProfile = false;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000042}
43
44GrGLCaps::GrGLCaps(const GrGLCaps& caps) {
45 *this = caps;
46}
47
48GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) {
49 fVerifiedColorConfigs = caps.fVerifiedColorConfigs;
50 fStencilFormats = caps.fStencilFormats;
51 fStencilVerifiedColorConfigs = caps.fStencilVerifiedColorConfigs;
52 fMaxFragmentUniformVectors = caps.fMaxFragmentUniformVectors;
bsalomon@google.com60da4172012-06-01 19:25:00 +000053 fMaxVertexAttributes = caps.fMaxVertexAttributes;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000054 fMSFBOType = caps.fMSFBOType;
bsalomon@google.comc9668ec2012-04-11 18:16:41 +000055 fCoverageAAType = caps.fCoverageAAType;
56 fMSAACoverageModes = caps.fMSAACoverageModes;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000057 fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport;
58 fBGRAFormatSupport = caps.fBGRAFormatSupport;
59 fBGRAIsInternalFormat = caps.fBGRAIsInternalFormat;
60 fTextureSwizzleSupport = caps.fTextureSwizzleSupport;
61 fUnpackRowLengthSupport = caps.fUnpackRowLengthSupport;
62 fUnpackFlipYSupport = caps.fUnpackFlipYSupport;
63 fPackRowLengthSupport = caps.fPackRowLengthSupport;
64 fPackFlipYSupport = caps.fPackFlipYSupport;
65 fTextureUsageSupport = caps.fTextureUsageSupport;
66 fTexStorageSupport = caps.fTexStorageSupport;
robertphillips@google.com443e5a52012-04-30 20:01:21 +000067 fTextureRedSupport = caps.fTextureRedSupport;
bsalomon@google.come76b7cc2012-06-18 12:47:06 +000068 fImagingSupport = caps.fImagingSupport;
robertphillips@google.com1d89c932012-06-27 19:31:41 +000069 fTwoFormatLimit = caps.fTwoFormatLimit;
bsalomon@google.com706f6682012-10-23 14:53:55 +000070 fFragCoordsConventionSupport = caps.fFragCoordsConventionSupport;
bsalomon@google.com07631cf2013-03-05 14:14:58 +000071 fVertexArrayObjectSupport = caps.fVertexArrayObjectSupport;
bsalomon@google.com96966a52013-02-21 16:34:21 +000072 fUseNonVBOVertexAndIndexDynamicData = caps.fUseNonVBOVertexAndIndexDynamicData;
bsalomon@google.com2b1b8c02013-02-28 22:06:02 +000073 fIsCoreProfile = caps.fIsCoreProfile;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000074
75 return *this;
76}
77
robertphillips@google.com6177e692013-02-28 20:16:25 +000078void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000079
80 this->reset();
81 if (!ctxInfo.isInitialized()) {
82 return;
83 }
84
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000085 GrGLBinding binding = ctxInfo.binding();
86 GrGLVersion version = ctxInfo.version();
87
88 if (kES2_GrGLBinding == binding) {
89 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_VECTORS,
90 &fMaxFragmentUniformVectors);
91 } else {
92 GrAssert(kDesktop_GrGLBinding == binding);
93 GrGLint max;
94 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max);
95 fMaxFragmentUniformVectors = max / 4;
96 }
bsalomon@google.com60da4172012-06-01 19:25:00 +000097 GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_ATTRIBS, &fMaxVertexAttributes);
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000098
99 if (kDesktop_GrGLBinding == binding) {
100 fRGBA8RenderbufferSupport = true;
101 } else {
102 fRGBA8RenderbufferSupport = ctxInfo.hasExtension("GL_OES_rgb8_rgba8") ||
103 ctxInfo.hasExtension("GL_ARM_rgba8");
104 }
105
106 if (kDesktop_GrGLBinding == binding) {
107 fBGRAFormatSupport = version >= GR_GL_VER(1,2) ||
108 ctxInfo.hasExtension("GL_EXT_bgra");
109 } else {
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000110 if (ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888")) {
111 fBGRAFormatSupport = true;
112 } else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) {
113 fBGRAFormatSupport = true;
114 fBGRAIsInternalFormat = true;
115 }
116 GrAssert(fBGRAFormatSupport ||
bsalomon@google.com0342a852012-08-20 19:22:38 +0000117 kSkia8888_GrPixelConfig != kBGRA_8888_GrPixelConfig);
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000118 }
119
120 if (kDesktop_GrGLBinding == binding) {
121 fTextureSwizzleSupport = version >= GR_GL_VER(3,3) ||
122 ctxInfo.hasExtension("GL_ARB_texture_swizzle");
123 } else {
124 fTextureSwizzleSupport = false;
125 }
126
127 if (kDesktop_GrGLBinding == binding) {
128 fUnpackRowLengthSupport = true;
129 fUnpackFlipYSupport = false;
130 fPackRowLengthSupport = true;
131 fPackFlipYSupport = false;
132 } else {
133 fUnpackRowLengthSupport =ctxInfo.hasExtension("GL_EXT_unpack_subimage");
134 fUnpackFlipYSupport = ctxInfo.hasExtension("GL_CHROMIUM_flipy");
135 // no extension for pack row length
136 fPackRowLengthSupport = false;
137 fPackFlipYSupport =
138 ctxInfo.hasExtension("GL_ANGLE_pack_reverse_row_order");
139 }
140
141 fTextureUsageSupport = (kES2_GrGLBinding == binding) &&
142 ctxInfo.hasExtension("GL_ANGLE_texture_usage");
143
144 // Tex storage is in desktop 4.2 and can be an extension to desktop or ES.
145 fTexStorageSupport = (kDesktop_GrGLBinding == binding &&
146 version >= GR_GL_VER(4,2)) ||
147 ctxInfo.hasExtension("GL_ARB_texture_storage") ||
148 ctxInfo.hasExtension("GL_EXT_texture_storage");
149
robertphillips@google.com443e5a52012-04-30 20:01:21 +0000150 // ARB_texture_rg is part of OpenGL 3.0
151 if (kDesktop_GrGLBinding == binding) {
152 fTextureRedSupport = version >= GR_GL_VER(3,0) ||
153 ctxInfo.hasExtension("GL_ARB_texture_rg");
154 } else {
155 fTextureRedSupport = ctxInfo.hasExtension("GL_EXT_texture_rg");
156 }
157
bsalomon@google.come76b7cc2012-06-18 12:47:06 +0000158 fImagingSupport = kDesktop_GrGLBinding == binding &&
159 ctxInfo.hasExtension("GL_ARB_imaging");
160
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000161 // ES 2 only guarantees RGBA/uchar + one other format/type combo for
162 // ReadPixels. The other format has to checked at run-time since it
163 // can change based on which render target is bound
164 fTwoFormatLimit = kES2_GrGLBinding == binding;
165
bsalomon@google.com706f6682012-10-23 14:53:55 +0000166 // Known issue on at least some Intel platforms:
167 // http://code.google.com/p/skia/issues/detail?id=946
168 if (kIntel_GrGLVendor != ctxInfo.vendor()) {
169 fFragCoordsConventionSupport = ctxInfo.glslGeneration() >= k150_GrGLSLGeneration ||
170 ctxInfo.hasExtension("GL_ARB_fragment_coord_conventions");
171 }
172
bsalomon@google.com3012ded2013-02-22 16:44:04 +0000173 // SGX and Mali GPUs that are based on a tiled-deferred architecture that have trouble with
174 // frequently changing VBOs. We've measured a performance increase using non-VBO vertex
175 // data for dynamic content on these GPUs. Perhaps we should read the renderer string and
176 // limit this decision to specific GPU families rather than basing it on the vendor alone.
177 if (!GR_GL_MUST_USE_VBO &&
178 (kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxInfo.vendor())) {
bsalomon@google.com96966a52013-02-21 16:34:21 +0000179 fUseNonVBOVertexAndIndexDynamicData = true;
180 }
skia.committer@gmail.com631cdcb2013-03-01 12:12:55 +0000181
bsalomon@google.com2b1b8c02013-02-28 22:06:02 +0000182 if (kDesktop_GrGLBinding == binding && version >= GR_GL_VER(3, 2)) {
183 GrGLint profileMask;
184 GR_GL_GetIntegerv(gli, GR_GL_CONTEXT_PROFILE_MASK, &profileMask);
185 fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_BIT);
186 }
bsalomon@google.com96966a52013-02-21 16:34:21 +0000187
bsalomon@google.com07631cf2013-03-05 14:14:58 +0000188 if (kDesktop_GrGLBinding == binding) {
189 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) ||
190 ctxInfo.hasExtension("GL_ARB_vertex_array_object");
191 } else {
192 fVertexArrayObjectSupport = ctxInfo.hasExtension("GL_OES_vertex_array_object");
193 }
194
robertphillips@google.com6177e692013-02-28 20:16:25 +0000195 this->initFSAASupport(ctxInfo, gli);
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000196 this->initStencilFormats(ctxInfo);
197}
198
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000199bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf,
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000200 GrGLenum format,
201 GrGLenum type) const {
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000202 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) {
203 // ES 2 guarantees this format is supported
robertphillips@google.comeca2dfb2012-06-27 20:13:49 +0000204 return true;
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000205 }
206
207 if (!fTwoFormatLimit) {
208 // not limited by ES 2's constraints
209 return true;
210 }
211
bsalomon@google.com548a4332012-07-11 19:45:22 +0000212 GrGLint otherFormat = GR_GL_RGBA;
213 GrGLint otherType = GR_GL_UNSIGNED_BYTE;
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000214
215 // The other supported format/type combo supported for ReadPixels
216 // can change based on which render target is bound
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000217 GR_GL_GetIntegerv(intf,
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000218 GR_GL_IMPLEMENTATION_COLOR_READ_FORMAT,
219 &otherFormat);
220
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000221 GR_GL_GetIntegerv(intf,
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000222 GR_GL_IMPLEMENTATION_COLOR_READ_TYPE,
223 &otherType);
224
bsalomon@google.com548a4332012-07-11 19:45:22 +0000225 return (GrGLenum)otherFormat == format && (GrGLenum)otherType == type;
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000226}
227
bsalomon@google.comc9668ec2012-04-11 18:16:41 +0000228namespace {
229int coverage_mode_compare(const GrGLCaps::MSAACoverageMode* left,
230 const GrGLCaps::MSAACoverageMode* right) {
231 if (left->fCoverageSampleCnt < right->fCoverageSampleCnt) {
232 return -1;
233 } else if (right->fCoverageSampleCnt < left->fCoverageSampleCnt) {
234 return 1;
235 } else if (left->fColorSampleCnt < right->fColorSampleCnt) {
236 return -1;
237 } else if (right->fColorSampleCnt < left->fColorSampleCnt) {
238 return 1;
239 }
240 return 0;
241}
242}
243
robertphillips@google.com6177e692013-02-28 20:16:25 +0000244void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000245
246 fMSFBOType = kNone_MSFBOType;
247 if (kDesktop_GrGLBinding != ctxInfo.binding()) {
248 if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) {
249 // chrome's extension is equivalent to the EXT msaa
250 // and fbo_blit extensions.
251 fMSFBOType = kDesktopEXT_MSFBOType;
252 } else if (ctxInfo.hasExtension("GL_APPLE_framebuffer_multisample")) {
bsalomon@google.comc9668ec2012-04-11 18:16:41 +0000253 fMSFBOType = kAppleES_MSFBOType;
254 }
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000255 } else {
256 if ((ctxInfo.version() >= GR_GL_VER(3,0)) ||
257 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) {
258 fMSFBOType = GrGLCaps::kDesktopARB_MSFBOType;
259 } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") &&
260 ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) {
261 fMSFBOType = GrGLCaps::kDesktopEXT_MSFBOType;
262 }
bsalomon@google.comc9668ec2012-04-11 18:16:41 +0000263 // TODO: We could populate fMSAACoverageModes using GetInternalformativ
264 // on GL 4.2+. It's format-specific, though. See also
265 // http://code.google.com/p/skia/issues/detail?id=470 about using actual
266 // rather than requested sample counts in cache key.
267 if (ctxInfo.hasExtension("GL_NV_framebuffer_multisample_coverage")) {
268 fCoverageAAType = kNVDesktop_CoverageAAType;
269 GrGLint count;
robertphillips@google.com6177e692013-02-28 20:16:25 +0000270 GR_GL_GetIntegerv(gli,
bsalomon@google.comc9668ec2012-04-11 18:16:41 +0000271 GR_GL_MAX_MULTISAMPLE_COVERAGE_MODES,
272 &count);
273 fMSAACoverageModes.setCount(count);
robertphillips@google.com6177e692013-02-28 20:16:25 +0000274 GR_GL_GetIntegerv(gli,
bsalomon@google.comc9668ec2012-04-11 18:16:41 +0000275 GR_GL_MULTISAMPLE_COVERAGE_MODES,
276 (int*)&fMSAACoverageModes[0]);
277 // The NV driver seems to return the modes already sorted but the
278 // spec doesn't require this. So we sort.
reed@google.comc7a67cb2012-05-07 14:52:12 +0000279 qsort(&fMSAACoverageModes[0],
bsalomon@google.comc9668ec2012-04-11 18:16:41 +0000280 count,
281 sizeof(MSAACoverageMode),
reed@google.comc7a67cb2012-05-07 14:52:12 +0000282 SkCastForQSort(coverage_mode_compare));
bsalomon@google.comc9668ec2012-04-11 18:16:41 +0000283 }
284 }
285}
286
bsalomon@google.com8a70eef2013-03-19 13:58:55 +0000287const GrGLCaps::MSAACoverageMode& GrGLCaps::getMSAACoverageMode(int desiredSampleCount) const {
bsalomon@google.comc9668ec2012-04-11 18:16:41 +0000288 static const MSAACoverageMode kNoneMode = {0, 0};
289 if (0 == fMSAACoverageModes.count()) {
290 return kNoneMode;
291 } else {
292 GrAssert(kNone_CoverageAAType != fCoverageAAType);
293 int max = (fMSAACoverageModes.end() - 1)->fCoverageSampleCnt;
294 desiredSampleCount = GrMin(desiredSampleCount, max);
295 MSAACoverageMode desiredMode = {desiredSampleCount, 0};
296 int idx = SkTSearch<MSAACoverageMode>(&fMSAACoverageModes[0],
297 fMSAACoverageModes.count(),
298 desiredMode,
299 sizeof(MSAACoverageMode),
300 &coverage_mode_compare);
301 if (idx < 0) {
302 idx = ~idx;
303 }
304 GrAssert(idx >= 0 && idx < fMSAACoverageModes.count());
305 return fMSAACoverageModes[idx];
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000306 }
307}
308
309namespace {
310const GrGLuint kUnknownBitCount = GrGLStencilBuffer::kUnknownBitCount;
311}
312
313void GrGLCaps::initStencilFormats(const GrGLContextInfo& ctxInfo) {
314
315 // Build up list of legal stencil formats (though perhaps not supported on
316 // the particular gpu/driver) from most preferred to least.
317
318 // these consts are in order of most preferred to least preferred
319 // we don't bother with GL_STENCIL_INDEX1 or GL_DEPTH32F_STENCIL8
320
321 static const StencilFormat
322 // internal Format stencil bits total bits packed?
323 gS8 = {GR_GL_STENCIL_INDEX8, 8, 8, false},
324 gS16 = {GR_GL_STENCIL_INDEX16, 16, 16, false},
325 gD24S8 = {GR_GL_DEPTH24_STENCIL8, 8, 32, true },
326 gS4 = {GR_GL_STENCIL_INDEX4, 4, 4, false},
caryclark@google.comcf6285b2012-06-06 12:09:01 +0000327 // gS = {GR_GL_STENCIL_INDEX, kUnknownBitCount, kUnknownBitCount, false},
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000328 gDS = {GR_GL_DEPTH_STENCIL, kUnknownBitCount, kUnknownBitCount, true };
329
330 if (kDesktop_GrGLBinding == ctxInfo.binding()) {
331 bool supportsPackedDS =
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000332 ctxInfo.version() >= GR_GL_VER(3,0) ||
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000333 ctxInfo.hasExtension("GL_EXT_packed_depth_stencil") ||
334 ctxInfo.hasExtension("GL_ARB_framebuffer_object");
335
336 // S1 thru S16 formats are in GL 3.0+, EXT_FBO, and ARB_FBO since we
337 // require FBO support we can expect these are legal formats and don't
338 // check. These also all support the unsized GL_STENCIL_INDEX.
339 fStencilFormats.push_back() = gS8;
340 fStencilFormats.push_back() = gS16;
341 if (supportsPackedDS) {
342 fStencilFormats.push_back() = gD24S8;
343 }
344 fStencilFormats.push_back() = gS4;
345 if (supportsPackedDS) {
346 fStencilFormats.push_back() = gDS;
347 }
348 } else {
349 // ES2 has STENCIL_INDEX8 without extensions but requires extensions
350 // for other formats.
351 // ES doesn't support using the unsized format.
352
353 fStencilFormats.push_back() = gS8;
354 //fStencilFormats.push_back() = gS16;
355 if (ctxInfo.hasExtension("GL_OES_packed_depth_stencil")) {
356 fStencilFormats.push_back() = gD24S8;
357 }
358 if (ctxInfo.hasExtension("GL_OES_stencil4")) {
359 fStencilFormats.push_back() = gS4;
360 }
361 }
362 GrAssert(0 == fStencilVerifiedColorConfigs.count());
363 fStencilVerifiedColorConfigs.push_back_n(fStencilFormats.count());
364}
365
366void GrGLCaps::markColorConfigAndStencilFormatAsVerified(
367 GrPixelConfig config,
368 const GrGLStencilBuffer::Format& format) {
369#if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT
370 return;
371#endif
372 GrAssert((unsigned)config < kGrPixelConfigCount);
373 GrAssert(fStencilFormats.count() == fStencilVerifiedColorConfigs.count());
374 int count = fStencilFormats.count();
375 // we expect a really small number of possible formats so linear search
376 // should be OK
377 GrAssert(count < 16);
378 for (int i = 0; i < count; ++i) {
379 if (format.fInternalFormat ==
380 fStencilFormats[i].fInternalFormat) {
381 fStencilVerifiedColorConfigs[i].markVerified(config);
382 return;
383 }
384 }
385 GrCrash("Why are we seeing a stencil format that "
386 "GrGLCaps doesn't know about.");
387}
388
389bool GrGLCaps::isColorConfigAndStencilFormatVerified(
390 GrPixelConfig config,
391 const GrGLStencilBuffer::Format& format) const {
392#if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT
393 return false;
394#endif
395 GrAssert((unsigned)config < kGrPixelConfigCount);
396 int count = fStencilFormats.count();
397 // we expect a really small number of possible formats so linear search
398 // should be OK
399 GrAssert(count < 16);
400 for (int i = 0; i < count; ++i) {
401 if (format.fInternalFormat ==
402 fStencilFormats[i].fInternalFormat) {
403 return fStencilVerifiedColorConfigs[i].isVerified(config);
404 }
405 }
406 GrCrash("Why are we seeing a stencil format that "
407 "GLCaps doesn't know about.");
408 return false;
409}
410
411void GrGLCaps::print() const {
412 for (int i = 0; i < fStencilFormats.count(); ++i) {
413 GrPrintf("Stencil Format %d, stencil bits: %02d, total bits: %02d\n",
414 i,
415 fStencilFormats[i].fStencilBits,
416 fStencilFormats[i].fTotalBits);
417 }
418
419 GR_STATIC_ASSERT(0 == kNone_MSFBOType);
420 GR_STATIC_ASSERT(1 == kDesktopARB_MSFBOType);
421 GR_STATIC_ASSERT(2 == kDesktopEXT_MSFBOType);
422 GR_STATIC_ASSERT(3 == kAppleES_MSFBOType);
423 static const char* gMSFBOExtStr[] = {
424 "None",
425 "ARB",
426 "EXT",
427 "Apple",
428 };
429 GrPrintf("MSAA Type: %s\n", gMSFBOExtStr[fMSFBOType]);
430 GrPrintf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors);
431 GrPrintf("Support RGBA8 Render Buffer: %s\n",
432 (fRGBA8RenderbufferSupport ? "YES": "NO"));
433 GrPrintf("BGRA is an internal format: %s\n",
434 (fBGRAIsInternalFormat ? "YES": "NO"));
435 GrPrintf("Support texture swizzle: %s\n",
436 (fTextureSwizzleSupport ? "YES": "NO"));
437 GrPrintf("Unpack Row length support: %s\n",
438 (fUnpackRowLengthSupport ? "YES": "NO"));
439 GrPrintf("Unpack Flip Y support: %s\n",
440 (fUnpackFlipYSupport ? "YES": "NO"));
441 GrPrintf("Pack Row length support: %s\n",
442 (fPackRowLengthSupport ? "YES": "NO"));
443 GrPrintf("Pack Flip Y support: %s\n",
444 (fPackFlipYSupport ? "YES": "NO"));
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000445 GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO"));
bsalomon@google.com706f6682012-10-23 14:53:55 +0000446 GrPrintf("Fragment coord conventions support: %s\n", (fFragCoordsConventionSupport ? "YES": "NO"));
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000447}