blob: 9058b35deaed3600ff9c87cde5ef71e31a3c3af1 [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.comf6b070d2012-04-27 14:25:44 +000022 fMaxSampleCount = 0;
bsalomon@google.comc9668ec2012-04-11 18:16:41 +000023 fCoverageAAType = kNone_CoverageAAType;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000024 fMaxFragmentUniformVectors = 0;
bsalomon@google.com60da4172012-06-01 19:25:00 +000025 fMaxVertexAttributes = 0;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000026 fRGBA8RenderbufferSupport = false;
27 fBGRAFormatSupport = false;
28 fBGRAIsInternalFormat = false;
29 fTextureSwizzleSupport = false;
30 fUnpackRowLengthSupport = false;
31 fUnpackFlipYSupport = false;
32 fPackRowLengthSupport = false;
33 fPackFlipYSupport = false;
34 fTextureUsageSupport = false;
35 fTexStorageSupport = false;
robertphillips@google.com443e5a52012-04-30 20:01:21 +000036 fTextureRedSupport = false;
bsalomon@google.come76b7cc2012-06-18 12:47:06 +000037 fImagingSupport = false;
robertphillips@google.com1d89c932012-06-27 19:31:41 +000038 fTwoFormatLimit = false;
bsalomon@google.com706f6682012-10-23 14:53:55 +000039 fFragCoordsConventionSupport = 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.comf6b070d2012-04-27 14:25:44 +000055 fMaxSampleCount = caps.fMaxSampleCount;
bsalomon@google.comc9668ec2012-04-11 18:16:41 +000056 fCoverageAAType = caps.fCoverageAAType;
57 fMSAACoverageModes = caps.fMSAACoverageModes;
bsalomon@google.comf7fa8062012-02-14 14:09:57 +000058 fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport;
59 fBGRAFormatSupport = caps.fBGRAFormatSupport;
60 fBGRAIsInternalFormat = caps.fBGRAIsInternalFormat;
61 fTextureSwizzleSupport = caps.fTextureSwizzleSupport;
62 fUnpackRowLengthSupport = caps.fUnpackRowLengthSupport;
63 fUnpackFlipYSupport = caps.fUnpackFlipYSupport;
64 fPackRowLengthSupport = caps.fPackRowLengthSupport;
65 fPackFlipYSupport = caps.fPackFlipYSupport;
66 fTextureUsageSupport = caps.fTextureUsageSupport;
67 fTexStorageSupport = caps.fTexStorageSupport;
robertphillips@google.com443e5a52012-04-30 20:01:21 +000068 fTextureRedSupport = caps.fTextureRedSupport;
bsalomon@google.come76b7cc2012-06-18 12:47:06 +000069 fImagingSupport = caps.fImagingSupport;
robertphillips@google.com1d89c932012-06-27 19:31:41 +000070 fTwoFormatLimit = caps.fTwoFormatLimit;
bsalomon@google.com706f6682012-10-23 14:53:55 +000071 fFragCoordsConventionSupport = caps.fFragCoordsConventionSupport;
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 }
bsalomon@google.com2b1b8c02013-02-28 22:06:02 +0000181
182 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
robertphillips@google.com6177e692013-02-28 20:16:25 +0000188 this->initFSAASupport(ctxInfo, gli);
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000189 this->initStencilFormats(ctxInfo);
190}
191
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000192bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf,
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000193 GrGLenum format,
194 GrGLenum type) const {
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000195 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) {
196 // ES 2 guarantees this format is supported
robertphillips@google.comeca2dfb2012-06-27 20:13:49 +0000197 return true;
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000198 }
199
200 if (!fTwoFormatLimit) {
201 // not limited by ES 2's constraints
202 return true;
203 }
204
bsalomon@google.com548a4332012-07-11 19:45:22 +0000205 GrGLint otherFormat = GR_GL_RGBA;
206 GrGLint otherType = GR_GL_UNSIGNED_BYTE;
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000207
208 // The other supported format/type combo supported for ReadPixels
209 // can change based on which render target is bound
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000210 GR_GL_GetIntegerv(intf,
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000211 GR_GL_IMPLEMENTATION_COLOR_READ_FORMAT,
212 &otherFormat);
213
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000214 GR_GL_GetIntegerv(intf,
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000215 GR_GL_IMPLEMENTATION_COLOR_READ_TYPE,
216 &otherType);
217
bsalomon@google.com548a4332012-07-11 19:45:22 +0000218 return (GrGLenum)otherFormat == format && (GrGLenum)otherType == type;
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000219}
220
bsalomon@google.comc9668ec2012-04-11 18:16:41 +0000221namespace {
222int coverage_mode_compare(const GrGLCaps::MSAACoverageMode* left,
223 const GrGLCaps::MSAACoverageMode* right) {
224 if (left->fCoverageSampleCnt < right->fCoverageSampleCnt) {
225 return -1;
226 } else if (right->fCoverageSampleCnt < left->fCoverageSampleCnt) {
227 return 1;
228 } else if (left->fColorSampleCnt < right->fColorSampleCnt) {
229 return -1;
230 } else if (right->fColorSampleCnt < left->fColorSampleCnt) {
231 return 1;
232 }
233 return 0;
234}
235}
236
robertphillips@google.com6177e692013-02-28 20:16:25 +0000237void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000238
239 fMSFBOType = kNone_MSFBOType;
240 if (kDesktop_GrGLBinding != ctxInfo.binding()) {
241 if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) {
242 // chrome's extension is equivalent to the EXT msaa
243 // and fbo_blit extensions.
244 fMSFBOType = kDesktopEXT_MSFBOType;
245 } else if (ctxInfo.hasExtension("GL_APPLE_framebuffer_multisample")) {
bsalomon@google.comc9668ec2012-04-11 18:16:41 +0000246 fMSFBOType = kAppleES_MSFBOType;
247 }
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000248 } else {
249 if ((ctxInfo.version() >= GR_GL_VER(3,0)) ||
250 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) {
251 fMSFBOType = GrGLCaps::kDesktopARB_MSFBOType;
252 } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") &&
253 ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) {
254 fMSFBOType = GrGLCaps::kDesktopEXT_MSFBOType;
255 }
bsalomon@google.comc9668ec2012-04-11 18:16:41 +0000256 // TODO: We could populate fMSAACoverageModes using GetInternalformativ
257 // on GL 4.2+. It's format-specific, though. See also
258 // http://code.google.com/p/skia/issues/detail?id=470 about using actual
259 // rather than requested sample counts in cache key.
260 if (ctxInfo.hasExtension("GL_NV_framebuffer_multisample_coverage")) {
261 fCoverageAAType = kNVDesktop_CoverageAAType;
262 GrGLint count;
robertphillips@google.com6177e692013-02-28 20:16:25 +0000263 GR_GL_GetIntegerv(gli,
bsalomon@google.comc9668ec2012-04-11 18:16:41 +0000264 GR_GL_MAX_MULTISAMPLE_COVERAGE_MODES,
265 &count);
266 fMSAACoverageModes.setCount(count);
robertphillips@google.com6177e692013-02-28 20:16:25 +0000267 GR_GL_GetIntegerv(gli,
bsalomon@google.comc9668ec2012-04-11 18:16:41 +0000268 GR_GL_MULTISAMPLE_COVERAGE_MODES,
269 (int*)&fMSAACoverageModes[0]);
270 // The NV driver seems to return the modes already sorted but the
271 // spec doesn't require this. So we sort.
reed@google.comc7a67cb2012-05-07 14:52:12 +0000272 qsort(&fMSAACoverageModes[0],
bsalomon@google.comc9668ec2012-04-11 18:16:41 +0000273 count,
274 sizeof(MSAACoverageMode),
reed@google.comc7a67cb2012-05-07 14:52:12 +0000275 SkCastForQSort(coverage_mode_compare));
bsalomon@google.comc9668ec2012-04-11 18:16:41 +0000276 }
277 }
bsalomon@google.comf6b070d2012-04-27 14:25:44 +0000278 if (kNone_MSFBOType != fMSFBOType) {
robertphillips@google.com6177e692013-02-28 20:16:25 +0000279 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount);
bsalomon@google.comf6b070d2012-04-27 14:25:44 +0000280 }
bsalomon@google.comc9668ec2012-04-11 18:16:41 +0000281}
282
283const GrGLCaps::MSAACoverageMode& GrGLCaps::getMSAACoverageMode(
284 int desiredSampleCount) const {
285 static const MSAACoverageMode kNoneMode = {0, 0};
286 if (0 == fMSAACoverageModes.count()) {
287 return kNoneMode;
288 } else {
289 GrAssert(kNone_CoverageAAType != fCoverageAAType);
290 int max = (fMSAACoverageModes.end() - 1)->fCoverageSampleCnt;
291 desiredSampleCount = GrMin(desiredSampleCount, max);
292 MSAACoverageMode desiredMode = {desiredSampleCount, 0};
293 int idx = SkTSearch<MSAACoverageMode>(&fMSAACoverageModes[0],
294 fMSAACoverageModes.count(),
295 desiredMode,
296 sizeof(MSAACoverageMode),
297 &coverage_mode_compare);
298 if (idx < 0) {
299 idx = ~idx;
300 }
301 GrAssert(idx >= 0 && idx < fMSAACoverageModes.count());
302 return fMSAACoverageModes[idx];
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000303 }
304}
305
306namespace {
307const GrGLuint kUnknownBitCount = GrGLStencilBuffer::kUnknownBitCount;
308}
309
310void GrGLCaps::initStencilFormats(const GrGLContextInfo& ctxInfo) {
311
312 // Build up list of legal stencil formats (though perhaps not supported on
313 // the particular gpu/driver) from most preferred to least.
314
315 // these consts are in order of most preferred to least preferred
316 // we don't bother with GL_STENCIL_INDEX1 or GL_DEPTH32F_STENCIL8
317
318 static const StencilFormat
319 // internal Format stencil bits total bits packed?
320 gS8 = {GR_GL_STENCIL_INDEX8, 8, 8, false},
321 gS16 = {GR_GL_STENCIL_INDEX16, 16, 16, false},
322 gD24S8 = {GR_GL_DEPTH24_STENCIL8, 8, 32, true },
323 gS4 = {GR_GL_STENCIL_INDEX4, 4, 4, false},
caryclark@google.comcf6285b2012-06-06 12:09:01 +0000324 // gS = {GR_GL_STENCIL_INDEX, kUnknownBitCount, kUnknownBitCount, false},
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000325 gDS = {GR_GL_DEPTH_STENCIL, kUnknownBitCount, kUnknownBitCount, true };
326
327 if (kDesktop_GrGLBinding == ctxInfo.binding()) {
328 bool supportsPackedDS =
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000329 ctxInfo.version() >= GR_GL_VER(3,0) ||
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000330 ctxInfo.hasExtension("GL_EXT_packed_depth_stencil") ||
331 ctxInfo.hasExtension("GL_ARB_framebuffer_object");
332
333 // S1 thru S16 formats are in GL 3.0+, EXT_FBO, and ARB_FBO since we
334 // require FBO support we can expect these are legal formats and don't
335 // check. These also all support the unsized GL_STENCIL_INDEX.
336 fStencilFormats.push_back() = gS8;
337 fStencilFormats.push_back() = gS16;
338 if (supportsPackedDS) {
339 fStencilFormats.push_back() = gD24S8;
340 }
341 fStencilFormats.push_back() = gS4;
342 if (supportsPackedDS) {
343 fStencilFormats.push_back() = gDS;
344 }
345 } else {
346 // ES2 has STENCIL_INDEX8 without extensions but requires extensions
347 // for other formats.
348 // ES doesn't support using the unsized format.
349
350 fStencilFormats.push_back() = gS8;
351 //fStencilFormats.push_back() = gS16;
352 if (ctxInfo.hasExtension("GL_OES_packed_depth_stencil")) {
353 fStencilFormats.push_back() = gD24S8;
354 }
355 if (ctxInfo.hasExtension("GL_OES_stencil4")) {
356 fStencilFormats.push_back() = gS4;
357 }
358 }
359 GrAssert(0 == fStencilVerifiedColorConfigs.count());
360 fStencilVerifiedColorConfigs.push_back_n(fStencilFormats.count());
361}
362
363void GrGLCaps::markColorConfigAndStencilFormatAsVerified(
364 GrPixelConfig config,
365 const GrGLStencilBuffer::Format& format) {
366#if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT
367 return;
368#endif
369 GrAssert((unsigned)config < kGrPixelConfigCount);
370 GrAssert(fStencilFormats.count() == fStencilVerifiedColorConfigs.count());
371 int count = fStencilFormats.count();
372 // we expect a really small number of possible formats so linear search
373 // should be OK
374 GrAssert(count < 16);
375 for (int i = 0; i < count; ++i) {
376 if (format.fInternalFormat ==
377 fStencilFormats[i].fInternalFormat) {
378 fStencilVerifiedColorConfigs[i].markVerified(config);
379 return;
380 }
381 }
382 GrCrash("Why are we seeing a stencil format that "
383 "GrGLCaps doesn't know about.");
384}
385
386bool GrGLCaps::isColorConfigAndStencilFormatVerified(
387 GrPixelConfig config,
388 const GrGLStencilBuffer::Format& format) const {
389#if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT
390 return false;
391#endif
392 GrAssert((unsigned)config < kGrPixelConfigCount);
393 int count = fStencilFormats.count();
394 // we expect a really small number of possible formats so linear search
395 // should be OK
396 GrAssert(count < 16);
397 for (int i = 0; i < count; ++i) {
398 if (format.fInternalFormat ==
399 fStencilFormats[i].fInternalFormat) {
400 return fStencilVerifiedColorConfigs[i].isVerified(config);
401 }
402 }
403 GrCrash("Why are we seeing a stencil format that "
404 "GLCaps doesn't know about.");
405 return false;
406}
407
408void GrGLCaps::print() const {
409 for (int i = 0; i < fStencilFormats.count(); ++i) {
410 GrPrintf("Stencil Format %d, stencil bits: %02d, total bits: %02d\n",
411 i,
412 fStencilFormats[i].fStencilBits,
413 fStencilFormats[i].fTotalBits);
414 }
415
416 GR_STATIC_ASSERT(0 == kNone_MSFBOType);
417 GR_STATIC_ASSERT(1 == kDesktopARB_MSFBOType);
418 GR_STATIC_ASSERT(2 == kDesktopEXT_MSFBOType);
419 GR_STATIC_ASSERT(3 == kAppleES_MSFBOType);
420 static const char* gMSFBOExtStr[] = {
421 "None",
422 "ARB",
423 "EXT",
424 "Apple",
425 };
426 GrPrintf("MSAA Type: %s\n", gMSFBOExtStr[fMSFBOType]);
427 GrPrintf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors);
428 GrPrintf("Support RGBA8 Render Buffer: %s\n",
429 (fRGBA8RenderbufferSupport ? "YES": "NO"));
430 GrPrintf("BGRA is an internal format: %s\n",
431 (fBGRAIsInternalFormat ? "YES": "NO"));
432 GrPrintf("Support texture swizzle: %s\n",
433 (fTextureSwizzleSupport ? "YES": "NO"));
434 GrPrintf("Unpack Row length support: %s\n",
435 (fUnpackRowLengthSupport ? "YES": "NO"));
436 GrPrintf("Unpack Flip Y support: %s\n",
437 (fUnpackFlipYSupport ? "YES": "NO"));
438 GrPrintf("Pack Row length support: %s\n",
439 (fPackRowLengthSupport ? "YES": "NO"));
440 GrPrintf("Pack Flip Y support: %s\n",
441 (fPackFlipYSupport ? "YES": "NO"));
robertphillips@google.com1d89c932012-06-27 19:31:41 +0000442 GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO"));
bsalomon@google.com706f6682012-10-23 14:53:55 +0000443 GrPrintf("Fragment coord conventions support: %s\n", (fFragCoordsConventionSupport ? "YES": "NO"));
bsalomon@google.comf7fa8062012-02-14 14:09:57 +0000444}