| 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 23 matching lines...) Expand all Loading... |
| 34 fTextureRedSupport = false; | 34 fTextureRedSupport = false; |
| 35 fImagingSupport = false; | 35 fImagingSupport = false; |
| 36 fVertexArrayObjectSupport = false; | 36 fVertexArrayObjectSupport = false; |
| 37 fDirectStateAccessSupport = false; | 37 fDirectStateAccessSupport = false; |
| 38 fDebugSupport = false; | 38 fDebugSupport = false; |
| 39 fES2CompatibilitySupport = false; | 39 fES2CompatibilitySupport = false; |
| 40 fDrawIndirectSupport = false; | 40 fDrawIndirectSupport = false; |
| 41 fMultiDrawIndirectSupport = false; | 41 fMultiDrawIndirectSupport = false; |
| 42 fBaseInstanceSupport = false; | 42 fBaseInstanceSupport = false; |
| 43 fCanDrawIndirectToFloat = false; | 43 fCanDrawIndirectToFloat = false; |
| 44 fUseNonVBOVertexAndIndexDynamicData = false; | |
| 45 fIsCoreProfile = false; | 44 fIsCoreProfile = false; |
| 46 fBindFragDataLocationSupport = false; | 45 fBindFragDataLocationSupport = false; |
| 47 fRectangleTextureSupport = false; | 46 fRectangleTextureSupport = false; |
| 48 fTextureSwizzleSupport = false; | 47 fTextureSwizzleSupport = false; |
| 49 fRGBA8888PixelsOpsAreSlow = false; | 48 fRGBA8888PixelsOpsAreSlow = false; |
| 50 fPartialFBOReadIsSlow = false; | 49 fPartialFBOReadIsSlow = false; |
| 51 fMipMapLevelAndLodControlSupport = false; | 50 fMipMapLevelAndLodControlSupport = false; |
| 52 fRGBAToBGRAReadbackConversionsAreSlow = false; | 51 fRGBAToBGRAReadbackConversionsAreSlow = false; |
| 53 fDoManualMipmapping = false; | 52 fDoManualMipmapping = false; |
| 54 | 53 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 fTextureRedSupport = version >= GR_GL_VER(3,0) || | 124 fTextureRedSupport = version >= GR_GL_VER(3,0) || |
| 126 ctxInfo.hasExtension("GL_ARB_texture_rg"); | 125 ctxInfo.hasExtension("GL_ARB_texture_rg"); |
| 127 } else { | 126 } else { |
| 128 fTextureRedSupport = version >= GR_GL_VER(3,0) || | 127 fTextureRedSupport = version >= GR_GL_VER(3,0) || |
| 129 ctxInfo.hasExtension("GL_EXT_texture_rg"); | 128 ctxInfo.hasExtension("GL_EXT_texture_rg"); |
| 130 } | 129 } |
| 131 } | 130 } |
| 132 fImagingSupport = kGL_GrGLStandard == standard && | 131 fImagingSupport = kGL_GrGLStandard == standard && |
| 133 ctxInfo.hasExtension("GL_ARB_imaging"); | 132 ctxInfo.hasExtension("GL_ARB_imaging"); |
| 134 | 133 |
| 135 // SGX and Mali GPUs that are based on a tiled-deferred architecture that ha
ve trouble with | |
| 136 // frequently changing VBOs. We've measured a performance increase using non
-VBO vertex | |
| 137 // data for dynamic content on these GPUs. Perhaps we should read the render
er string and | |
| 138 // limit this decision to specific GPU families rather than basing it on the
vendor alone. | |
| 139 if (!GR_GL_MUST_USE_VBO && | |
| 140 !fIsCoreProfile && | |
| 141 (kARM_GrGLVendor == ctxInfo.vendor() || | |
| 142 kImagination_GrGLVendor == ctxInfo.vendor() || | |
| 143 kQualcomm_GrGLVendor == ctxInfo.vendor())) { | |
| 144 fUseNonVBOVertexAndIndexDynamicData = true; | |
| 145 } | |
| 146 | |
| 147 // A driver but on the nexus 6 causes incorrect dst copies when invalidate i
s called beforehand. | 134 // A driver but on the nexus 6 causes incorrect dst copies when invalidate i
s called beforehand. |
| 148 // Thus we are blacklisting this extension for now on Adreno4xx devices. | 135 // Thus we are blacklisting this extension for now on Adreno4xx devices. |
| 149 if (kAdreno4xx_GrGLRenderer != ctxInfo.renderer() && | 136 if (kAdreno4xx_GrGLRenderer != ctxInfo.renderer() && |
| 150 ((kGL_GrGLStandard == standard && version >= GR_GL_VER(4,3)) || | 137 ((kGL_GrGLStandard == standard && version >= GR_GL_VER(4,3)) || |
| 151 (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3,0)) || | 138 (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3,0)) || |
| 152 ctxInfo.hasExtension("GL_ARB_invalidate_subdata"))) { | 139 ctxInfo.hasExtension("GL_ARB_invalidate_subdata"))) { |
| 153 fDiscardRenderTargetSupport = true; | 140 fDiscardRenderTargetSupport = true; |
| 154 fInvalidateFBType = kInvalidate_InvalidateFBType; | 141 fInvalidateFBType = kInvalidate_InvalidateFBType; |
| 155 } else if (ctxInfo.hasExtension("GL_EXT_discard_framebuffer")) { | 142 } else if (ctxInfo.hasExtension("GL_EXT_discard_framebuffer")) { |
| 156 fDiscardRenderTargetSupport = true; | 143 fDiscardRenderTargetSupport = true; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 fUsesMixedSamples = ctxInfo.hasExtension("GL_NV_framebuffer_mixed_sample
s") || | 324 fUsesMixedSamples = ctxInfo.hasExtension("GL_NV_framebuffer_mixed_sample
s") || |
| 338 ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_mixed_samples"); | 325 ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_mixed_samples"); |
| 339 // Workaround NVIDIA bug related to glInvalidateFramebuffer and mixed sa
mples. | 326 // Workaround NVIDIA bug related to glInvalidateFramebuffer and mixed sa
mples. |
| 340 if (fUsesMixedSamples && (kNVIDIA_GrGLDriver == ctxInfo.driver() || | 327 if (fUsesMixedSamples && (kNVIDIA_GrGLDriver == ctxInfo.driver() || |
| 341 kChromium_GrGLDriver == ctxInfo.driver())) { | 328 kChromium_GrGLDriver == ctxInfo.driver())) { |
| 342 fDiscardRenderTargetSupport = false; | 329 fDiscardRenderTargetSupport = false; |
| 343 fInvalidateFBType = kNone_InvalidateFBType; | 330 fInvalidateFBType = kNone_InvalidateFBType; |
| 344 } | 331 } |
| 345 } | 332 } |
| 346 | 333 |
| 334 // SGX and Mali GPUs that are based on a tiled-deferred architecture that ha
ve trouble with |
| 335 // frequently changing VBOs. We've measured a performance increase using non
-VBO vertex |
| 336 // data for dynamic content on these GPUs. Perhaps we should read the render
er string and |
| 337 // limit this decision to specific GPU families rather than basing it on the
vendor alone. |
| 338 if (!GR_GL_MUST_USE_VBO && |
| 339 !fIsCoreProfile && |
| 340 (kARM_GrGLVendor == ctxInfo.vendor() || |
| 341 kImagination_GrGLVendor == ctxInfo.vendor() || |
| 342 kQualcomm_GrGLVendor == ctxInfo.vendor())) { |
| 343 fPreferClientSideDynamicBuffers = true; |
| 344 } |
| 345 |
| 347 // fUsesMixedSamples must be set before calling initFSAASupport. | 346 // fUsesMixedSamples must be set before calling initFSAASupport. |
| 348 this->initFSAASupport(ctxInfo, gli); | 347 this->initFSAASupport(ctxInfo, gli); |
| 349 this->initBlendEqationSupport(ctxInfo); | 348 this->initBlendEqationSupport(ctxInfo); |
| 350 this->initStencilFormats(ctxInfo); | 349 this->initStencilFormats(ctxInfo); |
| 351 | 350 |
| 352 if (kGL_GrGLStandard == standard) { | 351 if (kGL_GrGLStandard == standard) { |
| 353 // we could also look for GL_ATI_separate_stencil extension or | 352 // we could also look for GL_ATI_separate_stencil extension or |
| 354 // GL_EXT_stencil_two_side but they use different function signatures | 353 // GL_EXT_stencil_two_side but they use different function signatures |
| 355 // than GL2.0+ (and than each other). | 354 // than GL2.0+ (and than each other). |
| 356 fTwoSidedStencilSupport = (ctxInfo.version() >= GR_GL_VER(2,0)); | 355 fTwoSidedStencilSupport = (ctxInfo.version() >= GR_GL_VER(2,0)); |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO"
)); | 1114 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO"
)); |
| 1116 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); | 1115 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); |
| 1117 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); | 1116 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); |
| 1118 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ?
"YES": "NO")); | 1117 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ?
"YES": "NO")); |
| 1119 r.appendf("Direct state access support: %s\n", (fDirectStateAccessSupport ?
"YES": "NO")); | 1118 r.appendf("Direct state access support: %s\n", (fDirectStateAccessSupport ?
"YES": "NO")); |
| 1120 r.appendf("Debug support: %s\n", (fDebugSupport ? "YES": "NO")); | 1119 r.appendf("Debug support: %s\n", (fDebugSupport ? "YES": "NO")); |
| 1121 r.appendf("Draw indirect support: %s\n", (fDrawIndirectSupport ? "YES" : "NO
")); | 1120 r.appendf("Draw indirect support: %s\n", (fDrawIndirectSupport ? "YES" : "NO
")); |
| 1122 r.appendf("Multi draw indirect support: %s\n", (fMultiDrawIndirectSupport ?
"YES" : "NO")); | 1121 r.appendf("Multi draw indirect support: %s\n", (fMultiDrawIndirectSupport ?
"YES" : "NO")); |
| 1123 r.appendf("Base instance support: %s\n", (fBaseInstanceSupport ? "YES" : "NO
")); | 1122 r.appendf("Base instance support: %s\n", (fBaseInstanceSupport ? "YES" : "NO
")); |
| 1124 r.appendf("Can draw indirect to float: %s\n", (fCanDrawIndirectToFloat ? "YE
S" : "NO")); | 1123 r.appendf("Can draw indirect to float: %s\n", (fCanDrawIndirectToFloat ? "YE
S" : "NO")); |
| 1125 r.appendf("Use non-VBO for dynamic data: %s\n", | |
| 1126 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); | |
| 1127 r.appendf("RGBA 8888 pixel ops are slow: %s\n", (fRGBA8888PixelsOpsAreSlow ?
"YES" : "NO")); | 1124 r.appendf("RGBA 8888 pixel ops are slow: %s\n", (fRGBA8888PixelsOpsAreSlow ?
"YES" : "NO")); |
| 1128 r.appendf("Partial FBO read is slow: %s\n", (fPartialFBOReadIsSlow ? "YES" :
"NO")); | 1125 r.appendf("Partial FBO read is slow: %s\n", (fPartialFBOReadIsSlow ? "YES" :
"NO")); |
| 1129 r.appendf("Bind uniform location support: %s\n", (fBindUniformLocationSuppor
t ? "YES" : "NO")); | 1126 r.appendf("Bind uniform location support: %s\n", (fBindUniformLocationSuppor
t ? "YES" : "NO")); |
| 1130 r.appendf("Rectangle texture support: %s\n", (fRectangleTextureSupport? "YES
" : "NO")); | 1127 r.appendf("Rectangle texture support: %s\n", (fRectangleTextureSupport? "YES
" : "NO")); |
| 1131 r.appendf("Texture swizzle support: %s\n", (fTextureSwizzleSupport ? "YES" :
"NO")); | 1128 r.appendf("Texture swizzle support: %s\n", (fTextureSwizzleSupport ? "YES" :
"NO")); |
| 1132 r.appendf("BGRA to RGBA readback conversions are slow: %s\n", | 1129 r.appendf("BGRA to RGBA readback conversions are slow: %s\n", |
| 1133 (fRGBAToBGRAReadbackConversionsAreSlow ? "YES" : "NO")); | 1130 (fRGBAToBGRAReadbackConversionsAreSlow ? "YES" : "NO")); |
| 1134 | 1131 |
| 1135 r.append("Configs\n-------\n"); | 1132 r.append("Configs\n-------\n"); |
| 1136 for (int i = 0; i < kGrPixelConfigCnt; ++i) { | 1133 for (int i = 0; i < kGrPixelConfigCnt; ++i) { |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1936 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { | 1933 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { |
| 1937 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != | 1934 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != |
| 1938 fConfigTable[i].fFormats.fExternalFormat[j]); | 1935 fConfigTable[i].fFormats.fExternalFormat[j]); |
| 1939 } | 1936 } |
| 1940 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats
.fExternalType); | 1937 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats
.fExternalType); |
| 1941 } | 1938 } |
| 1942 #endif | 1939 #endif |
| 1943 } | 1940 } |
| 1944 | 1941 |
| 1945 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} | 1942 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} |
| OLD | NEW |