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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 ctxInfo.hasExtension("GL_ANGLE_texture_usage"); | 107 ctxInfo.hasExtension("GL_ANGLE_texture_usage"); |
108 | 108 |
109 if (kGL_GrGLStandard == standard) { | 109 if (kGL_GrGLStandard == standard) { |
110 // The EXT version can apply to either GL or GLES. | 110 // The EXT version can apply to either GL or GLES. |
111 fTexStorageSupport = version >= GR_GL_VER(4,2) || | 111 fTexStorageSupport = version >= GR_GL_VER(4,2) || |
112 ctxInfo.hasExtension("GL_ARB_texture_storage") || | 112 ctxInfo.hasExtension("GL_ARB_texture_storage") || |
113 ctxInfo.hasExtension("GL_EXT_texture_storage"); | 113 ctxInfo.hasExtension("GL_EXT_texture_storage"); |
114 } else { | 114 } else { |
115 // Qualcomm Adreno drivers appear to have issues with texture storage. | 115 // Qualcomm Adreno drivers appear to have issues with texture storage. |
116 fTexStorageSupport = (version >= GR_GL_VER(3,0) && | 116 fTexStorageSupport = (version >= GR_GL_VER(3,0) && |
117 kQualcomm_GrGLVendor != ctxInfo.vendor()) || | 117 kQualcomm_GrGLVendor != ctxInfo.vendor()) && |
118 ctxInfo.hasExtension("GL_EXT_texture_storage"); | 118 ctxInfo.hasExtension("GL_EXT_texture_storage"); |
119 } | 119 } |
120 | 120 |
121 if (kGL_GrGLStandard == standard) { | 121 if (kGL_GrGLStandard == standard) { |
122 fTextureBarrierSupport = version >= GR_GL_VER(4,5) || | 122 fTextureBarrierSupport = version >= GR_GL_VER(4,5) || |
123 ctxInfo.hasExtension("GL_ARB_texture_barrier")
|| | 123 ctxInfo.hasExtension("GL_ARB_texture_barrier")
|| |
124 ctxInfo.hasExtension("GL_NV_texture_barrier"); | 124 ctxInfo.hasExtension("GL_NV_texture_barrier"); |
125 } else { | 125 } else { |
126 fTextureBarrierSupport = ctxInfo.hasExtension("GL_NV_texture_barrier"); | 126 fTextureBarrierSupport = ctxInfo.hasExtension("GL_NV_texture_barrier"); |
127 } | 127 } |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // extension includes glMapBuffer. | 353 // extension includes glMapBuffer. |
354 if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_ARB_map_buffe
r_range")) { | 354 if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_ARB_map_buffe
r_range")) { |
355 fMapBufferFlags |= kSubset_MapFlag; | 355 fMapBufferFlags |= kSubset_MapFlag; |
356 fMapBufferType = kMapBufferRange_MapBufferType; | 356 fMapBufferType = kMapBufferRange_MapBufferType; |
357 } else { | 357 } else { |
358 fMapBufferType = kMapBuffer_MapBufferType; | 358 fMapBufferType = kMapBuffer_MapBufferType; |
359 } | 359 } |
360 } else { | 360 } else { |
361 // Unextended GLES2 doesn't have any buffer mapping. | 361 // Unextended GLES2 doesn't have any buffer mapping. |
362 fMapBufferFlags = kNone_MapBufferType; | 362 fMapBufferFlags = kNone_MapBufferType; |
363 if (ctxInfo.hasExtension("GL_CHROMIUM_map_sub")) { | 363 if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_EXT_map_buffe
r_range")) { |
| 364 fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; |
| 365 fMapBufferType = kMapBufferRange_MapBufferType; |
| 366 } else if (ctxInfo.hasExtension("GL_CHROMIUM_map_sub")) { |
364 fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; | 367 fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; |
365 fMapBufferType = kChromium_MapBufferType; | 368 fMapBufferType = kChromium_MapBufferType; |
366 } else if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_EXT_ma
p_buffer_range")) { | |
367 fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; | |
368 fMapBufferType = kMapBufferRange_MapBufferType; | |
369 } else if (ctxInfo.hasExtension("GL_OES_mapbuffer")) { | 369 } else if (ctxInfo.hasExtension("GL_OES_mapbuffer")) { |
370 fMapBufferFlags = kCanMap_MapFlag; | 370 fMapBufferFlags = kCanMap_MapFlag; |
371 fMapBufferType = kMapBuffer_MapBufferType; | 371 fMapBufferType = kMapBuffer_MapBufferType; |
372 } | 372 } |
373 } | 373 } |
374 | 374 |
375 if (kGL_GrGLStandard == standard) { | 375 if (kGL_GrGLStandard == standard) { |
376 if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_ARB_pixel_buf
fer_object")) { | 376 if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_ARB_pixel_buf
fer_object")) { |
377 fTransferBufferType = kPBO_TransferBufferType; | 377 fTransferBufferType = kPBO_TransferBufferType; |
378 } | 378 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 fMultiDrawIndirectSupport = ctxInfo.hasExtension("GL_EXT_multi_draw_indi
rect"); | 513 fMultiDrawIndirectSupport = ctxInfo.hasExtension("GL_EXT_multi_draw_indi
rect"); |
514 fBaseInstanceSupport = ctxInfo.hasExtension("GL_EXT_base_instance"); | 514 fBaseInstanceSupport = ctxInfo.hasExtension("GL_EXT_base_instance"); |
515 } | 515 } |
516 | 516 |
517 this->initShaderPrecisionTable(ctxInfo, gli, glslCaps); | 517 this->initShaderPrecisionTable(ctxInfo, gli, glslCaps); |
518 | 518 |
519 if (contextOptions.fUseShaderSwizzling) { | 519 if (contextOptions.fUseShaderSwizzling) { |
520 fTextureSwizzleSupport = false; | 520 fTextureSwizzleSupport = false; |
521 } | 521 } |
522 | 522 |
| 523 // TODO: remove after command buffer supports full ES 3.0. |
| 524 if (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3, 0) && |
| 525 kChromium_GrGLDriver == ctxInfo.driver()) { |
| 526 fTexStorageSupport = false; |
| 527 fSupportsInstancedDraws = false; |
| 528 fTextureSwizzleSupport = false; |
| 529 SkASSERT(ctxInfo.hasExtension("GL_CHROMIUM_map_sub")); |
| 530 fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; |
| 531 fMapBufferType = kChromium_MapBufferType; |
| 532 } |
| 533 |
523 // Requires fTextureRedSupport, fTextureSwizzleSupport, msaa support, ES com
patibility have | 534 // Requires fTextureRedSupport, fTextureSwizzleSupport, msaa support, ES com
patibility have |
524 // already been detected. | 535 // already been detected. |
525 this->initConfigTable(ctxInfo, gli, glslCaps); | 536 this->initConfigTable(ctxInfo, gli, glslCaps); |
526 | 537 |
527 this->applyOptionsOverrides(contextOptions); | 538 this->applyOptionsOverrides(contextOptions); |
528 glslCaps->applyOptionsOverrides(contextOptions); | 539 glslCaps->applyOptionsOverrides(contextOptions); |
529 } | 540 } |
530 | 541 |
531 const char* get_glsl_version_decl_string(GrGLStandard standard, GrGLSLGeneration
generation, | 542 const char* get_glsl_version_decl_string(GrGLStandard standard, GrGLSLGeneration
generation, |
532 bool isCoreProfile) { | 543 bool isCoreProfile) { |
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { | 1745 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { |
1735 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != | 1746 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != |
1736 fConfigTable[i].fFormats.fExternalFormat[j]); | 1747 fConfigTable[i].fFormats.fExternalFormat[j]); |
1737 } | 1748 } |
1738 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats
.fExternalType); | 1749 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats
.fExternalType); |
1739 } | 1750 } |
1740 #endif | 1751 #endif |
1741 } | 1752 } |
1742 | 1753 |
1743 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} | 1754 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} |
OLD | NEW |