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 26 matching lines...) Expand all Loading... | |
| 37 fPackRowLengthSupport = false; | 37 fPackRowLengthSupport = false; |
| 38 fPackFlipYSupport = false; | 38 fPackFlipYSupport = false; |
| 39 fTextureUsageSupport = false; | 39 fTextureUsageSupport = false; |
| 40 fTexStorageSupport = false; | 40 fTexStorageSupport = false; |
| 41 fTextureRedSupport = false; | 41 fTextureRedSupport = false; |
| 42 fImagingSupport = false; | 42 fImagingSupport = false; |
| 43 fTwoFormatLimit = false; | 43 fTwoFormatLimit = false; |
| 44 fFragCoordsConventionSupport = false; | 44 fFragCoordsConventionSupport = false; |
| 45 fVertexArrayObjectSupport = false; | 45 fVertexArrayObjectSupport = false; |
| 46 fES2CompatibilitySupport = false; | 46 fES2CompatibilitySupport = false; |
| 47 fMultisampleDisableSupport = false; | |
| 47 fUseNonVBOVertexAndIndexDynamicData = false; | 48 fUseNonVBOVertexAndIndexDynamicData = false; |
| 48 fIsCoreProfile = false; | 49 fIsCoreProfile = false; |
| 49 fFullClearIsFree = false; | 50 fFullClearIsFree = false; |
| 50 fFBMixedSamplesSupport = false; | |
| 51 | 51 |
| 52 fReadPixelsSupportedCache.reset(); | 52 fReadPixelsSupportedCache.reset(); |
| 53 | 53 |
| 54 fShaderCaps.reset(SkNEW(GrGLSLCaps)); | 54 fShaderCaps.reset(SkNEW(GrGLSLCaps)); |
| 55 | 55 |
| 56 } | 56 } |
| 57 | 57 |
| 58 GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrCaps() { | 58 GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrCaps() { |
| 59 *this = caps; | 59 *this = caps; |
| 60 } | 60 } |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 79 fPackRowLengthSupport = caps.fPackRowLengthSupport; | 79 fPackRowLengthSupport = caps.fPackRowLengthSupport; |
| 80 fPackFlipYSupport = caps.fPackFlipYSupport; | 80 fPackFlipYSupport = caps.fPackFlipYSupport; |
| 81 fTextureUsageSupport = caps.fTextureUsageSupport; | 81 fTextureUsageSupport = caps.fTextureUsageSupport; |
| 82 fTexStorageSupport = caps.fTexStorageSupport; | 82 fTexStorageSupport = caps.fTexStorageSupport; |
| 83 fTextureRedSupport = caps.fTextureRedSupport; | 83 fTextureRedSupport = caps.fTextureRedSupport; |
| 84 fImagingSupport = caps.fImagingSupport; | 84 fImagingSupport = caps.fImagingSupport; |
| 85 fTwoFormatLimit = caps.fTwoFormatLimit; | 85 fTwoFormatLimit = caps.fTwoFormatLimit; |
| 86 fFragCoordsConventionSupport = caps.fFragCoordsConventionSupport; | 86 fFragCoordsConventionSupport = caps.fFragCoordsConventionSupport; |
| 87 fVertexArrayObjectSupport = caps.fVertexArrayObjectSupport; | 87 fVertexArrayObjectSupport = caps.fVertexArrayObjectSupport; |
| 88 fES2CompatibilitySupport = caps.fES2CompatibilitySupport; | 88 fES2CompatibilitySupport = caps.fES2CompatibilitySupport; |
| 89 fMultisampleDisableSupport = caps.fMultisampleDisableSupport; | |
| 89 fUseNonVBOVertexAndIndexDynamicData = caps.fUseNonVBOVertexAndIndexDynamicDa ta; | 90 fUseNonVBOVertexAndIndexDynamicData = caps.fUseNonVBOVertexAndIndexDynamicDa ta; |
| 90 fIsCoreProfile = caps.fIsCoreProfile; | 91 fIsCoreProfile = caps.fIsCoreProfile; |
| 91 fFullClearIsFree = caps.fFullClearIsFree; | 92 fFullClearIsFree = caps.fFullClearIsFree; |
| 92 fFBMixedSamplesSupport = caps.fFBMixedSamplesSupport; | |
| 93 | 93 |
| 94 *(reinterpret_cast<GrGLSLCaps*>(fShaderCaps.get())) = | 94 *(reinterpret_cast<GrGLSLCaps*>(fShaderCaps.get())) = |
| 95 *(reinterpret_cast<GrGLSLCaps*>(caps.f ShaderCaps.get())); | 95 *(reinterpret_cast<GrGLSLCaps*>(caps.f ShaderCaps.get())); |
| 96 | 96 |
| 97 return *this; | 97 return *this; |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { | 100 bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { |
| 101 | 101 |
| 102 this->reset(); | 102 this->reset(); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 ctxInfo.hasExtension("GL_OES_vertex_array_ob ject"); | 245 ctxInfo.hasExtension("GL_OES_vertex_array_ob ject"); |
| 246 } | 246 } |
| 247 | 247 |
| 248 if (kGL_GrGLStandard == standard) { | 248 if (kGL_GrGLStandard == standard) { |
| 249 fES2CompatibilitySupport = ctxInfo.hasExtension("GL_ARB_ES2_compatibilit y"); | 249 fES2CompatibilitySupport = ctxInfo.hasExtension("GL_ARB_ES2_compatibilit y"); |
| 250 } | 250 } |
| 251 else { | 251 else { |
| 252 fES2CompatibilitySupport = true; | 252 fES2CompatibilitySupport = true; |
| 253 } | 253 } |
| 254 | 254 |
| 255 if (kGL_GrGLStandard == standard) { | |
| 256 fMultisampleDisableSupport = true; | |
| 257 } else { | |
| 258 fMultisampleDisableSupport = false; | |
|
Chris Dalton
2015/05/21 03:28:52
This will eventually be replaced with a check for
| |
| 259 } | |
| 260 | |
| 255 this->initFSAASupport(ctxInfo, gli); | 261 this->initFSAASupport(ctxInfo, gli); |
| 256 this->initStencilFormats(ctxInfo); | 262 this->initStencilFormats(ctxInfo); |
| 257 | 263 |
| 258 /************************************************************************** | 264 /************************************************************************** |
| 259 * GrCaps fields | 265 * GrCaps fields |
| 260 **************************************************************************/ | 266 **************************************************************************/ |
| 261 if (kGL_GrGLStandard == standard) { | 267 if (kGL_GrGLStandard == standard) { |
| 262 // we could also look for GL_ATI_separate_stencil extension or | 268 // we could also look for GL_ATI_separate_stencil extension or |
| 263 // GL_EXT_stencil_two_side but they use different function signatures | 269 // GL_EXT_stencil_two_side but they use different function signatures |
| 264 // than GL2.0+ (and than each other). | 270 // than GL2.0+ (and than each other). |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 // to alllow arbitrary wrap modes, however. | 335 // to alllow arbitrary wrap modes, however. |
| 330 fMipMapSupport = fNPOTTextureTileSupport || ctxInfo.hasExtension("GL_IMG _texture_npot"); | 336 fMipMapSupport = fNPOTTextureTileSupport || ctxInfo.hasExtension("GL_IMG _texture_npot"); |
| 331 } | 337 } |
| 332 | 338 |
| 333 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_SIZE, &fMaxTextureSize); | 339 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_SIZE, &fMaxTextureSize); |
| 334 GR_GL_GetIntegerv(gli, GR_GL_MAX_RENDERBUFFER_SIZE, &fMaxRenderTargetSize); | 340 GR_GL_GetIntegerv(gli, GR_GL_MAX_RENDERBUFFER_SIZE, &fMaxRenderTargetSize); |
| 335 // Our render targets are always created with textures as the color | 341 // Our render targets are always created with textures as the color |
| 336 // attachment, hence this min: | 342 // attachment, hence this min: |
| 337 fMaxRenderTargetSize = SkTMin(fMaxTextureSize, fMaxRenderTargetSize); | 343 fMaxRenderTargetSize = SkTMin(fMaxTextureSize, fMaxRenderTargetSize); |
| 338 | 344 |
| 339 fFBMixedSamplesSupport = ctxInfo.hasExtension("GL_NV_framebuffer_mixed_sampl es"); | |
| 340 | |
| 341 fGpuTracingSupport = ctxInfo.hasExtension("GL_EXT_debug_marker"); | 345 fGpuTracingSupport = ctxInfo.hasExtension("GL_EXT_debug_marker"); |
| 342 | 346 |
| 343 // Disable scratch texture reuse on Mali and Adreno devices | 347 // Disable scratch texture reuse on Mali and Adreno devices |
| 344 fReuseScratchTextures = kARM_GrGLVendor != ctxInfo.vendor() && | 348 fReuseScratchTextures = kARM_GrGLVendor != ctxInfo.vendor() && |
| 345 kQualcomm_GrGLVendor != ctxInfo.vendor(); | 349 kQualcomm_GrGLVendor != ctxInfo.vendor(); |
| 346 | 350 |
| 347 if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) { | 351 if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) { |
| 348 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxSampleCount); | 352 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxSampleCount); |
| 349 } else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) { | 353 } else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) { |
| 350 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount); | 354 GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount); |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 908 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); | 912 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); |
| 909 | 913 |
| 910 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO" )); | 914 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO" )); |
| 911 r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO" )); | 915 r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO" )); |
| 912 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); | 916 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); |
| 913 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); | 917 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); |
| 914 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); | 918 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); |
| 915 r.appendf("Fragment coord conventions support: %s\n", | 919 r.appendf("Fragment coord conventions support: %s\n", |
| 916 (fFragCoordsConventionSupport ? "YES": "NO")); | 920 (fFragCoordsConventionSupport ? "YES": "NO")); |
| 917 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); | 921 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); |
| 922 r.appendf("Multisample disable support: %s\n", (fMultisampleDisableSupport ? "YES" : "NO")); | |
| 918 r.appendf("Use non-VBO for dynamic data: %s\n", | 923 r.appendf("Use non-VBO for dynamic data: %s\n", |
| 919 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); | 924 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); |
| 920 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO ")); | 925 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO ")); |
| 921 return r; | 926 return r; |
| 922 } | 927 } |
| 923 | 928 |
| 924 //////////////////////////////////////////////////////////////////////////////// //////////// | 929 //////////////////////////////////////////////////////////////////////////////// //////////// |
| 925 | 930 |
| 926 GrGLSLCaps::GrGLSLCaps() { | 931 GrGLSLCaps::GrGLSLCaps() { |
| 927 this->reset(); | 932 this->reset(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1027 fShaderDerivativeSupport = true; | 1032 fShaderDerivativeSupport = true; |
| 1028 // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS | 1033 // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS |
| 1029 fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3, 2) && | 1034 fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3, 2) && |
| 1030 ctxInfo.glslGeneration() >= k150_GrGLSLGeneration; | 1035 ctxInfo.glslGeneration() >= k150_GrGLSLGeneration; |
| 1031 } | 1036 } |
| 1032 else { | 1037 else { |
| 1033 fShaderDerivativeSupport = ctxInfo.version() >= GR_GL_VER(3, 0) || | 1038 fShaderDerivativeSupport = ctxInfo.version() >= GR_GL_VER(3, 0) || |
| 1034 ctxInfo.hasExtension("GL_OES_standard_derivatives"); | 1039 ctxInfo.hasExtension("GL_OES_standard_derivatives"); |
| 1035 } | 1040 } |
| 1036 | 1041 |
| 1042 // We need dual source blending and the ability to disable multisample in or der to support mixed | |
| 1043 // samples in every corner case. | |
| 1044 if (fDualSourceBlendingSupport && glCaps.multisampleDisableSupport()) { | |
| 1045 // We understand "mixed samples" to mean the collective capability of 3 different extensions | |
| 1046 fMixedSamplesSupport = ctxInfo.hasExtension("GL_NV_framebuffer_mixed_sam ples") && | |
| 1047 ctxInfo.hasExtension("GL_NV_sample_mask_override_ coverage") && | |
| 1048 ctxInfo.hasExtension("GL_EXT_raster_multisample") ; | |
| 1049 } | |
| 1050 | |
| 1037 if (glCaps.advancedBlendEquationSupport()) { | 1051 if (glCaps.advancedBlendEquationSupport()) { |
| 1038 bool coherent = glCaps.advancedCoherentBlendEquationSupport(); | 1052 bool coherent = glCaps.advancedCoherentBlendEquationSupport(); |
| 1039 if (ctxInfo.hasExtension(coherent ? "GL_NV_blend_equation_advanced_coher ent" | 1053 if (ctxInfo.hasExtension(coherent ? "GL_NV_blend_equation_advanced_coher ent" |
| 1040 : "GL_NV_blend_equation_advanced")) { | 1054 : "GL_NV_blend_equation_advanced")) { |
| 1041 fAdvBlendEqInteraction = kAutomatic_AdvBlendEqInteraction; | 1055 fAdvBlendEqInteraction = kAutomatic_AdvBlendEqInteraction; |
| 1042 } else { | 1056 } else { |
| 1043 fAdvBlendEqInteraction = kGeneralEnable_AdvBlendEqInteraction; | 1057 fAdvBlendEqInteraction = kGeneralEnable_AdvBlendEqInteraction; |
| 1044 // TODO: Use the following on any platform where "blend_support_all_ equations" is slow. | 1058 // TODO: Use the following on any platform where "blend_support_all_ equations" is slow. |
| 1045 //fAdvBlendEqInteraction = kSpecificEnables_AdvBlendEqInteraction; | 1059 //fAdvBlendEqInteraction = kSpecificEnables_AdvBlendEqInteraction; |
| 1046 } | 1060 } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1152 if (fGeometryShaderSupport) { | 1166 if (fGeometryShaderSupport) { |
| 1153 for (int p = 0; p < kGrSLPrecisionCount; ++p) { | 1167 for (int p = 0; p < kGrSLPrecisionCount; ++p) { |
| 1154 fFloatPrecisions[kGeometry_GrShaderType][p] = fFloatPrecisions[kVert ex_GrShaderType][p]; | 1168 fFloatPrecisions[kGeometry_GrShaderType][p] = fFloatPrecisions[kVert ex_GrShaderType][p]; |
| 1155 } | 1169 } |
| 1156 } | 1170 } |
| 1157 } | 1171 } |
| 1158 | 1172 |
| 1159 | 1173 |
| 1160 | 1174 |
| 1161 | 1175 |
| OLD | NEW |