| 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" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 fDualSourceBlendingSupport = ctxInfo.version() >= GR_GL_VER(3,3) || | 277 fDualSourceBlendingSupport = ctxInfo.version() >= GR_GL_VER(3,3) || |
| 278 ctxInfo.hasExtension("GL_ARB_blend_func_ext
ended"); | 278 ctxInfo.hasExtension("GL_ARB_blend_func_ext
ended"); |
| 279 fShaderDerivativeSupport = true; | 279 fShaderDerivativeSupport = true; |
| 280 // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS | 280 // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS |
| 281 fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3,2) && | 281 fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3,2) && |
| 282 ctxInfo.glslGeneration() >= k150_GrGLSLGenerati
on; | 282 ctxInfo.glslGeneration() >= k150_GrGLSLGenerati
on; |
| 283 } else { | 283 } else { |
| 284 fShaderDerivativeSupport = ctxInfo.hasExtension("GL_OES_standard_derivat
ives"); | 284 fShaderDerivativeSupport = ctxInfo.hasExtension("GL_OES_standard_derivat
ives"); |
| 285 } | 285 } |
| 286 | 286 |
| 287 if (GrGLCaps::kImaginationES_MSFBOType == fMSFBOType) { | 287 if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) { |
| 288 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxSampleCount); | 288 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxSampleCount); |
| 289 } else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) { | 289 } else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) { |
| 290 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount); | 290 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount); |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 | 293 |
| 294 bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, | 294 bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, |
| 295 GrGLenum format, | 295 GrGLenum format, |
| 296 GrGLenum type) const { | 296 GrGLenum type) const { |
| 297 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { | 297 if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 | 338 |
| 339 void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa
ce* gli) { | 339 void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa
ce* gli) { |
| 340 | 340 |
| 341 fMSFBOType = kNone_MSFBOType; | 341 fMSFBOType = kNone_MSFBOType; |
| 342 if (kDesktop_GrGLBinding != ctxInfo.binding()) { | 342 if (kDesktop_GrGLBinding != ctxInfo.binding()) { |
| 343 if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) { | 343 if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) { |
| 344 // chrome's extension is equivalent to the EXT msaa | 344 // chrome's extension is equivalent to the EXT msaa |
| 345 // and fbo_blit extensions. | 345 // and fbo_blit extensions. |
| 346 fMSFBOType = kDesktopEXT_MSFBOType; | 346 fMSFBOType = kDesktop_EXT_MSFBOType; |
| 347 } else if (ctxInfo.hasExtension("GL_APPLE_framebuffer_multisample")) { | 347 } else if (ctxInfo.hasExtension("GL_APPLE_framebuffer_multisample")) { |
| 348 fMSFBOType = kAppleES_MSFBOType; | 348 fMSFBOType = kES_Apple_MSFBOType; |
| 349 } else if (ctxInfo.hasExtension("GL_EXT_multisampled_render_to_texture"))
{ |
| 350 fMSFBOType = kES_EXT_MsToTexture_MSFBOType; |
| 349 } else if (ctxInfo.hasExtension("GL_IMG_multisampled_render_to_texture"))
{ | 351 } else if (ctxInfo.hasExtension("GL_IMG_multisampled_render_to_texture"))
{ |
| 350 fMSFBOType = kImaginationES_MSFBOType; | 352 fMSFBOType = kES_IMG_MsToTexture_MSFBOType; |
| 351 } | 353 } |
| 352 } else { | 354 } else { |
| 353 if ((ctxInfo.version() >= GR_GL_VER(3,0)) || | 355 if ((ctxInfo.version() >= GR_GL_VER(3,0)) || |
| 354 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { | 356 ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { |
| 355 fMSFBOType = GrGLCaps::kDesktopARB_MSFBOType; | 357 fMSFBOType = GrGLCaps::kDesktop_ARB_MSFBOType; |
| 356 } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") && | 358 } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") && |
| 357 ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) { | 359 ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) { |
| 358 fMSFBOType = GrGLCaps::kDesktopEXT_MSFBOType; | 360 fMSFBOType = GrGLCaps::kDesktop_EXT_MSFBOType; |
| 359 } | 361 } |
| 360 // TODO: We could populate fMSAACoverageModes using GetInternalformativ | 362 // TODO: We could populate fMSAACoverageModes using GetInternalformativ |
| 361 // on GL 4.2+. It's format-specific, though. See also | 363 // on GL 4.2+. It's format-specific, though. See also |
| 362 // http://code.google.com/p/skia/issues/detail?id=470 about using actual | 364 // http://code.google.com/p/skia/issues/detail?id=470 about using actual |
| 363 // rather than requested sample counts in cache key. | 365 // rather than requested sample counts in cache key. |
| 364 if (ctxInfo.hasExtension("GL_NV_framebuffer_multisample_coverage")) { | 366 if (ctxInfo.hasExtension("GL_NV_framebuffer_multisample_coverage")) { |
| 365 fCoverageAAType = kNVDesktop_CoverageAAType; | 367 fCoverageAAType = kNVDesktop_CoverageAAType; |
| 366 GrGLint count; | 368 GrGLint count; |
| 367 GR_GL_GetIntegerv(gli, | 369 GR_GL_GetIntegerv(gli, |
| 368 GR_GL_MAX_MULTISAMPLE_COVERAGE_MODES, | 370 GR_GL_MAX_MULTISAMPLE_COVERAGE_MODES, |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 513 |
| 512 GrPrintf("--- GL-Specific ---\n"); | 514 GrPrintf("--- GL-Specific ---\n"); |
| 513 for (int i = 0; i < fStencilFormats.count(); ++i) { | 515 for (int i = 0; i < fStencilFormats.count(); ++i) { |
| 514 GrPrintf("Stencil Format %d, stencil bits: %02d, total bits: %02d\n", | 516 GrPrintf("Stencil Format %d, stencil bits: %02d, total bits: %02d\n", |
| 515 i, | 517 i, |
| 516 fStencilFormats[i].fStencilBits, | 518 fStencilFormats[i].fStencilBits, |
| 517 fStencilFormats[i].fTotalBits); | 519 fStencilFormats[i].fTotalBits); |
| 518 } | 520 } |
| 519 | 521 |
| 520 GR_STATIC_ASSERT(0 == kNone_MSFBOType); | 522 GR_STATIC_ASSERT(0 == kNone_MSFBOType); |
| 521 GR_STATIC_ASSERT(1 == kDesktopARB_MSFBOType); | 523 GR_STATIC_ASSERT(1 == kDesktop_ARB_MSFBOType); |
| 522 GR_STATIC_ASSERT(2 == kDesktopEXT_MSFBOType); | 524 GR_STATIC_ASSERT(2 == kDesktop_EXT_MSFBOType); |
| 523 GR_STATIC_ASSERT(3 == kAppleES_MSFBOType); | 525 GR_STATIC_ASSERT(3 == kES_Apple_MSFBOType); |
| 524 GR_STATIC_ASSERT(4 == kImaginationES_MSFBOType); | 526 GR_STATIC_ASSERT(4 == kES_IMG_MsToTexture_MSFBOType); |
| 527 GR_STATIC_ASSERT(5 == kES_EXT_MsToTexture_MSFBOType); |
| 525 static const char* gMSFBOExtStr[] = { | 528 static const char* gMSFBOExtStr[] = { |
| 526 "None", | 529 "None", |
| 527 "ARB", | 530 "ARB", |
| 528 "EXT", | 531 "EXT", |
| 529 "Apple", | 532 "Apple", |
| 530 "IMG", | 533 "IMG MS To Texture", |
| 534 "EXT MS To Texture", |
| 531 }; | 535 }; |
| 532 GrPrintf("MSAA Type: %s\n", gMSFBOExtStr[fMSFBOType]); | 536 GrPrintf("MSAA Type: %s\n", gMSFBOExtStr[fMSFBOType]); |
| 533 GrPrintf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors); | 537 GrPrintf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors); |
| 534 GrPrintf("Max Vertex Attributes: %d\n", fMaxVertexAttributes); | 538 GrPrintf("Max Vertex Attributes: %d\n", fMaxVertexAttributes); |
| 535 GrPrintf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "
YES": "NO")); | 539 GrPrintf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "
YES": "NO")); |
| 536 GrPrintf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO")); | 540 GrPrintf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO")); |
| 537 GrPrintf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES":
"NO")); | 541 GrPrintf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES":
"NO")); |
| 538 GrPrintf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES": "
NO")); | 542 GrPrintf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES": "
NO")); |
| 539 GrPrintf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES"
: "NO")); | 543 GrPrintf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES"
: "NO")); |
| 540 GrPrintf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO"))
; | 544 GrPrintf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO"))
; |
| 541 GrPrintf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "N
O")); | 545 GrPrintf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "N
O")); |
| 542 GrPrintf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); | 546 GrPrintf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); |
| 543 | 547 |
| 544 GrPrintf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO")
); | 548 GrPrintf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO")
); |
| 545 GrPrintf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO")
); | 549 GrPrintf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO")
); |
| 546 GrPrintf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); | 550 GrPrintf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); |
| 547 GrPrintf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); | 551 GrPrintf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); |
| 548 GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); | 552 GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); |
| 549 GrPrintf("Fragment coord conventions support: %s\n", | 553 GrPrintf("Fragment coord conventions support: %s\n", |
| 550 (fFragCoordsConventionSupport ? "YES": "NO")); | 554 (fFragCoordsConventionSupport ? "YES": "NO")); |
| 551 GrPrintf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "
YES": "NO")); | 555 GrPrintf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "
YES": "NO")); |
| 552 GrPrintf("Use non-VBO for dynamic data: %s\n", | 556 GrPrintf("Use non-VBO for dynamic data: %s\n", |
| 553 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); | 557 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); |
| 554 GrPrintf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO")); | 558 GrPrintf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO")); |
| 555 GrPrintf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" : "
NO")); | 559 GrPrintf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" : "
NO")); |
| 556 } | 560 } |
| OLD | NEW |