Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright 2011 Google Inc. |
michael@0 | 3 | * |
michael@0 | 4 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 5 | * found in the LICENSE file. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | |
michael@0 | 9 | #include "gl/GrGLInterface.h" |
michael@0 | 10 | #include "gl/GrGLExtensions.h" |
michael@0 | 11 | #include "gl/GrGLUtil.h" |
michael@0 | 12 | |
michael@0 | 13 | #include <stdio.h> |
michael@0 | 14 | |
michael@0 | 15 | #if GR_GL_PER_GL_FUNC_CALLBACK |
michael@0 | 16 | namespace { |
michael@0 | 17 | void GrGLDefaultInterfaceCallback(const GrGLInterface*) {} |
michael@0 | 18 | } |
michael@0 | 19 | #endif |
michael@0 | 20 | |
michael@0 | 21 | const GrGLInterface* GrGLInterfaceAddTestDebugMarker(const GrGLInterface* interface, |
michael@0 | 22 | GrGLInsertEventMarkerProc insertEventMarkerFn, |
michael@0 | 23 | GrGLPushGroupMarkerProc pushGroupMarkerFn, |
michael@0 | 24 | GrGLPopGroupMarkerProc popGroupMarkerFn) { |
michael@0 | 25 | GrGLInterface* newInterface = GrGLInterface::NewClone(interface); |
michael@0 | 26 | |
michael@0 | 27 | if (!newInterface->fExtensions.has("GL_EXT_debug_marker")) { |
michael@0 | 28 | newInterface->fExtensions.add("GL_EXT_debug_marker"); |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | newInterface->fFunctions.fInsertEventMarker = insertEventMarkerFn; |
michael@0 | 32 | newInterface->fFunctions.fPushGroupMarker = pushGroupMarkerFn; |
michael@0 | 33 | newInterface->fFunctions.fPopGroupMarker = popGroupMarkerFn; |
michael@0 | 34 | |
michael@0 | 35 | return newInterface; |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface* interface) { |
michael@0 | 39 | GrGLInterface* newInterface = GrGLInterface::NewClone(interface); |
michael@0 | 40 | |
michael@0 | 41 | newInterface->fExtensions.remove("GL_NV_path_rendering"); |
michael@0 | 42 | |
michael@0 | 43 | newInterface->fFunctions.fPathCommands = NULL; |
michael@0 | 44 | newInterface->fFunctions.fPathCoords = NULL; |
michael@0 | 45 | newInterface->fFunctions.fPathSubCommands = NULL; |
michael@0 | 46 | newInterface->fFunctions.fPathSubCoords = NULL; |
michael@0 | 47 | newInterface->fFunctions.fPathString = NULL; |
michael@0 | 48 | newInterface->fFunctions.fPathGlyphs = NULL; |
michael@0 | 49 | newInterface->fFunctions.fPathGlyphRange = NULL; |
michael@0 | 50 | newInterface->fFunctions.fWeightPaths = NULL; |
michael@0 | 51 | newInterface->fFunctions.fCopyPath = NULL; |
michael@0 | 52 | newInterface->fFunctions.fInterpolatePaths = NULL; |
michael@0 | 53 | newInterface->fFunctions.fTransformPath = NULL; |
michael@0 | 54 | newInterface->fFunctions.fPathParameteriv = NULL; |
michael@0 | 55 | newInterface->fFunctions.fPathParameteri = NULL; |
michael@0 | 56 | newInterface->fFunctions.fPathParameterfv = NULL; |
michael@0 | 57 | newInterface->fFunctions.fPathParameterf = NULL; |
michael@0 | 58 | newInterface->fFunctions.fPathDashArray = NULL; |
michael@0 | 59 | newInterface->fFunctions.fGenPaths = NULL; |
michael@0 | 60 | newInterface->fFunctions.fDeletePaths = NULL; |
michael@0 | 61 | newInterface->fFunctions.fIsPath = NULL; |
michael@0 | 62 | newInterface->fFunctions.fPathStencilFunc = NULL; |
michael@0 | 63 | newInterface->fFunctions.fPathStencilDepthOffset = NULL; |
michael@0 | 64 | newInterface->fFunctions.fStencilFillPath = NULL; |
michael@0 | 65 | newInterface->fFunctions.fStencilStrokePath = NULL; |
michael@0 | 66 | newInterface->fFunctions.fStencilFillPathInstanced = NULL; |
michael@0 | 67 | newInterface->fFunctions.fStencilStrokePathInstanced = NULL; |
michael@0 | 68 | newInterface->fFunctions.fPathCoverDepthFunc = NULL; |
michael@0 | 69 | newInterface->fFunctions.fPathColorGen = NULL; |
michael@0 | 70 | newInterface->fFunctions.fPathTexGen = NULL; |
michael@0 | 71 | newInterface->fFunctions.fPathFogGen = NULL; |
michael@0 | 72 | newInterface->fFunctions.fCoverFillPath = NULL; |
michael@0 | 73 | newInterface->fFunctions.fCoverStrokePath = NULL; |
michael@0 | 74 | newInterface->fFunctions.fCoverFillPathInstanced = NULL; |
michael@0 | 75 | newInterface->fFunctions.fCoverStrokePathInstanced = NULL; |
michael@0 | 76 | newInterface->fFunctions.fGetPathParameteriv = NULL; |
michael@0 | 77 | newInterface->fFunctions.fGetPathParameterfv = NULL; |
michael@0 | 78 | newInterface->fFunctions.fGetPathCommands = NULL; |
michael@0 | 79 | newInterface->fFunctions.fGetPathCoords = NULL; |
michael@0 | 80 | newInterface->fFunctions.fGetPathDashArray = NULL; |
michael@0 | 81 | newInterface->fFunctions.fGetPathMetrics = NULL; |
michael@0 | 82 | newInterface->fFunctions.fGetPathMetricRange = NULL; |
michael@0 | 83 | newInterface->fFunctions.fGetPathSpacing = NULL; |
michael@0 | 84 | newInterface->fFunctions.fGetPathColorGeniv = NULL; |
michael@0 | 85 | newInterface->fFunctions.fGetPathColorGenfv = NULL; |
michael@0 | 86 | newInterface->fFunctions.fGetPathTexGeniv = NULL; |
michael@0 | 87 | newInterface->fFunctions.fGetPathTexGenfv = NULL; |
michael@0 | 88 | newInterface->fFunctions.fIsPointInFillPath = NULL; |
michael@0 | 89 | newInterface->fFunctions.fIsPointInStrokePath = NULL; |
michael@0 | 90 | newInterface->fFunctions.fGetPathLength = NULL; |
michael@0 | 91 | newInterface->fFunctions.fPointAlongPath = NULL; |
michael@0 | 92 | |
michael@0 | 93 | return newInterface; |
michael@0 | 94 | } |
michael@0 | 95 | |
michael@0 | 96 | GrGLInterface::GrGLInterface() { |
michael@0 | 97 | fStandard = kNone_GrGLStandard; |
michael@0 | 98 | |
michael@0 | 99 | #if GR_GL_PER_GL_FUNC_CALLBACK |
michael@0 | 100 | fCallback = GrGLDefaultInterfaceCallback; |
michael@0 | 101 | fCallbackData = 0; |
michael@0 | 102 | #endif |
michael@0 | 103 | } |
michael@0 | 104 | |
michael@0 | 105 | GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) { |
michael@0 | 106 | SkASSERT(NULL != interface); |
michael@0 | 107 | |
michael@0 | 108 | GrGLInterface* clone = SkNEW(GrGLInterface); |
michael@0 | 109 | clone->fStandard = interface->fStandard; |
michael@0 | 110 | clone->fExtensions = interface->fExtensions; |
michael@0 | 111 | clone->fFunctions = interface->fFunctions; |
michael@0 | 112 | #if GR_GL_PER_GL_FUNC_CALLBACK |
michael@0 | 113 | clone->fCallback = interface->fCallback; |
michael@0 | 114 | clone->fCallbackData = interface->fCallbackData; |
michael@0 | 115 | #endif |
michael@0 | 116 | return clone; |
michael@0 | 117 | } |
michael@0 | 118 | |
michael@0 | 119 | bool GrGLInterface::validate() const { |
michael@0 | 120 | |
michael@0 | 121 | if (kNone_GrGLStandard == fStandard) { |
michael@0 | 122 | return false; |
michael@0 | 123 | } |
michael@0 | 124 | |
michael@0 | 125 | if (!fExtensions.isInitialized()) { |
michael@0 | 126 | return false; |
michael@0 | 127 | } |
michael@0 | 128 | |
michael@0 | 129 | // functions that are always required |
michael@0 | 130 | if (NULL == fFunctions.fActiveTexture || |
michael@0 | 131 | NULL == fFunctions.fAttachShader || |
michael@0 | 132 | NULL == fFunctions.fBindAttribLocation || |
michael@0 | 133 | NULL == fFunctions.fBindBuffer || |
michael@0 | 134 | NULL == fFunctions.fBindTexture || |
michael@0 | 135 | NULL == fFunctions.fBlendFunc || |
michael@0 | 136 | NULL == fFunctions.fBlendColor || // -> GL >= 1.4, ES >= 2.0 or extension |
michael@0 | 137 | NULL == fFunctions.fBufferData || |
michael@0 | 138 | NULL == fFunctions.fBufferSubData || |
michael@0 | 139 | NULL == fFunctions.fClear || |
michael@0 | 140 | NULL == fFunctions.fClearColor || |
michael@0 | 141 | NULL == fFunctions.fClearStencil || |
michael@0 | 142 | NULL == fFunctions.fColorMask || |
michael@0 | 143 | NULL == fFunctions.fCompileShader || |
michael@0 | 144 | NULL == fFunctions.fCopyTexSubImage2D || |
michael@0 | 145 | NULL == fFunctions.fCreateProgram || |
michael@0 | 146 | NULL == fFunctions.fCreateShader || |
michael@0 | 147 | NULL == fFunctions.fCullFace || |
michael@0 | 148 | NULL == fFunctions.fDeleteBuffers || |
michael@0 | 149 | NULL == fFunctions.fDeleteProgram || |
michael@0 | 150 | NULL == fFunctions.fDeleteShader || |
michael@0 | 151 | NULL == fFunctions.fDeleteTextures || |
michael@0 | 152 | NULL == fFunctions.fDepthMask || |
michael@0 | 153 | NULL == fFunctions.fDisable || |
michael@0 | 154 | NULL == fFunctions.fDisableVertexAttribArray || |
michael@0 | 155 | NULL == fFunctions.fDrawArrays || |
michael@0 | 156 | NULL == fFunctions.fDrawElements || |
michael@0 | 157 | NULL == fFunctions.fEnable || |
michael@0 | 158 | NULL == fFunctions.fEnableVertexAttribArray || |
michael@0 | 159 | NULL == fFunctions.fFrontFace || |
michael@0 | 160 | NULL == fFunctions.fGenBuffers || |
michael@0 | 161 | NULL == fFunctions.fGenTextures || |
michael@0 | 162 | NULL == fFunctions.fGetBufferParameteriv || |
michael@0 | 163 | NULL == fFunctions.fGenerateMipmap || |
michael@0 | 164 | NULL == fFunctions.fGetError || |
michael@0 | 165 | NULL == fFunctions.fGetIntegerv || |
michael@0 | 166 | NULL == fFunctions.fGetProgramInfoLog || |
michael@0 | 167 | NULL == fFunctions.fGetProgramiv || |
michael@0 | 168 | NULL == fFunctions.fGetShaderInfoLog || |
michael@0 | 169 | NULL == fFunctions.fGetShaderiv || |
michael@0 | 170 | NULL == fFunctions.fGetString || |
michael@0 | 171 | NULL == fFunctions.fGetUniformLocation || |
michael@0 | 172 | NULL == fFunctions.fLinkProgram || |
michael@0 | 173 | NULL == fFunctions.fLineWidth || |
michael@0 | 174 | NULL == fFunctions.fPixelStorei || |
michael@0 | 175 | NULL == fFunctions.fReadPixels || |
michael@0 | 176 | NULL == fFunctions.fScissor || |
michael@0 | 177 | NULL == fFunctions.fShaderSource || |
michael@0 | 178 | NULL == fFunctions.fStencilFunc || |
michael@0 | 179 | NULL == fFunctions.fStencilMask || |
michael@0 | 180 | NULL == fFunctions.fStencilOp || |
michael@0 | 181 | NULL == fFunctions.fTexImage2D || |
michael@0 | 182 | NULL == fFunctions.fTexParameteri || |
michael@0 | 183 | NULL == fFunctions.fTexParameteriv || |
michael@0 | 184 | NULL == fFunctions.fTexSubImage2D || |
michael@0 | 185 | NULL == fFunctions.fUniform1f || |
michael@0 | 186 | NULL == fFunctions.fUniform1i || |
michael@0 | 187 | NULL == fFunctions.fUniform1fv || |
michael@0 | 188 | NULL == fFunctions.fUniform1iv || |
michael@0 | 189 | NULL == fFunctions.fUniform2f || |
michael@0 | 190 | NULL == fFunctions.fUniform2i || |
michael@0 | 191 | NULL == fFunctions.fUniform2fv || |
michael@0 | 192 | NULL == fFunctions.fUniform2iv || |
michael@0 | 193 | NULL == fFunctions.fUniform3f || |
michael@0 | 194 | NULL == fFunctions.fUniform3i || |
michael@0 | 195 | NULL == fFunctions.fUniform3fv || |
michael@0 | 196 | NULL == fFunctions.fUniform3iv || |
michael@0 | 197 | NULL == fFunctions.fUniform4f || |
michael@0 | 198 | NULL == fFunctions.fUniform4i || |
michael@0 | 199 | NULL == fFunctions.fUniform4fv || |
michael@0 | 200 | NULL == fFunctions.fUniform4iv || |
michael@0 | 201 | NULL == fFunctions.fUniformMatrix2fv || |
michael@0 | 202 | NULL == fFunctions.fUniformMatrix3fv || |
michael@0 | 203 | NULL == fFunctions.fUniformMatrix4fv || |
michael@0 | 204 | NULL == fFunctions.fUseProgram || |
michael@0 | 205 | NULL == fFunctions.fVertexAttrib4fv || |
michael@0 | 206 | NULL == fFunctions.fVertexAttribPointer || |
michael@0 | 207 | NULL == fFunctions.fViewport || |
michael@0 | 208 | NULL == fFunctions.fBindFramebuffer || |
michael@0 | 209 | NULL == fFunctions.fBindRenderbuffer || |
michael@0 | 210 | NULL == fFunctions.fCheckFramebufferStatus || |
michael@0 | 211 | NULL == fFunctions.fDeleteFramebuffers || |
michael@0 | 212 | NULL == fFunctions.fDeleteRenderbuffers || |
michael@0 | 213 | NULL == fFunctions.fFinish || |
michael@0 | 214 | NULL == fFunctions.fFlush || |
michael@0 | 215 | NULL == fFunctions.fFramebufferRenderbuffer || |
michael@0 | 216 | NULL == fFunctions.fFramebufferTexture2D || |
michael@0 | 217 | NULL == fFunctions.fGetFramebufferAttachmentParameteriv || |
michael@0 | 218 | NULL == fFunctions.fGetRenderbufferParameteriv || |
michael@0 | 219 | NULL == fFunctions.fGenFramebuffers || |
michael@0 | 220 | NULL == fFunctions.fGenRenderbuffers || |
michael@0 | 221 | NULL == fFunctions.fRenderbufferStorage) { |
michael@0 | 222 | return false; |
michael@0 | 223 | } |
michael@0 | 224 | |
michael@0 | 225 | GrGLVersion glVer = GrGLGetVersion(this); |
michael@0 | 226 | |
michael@0 | 227 | bool isCoreProfile = false; |
michael@0 | 228 | if (kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,2)) { |
michael@0 | 229 | GrGLint profileMask; |
michael@0 | 230 | GR_GL_GetIntegerv(this, GR_GL_CONTEXT_PROFILE_MASK, &profileMask); |
michael@0 | 231 | isCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_BIT); |
michael@0 | 232 | } |
michael@0 | 233 | |
michael@0 | 234 | // Now check that baseline ES/Desktop fns not covered above are present |
michael@0 | 235 | // and that we have fn pointers for any advertised fExtensions that we will |
michael@0 | 236 | // try to use. |
michael@0 | 237 | |
michael@0 | 238 | // these functions are part of ES2, we assume they are available |
michael@0 | 239 | // On the desktop we assume they are available if the extension |
michael@0 | 240 | // is present or GL version is high enough. |
michael@0 | 241 | if (kGLES_GrGLStandard == fStandard) { |
michael@0 | 242 | if (NULL == fFunctions.fStencilFuncSeparate || |
michael@0 | 243 | NULL == fFunctions.fStencilMaskSeparate || |
michael@0 | 244 | NULL == fFunctions.fStencilOpSeparate) { |
michael@0 | 245 | return false; |
michael@0 | 246 | } |
michael@0 | 247 | } else if (kGL_GrGLStandard == fStandard) { |
michael@0 | 248 | |
michael@0 | 249 | if (glVer >= GR_GL_VER(2,0)) { |
michael@0 | 250 | if (NULL == fFunctions.fStencilFuncSeparate || |
michael@0 | 251 | NULL == fFunctions.fStencilMaskSeparate || |
michael@0 | 252 | NULL == fFunctions.fStencilOpSeparate) { |
michael@0 | 253 | return false; |
michael@0 | 254 | } |
michael@0 | 255 | } |
michael@0 | 256 | if (glVer >= GR_GL_VER(3,0) && NULL == fFunctions.fBindFragDataLocation) { |
michael@0 | 257 | return false; |
michael@0 | 258 | } |
michael@0 | 259 | if (glVer >= GR_GL_VER(2,0) || fExtensions.has("GL_ARB_draw_buffers")) { |
michael@0 | 260 | if (NULL == fFunctions.fDrawBuffers) { |
michael@0 | 261 | return false; |
michael@0 | 262 | } |
michael@0 | 263 | } |
michael@0 | 264 | |
michael@0 | 265 | if (glVer >= GR_GL_VER(1,5) || fExtensions.has("GL_ARB_occlusion_query")) { |
michael@0 | 266 | if (NULL == fFunctions.fGenQueries || |
michael@0 | 267 | NULL == fFunctions.fDeleteQueries || |
michael@0 | 268 | NULL == fFunctions.fBeginQuery || |
michael@0 | 269 | NULL == fFunctions.fEndQuery || |
michael@0 | 270 | NULL == fFunctions.fGetQueryiv || |
michael@0 | 271 | NULL == fFunctions.fGetQueryObjectiv || |
michael@0 | 272 | NULL == fFunctions.fGetQueryObjectuiv) { |
michael@0 | 273 | return false; |
michael@0 | 274 | } |
michael@0 | 275 | } |
michael@0 | 276 | if (glVer >= GR_GL_VER(3,3) || |
michael@0 | 277 | fExtensions.has("GL_ARB_timer_query") || |
michael@0 | 278 | fExtensions.has("GL_EXT_timer_query")) { |
michael@0 | 279 | if (NULL == fFunctions.fGetQueryObjecti64v || |
michael@0 | 280 | NULL == fFunctions.fGetQueryObjectui64v) { |
michael@0 | 281 | return false; |
michael@0 | 282 | } |
michael@0 | 283 | } |
michael@0 | 284 | if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_timer_query")) { |
michael@0 | 285 | if (NULL == fFunctions.fQueryCounter) { |
michael@0 | 286 | return false; |
michael@0 | 287 | } |
michael@0 | 288 | } |
michael@0 | 289 | if (!isCoreProfile) { |
michael@0 | 290 | if (NULL == fFunctions.fLoadIdentity || |
michael@0 | 291 | NULL == fFunctions.fLoadMatrixf || |
michael@0 | 292 | NULL == fFunctions.fMatrixMode || |
michael@0 | 293 | NULL == fFunctions.fTexGenfv || |
michael@0 | 294 | NULL == fFunctions.fTexGeni) { |
michael@0 | 295 | return false; |
michael@0 | 296 | } |
michael@0 | 297 | } |
michael@0 | 298 | if (fExtensions.has("GL_NV_path_rendering")) { |
michael@0 | 299 | if (NULL == fFunctions.fPathCommands || |
michael@0 | 300 | NULL == fFunctions.fPathCoords || |
michael@0 | 301 | NULL == fFunctions.fPathSubCommands || |
michael@0 | 302 | NULL == fFunctions.fPathSubCoords || |
michael@0 | 303 | NULL == fFunctions.fPathString || |
michael@0 | 304 | NULL == fFunctions.fPathGlyphs || |
michael@0 | 305 | NULL == fFunctions.fPathGlyphRange || |
michael@0 | 306 | NULL == fFunctions.fWeightPaths || |
michael@0 | 307 | NULL == fFunctions.fCopyPath || |
michael@0 | 308 | NULL == fFunctions.fInterpolatePaths || |
michael@0 | 309 | NULL == fFunctions.fTransformPath || |
michael@0 | 310 | NULL == fFunctions.fPathParameteriv || |
michael@0 | 311 | NULL == fFunctions.fPathParameteri || |
michael@0 | 312 | NULL == fFunctions.fPathParameterfv || |
michael@0 | 313 | NULL == fFunctions.fPathParameterf || |
michael@0 | 314 | NULL == fFunctions.fPathDashArray || |
michael@0 | 315 | NULL == fFunctions.fGenPaths || |
michael@0 | 316 | NULL == fFunctions.fDeletePaths || |
michael@0 | 317 | NULL == fFunctions.fIsPath || |
michael@0 | 318 | NULL == fFunctions.fPathStencilFunc || |
michael@0 | 319 | NULL == fFunctions.fPathStencilDepthOffset || |
michael@0 | 320 | NULL == fFunctions.fStencilFillPath || |
michael@0 | 321 | NULL == fFunctions.fStencilStrokePath || |
michael@0 | 322 | NULL == fFunctions.fStencilFillPathInstanced || |
michael@0 | 323 | NULL == fFunctions.fStencilStrokePathInstanced || |
michael@0 | 324 | NULL == fFunctions.fPathCoverDepthFunc || |
michael@0 | 325 | NULL == fFunctions.fPathColorGen || |
michael@0 | 326 | NULL == fFunctions.fPathTexGen || |
michael@0 | 327 | NULL == fFunctions.fPathFogGen || |
michael@0 | 328 | NULL == fFunctions.fCoverFillPath || |
michael@0 | 329 | NULL == fFunctions.fCoverStrokePath || |
michael@0 | 330 | NULL == fFunctions.fCoverFillPathInstanced || |
michael@0 | 331 | NULL == fFunctions.fCoverStrokePathInstanced || |
michael@0 | 332 | NULL == fFunctions.fGetPathParameteriv || |
michael@0 | 333 | NULL == fFunctions.fGetPathParameterfv || |
michael@0 | 334 | NULL == fFunctions.fGetPathCommands || |
michael@0 | 335 | NULL == fFunctions.fGetPathCoords || |
michael@0 | 336 | NULL == fFunctions.fGetPathDashArray || |
michael@0 | 337 | NULL == fFunctions.fGetPathMetrics || |
michael@0 | 338 | NULL == fFunctions.fGetPathMetricRange || |
michael@0 | 339 | NULL == fFunctions.fGetPathSpacing || |
michael@0 | 340 | NULL == fFunctions.fGetPathColorGeniv || |
michael@0 | 341 | NULL == fFunctions.fGetPathColorGenfv || |
michael@0 | 342 | NULL == fFunctions.fGetPathTexGeniv || |
michael@0 | 343 | NULL == fFunctions.fGetPathTexGenfv || |
michael@0 | 344 | NULL == fFunctions.fIsPointInFillPath || |
michael@0 | 345 | NULL == fFunctions.fIsPointInStrokePath || |
michael@0 | 346 | NULL == fFunctions.fGetPathLength || |
michael@0 | 347 | NULL == fFunctions.fPointAlongPath) { |
michael@0 | 348 | return false; |
michael@0 | 349 | } |
michael@0 | 350 | } |
michael@0 | 351 | } |
michael@0 | 352 | |
michael@0 | 353 | // optional function on desktop before 1.3 |
michael@0 | 354 | if (kGL_GrGLStandard != fStandard || |
michael@0 | 355 | (glVer >= GR_GL_VER(1,3)) || |
michael@0 | 356 | fExtensions.has("GL_ARB_texture_compression")) { |
michael@0 | 357 | if (NULL == fFunctions.fCompressedTexImage2D) { |
michael@0 | 358 | return false; |
michael@0 | 359 | } |
michael@0 | 360 | } |
michael@0 | 361 | |
michael@0 | 362 | // part of desktop GL, but not ES |
michael@0 | 363 | if (kGL_GrGLStandard == fStandard && |
michael@0 | 364 | (NULL == fFunctions.fGetTexLevelParameteriv || |
michael@0 | 365 | NULL == fFunctions.fDrawBuffer || |
michael@0 | 366 | NULL == fFunctions.fReadBuffer)) { |
michael@0 | 367 | return false; |
michael@0 | 368 | } |
michael@0 | 369 | |
michael@0 | 370 | // GL_EXT_texture_storage is part of desktop 4.2 |
michael@0 | 371 | // There is a desktop ARB extension and an ES+desktop EXT extension |
michael@0 | 372 | if (kGL_GrGLStandard == fStandard) { |
michael@0 | 373 | if (glVer >= GR_GL_VER(4,2) || |
michael@0 | 374 | fExtensions.has("GL_ARB_texture_storage") || |
michael@0 | 375 | fExtensions.has("GL_EXT_texture_storage")) { |
michael@0 | 376 | if (NULL == fFunctions.fTexStorage2D) { |
michael@0 | 377 | return false; |
michael@0 | 378 | } |
michael@0 | 379 | } |
michael@0 | 380 | } else if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_texture_storage")) { |
michael@0 | 381 | if (NULL == fFunctions.fTexStorage2D) { |
michael@0 | 382 | return false; |
michael@0 | 383 | } |
michael@0 | 384 | } |
michael@0 | 385 | |
michael@0 | 386 | if (fExtensions.has("GL_EXT_discard_framebuffer")) { |
michael@0 | 387 | // FIXME: Remove this once Chromium is updated to provide this function |
michael@0 | 388 | #if 0 |
michael@0 | 389 | if (NULL == fFunctions.fDiscardFramebuffer) { |
michael@0 | 390 | return false; |
michael@0 | 391 | } |
michael@0 | 392 | #endif |
michael@0 | 393 | } |
michael@0 | 394 | |
michael@0 | 395 | // FBO MSAA |
michael@0 | 396 | if (kGL_GrGLStandard == fStandard) { |
michael@0 | 397 | // GL 3.0 and the ARB extension have multisample + blit |
michael@0 | 398 | if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_ARB_framebuffer_object")) { |
michael@0 | 399 | if (NULL == fFunctions.fRenderbufferStorageMultisample || |
michael@0 | 400 | NULL == fFunctions.fBlitFramebuffer) { |
michael@0 | 401 | return false; |
michael@0 | 402 | } |
michael@0 | 403 | } else { |
michael@0 | 404 | if (fExtensions.has("GL_EXT_framebuffer_blit") && |
michael@0 | 405 | NULL == fFunctions.fBlitFramebuffer) { |
michael@0 | 406 | return false; |
michael@0 | 407 | } |
michael@0 | 408 | if (fExtensions.has("GL_EXT_framebuffer_multisample") && |
michael@0 | 409 | NULL == fFunctions.fRenderbufferStorageMultisample) { |
michael@0 | 410 | return false; |
michael@0 | 411 | } |
michael@0 | 412 | } |
michael@0 | 413 | } else { |
michael@0 | 414 | if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_CHROMIUM_framebuffer_multisample")) { |
michael@0 | 415 | if (NULL == fFunctions.fRenderbufferStorageMultisample || |
michael@0 | 416 | NULL == fFunctions.fBlitFramebuffer) { |
michael@0 | 417 | return false; |
michael@0 | 418 | } |
michael@0 | 419 | } |
michael@0 | 420 | if (fExtensions.has("GL_APPLE_framebuffer_multisample")) { |
michael@0 | 421 | if (NULL == fFunctions.fRenderbufferStorageMultisampleES2APPLE || |
michael@0 | 422 | NULL == fFunctions.fResolveMultisampleFramebuffer) { |
michael@0 | 423 | return false; |
michael@0 | 424 | } |
michael@0 | 425 | } |
michael@0 | 426 | if (fExtensions.has("GL_IMG_multisampled_render_to_texture") || |
michael@0 | 427 | fExtensions.has("GL_EXT_multisampled_render_to_texture")) { |
michael@0 | 428 | if (NULL == fFunctions.fRenderbufferStorageMultisampleES2EXT || |
michael@0 | 429 | NULL == fFunctions.fFramebufferTexture2DMultisample) { |
michael@0 | 430 | return false; |
michael@0 | 431 | } |
michael@0 | 432 | } |
michael@0 | 433 | } |
michael@0 | 434 | |
michael@0 | 435 | // On ES buffer mapping is an extension. On Desktop |
michael@0 | 436 | // buffer mapping was part of original VBO extension |
michael@0 | 437 | // which we require. |
michael@0 | 438 | if (kGL_GrGLStandard == fStandard || fExtensions.has("GL_OES_mapbuffer")) { |
michael@0 | 439 | if (NULL == fFunctions.fMapBuffer || |
michael@0 | 440 | NULL == fFunctions.fUnmapBuffer) { |
michael@0 | 441 | return false; |
michael@0 | 442 | } |
michael@0 | 443 | } |
michael@0 | 444 | |
michael@0 | 445 | // Dual source blending |
michael@0 | 446 | if (kGL_GrGLStandard == fStandard && |
michael@0 | 447 | (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_blend_func_extended"))) { |
michael@0 | 448 | if (NULL == fFunctions.fBindFragDataLocationIndexed) { |
michael@0 | 449 | return false; |
michael@0 | 450 | } |
michael@0 | 451 | } |
michael@0 | 452 | |
michael@0 | 453 | // glGetStringi was added in version 3.0 of both desktop and ES. |
michael@0 | 454 | if (glVer >= GR_GL_VER(3, 0)) { |
michael@0 | 455 | if (NULL == fFunctions.fGetStringi) { |
michael@0 | 456 | return false; |
michael@0 | 457 | } |
michael@0 | 458 | } |
michael@0 | 459 | |
michael@0 | 460 | if (kGL_GrGLStandard == fStandard) { |
michael@0 | 461 | if (glVer >= GR_GL_VER(3, 0) || fExtensions.has("GL_ARB_vertex_array_object")) { |
michael@0 | 462 | if (NULL == fFunctions.fBindVertexArray || |
michael@0 | 463 | NULL == fFunctions.fDeleteVertexArrays || |
michael@0 | 464 | NULL == fFunctions.fGenVertexArrays) { |
michael@0 | 465 | return false; |
michael@0 | 466 | } |
michael@0 | 467 | } |
michael@0 | 468 | } else { |
michael@0 | 469 | if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_OES_vertex_array_object")) { |
michael@0 | 470 | if (NULL == fFunctions.fBindVertexArray || |
michael@0 | 471 | NULL == fFunctions.fDeleteVertexArrays || |
michael@0 | 472 | NULL == fFunctions.fGenVertexArrays) { |
michael@0 | 473 | return false; |
michael@0 | 474 | } |
michael@0 | 475 | } |
michael@0 | 476 | } |
michael@0 | 477 | |
michael@0 | 478 | #if 0 |
michael@0 | 479 | if (fExtensions.has("GL_EXT_debug_marker")) { |
michael@0 | 480 | if (NULL == fFunctions.fInsertEventMarker || |
michael@0 | 481 | NULL == fFunctions.fPushGroupMarker || |
michael@0 | 482 | NULL == fFunctions.fPopGroupMarker) { |
michael@0 | 483 | return false; |
michael@0 | 484 | } |
michael@0 | 485 | } |
michael@0 | 486 | #endif |
michael@0 | 487 | return true; |
michael@0 | 488 | } |