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