GrGLInterface.cpp revision f66967243c3732523c2035f7d6dbf65c2d20b264
1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com/*
2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2011 Google Inc.
3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com *
4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be
5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file.
659a190bcab5d4b2bf03f8f10cb6a581d19fed403twiz@google.com */
759a190bcab5d4b2bf03f8f10cb6a581d19fed403twiz@google.com
859a190bcab5d4b2bf03f8f10cb6a581d19fed403twiz@google.com
96bf38b59c9de1cd35cd091cf8766117f4e1f66a0tomhudson@google.com#include "gl/GrGLInterface.h"
101744f97ea73384b9f75b0ccee0a36a213c681d3absalomon@google.com#include "gl/GrGLExtensions.h"
111744f97ea73384b9f75b0ccee0a36a213c681d3absalomon@google.com#include "gl/GrGLUtil.h"
1259a190bcab5d4b2bf03f8f10cb6a581d19fed403twiz@google.com
1359a190bcab5d4b2bf03f8f10cb6a581d19fed403twiz@google.com#include <stdio.h>
1459a190bcab5d4b2bf03f8f10cb6a581d19fed403twiz@google.com
1556bfc5acc210987838744eece7383bc2f6b34915bsalomon@google.com#if GR_GL_PER_GL_FUNC_CALLBACK
1656bfc5acc210987838744eece7383bc2f6b34915bsalomon@google.comnamespace {
1756bfc5acc210987838744eece7383bc2f6b34915bsalomon@google.comvoid GrGLDefaultInterfaceCallback(const GrGLInterface*) {}
1856bfc5acc210987838744eece7383bc2f6b34915bsalomon@google.com}
1956bfc5acc210987838744eece7383bc2f6b34915bsalomon@google.com#endif
2056bfc5acc210987838744eece7383bc2f6b34915bsalomon@google.com
21a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.orgconst GrGLInterface* GrGLInterfaceAddTestDebugMarker(const GrGLInterface* interface,
22a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org                                                     GrGLInsertEventMarkerProc insertEventMarkerFn,
23a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org                                                     GrGLPushGroupMarkerProc pushGroupMarkerFn,
24a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org                                                     GrGLPopGroupMarkerProc popGroupMarkerFn) {
25a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org    GrGLInterface* newInterface = GrGLInterface::NewClone(interface);
26a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org
27a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org    if (!newInterface->fExtensions.has("GL_EXT_debug_marker")) {
28a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org        newInterface->fExtensions.add("GL_EXT_debug_marker");
29a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org    }
30a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org
31f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fInsertEventMarker = insertEventMarkerFn;
32f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPushGroupMarker = pushGroupMarkerFn;
33f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPopGroupMarker = popGroupMarkerFn;
34a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org
35a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org    return newInterface;
36a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org}
37a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org
38d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.orgconst GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface* interface) {
39d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org    GrGLInterface* newInterface = GrGLInterface::NewClone(interface);
40d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org
41d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org    newInterface->fExtensions.remove("GL_NV_path_rendering");
42d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org
43f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathCommands = NULL;
44f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathCoords = NULL;
45f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathSubCommands = NULL;
46f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathSubCoords = NULL;
47f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathString = NULL;
48f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathGlyphs = NULL;
49f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathGlyphRange = NULL;
50f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fWeightPaths = NULL;
51f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fCopyPath = NULL;
52f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fInterpolatePaths = NULL;
53f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fTransformPath = NULL;
54f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathParameteriv = NULL;
55f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathParameteri = NULL;
56f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathParameterfv = NULL;
57f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathParameterf = NULL;
58f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathDashArray = NULL;
59f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fGenPaths = NULL;
60f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fDeletePaths = NULL;
61f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fIsPath = NULL;
62f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathStencilFunc = NULL;
63f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathStencilDepthOffset = NULL;
64f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fStencilFillPath = NULL;
65f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fStencilStrokePath = NULL;
66f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fStencilFillPathInstanced = NULL;
67f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fStencilStrokePathInstanced = NULL;
68f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathCoverDepthFunc = NULL;
69f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathColorGen = NULL;
70f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathTexGen = NULL;
71f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPathFogGen = NULL;
72f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fCoverFillPath = NULL;
73f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fCoverStrokePath = NULL;
74f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fCoverFillPathInstanced = NULL;
75f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fCoverStrokePathInstanced = NULL;
76f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fGetPathParameteriv = NULL;
77f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fGetPathParameterfv = NULL;
78f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fGetPathCommands = NULL;
79f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fGetPathCoords = NULL;
80f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fGetPathDashArray = NULL;
81f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fGetPathMetrics = NULL;
82f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fGetPathMetricRange = NULL;
83f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fGetPathSpacing = NULL;
84f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fGetPathColorGeniv = NULL;
85f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fGetPathColorGenfv = NULL;
86f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fGetPathTexGeniv = NULL;
87f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fGetPathTexGenfv = NULL;
88f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fIsPointInFillPath = NULL;
89f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fIsPointInStrokePath = NULL;
90f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fGetPathLength = NULL;
91f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.org    newInterface->fFunctions.fPointAlongPath = NULL;
92d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org
93d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org    return newInterface;
94d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org}
95d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org
96f535561b3baeb5f19c5b81fb439818bdde00d882commit-bot@chromium.orgGrGLInterface::GrGLInterface() {
979e90aed5de82732cc9921f01388d3063a41a053bcommit-bot@chromium.org    fStandard = kNone_GrGLStandard;
980b77d6892b067ad402c9678b0226bff70599fbe2bsalomon@google.com
9956bfc5acc210987838744eece7383bc2f6b34915bsalomon@google.com#if GR_GL_PER_GL_FUNC_CALLBACK
10056bfc5acc210987838744eece7383bc2f6b34915bsalomon@google.com    fCallback = GrGLDefaultInterfaceCallback;
10156bfc5acc210987838744eece7383bc2f6b34915bsalomon@google.com    fCallbackData = 0;
10256bfc5acc210987838744eece7383bc2f6b34915bsalomon@google.com#endif
1030b77d6892b067ad402c9678b0226bff70599fbe2bsalomon@google.com}
1040b77d6892b067ad402c9678b0226bff70599fbe2bsalomon@google.com
105d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.orgGrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) {
106d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org    SkASSERT(NULL != interface);
107d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org
108d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org    GrGLInterface* clone = SkNEW(GrGLInterface);
109d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org    clone->fStandard = interface->fStandard;
110d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org    clone->fExtensions = interface->fExtensions;
111d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org    clone->fFunctions = interface->fFunctions;
112d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org#if GR_GL_PER_GL_FUNC_CALLBACK
113d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org    clone->fCallback = interface->fCallback;
114d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org    clone->fCallbackData = interface->fCallbackData;
115d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org#endif
116d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org    return clone;
117d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org}
118d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org
119adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org#define RETURN_FALSE_INTERFACE                             \
120adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org    GrDebugCrash("GrGLInterface::validate() failed.");     \
121adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org    return false;                                          \
122adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org
1239e90aed5de82732cc9921f01388d3063a41a053bcommit-bot@chromium.orgbool GrGLInterface::validate() const {
124bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com
1259e90aed5de82732cc9921f01388d3063a41a053bcommit-bot@chromium.org    if (kNone_GrGLStandard == fStandard) {
126adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org        RETURN_FALSE_INTERFACE
127bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    }
12812eea2b10d6caaafe0a207d10b1e9322510983a2skia.committer@gmail.com
12990313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org    if (!fExtensions.isInitialized()) {
130adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org        RETURN_FALSE_INTERFACE
1311744f97ea73384b9f75b0ccee0a36a213c681d3absalomon@google.com    }
132bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com
133bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    // functions that are always required
134c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org    if (NULL == fFunctions.fActiveTexture ||
135c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fAttachShader ||
136c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fBindAttribLocation ||
137c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fBindBuffer ||
138c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fBindTexture ||
139c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fBlendFunc ||
140c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fBlendColor ||      // -> GL >= 1.4, ES >= 2.0 or extension
141c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fBufferData ||
142c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fBufferSubData ||
143c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fClear ||
144c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fClearColor ||
145c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fClearStencil ||
146c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fColorMask ||
147c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fCompileShader ||
148c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fCopyTexSubImage2D ||
149c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fCreateProgram ||
150c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fCreateShader ||
151c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fCullFace ||
152c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fDeleteBuffers ||
153c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fDeleteProgram ||
154c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fDeleteShader ||
155c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fDeleteTextures ||
156c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fDepthMask ||
157c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fDisable ||
158c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fDisableVertexAttribArray ||
159c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fDrawArrays ||
160c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fDrawElements ||
161c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fEnable ||
162c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fEnableVertexAttribArray ||
163c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fFrontFace ||
164c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fGenBuffers ||
165c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fGenTextures ||
166c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fGetBufferParameteriv ||
167c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fGenerateMipmap ||
168c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fGetError ||
169c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fGetIntegerv ||
170c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fGetProgramInfoLog ||
171c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fGetProgramiv ||
172c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fGetShaderInfoLog ||
173c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fGetShaderiv ||
174c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fGetString ||
175c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fGetUniformLocation ||
176c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fLinkProgram ||
177c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fLineWidth ||
178c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fPixelStorei ||
179c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fReadPixels ||
180c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fScissor ||
181c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fShaderSource ||
182c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fStencilFunc ||
183c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fStencilMask ||
184c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fStencilOp ||
185c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fTexImage2D ||
186c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fTexParameteri ||
187c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fTexParameteriv ||
188c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fTexSubImage2D ||
189c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniform1f ||
190c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniform1i ||
191c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniform1fv ||
192c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniform1iv ||
193c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniform2f ||
194c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniform2i ||
195c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniform2fv ||
196c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniform2iv ||
197c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniform3f ||
198c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniform3i ||
199c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniform3fv ||
200c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniform3iv ||
201c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniform4f ||
202c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniform4i ||
203c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniform4fv ||
204c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniform4iv ||
205c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniformMatrix2fv ||
206c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniformMatrix3fv ||
207c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUniformMatrix4fv ||
208c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fUseProgram ||
209c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fVertexAttrib4fv ||
210c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fVertexAttribPointer ||
211c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fViewport ||
212c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fBindFramebuffer ||
213c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fBindRenderbuffer ||
214c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fCheckFramebufferStatus ||
215c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fDeleteFramebuffers ||
216c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fDeleteRenderbuffers ||
217c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fFinish ||
218c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fFlush ||
219c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fFramebufferRenderbuffer ||
220c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fFramebufferTexture2D ||
221c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fGetFramebufferAttachmentParameteriv ||
222c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fGetRenderbufferParameteriv ||
223c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fGenFramebuffers ||
224c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fGenRenderbuffers ||
225c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        NULL == fFunctions.fRenderbufferStorage) {
226adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org        RETURN_FALSE_INTERFACE
227bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    }
228bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com
229c82b8899d97c2a26f5991bc771ad3beb8257edaebsalomon@google.com    GrGLVersion glVer = GrGLGetVersion(this);
230bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com
231bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    // Now check that baseline ES/Desktop fns not covered above are present
23290313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org    // and that we have fn pointers for any advertised fExtensions that we will
233bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    // try to use.
234bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com
235bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    // these functions are part of ES2, we assume they are available
236bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    // On the desktop we assume they are available if the extension
237bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    // is present or GL version is high enough.
2389e90aed5de82732cc9921f01388d3063a41a053bcommit-bot@chromium.org    if (kGLES_GrGLStandard == fStandard) {
239c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        if (NULL == fFunctions.fStencilFuncSeparate ||
240c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org            NULL == fFunctions.fStencilMaskSeparate ||
241c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org            NULL == fFunctions.fStencilOpSeparate) {
242adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org            RETURN_FALSE_INTERFACE
243bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com        }
2449e90aed5de82732cc9921f01388d3063a41a053bcommit-bot@chromium.org    } else if (kGL_GrGLStandard == fStandard) {
245e788430144d1474329878abd1ddb39cc0ca52a0arobertphillips@google.com
246c82b8899d97c2a26f5991bc771ad3beb8257edaebsalomon@google.com        if (glVer >= GR_GL_VER(2,0)) {
247c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org            if (NULL == fFunctions.fStencilFuncSeparate ||
248c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fStencilMaskSeparate ||
249c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fStencilOpSeparate) {
250adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org                RETURN_FALSE_INTERFACE
251bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com            }
252bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com        }
253c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        if (glVer >= GR_GL_VER(3,0) && NULL == fFunctions.fBindFragDataLocation) {
254adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org            RETURN_FALSE_INTERFACE
255bc5cf51627505f763586100675aa60b66d743c7ebsalomon@google.com        }
25690313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org        if (glVer >= GR_GL_VER(2,0) || fExtensions.has("GL_ARB_draw_buffers")) {
257c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org            if (NULL == fFunctions.fDrawBuffers) {
258adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org                RETURN_FALSE_INTERFACE
259d32c5f564e4aa9ada2650e07d3856d5b21cd2138bsalomon@google.com            }
260d32c5f564e4aa9ada2650e07d3856d5b21cd2138bsalomon@google.com        }
261e788430144d1474329878abd1ddb39cc0ca52a0arobertphillips@google.com
26290313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org        if (glVer >= GR_GL_VER(1,5) || fExtensions.has("GL_ARB_occlusion_query")) {
263c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org            if (NULL == fFunctions.fGenQueries ||
264c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fDeleteQueries ||
265c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fBeginQuery ||
266c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fEndQuery ||
267c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetQueryiv ||
268c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetQueryObjectiv ||
269c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetQueryObjectuiv) {
270adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org                RETURN_FALSE_INTERFACE
271373a6635b7190b4af4d265fdd4b70f102ec3a6fdbsalomon@google.com            }
272373a6635b7190b4af4d265fdd4b70f102ec3a6fdbsalomon@google.com        }
273373a6635b7190b4af4d265fdd4b70f102ec3a6fdbsalomon@google.com        if (glVer >= GR_GL_VER(3,3) ||
27490313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org            fExtensions.has("GL_ARB_timer_query") ||
27590313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org            fExtensions.has("GL_EXT_timer_query")) {
276c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org            if (NULL == fFunctions.fGetQueryObjecti64v ||
277c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetQueryObjectui64v) {
278adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org                RETURN_FALSE_INTERFACE
279373a6635b7190b4af4d265fdd4b70f102ec3a6fdbsalomon@google.com            }
280373a6635b7190b4af4d265fdd4b70f102ec3a6fdbsalomon@google.com        }
28190313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org        if (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_timer_query")) {
282c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org            if (NULL == fFunctions.fQueryCounter) {
283adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org                RETURN_FALSE_INTERFACE
284373a6635b7190b4af4d265fdd4b70f102ec3a6fdbsalomon@google.com            }
285373a6635b7190b4af4d265fdd4b70f102ec3a6fdbsalomon@google.com        }
286f66967243c3732523c2035f7d6dbf65c2d20b264commit-bot@chromium.org        if (fExtensions.has("GL_EXT_direct_state_access")) {
287f66967243c3732523c2035f7d6dbf65c2d20b264commit-bot@chromium.org            if (NULL == fFunctions.fMatrixLoadf ||
288f66967243c3732523c2035f7d6dbf65c2d20b264commit-bot@chromium.org                NULL == fFunctions.fMatrixLoadIdentity) {
289adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org                RETURN_FALSE_INTERFACE
29046fbfe0cd1bbe60fd15ce52e784f5d51450ff5fdcommit-bot@chromium.org            }
291fe11cb6486adfccc1a9ca9658ae25907192a8642bsalomon@google.com        }
292d8ed85101ee77ad2cb0c186a79d197698a75d246commit-bot@chromium.org        if (fExtensions.has("GL_NV_path_rendering")) {
293c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org            if (NULL == fFunctions.fPathCommands ||
294c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathCoords ||
295c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathSubCommands ||
296c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathSubCoords ||
297c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathString ||
298c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathGlyphs ||
299c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathGlyphRange ||
300c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fWeightPaths ||
301c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fCopyPath ||
302c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fInterpolatePaths ||
303c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fTransformPath ||
304c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathParameteriv ||
305c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathParameteri ||
306c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathParameterfv ||
307c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathParameterf ||
308c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathDashArray ||
309c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGenPaths ||
310c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fDeletePaths ||
311c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fIsPath ||
312c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathStencilFunc ||
313c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathStencilDepthOffset ||
314c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fStencilFillPath ||
315c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fStencilStrokePath ||
316c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fStencilFillPathInstanced ||
317c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fStencilStrokePathInstanced ||
318c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathCoverDepthFunc ||
319c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathColorGen ||
320c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathTexGen ||
321c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPathFogGen ||
322c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fCoverFillPath ||
323c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fCoverStrokePath ||
324c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fCoverFillPathInstanced ||
325c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fCoverStrokePathInstanced ||
326c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetPathParameteriv ||
327c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetPathParameterfv ||
328c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetPathCommands ||
329c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetPathCoords ||
330c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetPathDashArray ||
331c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetPathMetrics ||
332c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetPathMetricRange ||
333c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetPathSpacing ||
334c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetPathColorGeniv ||
335c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetPathColorGenfv ||
336c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetPathTexGeniv ||
337c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetPathTexGenfv ||
338c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fIsPointInFillPath ||
339c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fIsPointInStrokePath ||
340c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGetPathLength ||
341c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fPointAlongPath) {
342adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org                RETURN_FALSE_INTERFACE
343fe11cb6486adfccc1a9ca9658ae25907192a8642bsalomon@google.com            }
344fe11cb6486adfccc1a9ca9658ae25907192a8642bsalomon@google.com        }
345bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    }
346bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com
347bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    // optional function on desktop before 1.3
3489e90aed5de82732cc9921f01388d3063a41a053bcommit-bot@chromium.org    if (kGL_GrGLStandard != fStandard ||
3491744f97ea73384b9f75b0ccee0a36a213c681d3absalomon@google.com        (glVer >= GR_GL_VER(1,3)) ||
35090313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org        fExtensions.has("GL_ARB_texture_compression")) {
351c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        if (NULL == fFunctions.fCompressedTexImage2D) {
352adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org            RETURN_FALSE_INTERFACE
353bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com        }
354bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    }
355bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com
356d32c5f564e4aa9ada2650e07d3856d5b21cd2138bsalomon@google.com    // part of desktop GL, but not ES
3579e90aed5de82732cc9921f01388d3063a41a053bcommit-bot@chromium.org    if (kGL_GrGLStandard == fStandard &&
358c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        (NULL == fFunctions.fGetTexLevelParameteriv ||
359c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org         NULL == fFunctions.fDrawBuffer ||
360c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org         NULL == fFunctions.fReadBuffer)) {
361adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org        RETURN_FALSE_INTERFACE
362bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    }
363cee661af926cc977addc6e039b7022975a448acebsalomon@google.com
364280e99f1a61f2cf66a8ee9b9e6c517f3d2290de7bsalomon@google.com    // GL_EXT_texture_storage is part of desktop 4.2
365280e99f1a61f2cf66a8ee9b9e6c517f3d2290de7bsalomon@google.com    // There is a desktop ARB extension and an ES+desktop EXT extension
3669e90aed5de82732cc9921f01388d3063a41a053bcommit-bot@chromium.org    if (kGL_GrGLStandard == fStandard) {
367baa9ea10f9b704f42efc804e7401e0aa519b3e29bsalomon@google.com        if (glVer >= GR_GL_VER(4,2) ||
36890313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org            fExtensions.has("GL_ARB_texture_storage") ||
36990313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org            fExtensions.has("GL_EXT_texture_storage")) {
370c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org            if (NULL == fFunctions.fTexStorage2D) {
371adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org                RETURN_FALSE_INTERFACE
372baa9ea10f9b704f42efc804e7401e0aa519b3e29bsalomon@google.com            }
373baa9ea10f9b704f42efc804e7401e0aa519b3e29bsalomon@google.com        }
37490313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org    } else if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_texture_storage")) {
375c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        if (NULL == fFunctions.fTexStorage2D) {
376adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org            RETURN_FALSE_INTERFACE
377baa9ea10f9b704f42efc804e7401e0aa519b3e29bsalomon@google.com        }
378280e99f1a61f2cf66a8ee9b9e6c517f3d2290de7bsalomon@google.com    }
379280e99f1a61f2cf66a8ee9b9e6c517f3d2290de7bsalomon@google.com
38090313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org    if (fExtensions.has("GL_EXT_discard_framebuffer")) {
381a6ffb58b109f71512bde4e14d06a655914578c8drobertphillips@google.com// FIXME: Remove this once Chromium is updated to provide this function
382a6ffb58b109f71512bde4e14d06a655914578c8drobertphillips@google.com#if 0
383c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        if (NULL == fFunctions.fDiscardFramebuffer) {
384adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org            RETURN_FALSE_INTERFACE
385a6ffb58b109f71512bde4e14d06a655914578c8drobertphillips@google.com        }
386a6ffb58b109f71512bde4e14d06a655914578c8drobertphillips@google.com#endif
387a6ffb58b109f71512bde4e14d06a655914578c8drobertphillips@google.com    }
388a6ffb58b109f71512bde4e14d06a655914578c8drobertphillips@google.com
389bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    // FBO MSAA
3909e90aed5de82732cc9921f01388d3063a41a053bcommit-bot@chromium.org    if (kGL_GrGLStandard == fStandard) {
391bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com        // GL 3.0 and the ARB extension have multisample + blit
39290313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org        if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_ARB_framebuffer_object")) {
393c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org            if (NULL == fFunctions.fRenderbufferStorageMultisample ||
394c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fBlitFramebuffer) {
395adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org                RETURN_FALSE_INTERFACE
396bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com            }
397bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com        } else {
39890313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org            if (fExtensions.has("GL_EXT_framebuffer_blit") &&
399c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fBlitFramebuffer) {
400adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org                RETURN_FALSE_INTERFACE
401bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com            }
40290313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org            if (fExtensions.has("GL_EXT_framebuffer_multisample") &&
403c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fRenderbufferStorageMultisample) {
404adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org                RETURN_FALSE_INTERFACE
405bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com            }
406bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com        }
407bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    } else {
40890313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org        if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_CHROMIUM_framebuffer_multisample")) {
409c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org            if (NULL == fFunctions.fRenderbufferStorageMultisample ||
410c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fBlitFramebuffer) {
411adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org                RETURN_FALSE_INTERFACE
412a8e5a06f69b7e0cb17a4b3203f0a7a1d52aa73eccommit-bot@chromium.org            }
413a8e5a06f69b7e0cb17a4b3203f0a7a1d52aa73eccommit-bot@chromium.org        }
41490313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org        if (fExtensions.has("GL_APPLE_framebuffer_multisample")) {
415c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org            if (NULL == fFunctions.fRenderbufferStorageMultisampleES2APPLE ||
416c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fResolveMultisampleFramebuffer) {
417adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org                RETURN_FALSE_INTERFACE
418bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com            }
419bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com        }
42090313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org        if (fExtensions.has("GL_IMG_multisampled_render_to_texture") ||
42190313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org            fExtensions.has("GL_EXT_multisampled_render_to_texture")) {
422c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org            if (NULL == fFunctions.fRenderbufferStorageMultisampleES2EXT ||
423c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fFramebufferTexture2DMultisample) {
424adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org                RETURN_FALSE_INTERFACE
425f3a60c09b975f50bbd14215df10effffd2fd46e8bsalomon@google.com            }
426f3a60c09b975f50bbd14215df10effffd2fd46e8bsalomon@google.com        }
427bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    }
428bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com
429bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    // On ES buffer mapping is an extension. On Desktop
430bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    // buffer mapping was part of original VBO extension
431bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    // which we require.
43290313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org    if (kGL_GrGLStandard == fStandard || fExtensions.has("GL_OES_mapbuffer")) {
433c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        if (NULL == fFunctions.fMapBuffer ||
434c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org            NULL == fFunctions.fUnmapBuffer) {
435adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org            RETURN_FALSE_INTERFACE
436bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com        }
437bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    }
438bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com
439271cffc77bd2fcb3458559e509634442517ca1e9bsalomon@google.com    // Dual source blending
4409e90aed5de82732cc9921f01388d3063a41a053bcommit-bot@chromium.org    if (kGL_GrGLStandard == fStandard &&
44190313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org        (glVer >= GR_GL_VER(3,3) || fExtensions.has("GL_ARB_blend_func_extended"))) {
442c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        if (NULL == fFunctions.fBindFragDataLocationIndexed) {
443adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org            RETURN_FALSE_INTERFACE
444271cffc77bd2fcb3458559e509634442517ca1e9bsalomon@google.com        }
445271cffc77bd2fcb3458559e509634442517ca1e9bsalomon@google.com    }
44612eea2b10d6caaafe0a207d10b1e9322510983a2skia.committer@gmail.com
447726e621000582e4de7c9ce0f7e9950c3af4e5d9bcommit-bot@chromium.org    // glGetStringi was added in version 3.0 of both desktop and ES.
448726e621000582e4de7c9ce0f7e9950c3af4e5d9bcommit-bot@chromium.org    if (glVer >= GR_GL_VER(3, 0)) {
449c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org        if (NULL == fFunctions.fGetStringi) {
450adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org            RETURN_FALSE_INTERFACE
4511744f97ea73384b9f75b0ccee0a36a213c681d3absalomon@google.com        }
4521744f97ea73384b9f75b0ccee0a36a213c681d3absalomon@google.com    }
453271cffc77bd2fcb3458559e509634442517ca1e9bsalomon@google.com
4549e90aed5de82732cc9921f01388d3063a41a053bcommit-bot@chromium.org    if (kGL_GrGLStandard == fStandard) {
45590313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org        if (glVer >= GR_GL_VER(3, 0) || fExtensions.has("GL_ARB_vertex_array_object")) {
456c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org            if (NULL == fFunctions.fBindVertexArray ||
457c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fDeleteVertexArrays ||
458c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGenVertexArrays) {
459adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org                RETURN_FALSE_INTERFACE
460ecd84842b3f65918eb040c53391172b6413fd7adbsalomon@google.com            }
461ecd84842b3f65918eb040c53391172b6413fd7adbsalomon@google.com        }
462ecd84842b3f65918eb040c53391172b6413fd7adbsalomon@google.com    } else {
46390313cc36a6f43a3e9d3818aca536cd6631c222bcommit-bot@chromium.org        if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_OES_vertex_array_object")) {
464c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org            if (NULL == fFunctions.fBindVertexArray ||
465c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fDeleteVertexArrays ||
466c72425ae368bfcb47de7d2532eb90d305ec0d1cfcommit-bot@chromium.org                NULL == fFunctions.fGenVertexArrays) {
467adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org                RETURN_FALSE_INTERFACE
468ecd84842b3f65918eb040c53391172b6413fd7adbsalomon@google.com            }
469ecd84842b3f65918eb040c53391172b6413fd7adbsalomon@google.com        }
470ecd84842b3f65918eb040c53391172b6413fd7adbsalomon@google.com    }
471a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org
472a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org    if (fExtensions.has("GL_EXT_debug_marker")) {
473a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org        if (NULL == fFunctions.fInsertEventMarker ||
474a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org            NULL == fFunctions.fPushGroupMarker ||
475a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org            NULL == fFunctions.fPopGroupMarker) {
476adadf7c31f964fb98a64d1f59c18fa099888cae5commit-bot@chromium.org            RETURN_FALSE_INTERFACE
477a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org        }
478a3baf3be0e2a3128fb73bd41d40d130f75a4dc86commit-bot@chromium.org    }
479a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com
480a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com#if 0 // This can be enabled once Chromium is updated to set these functions pointers.
481a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com    if ((kGL_GrGLStandard == fStandard) || fExtensions.has("GL_ARB_invalidate_subdata")) {
482a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com        if (NULL == fFunctions.fInvalidateBufferData ||
483a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com            NULL == fFunctions.fInvalidateBufferSubData ||
484a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com            NULL == fFunctions.fInvalidateFramebuffer ||
485a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com            NULL == fFunctions.fInvalidateSubFramebuffer ||
486a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com            NULL == fFunctions.fInvalidateTexImage ||
487a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com            NULL == fFunctions.fInvalidateTexSubImage) {
488a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com            RETURN_FALSE_INTERFACE;
489a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com        }
490a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com    } else if (glVer >= GR_GL_VER(3,0)) {
491a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com        // ES 3.0 adds the framebuffer functions but not the others.
492a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com        if (NULL == fFunctions.fInvalidateFramebuffer ||
493a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com            NULL == fFunctions.fInvalidateSubFramebuffer) {
494a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com            RETURN_FALSE_INTERFACE;
495a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com        }
496a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com    }
497beb8b3a4da83ce30e313e72ae0e444870acecb7ecommit-bot@chromium.org
498beb8b3a4da83ce30e313e72ae0e444870acecb7ecommit-bot@chromium.org    if (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_CHROMIUM_map_sub")) {
499beb8b3a4da83ce30e313e72ae0e444870acecb7ecommit-bot@chromium.org        if (NULL == fFunctions.fMapBufferSubData ||
500beb8b3a4da83ce30e313e72ae0e444870acecb7ecommit-bot@chromium.org            NULL == fFunctions.fMapTexSubImage2D ||
501beb8b3a4da83ce30e313e72ae0e444870acecb7ecommit-bot@chromium.org            NULL == fFunctions.fUnmapBufferSubData ||
502beb8b3a4da83ce30e313e72ae0e444870acecb7ecommit-bot@chromium.org            NULL == fFunctions.fUnmapTexSubImage2D) {
503beb8b3a4da83ce30e313e72ae0e444870acecb7ecommit-bot@chromium.org            RETURN_FALSE_INTERFACE;
504beb8b3a4da83ce30e313e72ae0e444870acecb7ecommit-bot@chromium.org        }
505beb8b3a4da83ce30e313e72ae0e444870acecb7ecommit-bot@chromium.org    }
506a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com#endif
507a34bb60c4e319f2289106d519544fe09d43eabd5bsalomon@google.com
508bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com    return true;
509bf2a46941e8fdebfcd24ea8f7184779021898225bsalomon@google.com}
510