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 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 fUnpackFlipYSupport = false; | 31 fUnpackFlipYSupport = false; |
32 fPackRowLengthSupport = false; | 32 fPackRowLengthSupport = false; |
33 fPackFlipYSupport = false; | 33 fPackFlipYSupport = false; |
34 fTextureUsageSupport = false; | 34 fTextureUsageSupport = false; |
35 fTextureRedSupport = false; | 35 fTextureRedSupport = false; |
36 fImagingSupport = false; | 36 fImagingSupport = false; |
37 fVertexArrayObjectSupport = false; | 37 fVertexArrayObjectSupport = false; |
38 fDirectStateAccessSupport = false; | 38 fDirectStateAccessSupport = false; |
39 fDebugSupport = false; | 39 fDebugSupport = false; |
40 fES2CompatibilitySupport = false; | 40 fES2CompatibilitySupport = false; |
| 41 fDrawInstancedSupport = false; |
41 fDrawIndirectSupport = false; | 42 fDrawIndirectSupport = false; |
42 fMultiDrawIndirectSupport = false; | 43 fMultiDrawIndirectSupport = false; |
43 fBaseInstanceSupport = false; | 44 fBaseInstanceSupport = false; |
44 fIsCoreProfile = false; | 45 fIsCoreProfile = false; |
45 fBindFragDataLocationSupport = false; | 46 fBindFragDataLocationSupport = false; |
46 fRectangleTextureSupport = false; | 47 fRectangleTextureSupport = false; |
47 fTextureSwizzleSupport = false; | 48 fTextureSwizzleSupport = false; |
48 fRGBA8888PixelsOpsAreSlow = false; | 49 fRGBA8888PixelsOpsAreSlow = false; |
49 fPartialFBOReadIsSlow = false; | 50 fPartialFBOReadIsSlow = false; |
50 fMipMapLevelAndLodControlSupport = false; | 51 fMipMapLevelAndLodControlSupport = false; |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 SkASSERT(ctxInfo.hasExtension("GL_EXT_framebuffer_object")); | 496 SkASSERT(ctxInfo.hasExtension("GL_EXT_framebuffer_object")); |
496 } | 497 } |
497 } else { | 498 } else { |
498 // ES 3.0 supports mixed size FBO attachments, 2.0 does not. | 499 // ES 3.0 supports mixed size FBO attachments, 2.0 does not. |
499 fOversizedStencilSupport = ctxInfo.version() >= GR_GL_VER(3, 0); | 500 fOversizedStencilSupport = ctxInfo.version() >= GR_GL_VER(3, 0); |
500 } | 501 } |
501 | 502 |
502 if (kGL_GrGLStandard == standard) { | 503 if (kGL_GrGLStandard == standard) { |
503 // 3.1 has draw_instanced but not instanced_arrays, for the time being w
e only care about | 504 // 3.1 has draw_instanced but not instanced_arrays, for the time being w
e only care about |
504 // instanced arrays, but we could make this more granular if we wanted | 505 // instanced arrays, but we could make this more granular if we wanted |
505 fSupportsInstancedDraws = | 506 fDrawInstancedSupport = |
506 version >= GR_GL_VER(3, 2) || | 507 version >= GR_GL_VER(3, 2) || |
507 (ctxInfo.hasExtension("GL_ARB_draw_instanced") && | 508 (ctxInfo.hasExtension("GL_ARB_draw_instanced") && |
508 ctxInfo.hasExtension("GL_ARB_instanced_arrays")); | 509 ctxInfo.hasExtension("GL_ARB_instanced_arrays")); |
509 } else { | 510 } else { |
510 fSupportsInstancedDraws = | 511 fDrawInstancedSupport = |
511 version >= GR_GL_VER(3, 0) || | 512 version >= GR_GL_VER(3, 0) || |
512 (ctxInfo.hasExtension("GL_EXT_draw_instanced") && | 513 (ctxInfo.hasExtension("GL_EXT_draw_instanced") && |
513 ctxInfo.hasExtension("GL_EXT_instanced_arrays")); | 514 ctxInfo.hasExtension("GL_EXT_instanced_arrays")); |
514 } | 515 } |
515 | 516 |
516 if (kGL_GrGLStandard == standard) { | 517 if (kGL_GrGLStandard == standard) { |
517 fDrawIndirectSupport = version >= GR_GL_VER(4,0) || | 518 fDrawIndirectSupport = version >= GR_GL_VER(4,0) || |
518 ctxInfo.hasExtension("GL_ARB_draw_indirect"); | 519 ctxInfo.hasExtension("GL_ARB_draw_indirect"); |
519 fBaseInstanceSupport = version >= GR_GL_VER(4,2); | 520 fBaseInstanceSupport = version >= GR_GL_VER(4,2); |
520 fMultiDrawIndirectSupport = version >= GR_GL_VER(4,3) || | 521 fMultiDrawIndirectSupport = version >= GR_GL_VER(4,3) || |
521 (!fBaseInstanceSupport && // The ARB extensi
on has no base inst. | 522 (fDrawIndirectSupport && |
| 523 !fBaseInstanceSupport && // The ARB extensi
on has no base inst. |
522 ctxInfo.hasExtension("GL_ARB_multi_draw_ind
irect")); | 524 ctxInfo.hasExtension("GL_ARB_multi_draw_ind
irect")); |
523 } else { | 525 } else { |
524 fDrawIndirectSupport = version >= GR_GL_VER(3,1); | 526 fDrawIndirectSupport = version >= GR_GL_VER(3,1); |
525 fMultiDrawIndirectSupport = ctxInfo.hasExtension("GL_EXT_multi_draw_indi
rect"); | 527 fMultiDrawIndirectSupport = fDrawIndirectSupport && |
526 fBaseInstanceSupport = ctxInfo.hasExtension("GL_EXT_base_instance"); | 528 ctxInfo.hasExtension("GL_EXT_multi_draw_indi
rect"); |
| 529 fBaseInstanceSupport = fDrawIndirectSupport && |
| 530 ctxInfo.hasExtension("GL_EXT_base_instance"); |
527 } | 531 } |
528 | 532 |
529 this->initShaderPrecisionTable(ctxInfo, gli, glslCaps); | 533 this->initShaderPrecisionTable(ctxInfo, gli, glslCaps); |
530 | 534 |
531 if (contextOptions.fUseShaderSwizzling) { | 535 if (contextOptions.fUseShaderSwizzling) { |
532 fTextureSwizzleSupport = false; | 536 fTextureSwizzleSupport = false; |
533 } | 537 } |
534 | 538 |
535 if (kGL_GrGLStandard == standard) { | 539 if (kGL_GrGLStandard == standard) { |
536 if ((version >= GR_GL_VER(4, 0) || ctxInfo.hasExtension("GL_ARB_sample_s
hading")) && | 540 if ((version >= GR_GL_VER(4, 0) || ctxInfo.hasExtension("GL_ARB_sample_s
hading")) && |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO")
); | 1102 r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO")
); |
1099 r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "
NO")); | 1103 r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "
NO")); |
1100 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); | 1104 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); |
1101 | 1105 |
1102 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO"
)); | 1106 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO"
)); |
1103 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); | 1107 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); |
1104 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); | 1108 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); |
1105 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ?
"YES": "NO")); | 1109 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ?
"YES": "NO")); |
1106 r.appendf("Direct state access support: %s\n", (fDirectStateAccessSupport ?
"YES": "NO")); | 1110 r.appendf("Direct state access support: %s\n", (fDirectStateAccessSupport ?
"YES": "NO")); |
1107 r.appendf("Debug support: %s\n", (fDebugSupport ? "YES": "NO")); | 1111 r.appendf("Debug support: %s\n", (fDebugSupport ? "YES": "NO")); |
| 1112 r.appendf("Draw instanced support: %s\n", (fDrawInstancedSupport ? "YES" : "
NO")); |
1108 r.appendf("Draw indirect support: %s\n", (fDrawIndirectSupport ? "YES" : "NO
")); | 1113 r.appendf("Draw indirect support: %s\n", (fDrawIndirectSupport ? "YES" : "NO
")); |
1109 r.appendf("Multi draw indirect support: %s\n", (fMultiDrawIndirectSupport ?
"YES" : "NO")); | 1114 r.appendf("Multi draw indirect support: %s\n", (fMultiDrawIndirectSupport ?
"YES" : "NO")); |
1110 r.appendf("Base instance support: %s\n", (fBaseInstanceSupport ? "YES" : "NO
")); | 1115 r.appendf("Base instance support: %s\n", (fBaseInstanceSupport ? "YES" : "NO
")); |
1111 r.appendf("RGBA 8888 pixel ops are slow: %s\n", (fRGBA8888PixelsOpsAreSlow ?
"YES" : "NO")); | 1116 r.appendf("RGBA 8888 pixel ops are slow: %s\n", (fRGBA8888PixelsOpsAreSlow ?
"YES" : "NO")); |
1112 r.appendf("Partial FBO read is slow: %s\n", (fPartialFBOReadIsSlow ? "YES" :
"NO")); | 1117 r.appendf("Partial FBO read is slow: %s\n", (fPartialFBOReadIsSlow ? "YES" :
"NO")); |
1113 r.appendf("Bind uniform location support: %s\n", (fBindUniformLocationSuppor
t ? "YES" : "NO")); | 1118 r.appendf("Bind uniform location support: %s\n", (fBindUniformLocationSuppor
t ? "YES" : "NO")); |
1114 r.appendf("Rectangle texture support: %s\n", (fRectangleTextureSupport? "YES
" : "NO")); | 1119 r.appendf("Rectangle texture support: %s\n", (fRectangleTextureSupport? "YES
" : "NO")); |
1115 r.appendf("Texture swizzle support: %s\n", (fTextureSwizzleSupport ? "YES" :
"NO")); | 1120 r.appendf("Texture swizzle support: %s\n", (fTextureSwizzleSupport ? "YES" :
"NO")); |
1116 r.appendf("BGRA to RGBA readback conversions are slow: %s\n", | 1121 r.appendf("BGRA to RGBA readback conversions are slow: %s\n", |
1117 (fRGBAToBGRAReadbackConversionsAreSlow ? "YES" : "NO")); | 1122 (fRGBAToBGRAReadbackConversionsAreSlow ? "YES" : "NO")); |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1929 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { | 1934 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { |
1930 if (options.fEnableInstancedRendering) { | 1935 if (options.fEnableInstancedRendering) { |
1931 fInstancedSupport = gr_instanced::GLInstancedRendering::CheckSupport(*th
is); | 1936 fInstancedSupport = gr_instanced::GLInstancedRendering::CheckSupport(*th
is); |
1932 #ifndef SK_BUILD_FOR_MAC | 1937 #ifndef SK_BUILD_FOR_MAC |
1933 // OS X doesn't seem to write correctly to floating point textures when
using | 1938 // OS X doesn't seem to write correctly to floating point textures when
using |
1934 // glDraw*Indirect, regardless of the underlying GPU. | 1939 // glDraw*Indirect, regardless of the underlying GPU. |
1935 fAvoidInstancedDrawsToFPTargets = true; | 1940 fAvoidInstancedDrawsToFPTargets = true; |
1936 #endif | 1941 #endif |
1937 } | 1942 } |
1938 } | 1943 } |
OLD | NEW |