| 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 19 matching lines...) Expand all Loading... |
| 30 fBGRAIsInternalFormat = false; | 30 fBGRAIsInternalFormat = false; |
| 31 fUnpackRowLengthSupport = false; | 31 fUnpackRowLengthSupport = false; |
| 32 fUnpackFlipYSupport = false; | 32 fUnpackFlipYSupport = false; |
| 33 fPackRowLengthSupport = false; | 33 fPackRowLengthSupport = false; |
| 34 fPackFlipYSupport = false; | 34 fPackFlipYSupport = false; |
| 35 fTextureUsageSupport = false; | 35 fTextureUsageSupport = false; |
| 36 fTexStorageSupport = false; | 36 fTexStorageSupport = false; |
| 37 fTextureRedSupport = false; | 37 fTextureRedSupport = false; |
| 38 fImagingSupport = false; | 38 fImagingSupport = false; |
| 39 fTwoFormatLimit = false; | 39 fTwoFormatLimit = false; |
| 40 fFragCoordsConventionSupport = false; | |
| 41 fVertexArrayObjectSupport = false; | 40 fVertexArrayObjectSupport = false; |
| 42 fInstancedDrawingSupport = false; | 41 fInstancedDrawingSupport = false; |
| 43 fDirectStateAccessSupport = false; | 42 fDirectStateAccessSupport = false; |
| 44 fDebugSupport = false; | 43 fDebugSupport = false; |
| 45 fES2CompatibilitySupport = false; | 44 fES2CompatibilitySupport = false; |
| 46 fUseNonVBOVertexAndIndexDynamicData = false; | 45 fUseNonVBOVertexAndIndexDynamicData = false; |
| 47 fIsCoreProfile = false; | 46 fIsCoreProfile = false; |
| 48 fBindFragDataLocationSupport = false; | 47 fBindFragDataLocationSupport = false; |
| 49 fSRGBWriteControl = false; | 48 fSRGBWriteControl = false; |
| 50 fRGBA8888PixelsOpsAreSlow = false; | 49 fRGBA8888PixelsOpsAreSlow = false; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 fSRGBWriteControl = srgbSupport; | 163 fSRGBWriteControl = srgbSupport; |
| 165 } else { | 164 } else { |
| 166 // See https://bug.skia.org/4148 for PowerVR issue. | 165 // See https://bug.skia.org/4148 for PowerVR issue. |
| 167 srgbSupport = kPowerVRRogue_GrGLRenderer != ctxInfo.renderer() && | 166 srgbSupport = kPowerVRRogue_GrGLRenderer != ctxInfo.renderer() && |
| 168 (ctxInfo.version() >= GR_GL_VER(3,0) || ctxInfo.hasExtensi
on("GL_EXT_sRGB")); | 167 (ctxInfo.version() >= GR_GL_VER(3,0) || ctxInfo.hasExtensi
on("GL_EXT_sRGB")); |
| 169 // ES through 3.1 requires EXT_srgb_write_control to support toggling | 168 // ES through 3.1 requires EXT_srgb_write_control to support toggling |
| 170 // sRGB writing for destinations. | 169 // sRGB writing for destinations. |
| 171 fSRGBWriteControl = ctxInfo.hasExtension("GL_EXT_sRGB_write_control"); | 170 fSRGBWriteControl = ctxInfo.hasExtension("GL_EXT_sRGB_write_control"); |
| 172 } | 171 } |
| 173 | 172 |
| 174 // Frag Coords Convention support is not part of ES | |
| 175 // Known issue on at least some Intel platforms: | |
| 176 // http://code.google.com/p/skia/issues/detail?id=946 | |
| 177 if (kIntel_GrGLVendor != ctxInfo.vendor() && kGLES_GrGLStandard != standard)
{ | |
| 178 fFragCoordsConventionSupport = ctxInfo.glslGeneration() >= k150_GrGLSLGe
neration || | |
| 179 ctxInfo.hasExtension("GL_ARB_fragment_coo
rd_conventions"); | |
| 180 } | |
| 181 | |
| 182 // SGX and Mali GPUs that are based on a tiled-deferred architecture that ha
ve trouble with | 173 // SGX and Mali GPUs that are based on a tiled-deferred architecture that ha
ve trouble with |
| 183 // frequently changing VBOs. We've measured a performance increase using non
-VBO vertex | 174 // frequently changing VBOs. We've measured a performance increase using non
-VBO vertex |
| 184 // data for dynamic content on these GPUs. Perhaps we should read the render
er string and | 175 // data for dynamic content on these GPUs. Perhaps we should read the render
er string and |
| 185 // limit this decision to specific GPU families rather than basing it on the
vendor alone. | 176 // limit this decision to specific GPU families rather than basing it on the
vendor alone. |
| 186 if (!GR_GL_MUST_USE_VBO && | 177 if (!GR_GL_MUST_USE_VBO && |
| 187 (kARM_GrGLVendor == ctxInfo.vendor() || | 178 (kARM_GrGLVendor == ctxInfo.vendor() || |
| 188 kImagination_GrGLVendor == ctxInfo.vendor() || | 179 kImagination_GrGLVendor == ctxInfo.vendor() || |
| 189 kQualcomm_GrGLVendor == ctxInfo.vendor())) { | 180 kQualcomm_GrGLVendor == ctxInfo.vendor())) { |
| 190 fUseNonVBOVertexAndIndexDynamicData = true; | 181 fUseNonVBOVertexAndIndexDynamicData = true; |
| 191 } | 182 } |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 | 576 |
| 586 glslCaps->fForceHighPrecisionNDSTransform = kARM_GrGLVendor == ctxInfo.vendo
r() || | 577 glslCaps->fForceHighPrecisionNDSTransform = kARM_GrGLVendor == ctxInfo.vendo
r() || |
| 587 kPowerVR54x_GrGLRenderer == ctxI
nfo.renderer(); | 578 kPowerVR54x_GrGLRenderer == ctxI
nfo.renderer(); |
| 588 | 579 |
| 589 glslCaps->fVersionDeclString = get_glsl_version_decl_string(standard, glslCa
ps->fGLSLGeneration, | 580 glslCaps->fVersionDeclString = get_glsl_version_decl_string(standard, glslCa
ps->fGLSLGeneration, |
| 590 fIsCoreProfile); | 581 fIsCoreProfile); |
| 591 | 582 |
| 592 if (kGLES_GrGLStandard == standard && k110_GrGLSLGeneration == glslCaps->fGL
SLGeneration) { | 583 if (kGLES_GrGLStandard == standard && k110_GrGLSLGeneration == glslCaps->fGL
SLGeneration) { |
| 593 glslCaps->fShaderDerivativeExtensionString = "GL_OES_standard_derivative
s"; | 584 glslCaps->fShaderDerivativeExtensionString = "GL_OES_standard_derivative
s"; |
| 594 } | 585 } |
| 586 |
| 587 // Frag Coords Convention support is not part of ES |
| 588 // Known issue on at least some Intel platforms: |
| 589 // http://code.google.com/p/skia/issues/detail?id=946 |
| 590 if (kIntel_GrGLVendor != ctxInfo.vendor() && |
| 591 kGLES_GrGLStandard != standard && |
| 592 (ctxInfo.glslGeneration() >= k150_GrGLSLGeneration || |
| 593 ctxInfo.hasExtension("GL_ARB_fragment_coord_conventions"))) { |
| 594 glslCaps->fFragCoordConventionsExtensionString = "GL_ARB_fragment_coord_
conventions"; |
| 595 } |
| 596 |
| 597 if (kGLES_GrGLStandard == standard) { |
| 598 glslCaps->fSecondaryOutputExtensionString = "GL_EXT_blend_func_extended"
; |
| 599 } |
| 600 |
| 601 // The Tegra3 compiler will sometimes never return if we have min(abs(x), 1.
0), so we must do |
| 602 // the abs first in a separate expression. |
| 603 if (kTegra3_GrGLRenderer == ctxInfo.renderer()) { |
| 604 glslCaps->fCanUseMinAndAbsTogether = false; |
| 605 } |
| 606 |
| 607 // On Intel GPU there is an issue where it reads the second arguement to ata
n "- %s.x" as an int |
| 608 // thus must us -1.0 * %s.x to work correctly |
| 609 if (kIntel_GrGLVendor == ctxInfo.vendor()) { |
| 610 glslCaps->fMustForceNegatedAtanParamToFloat = true; |
| 611 } |
| 595 } | 612 } |
| 596 | 613 |
| 597 bool GrGLCaps::hasPathRenderingSupport(const GrGLContextInfo& ctxInfo, const GrG
LInterface* gli) { | 614 bool GrGLCaps::hasPathRenderingSupport(const GrGLContextInfo& ctxInfo, const GrG
LInterface* gli) { |
| 598 bool hasChromiumPathRendering = ctxInfo.hasExtension("GL_CHROMIUM_path_rende
ring"); | 615 bool hasChromiumPathRendering = ctxInfo.hasExtension("GL_CHROMIUM_path_rende
ring"); |
| 599 | 616 |
| 600 if (!(ctxInfo.hasExtension("GL_NV_path_rendering") || hasChromiumPathRenderi
ng)) { | 617 if (!(ctxInfo.hasExtension("GL_NV_path_rendering") || hasChromiumPathRenderi
ng)) { |
| 601 return false; | 618 return false; |
| 602 } | 619 } |
| 603 | 620 |
| 604 if (kGL_GrGLStandard == ctxInfo.standard()) { | 621 if (kGL_GrGLStandard == ctxInfo.standard()) { |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 r.appendf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES
": "NO")); | 1186 r.appendf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES
": "NO")); |
| 1170 r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO")
); | 1187 r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO")
); |
| 1171 r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "
NO")); | 1188 r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "
NO")); |
| 1172 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); | 1189 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); |
| 1173 | 1190 |
| 1174 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO"
)); | 1191 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO"
)); |
| 1175 r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO"
)); | 1192 r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO"
)); |
| 1176 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); | 1193 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); |
| 1177 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); | 1194 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); |
| 1178 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); | 1195 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); |
| 1179 r.appendf("Fragment coord conventions support: %s\n", | |
| 1180 (fFragCoordsConventionSupport ? "YES": "NO")); | |
| 1181 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ?
"YES": "NO")); | 1196 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ?
"YES": "NO")); |
| 1182 r.appendf("Instanced drawing support: %s\n", (fInstancedDrawingSupport ? "YE
S": "NO")); | 1197 r.appendf("Instanced drawing support: %s\n", (fInstancedDrawingSupport ? "YE
S": "NO")); |
| 1183 r.appendf("Direct state access support: %s\n", (fDirectStateAccessSupport ?
"YES": "NO")); | 1198 r.appendf("Direct state access support: %s\n", (fDirectStateAccessSupport ?
"YES": "NO")); |
| 1184 r.appendf("Debug support: %s\n", (fDebugSupport ? "YES": "NO")); | 1199 r.appendf("Debug support: %s\n", (fDebugSupport ? "YES": "NO")); |
| 1185 r.appendf("Use non-VBO for dynamic data: %s\n", | 1200 r.appendf("Use non-VBO for dynamic data: %s\n", |
| 1186 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); | 1201 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); |
| 1187 r.appendf("SRGB write contol: %s\n", (fSRGBWriteControl ? "YES" : "NO")); | 1202 r.appendf("SRGB write contol: %s\n", (fSRGBWriteControl ? "YES" : "NO")); |
| 1188 r.appendf("RGBA 8888 pixel ops are slow: %s\n", (fRGBA8888PixelsOpsAreSlow ?
"YES" : "NO")); | 1203 r.appendf("RGBA 8888 pixel ops are slow: %s\n", (fRGBA8888PixelsOpsAreSlow ?
"YES" : "NO")); |
| 1189 r.appendf("Partial FBO read is slow: %s\n", (fPartialFBOReadIsSlow ? "YES" :
"NO")); | 1204 r.appendf("Partial FBO read is slow: %s\n", (fPartialFBOReadIsSlow ? "YES" :
"NO")); |
| 1190 r.appendf("Bind uniform location support: %s\n", (fBindUniformLocationSuppor
t ? "YES" : "NO")); | 1205 r.appendf("Bind uniform location support: %s\n", (fBindUniformLocationSuppor
t ? "YES" : "NO")); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 glslCaps->fConfigSwizzle[kR11_EAC_GrPixelConfig] = "rrrr"; | 1324 glslCaps->fConfigSwizzle[kR11_EAC_GrPixelConfig] = "rrrr"; |
| 1310 glslCaps->fConfigSwizzle[kASTC_12x12_GrPixelConfig] = "rgba"; | 1325 glslCaps->fConfigSwizzle[kASTC_12x12_GrPixelConfig] = "rgba"; |
| 1311 glslCaps->fConfigSwizzle[kRGBA_float_GrPixelConfig] = "rgba"; | 1326 glslCaps->fConfigSwizzle[kRGBA_float_GrPixelConfig] = "rgba"; |
| 1312 glslCaps->fConfigSwizzle[kRGBA_half_GrPixelConfig] = "rgba"; | 1327 glslCaps->fConfigSwizzle[kRGBA_half_GrPixelConfig] = "rgba"; |
| 1313 | 1328 |
| 1314 } | 1329 } |
| 1315 | 1330 |
| 1316 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} | 1331 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} |
| 1317 | 1332 |
| 1318 | 1333 |
| OLD | NEW |