Chromium Code Reviews| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 ctxInfo.hasExtension("GL_ANGLE_texture_usage"); | 105 ctxInfo.hasExtension("GL_ANGLE_texture_usage"); |
| 106 | 106 |
| 107 if (kGL_GrGLStandard == standard) { | 107 if (kGL_GrGLStandard == standard) { |
| 108 // The EXT version can apply to either GL or GLES. | 108 // The EXT version can apply to either GL or GLES. |
| 109 fTexStorageSupport = version >= GR_GL_VER(4,2) || | 109 fTexStorageSupport = version >= GR_GL_VER(4,2) || |
| 110 ctxInfo.hasExtension("GL_ARB_texture_storage") || | 110 ctxInfo.hasExtension("GL_ARB_texture_storage") || |
| 111 ctxInfo.hasExtension("GL_EXT_texture_storage"); | 111 ctxInfo.hasExtension("GL_EXT_texture_storage"); |
| 112 } else { | 112 } else { |
| 113 // Qualcomm Adreno drivers appear to have issues with texture storage. | 113 // Qualcomm Adreno drivers appear to have issues with texture storage. |
| 114 fTexStorageSupport = (version >= GR_GL_VER(3,0) && | 114 fTexStorageSupport = (version >= GR_GL_VER(3,0) && |
| 115 kQualcomm_GrGLVendor != ctxInfo.vendor()) || | 115 kQualcomm_GrGLVendor != ctxInfo.vendor() && |
| 116 // TODO: remove after command buffer supports full ES 3.0 | |
| 117 kChromium_GrGLDriver != ctxInfo.driver()) || | |
|
bsalomon
2016/02/12 14:03:27
Could we consolidate all the workarounds for an in
Kimmo Kinnunen
2016/02/15 08:10:14
Done.
| |
| 116 ctxInfo.hasExtension("GL_EXT_texture_storage"); | 118 ctxInfo.hasExtension("GL_EXT_texture_storage"); |
| 117 } | 119 } |
| 118 | 120 |
| 119 if (kGL_GrGLStandard == standard) { | 121 if (kGL_GrGLStandard == standard) { |
| 120 fTextureBarrierSupport = version >= GR_GL_VER(4,5) || | 122 fTextureBarrierSupport = version >= GR_GL_VER(4,5) || |
| 121 ctxInfo.hasExtension("GL_ARB_texture_barrier") || | 123 ctxInfo.hasExtension("GL_ARB_texture_barrier") || |
| 122 ctxInfo.hasExtension("GL_NV_texture_barrier"); | 124 ctxInfo.hasExtension("GL_NV_texture_barrier"); |
| 123 } else { | 125 } else { |
| 124 fTextureBarrierSupport = ctxInfo.hasExtension("GL_NV_texture_barrier"); | 126 fTextureBarrierSupport = ctxInfo.hasExtension("GL_NV_texture_barrier"); |
| 125 } | 127 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 // but it should not be used. Also, at the time of writing command buffe r | 241 // but it should not be used. Also, at the time of writing command buffe r |
| 240 // lacks TexImage2D support and ANGLE lacks GL ES 3.0 support. | 242 // lacks TexImage2D support and ANGLE lacks GL ES 3.0 support. |
| 241 } | 243 } |
| 242 | 244 |
| 243 if (kGL_GrGLStandard == standard) { | 245 if (kGL_GrGLStandard == standard) { |
| 244 if (version >= GR_GL_VER(3,3) || ctxInfo.hasExtension("GL_ARB_texture_sw izzle")) { | 246 if (version >= GR_GL_VER(3,3) || ctxInfo.hasExtension("GL_ARB_texture_sw izzle")) { |
| 245 fTextureSwizzleSupport = true; | 247 fTextureSwizzleSupport = true; |
| 246 } | 248 } |
| 247 } else { | 249 } else { |
| 248 if (version >= GR_GL_VER(3,0)) { | 250 if (version >= GR_GL_VER(3,0)) { |
| 249 fTextureSwizzleSupport = true; | 251 // TODO: swizzle is not implemented yet in Command Buffer ES 3.0. |
| 252 fTextureSwizzleSupport = kChromium_GrGLDriver != ctxInfo.driver(); | |
| 250 } | 253 } |
| 251 } | 254 } |
| 252 | 255 |
| 253 #ifdef SK_BUILD_FOR_WIN | 256 #ifdef SK_BUILD_FOR_WIN |
| 254 // We're assuming that on Windows Chromium we're using ANGLE. | 257 // We're assuming that on Windows Chromium we're using ANGLE. |
| 255 bool isANGLE = kANGLE_GrGLDriver == ctxInfo.driver() || | 258 bool isANGLE = kANGLE_GrGLDriver == ctxInfo.driver() || |
| 256 kChromium_GrGLDriver == ctxInfo.driver(); | 259 kChromium_GrGLDriver == ctxInfo.driver(); |
| 257 // Angle has slow read/write pixel paths for 32bit RGBA (but fast for BGRA). | 260 // Angle has slow read/write pixel paths for 32bit RGBA (but fast for BGRA). |
| 258 fRGBA8888PixelsOpsAreSlow = isANGLE; | 261 fRGBA8888PixelsOpsAreSlow = isANGLE; |
| 259 // On DX9 ANGLE reading a partial FBO is slow. TODO: Check whether this is s till true and | 262 // On DX9 ANGLE reading a partial FBO is slow. TODO: Check whether this is s till true and |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 354 fMapBufferType = kMapBufferRange_MapBufferType; | 357 fMapBufferType = kMapBufferRange_MapBufferType; |
| 355 } else { | 358 } else { |
| 356 fMapBufferType = kMapBuffer_MapBufferType; | 359 fMapBufferType = kMapBuffer_MapBufferType; |
| 357 } | 360 } |
| 358 } else { | 361 } else { |
| 359 // Unextended GLES2 doesn't have any buffer mapping. | 362 // Unextended GLES2 doesn't have any buffer mapping. |
| 360 fMapBufferFlags = kNone_MapBufferType; | 363 fMapBufferFlags = kNone_MapBufferType; |
| 361 if (ctxInfo.hasExtension("GL_CHROMIUM_map_sub")) { | 364 if (ctxInfo.hasExtension("GL_CHROMIUM_map_sub")) { |
| 362 fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; | 365 fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; |
| 363 fMapBufferType = kChromium_MapBufferType; | 366 fMapBufferType = kChromium_MapBufferType; |
| 364 } else if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_EXT_ma p_buffer_range")) { | 367 } else if ((version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_EXT_m ap_buffer_range")) |
| 368 && kChromium_GrGLDriver != ctxInfo.driver()) { | |
| 365 fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; | 369 fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; |
| 366 fMapBufferType = kMapBufferRange_MapBufferType; | 370 fMapBufferType = kMapBufferRange_MapBufferType; |
| 367 } else if (ctxInfo.hasExtension("GL_OES_mapbuffer")) { | 371 } else if (ctxInfo.hasExtension("GL_OES_mapbuffer")) { |
| 368 fMapBufferFlags = kCanMap_MapFlag; | 372 fMapBufferFlags = kCanMap_MapFlag; |
| 369 fMapBufferType = kMapBuffer_MapBufferType; | 373 fMapBufferType = kMapBuffer_MapBufferType; |
| 370 } | 374 } |
| 371 } | 375 } |
| 372 | 376 |
| 373 if (kGL_GrGLStandard == standard) { | 377 if (kGL_GrGLStandard == standard) { |
| 374 if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_ARB_pixel_buf fer_object")) { | 378 if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_ARB_pixel_buf fer_object")) { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 483 | 487 |
| 484 if (kGL_GrGLStandard == standard) { | 488 if (kGL_GrGLStandard == standard) { |
| 485 // 3.1 has draw_instanced but not instanced_arrays, for the time being w e only care about | 489 // 3.1 has draw_instanced but not instanced_arrays, for the time being w e only care about |
| 486 // instanced arrays, but we could make this more granular if we wanted | 490 // instanced arrays, but we could make this more granular if we wanted |
| 487 fSupportsInstancedDraws = | 491 fSupportsInstancedDraws = |
| 488 version >= GR_GL_VER(3, 2) || | 492 version >= GR_GL_VER(3, 2) || |
| 489 (ctxInfo.hasExtension("GL_ARB_draw_instanced") && | 493 (ctxInfo.hasExtension("GL_ARB_draw_instanced") && |
| 490 ctxInfo.hasExtension("GL_ARB_instanced_arrays")); | 494 ctxInfo.hasExtension("GL_ARB_instanced_arrays")); |
| 491 } else { | 495 } else { |
| 492 fSupportsInstancedDraws = | 496 fSupportsInstancedDraws = |
| 493 version >= GR_GL_VER(3, 0) || | 497 (version >= GR_GL_VER(3, 0) || |
| 494 (ctxInfo.hasExtension("GL_EXT_draw_instanced") && | 498 (ctxInfo.hasExtension("GL_EXT_draw_instanced") && |
| 495 ctxInfo.hasExtension("GL_EXT_instanced_arrays")); | 499 ctxInfo.hasExtension("GL_EXT_instanced_arrays"))) && |
| 500 // TODO: remove once command buffer implements full ES3. | |
| 501 kChromium_GrGLDriver != ctxInfo.driver(); | |
| 496 } | 502 } |
| 497 | 503 |
| 498 if (kGL_GrGLStandard == standard) { | 504 if (kGL_GrGLStandard == standard) { |
| 499 // We don't use ARB_draw_indirect because it does not support a base ins tance. | 505 // We don't use ARB_draw_indirect because it does not support a base ins tance. |
| 500 // We don't use ARB_multi_draw_indirect because it does not support GL_D RAW_INDIRECT_BUFFER. | 506 // We don't use ARB_multi_draw_indirect because it does not support GL_D RAW_INDIRECT_BUFFER. |
| 501 fDrawIndirectSupport = | 507 fDrawIndirectSupport = |
| 502 fMultiDrawIndirectSupport = fBaseInstanceSupport = version >= GR_GL_ VER(4,3); | 508 fMultiDrawIndirectSupport = fBaseInstanceSupport = version >= GR_GL_ VER(4,3); |
| 503 } else { | 509 } else { |
| 504 fDrawIndirectSupport = version >= GR_GL_VER(3,1); | 510 fDrawIndirectSupport = version >= GR_GL_VER(3,1); |
| 505 fMultiDrawIndirectSupport = ctxInfo.hasExtension("GL_EXT_multi_draw_indi rect"); | 511 fMultiDrawIndirectSupport = ctxInfo.hasExtension("GL_EXT_multi_draw_indi rect"); |
| (...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1669 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { | 1675 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { |
| 1670 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != | 1676 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != |
| 1671 fConfigTable[i].fFormats.fExternalFormat[j]); | 1677 fConfigTable[i].fFormats.fExternalFormat[j]); |
| 1672 } | 1678 } |
| 1673 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats .fExternalType); | 1679 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats .fExternalType); |
| 1674 } | 1680 } |
| 1675 #endif | 1681 #endif |
| 1676 } | 1682 } |
| 1677 | 1683 |
| 1678 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} | 1684 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} |
| OLD | NEW |