OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include "GrGLCaps.h" | 9 #include "GrGLCaps.h" |
10 #include "GrGLContext.h" | 10 #include "GrGLContext.h" |
11 #include "SkTSearch.h" | 11 #include "SkTSearch.h" |
12 | 12 |
13 SK_DEFINE_INST_COUNT(GrGLCaps) | 13 SK_DEFINE_INST_COUNT(GrGLCaps) |
14 | 14 |
15 GrGLCaps::GrGLCaps() { | 15 GrGLCaps::GrGLCaps() { |
16 this->reset(); | 16 this->reset(); |
17 } | 17 } |
18 | 18 |
19 void GrGLCaps::reset() { | 19 void GrGLCaps::reset() { |
20 INHERITED::reset(); | 20 INHERITED::reset(); |
21 | 21 |
22 fVerifiedColorConfigs.reset(); | 22 fVerifiedColorConfigs.reset(); |
23 fStencilFormats.reset(); | 23 fStencilFormats.reset(); |
24 fStencilVerifiedColorConfigs.reset(); | 24 fStencilVerifiedColorConfigs.reset(); |
25 fMSFBOType = kNone_MSFBOType; | 25 fMSFBOType = kNone_MSFBOType; |
26 fCoverageAAType = kNone_CoverageAAType; | 26 fCoverageAAType = kNone_CoverageAAType; |
| 27 fFBFetchType = kNone_FBFetchType; |
27 fMaxFragmentUniformVectors = 0; | 28 fMaxFragmentUniformVectors = 0; |
28 fMaxVertexAttributes = 0; | 29 fMaxVertexAttributes = 0; |
29 fRGBA8RenderbufferSupport = false; | 30 fRGBA8RenderbufferSupport = false; |
30 fBGRAFormatSupport = false; | 31 fBGRAFormatSupport = false; |
31 fBGRAIsInternalFormat = false; | 32 fBGRAIsInternalFormat = false; |
32 fTextureSwizzleSupport = false; | 33 fTextureSwizzleSupport = false; |
33 fUnpackRowLengthSupport = false; | 34 fUnpackRowLengthSupport = false; |
34 fUnpackFlipYSupport = false; | 35 fUnpackFlipYSupport = false; |
35 fPackRowLengthSupport = false; | 36 fPackRowLengthSupport = false; |
36 fPackFlipYSupport = false; | 37 fPackFlipYSupport = false; |
(...skipping 16 matching lines...) Expand all Loading... |
53 GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) { | 54 GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) { |
54 INHERITED::operator=(caps); | 55 INHERITED::operator=(caps); |
55 fVerifiedColorConfigs = caps.fVerifiedColorConfigs; | 56 fVerifiedColorConfigs = caps.fVerifiedColorConfigs; |
56 fStencilFormats = caps.fStencilFormats; | 57 fStencilFormats = caps.fStencilFormats; |
57 fStencilVerifiedColorConfigs = caps.fStencilVerifiedColorConfigs; | 58 fStencilVerifiedColorConfigs = caps.fStencilVerifiedColorConfigs; |
58 fMaxFragmentUniformVectors = caps.fMaxFragmentUniformVectors; | 59 fMaxFragmentUniformVectors = caps.fMaxFragmentUniformVectors; |
59 fMaxVertexAttributes = caps.fMaxVertexAttributes; | 60 fMaxVertexAttributes = caps.fMaxVertexAttributes; |
60 fMSFBOType = caps.fMSFBOType; | 61 fMSFBOType = caps.fMSFBOType; |
61 fCoverageAAType = caps.fCoverageAAType; | 62 fCoverageAAType = caps.fCoverageAAType; |
62 fMSAACoverageModes = caps.fMSAACoverageModes; | 63 fMSAACoverageModes = caps.fMSAACoverageModes; |
| 64 fFBFetchType = caps.fFBFetchType; |
63 fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport; | 65 fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport; |
64 fBGRAFormatSupport = caps.fBGRAFormatSupport; | 66 fBGRAFormatSupport = caps.fBGRAFormatSupport; |
65 fBGRAIsInternalFormat = caps.fBGRAIsInternalFormat; | 67 fBGRAIsInternalFormat = caps.fBGRAIsInternalFormat; |
66 fTextureSwizzleSupport = caps.fTextureSwizzleSupport; | 68 fTextureSwizzleSupport = caps.fTextureSwizzleSupport; |
67 fUnpackRowLengthSupport = caps.fUnpackRowLengthSupport; | 69 fUnpackRowLengthSupport = caps.fUnpackRowLengthSupport; |
68 fUnpackFlipYSupport = caps.fUnpackFlipYSupport; | 70 fUnpackFlipYSupport = caps.fUnpackFlipYSupport; |
69 fPackRowLengthSupport = caps.fPackRowLengthSupport; | 71 fPackRowLengthSupport = caps.fPackRowLengthSupport; |
70 fPackFlipYSupport = caps.fPackFlipYSupport; | 72 fPackFlipYSupport = caps.fPackFlipYSupport; |
71 fTextureUsageSupport = caps.fTextureUsageSupport; | 73 fTextureUsageSupport = caps.fTextureUsageSupport; |
72 fTexStorageSupport = caps.fTexStorageSupport; | 74 fTexStorageSupport = caps.fTexStorageSupport; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 200 |
199 fDiscardFBSupport = ctxInfo.hasExtension("GL_EXT_discard_framebuffer"); | 201 fDiscardFBSupport = ctxInfo.hasExtension("GL_EXT_discard_framebuffer"); |
200 | 202 |
201 if (kDesktop_GrGLBinding == binding) { | 203 if (kDesktop_GrGLBinding == binding) { |
202 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || | 204 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || |
203 ctxInfo.hasExtension("GL_ARB_vertex_array_ob
ject"); | 205 ctxInfo.hasExtension("GL_ARB_vertex_array_ob
ject"); |
204 } else { | 206 } else { |
205 fVertexArrayObjectSupport = ctxInfo.hasExtension("GL_OES_vertex_array_ob
ject"); | 207 fVertexArrayObjectSupport = ctxInfo.hasExtension("GL_OES_vertex_array_ob
ject"); |
206 } | 208 } |
207 | 209 |
| 210 if (kES2_GrGLBinding == binding) { |
| 211 if (ctxInfo.hasExtension("GL_EXT_shader_framebuffer_fetch")) { |
| 212 fFBFetchType = kEXT_FBFetchType; |
| 213 } else if (ctxInfo.hasExtension("GL_NV_shader_framebuffer_fetch")) { |
| 214 fFBFetchType = kNV_FBFetchType; |
| 215 } |
| 216 } |
| 217 |
208 this->initFSAASupport(ctxInfo, gli); | 218 this->initFSAASupport(ctxInfo, gli); |
209 this->initStencilFormats(ctxInfo); | 219 this->initStencilFormats(ctxInfo); |
210 | 220 |
211 /************************************************************************** | 221 /************************************************************************** |
212 * GrDrawTargetCaps fields | 222 * GrDrawTargetCaps fields |
213 **************************************************************************/ | 223 **************************************************************************/ |
214 GrGLint maxTextureUnits; | 224 GrGLint maxTextureUnits; |
215 // check FS and fixed-function texture unit limits | 225 // check FS and fixed-function texture unit limits |
216 // we only use textures in the fragment stage currently. | 226 // we only use textures in the fragment stage currently. |
217 // checks are > to make sure we have a spare unit. | 227 // checks are > to make sure we have a spare unit. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 277 |
268 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_SIZE, &fMaxTextureSize); | 278 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_SIZE, &fMaxTextureSize); |
269 GR_GL_GetIntegerv(gli, GR_GL_MAX_RENDERBUFFER_SIZE, &fMaxRenderTargetSize); | 279 GR_GL_GetIntegerv(gli, GR_GL_MAX_RENDERBUFFER_SIZE, &fMaxRenderTargetSize); |
270 // Our render targets are always created with textures as the color | 280 // Our render targets are always created with textures as the color |
271 // attachment, hence this min: | 281 // attachment, hence this min: |
272 fMaxRenderTargetSize = GrMin(fMaxTextureSize, fMaxRenderTargetSize); | 282 fMaxRenderTargetSize = GrMin(fMaxTextureSize, fMaxRenderTargetSize); |
273 | 283 |
274 fPathStencilingSupport = GR_GL_USE_NV_PATH_RENDERING && | 284 fPathStencilingSupport = GR_GL_USE_NV_PATH_RENDERING && |
275 ctxInfo.hasExtension("GL_NV_path_rendering"); | 285 ctxInfo.hasExtension("GL_NV_path_rendering"); |
276 | 286 |
| 287 fDstReadInShaderSupport = kNone_FBFetchType != fFBFetchType; |
| 288 |
277 // Enable supported shader-related caps | 289 // Enable supported shader-related caps |
278 if (kDesktop_GrGLBinding == binding) { | 290 if (kDesktop_GrGLBinding == binding) { |
279 fDualSourceBlendingSupport = ctxInfo.version() >= GR_GL_VER(3,3) || | 291 fDualSourceBlendingSupport = ctxInfo.version() >= GR_GL_VER(3,3) || |
280 ctxInfo.hasExtension("GL_ARB_blend_func_ext
ended"); | 292 ctxInfo.hasExtension("GL_ARB_blend_func_ext
ended"); |
281 fShaderDerivativeSupport = true; | 293 fShaderDerivativeSupport = true; |
282 // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS | 294 // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS |
283 fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3,2) && | 295 fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3,2) && |
284 ctxInfo.glslGeneration() >= k150_GrGLSLGenerati
on; | 296 ctxInfo.glslGeneration() >= k150_GrGLSLGenerati
on; |
285 } else { | 297 } else { |
286 fShaderDerivativeSupport = ctxInfo.hasExtension("GL_OES_standard_derivat
ives"); | 298 fShaderDerivativeSupport = ctxInfo.hasExtension("GL_OES_standard_derivat
ives"); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 INHERITED::print(); | 526 INHERITED::print(); |
515 | 527 |
516 GrPrintf("--- GL-Specific ---\n"); | 528 GrPrintf("--- GL-Specific ---\n"); |
517 for (int i = 0; i < fStencilFormats.count(); ++i) { | 529 for (int i = 0; i < fStencilFormats.count(); ++i) { |
518 GrPrintf("Stencil Format %d, stencil bits: %02d, total bits: %02d\n", | 530 GrPrintf("Stencil Format %d, stencil bits: %02d, total bits: %02d\n", |
519 i, | 531 i, |
520 fStencilFormats[i].fStencilBits, | 532 fStencilFormats[i].fStencilBits, |
521 fStencilFormats[i].fTotalBits); | 533 fStencilFormats[i].fTotalBits); |
522 } | 534 } |
523 | 535 |
524 GR_STATIC_ASSERT(0 == kNone_MSFBOType); | 536 static const char* kMSFBOExtStr[] = { |
525 GR_STATIC_ASSERT(1 == kDesktop_ARB_MSFBOType); | |
526 GR_STATIC_ASSERT(2 == kDesktop_EXT_MSFBOType); | |
527 GR_STATIC_ASSERT(3 == kES_Apple_MSFBOType); | |
528 GR_STATIC_ASSERT(4 == kES_IMG_MsToTexture_MSFBOType); | |
529 GR_STATIC_ASSERT(5 == kES_EXT_MsToTexture_MSFBOType); | |
530 static const char* gMSFBOExtStr[] = { | |
531 "None", | 537 "None", |
532 "ARB", | 538 "ARB", |
533 "EXT", | 539 "EXT", |
534 "Apple", | 540 "Apple", |
535 "IMG MS To Texture", | 541 "IMG MS To Texture", |
536 "EXT MS To Texture", | 542 "EXT MS To Texture", |
537 }; | 543 }; |
538 GrPrintf("MSAA Type: %s\n", gMSFBOExtStr[fMSFBOType]); | 544 GR_STATIC_ASSERT(0 == kNone_MSFBOType); |
| 545 GR_STATIC_ASSERT(1 == kDesktop_ARB_MSFBOType); |
| 546 GR_STATIC_ASSERT(2 == kDesktop_EXT_MSFBOType); |
| 547 GR_STATIC_ASSERT(3 == kES_Apple_MSFBOType); |
| 548 GR_STATIC_ASSERT(4 == kES_IMG_MsToTexture_MSFBOType); |
| 549 GR_STATIC_ASSERT(5 == kES_EXT_MsToTexture_MSFBOType); |
| 550 GR_STATIC_ASSERT(GR_ARRAY_COUNT(kMSFBOExtStr) == kLast_MSFBOType + 1); |
| 551 |
| 552 static const char* kFBFetchTypeStr[] = { |
| 553 "None", |
| 554 "EXT", |
| 555 "NV", |
| 556 }; |
| 557 GR_STATIC_ASSERT(0 == kNone_FBFetchType); |
| 558 GR_STATIC_ASSERT(1 == kEXT_FBFetchType); |
| 559 GR_STATIC_ASSERT(2 == kNV_FBFetchType); |
| 560 GR_STATIC_ASSERT(GR_ARRAY_COUNT(kFBFetchTypeStr) == kLast_FBFetchType + 1); |
| 561 |
| 562 |
| 563 GrPrintf("MSAA Type: %s\n", kMSFBOExtStr[fMSFBOType]); |
| 564 GrPrintf("FB Fetch Type: %s\n", kFBFetchTypeStr[fFBFetchType]); |
539 GrPrintf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors); | 565 GrPrintf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors); |
540 GrPrintf("Max Vertex Attributes: %d\n", fMaxVertexAttributes); | 566 GrPrintf("Max Vertex Attributes: %d\n", fMaxVertexAttributes); |
541 GrPrintf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "
YES": "NO")); | 567 GrPrintf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "
YES": "NO")); |
542 GrPrintf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO")); | 568 GrPrintf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO")); |
543 GrPrintf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES":
"NO")); | 569 GrPrintf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES":
"NO")); |
544 GrPrintf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES": "
NO")); | 570 GrPrintf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES": "
NO")); |
545 GrPrintf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES"
: "NO")); | 571 GrPrintf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES"
: "NO")); |
546 GrPrintf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO"))
; | 572 GrPrintf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO"))
; |
547 GrPrintf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "N
O")); | 573 GrPrintf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "N
O")); |
548 GrPrintf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); | 574 GrPrintf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); |
549 | 575 |
550 GrPrintf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO")
); | 576 GrPrintf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO")
); |
551 GrPrintf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO")
); | 577 GrPrintf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO")
); |
552 GrPrintf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); | 578 GrPrintf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); |
553 GrPrintf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); | 579 GrPrintf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); |
554 GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); | 580 GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); |
555 GrPrintf("Fragment coord conventions support: %s\n", | 581 GrPrintf("Fragment coord conventions support: %s\n", |
556 (fFragCoordsConventionSupport ? "YES": "NO")); | 582 (fFragCoordsConventionSupport ? "YES": "NO")); |
557 GrPrintf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "
YES": "NO")); | 583 GrPrintf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "
YES": "NO")); |
558 GrPrintf("Use non-VBO for dynamic data: %s\n", | 584 GrPrintf("Use non-VBO for dynamic data: %s\n", |
559 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); | 585 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); |
560 GrPrintf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO")); | 586 GrPrintf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO")); |
561 GrPrintf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" : "
NO")); | 587 GrPrintf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" : "
NO")); |
562 } | 588 } |
OLD | NEW |