blob: 50b1828399944705022b523fa146f7036e203810 [file] [log] [blame]
bsalomon@google.com74913722011-10-27 20:44:19 +00001/*
2 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8
tomhudson@google.com6bf38b52012-02-14 15:11:59 +00009#include "gl/GrGLInterface.h"
bsalomon@google.com91bcc942012-05-07 17:28:41 +000010#include "GrGLDefines.h"
bsalomon@google.com21cbec42013-01-07 17:23:00 +000011#include "SkTDArray.h"
bsalomon@google.com8f943612013-02-26 14:34:43 +000012#include "GrGLNoOpInterface.h"
13
14// Functions not declared in GrGLBogusInterface.h (not common with the Debug GL interface).
bsalomon@google.com74913722011-10-27 20:44:19 +000015
caryclark@google.comcf6285b2012-06-06 12:09:01 +000016namespace { // added to suppress 'no previous prototype' warning
17
robertphillips@google.comd6543e52013-07-18 17:39:14 +000018class GrBufferObj {
19public:
20 GrBufferObj(GrGLuint id) : fID(id), fDataPtr(NULL), fSize(0), fMapped(false) {
21 }
22 ~GrBufferObj() { SkDELETE_ARRAY(fDataPtr); }
23
robertphillips@google.comae6b7772013-07-18 18:07:39 +000024 void allocate(GrGLsizeiptr size, const GrGLchar* dataPtr) {
robertphillips@google.comd6543e52013-07-18 17:39:14 +000025 if (NULL != fDataPtr) {
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +000026 SkASSERT(0 != fSize);
robertphillips@google.comd6543e52013-07-18 17:39:14 +000027 SkDELETE_ARRAY(fDataPtr);
28 }
29
30 fSize = size;
31 fDataPtr = SkNEW_ARRAY(char, size);
32 }
33
34 GrGLuint id() const { return fID; }
35 GrGLchar* dataPtr() { return fDataPtr; }
robertphillips@google.comae6b7772013-07-18 18:07:39 +000036 GrGLsizeiptr size() const { return fSize; }
robertphillips@google.comd6543e52013-07-18 17:39:14 +000037
38 void setMapped(bool mapped) { fMapped = mapped; }
39 bool mapped() const { return fMapped; }
40
41private:
42 GrGLuint fID;
43 GrGLchar* fDataPtr;
robertphillips@google.comae6b7772013-07-18 18:07:39 +000044 GrGLsizeiptr fSize; // size in bytes
robertphillips@google.comd6543e52013-07-18 17:39:14 +000045 bool fMapped;
46};
47
48// In debug builds we do asserts that ensure we agree with GL about when a buffer
49// is mapped.
50static SkTDArray<GrBufferObj*> gBuffers; // slot 0 is reserved for head of free list
51static GrGLuint gCurrArrayBuffer;
52static GrGLuint gCurrElementArrayBuffer;
53
54static GrBufferObj* look_up(GrGLuint id) {
55 GrBufferObj* buffer = gBuffers[id];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +000056 SkASSERT(NULL != buffer && buffer->id() == id);
robertphillips@google.comd6543e52013-07-18 17:39:14 +000057 return buffer;
58}
59
60static GrBufferObj* create_buffer() {
61 if (0 == gBuffers.count()) {
62 // slot zero is reserved for the head of the free list
63 *gBuffers.append() = NULL;
64 }
65
66 GrGLuint id;
67 GrBufferObj* buffer;
68
69 if (NULL == gBuffers[0]) {
70 // no free slots - create a new one
71 id = gBuffers.count();
72 buffer = SkNEW_ARGS(GrBufferObj, (id));
73 gBuffers.append(1, &buffer);
74 } else {
75 // recycle a slot from the free list
robertphillips@google.comae6b7772013-07-18 18:07:39 +000076 id = SkTCast<GrGLuint>(gBuffers[0]);
robertphillips@google.comd6543e52013-07-18 17:39:14 +000077 gBuffers[0] = gBuffers[id];
78
79 buffer = SkNEW_ARGS(GrBufferObj, (id));
80 gBuffers[id] = buffer;
81 }
82
83 return buffer;
84}
85
86static void delete_buffer(GrBufferObj* buffer) {
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +000087 SkASSERT(gBuffers.count() > 0);
robertphillips@google.comd6543e52013-07-18 17:39:14 +000088
89 GrGLuint id = buffer->id();
90 SkDELETE(buffer);
91
92 // Add this slot to the free list
93 gBuffers[id] = gBuffers[0];
robertphillips@google.comd6bcfa32013-07-18 18:33:39 +000094 gBuffers[0] = SkTCast<GrBufferObj*>((const void*)(intptr_t)id);
robertphillips@google.comd6543e52013-07-18 17:39:14 +000095}
96
bsalomon@google.com74913722011-10-27 20:44:19 +000097GrGLvoid GR_GL_FUNCTION_TYPE nullGLActiveTexture(GrGLenum texture) {}
98GrGLvoid GR_GL_FUNCTION_TYPE nullGLAttachShader(GrGLuint program, GrGLuint shader) {}
99GrGLvoid GR_GL_FUNCTION_TYPE nullGLBeginQuery(GrGLenum target, GrGLuint id) {}
100GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindAttribLocation(GrGLuint program, GrGLuint index, const char* name) {}
101GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindTexture(GrGLenum target, GrGLuint texture) {}
bsalomon@google.comecd84842013-03-01 15:36:02 +0000102GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindVertexArray(GrGLuint id) {}
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000103
104GrGLvoid GR_GL_FUNCTION_TYPE nullGLGenBuffers(GrGLsizei n, GrGLuint* ids) {
105
106 for (int i = 0; i < n; ++i) {
107 GrBufferObj* buffer = create_buffer();
108 ids[i] = buffer->id();
109 }
110}
111
commit-bot@chromium.orgcffff792013-07-26 16:36:04 +0000112GrGLvoid GR_GL_FUNCTION_TYPE nullGLGenerateMipmap(GrGLenum target) {}
113
skia.committer@gmail.coma7991982013-07-19 07:00:57 +0000114GrGLvoid GR_GL_FUNCTION_TYPE nullGLBufferData(GrGLenum target,
115 GrGLsizeiptr size,
116 const GrGLvoid* data,
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000117 GrGLenum usage) {
118 GrGLuint id = 0;
119
120 switch (target) {
121 case GR_GL_ARRAY_BUFFER:
122 id = gCurrArrayBuffer;
123 break;
124 case GR_GL_ELEMENT_ARRAY_BUFFER:
125 id = gCurrElementArrayBuffer;
126 break;
127 default:
128 GrCrash("Unexpected target to nullGLBufferData");
129 break;
130 }
131
132 if (id > 0) {
133 GrBufferObj* buffer = look_up(id);
134 buffer->allocate(size, (const GrGLchar*) data);
135 }
136}
137
bsalomon@google.com74913722011-10-27 20:44:19 +0000138GrGLvoid GR_GL_FUNCTION_TYPE nullGLPixelStorei(GrGLenum pname, GrGLint param) {}
bsalomon@google.com74913722011-10-27 20:44:19 +0000139GrGLvoid GR_GL_FUNCTION_TYPE nullGLReadPixels(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLvoid* pixels) {}
bsalomon@google.com74913722011-10-27 20:44:19 +0000140GrGLvoid GR_GL_FUNCTION_TYPE nullGLUseProgram(GrGLuint program) {}
bsalomon@google.com74913722011-10-27 20:44:19 +0000141GrGLvoid GR_GL_FUNCTION_TYPE nullGLViewport(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {}
142GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindFramebuffer(GrGLenum target, GrGLuint framebuffer) {}
143GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindRenderbuffer(GrGLenum target, GrGLuint renderbuffer) {}
144GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteFramebuffers(GrGLsizei n, const GrGLuint *framebuffers) {}
145GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteRenderbuffers(GrGLsizei n, const GrGLuint *renderbuffers) {}
146GrGLvoid GR_GL_FUNCTION_TYPE nullGLFramebufferRenderbuffer(GrGLenum target, GrGLenum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer) {}
147GrGLvoid GR_GL_FUNCTION_TYPE nullGLFramebufferTexture2D(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level) {}
bsalomon@google.com74913722011-10-27 20:44:19 +0000148
149GrGLuint GR_GL_FUNCTION_TYPE nullGLCreateProgram() {
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000150 static GrGLuint gCurrID = 0;
bsalomon@google.com74913722011-10-27 20:44:19 +0000151 return ++gCurrID;
152}
153
154GrGLuint GR_GL_FUNCTION_TYPE nullGLCreateShader(GrGLenum type) {
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000155 static GrGLuint gCurrID = 0;
bsalomon@google.com74913722011-10-27 20:44:19 +0000156 return ++gCurrID;
157}
158
159// same delete used for shaders and programs
160GrGLvoid GR_GL_FUNCTION_TYPE nullGLDelete(GrGLuint program) {
161}
162
bsalomon@google.com74913722011-10-27 20:44:19 +0000163GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindBuffer(GrGLenum target, GrGLuint buffer) {
164 switch (target) {
165 case GR_GL_ARRAY_BUFFER:
166 gCurrArrayBuffer = buffer;
167 break;
168 case GR_GL_ELEMENT_ARRAY_BUFFER:
169 gCurrElementArrayBuffer = buffer;
170 break;
171 }
172}
173
174// deleting a bound buffer has the side effect of binding 0
175GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteBuffers(GrGLsizei n, const GrGLuint* ids) {
176 for (int i = 0; i < n; ++i) {
177 if (ids[i] == gCurrArrayBuffer) {
178 gCurrArrayBuffer = 0;
179 }
180 if (ids[i] == gCurrElementArrayBuffer) {
181 gCurrElementArrayBuffer = 0;
182 }
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000183
184 GrBufferObj* buffer = look_up(ids[i]);
185 delete_buffer(buffer);
bsalomon@google.com74913722011-10-27 20:44:19 +0000186 }
187}
188
189GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBuffer(GrGLenum target, GrGLenum access) {
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000190
191 GrGLuint id = 0;
bsalomon@google.com74913722011-10-27 20:44:19 +0000192 switch (target) {
193 case GR_GL_ARRAY_BUFFER:
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000194 id = gCurrArrayBuffer;
bsalomon@google.com74913722011-10-27 20:44:19 +0000195 break;
196 case GR_GL_ELEMENT_ARRAY_BUFFER:
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000197 id = gCurrElementArrayBuffer;
bsalomon@google.com74913722011-10-27 20:44:19 +0000198 break;
199 }
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000200
201 if (id > 0) {
202 GrBufferObj* buffer = look_up(id);
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000203 SkASSERT(!buffer->mapped());
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000204 buffer->setMapped(true);
205 return buffer->dataPtr();
bsalomon@google.com74913722011-10-27 20:44:19 +0000206 }
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000207
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000208 SkASSERT(false);
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000209 return NULL; // no buffer bound to target
bsalomon@google.com74913722011-10-27 20:44:19 +0000210}
211
212GrGLboolean GR_GL_FUNCTION_TYPE nullGLUnmapBuffer(GrGLenum target) {
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000213 GrGLuint id = 0;
bsalomon@google.com74913722011-10-27 20:44:19 +0000214 switch (target) {
215 case GR_GL_ARRAY_BUFFER:
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000216 id = gCurrArrayBuffer;
bsalomon@google.com74913722011-10-27 20:44:19 +0000217 break;
218 case GR_GL_ELEMENT_ARRAY_BUFFER:
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000219 id = gCurrElementArrayBuffer;
bsalomon@google.com74913722011-10-27 20:44:19 +0000220 break;
221 }
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000222 if (id > 0) {
223 GrBufferObj* buffer = look_up(id);
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000224 SkASSERT(buffer->mapped());
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000225 buffer->setMapped(false);
226 return GR_GL_TRUE;
bsalomon@google.com74913722011-10-27 20:44:19 +0000227 }
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000228
229 GrAlwaysAssert(false);
230 return GR_GL_FALSE; // GR_GL_INVALID_OPERATION;
bsalomon@google.com74913722011-10-27 20:44:19 +0000231}
232
233GrGLvoid GR_GL_FUNCTION_TYPE nullGLGetBufferParameteriv(GrGLenum target, GrGLenum pname, GrGLint* params) {
234 switch (pname) {
235 case GR_GL_BUFFER_MAPPED: {
236 *params = GR_GL_FALSE;
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000237 GrGLuint id = 0;
bsalomon@google.com74913722011-10-27 20:44:19 +0000238 switch (target) {
239 case GR_GL_ARRAY_BUFFER:
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000240 id = gCurrArrayBuffer;
bsalomon@google.com74913722011-10-27 20:44:19 +0000241 break;
242 case GR_GL_ELEMENT_ARRAY_BUFFER:
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000243 id = gCurrElementArrayBuffer;
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000244 break;
bsalomon@google.com74913722011-10-27 20:44:19 +0000245 }
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000246 if (id > 0) {
247 GrBufferObj* buffer = look_up(id);
248 if (buffer->mapped()) {
249 *params = GR_GL_TRUE;
bsalomon@google.com74913722011-10-27 20:44:19 +0000250 }
251 }
252 break; }
253 default:
254 GrCrash("Unexpected pname to GetBufferParamateriv");
255 break;
256 }
257};
258
caryclark@google.comcf6285b2012-06-06 12:09:01 +0000259} // end anonymous namespace
260
bsalomon@google.com74913722011-10-27 20:44:19 +0000261const GrGLInterface* GrGLCreateNullInterface() {
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000262 // The gl functions are not context-specific so we create one global
bsalomon@google.com74913722011-10-27 20:44:19 +0000263 // interface
264 static SkAutoTUnref<GrGLInterface> glInterface;
265 if (!glInterface.get()) {
tomhudson@google.comc377baf2012-07-09 20:17:56 +0000266 GrGLInterface* interface = SkNEW(GrGLInterface);
bsalomon@google.com74913722011-10-27 20:44:19 +0000267 glInterface.reset(interface);
commit-bot@chromium.orgc72425a2014-01-21 16:09:18 +0000268
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +0000269 interface->fStandard = kGL_GrGLStandard;
commit-bot@chromium.orgc72425a2014-01-21 16:09:18 +0000270
271 GrGLInterface::Functions* functions = &interface->fFunctions;
272 functions->fActiveTexture = nullGLActiveTexture;
273 functions->fAttachShader = nullGLAttachShader;
274 functions->fBeginQuery = nullGLBeginQuery;
275 functions->fBindAttribLocation = nullGLBindAttribLocation;
276 functions->fBindBuffer = nullGLBindBuffer;
277 functions->fBindFragDataLocation = noOpGLBindFragDataLocation;
278 functions->fBindTexture = nullGLBindTexture;
279 functions->fBindVertexArray = nullGLBindVertexArray;
280 functions->fBlendColor = noOpGLBlendColor;
281 functions->fBlendFunc = noOpGLBlendFunc;
282 functions->fBufferData = nullGLBufferData;
283 functions->fBufferSubData = noOpGLBufferSubData;
284 functions->fClear = noOpGLClear;
285 functions->fClearColor = noOpGLClearColor;
286 functions->fClearStencil = noOpGLClearStencil;
commit-bot@chromium.orgc72425a2014-01-21 16:09:18 +0000287 functions->fColorMask = noOpGLColorMask;
288 functions->fCompileShader = noOpGLCompileShader;
289 functions->fCompressedTexImage2D = noOpGLCompressedTexImage2D;
290 functions->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D;
291 functions->fCreateProgram = nullGLCreateProgram;
292 functions->fCreateShader = nullGLCreateShader;
293 functions->fCullFace = noOpGLCullFace;
294 functions->fDeleteBuffers = nullGLDeleteBuffers;
295 functions->fDeleteProgram = nullGLDelete;
296 functions->fDeleteQueries = noOpGLDeleteIds;
297 functions->fDeleteShader = nullGLDelete;
298 functions->fDeleteTextures = noOpGLDeleteIds;
299 functions->fDeleteVertexArrays = noOpGLDeleteIds;
300 functions->fDepthMask = noOpGLDepthMask;
301 functions->fDisable = noOpGLDisable;
commit-bot@chromium.orgc72425a2014-01-21 16:09:18 +0000302 functions->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray;
303 functions->fDrawArrays = noOpGLDrawArrays;
304 functions->fDrawBuffer = noOpGLDrawBuffer;
305 functions->fDrawBuffers = noOpGLDrawBuffers;
306 functions->fDrawElements = noOpGLDrawElements;
307 functions->fEnable = noOpGLEnable;
commit-bot@chromium.orgc72425a2014-01-21 16:09:18 +0000308 functions->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray;
309 functions->fEndQuery = noOpGLEndQuery;
310 functions->fFinish = noOpGLFinish;
311 functions->fFlush = noOpGLFlush;
312 functions->fFrontFace = noOpGLFrontFace;
313 functions->fGenBuffers = nullGLGenBuffers;
314 functions->fGenerateMipmap = nullGLGenerateMipmap;
315 functions->fGenQueries = noOpGLGenIds;
316 functions->fGenTextures = noOpGLGenIds;
317 functions->fGenVertexArrays = noOpGLGenIds;
318 functions->fGetBufferParameteriv = nullGLGetBufferParameteriv;
319 functions->fGetError = noOpGLGetError;
320 functions->fGetIntegerv = noOpGLGetIntegerv;
321 functions->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v;
322 functions->fGetQueryObjectiv = noOpGLGetQueryObjectiv;
323 functions->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v;
324 functions->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv;
325 functions->fGetQueryiv = noOpGLGetQueryiv;
326 functions->fGetProgramInfoLog = noOpGLGetInfoLog;
327 functions->fGetProgramiv = noOpGLGetShaderOrProgramiv;
328 functions->fGetShaderInfoLog = noOpGLGetInfoLog;
329 functions->fGetShaderiv = noOpGLGetShaderOrProgramiv;
330 functions->fGetString = noOpGLGetString;
331 functions->fGetStringi = noOpGLGetStringi;
332 functions->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv;
333 functions->fGetUniformLocation = noOpGLGetUniformLocation;
commit-bot@chromium.orga3baf3b2014-02-21 18:45:30 +0000334 functions->fInsertEventMarker = noOpGLInsertEventMarker;
commit-bot@chromium.orgc72425a2014-01-21 16:09:18 +0000335 functions->fLoadIdentity = noOpGLLoadIdentity;
336 functions->fLoadMatrixf = noOpGLLoadMatrixf;
337 functions->fLineWidth = noOpGLLineWidth;
338 functions->fLinkProgram = noOpGLLinkProgram;
339 functions->fMatrixMode = noOpGLMatrixMode;
340 functions->fPixelStorei = nullGLPixelStorei;
commit-bot@chromium.orga3baf3b2014-02-21 18:45:30 +0000341 functions->fPopGroupMarker = noOpGLPopGroupMarker;
342 functions->fPushGroupMarker = noOpGLPushGroupMarker;
commit-bot@chromium.orgc72425a2014-01-21 16:09:18 +0000343 functions->fQueryCounter = noOpGLQueryCounter;
344 functions->fReadBuffer = noOpGLReadBuffer;
345 functions->fReadPixels = nullGLReadPixels;
346 functions->fScissor = noOpGLScissor;
347 functions->fShaderSource = noOpGLShaderSource;
348 functions->fStencilFunc = noOpGLStencilFunc;
349 functions->fStencilFuncSeparate = noOpGLStencilFuncSeparate;
350 functions->fStencilMask = noOpGLStencilMask;
351 functions->fStencilMaskSeparate = noOpGLStencilMaskSeparate;
352 functions->fStencilOp = noOpGLStencilOp;
353 functions->fStencilOpSeparate = noOpGLStencilOpSeparate;
commit-bot@chromium.orgc72425a2014-01-21 16:09:18 +0000354 functions->fTexGenfv = noOpGLTexGenfv;
355 functions->fTexGeni = noOpGLTexGeni;
356 functions->fTexImage2D = noOpGLTexImage2D;
357 functions->fTexParameteri = noOpGLTexParameteri;
358 functions->fTexParameteriv = noOpGLTexParameteriv;
359 functions->fTexSubImage2D = noOpGLTexSubImage2D;
360 functions->fTexStorage2D = noOpGLTexStorage2D;
361 functions->fDiscardFramebuffer = noOpGLDiscardFramebuffer;
362 functions->fUniform1f = noOpGLUniform1f;
363 functions->fUniform1i = noOpGLUniform1i;
364 functions->fUniform1fv = noOpGLUniform1fv;
365 functions->fUniform1iv = noOpGLUniform1iv;
366 functions->fUniform2f = noOpGLUniform2f;
367 functions->fUniform2i = noOpGLUniform2i;
368 functions->fUniform2fv = noOpGLUniform2fv;
369 functions->fUniform2iv = noOpGLUniform2iv;
370 functions->fUniform3f = noOpGLUniform3f;
371 functions->fUniform3i = noOpGLUniform3i;
372 functions->fUniform3fv = noOpGLUniform3fv;
373 functions->fUniform3iv = noOpGLUniform3iv;
374 functions->fUniform4f = noOpGLUniform4f;
375 functions->fUniform4i = noOpGLUniform4i;
376 functions->fUniform4fv = noOpGLUniform4fv;
377 functions->fUniform4iv = noOpGLUniform4iv;
378 functions->fUniformMatrix2fv = noOpGLUniformMatrix2fv;
379 functions->fUniformMatrix3fv = noOpGLUniformMatrix3fv;
380 functions->fUniformMatrix4fv = noOpGLUniformMatrix4fv;
381 functions->fUseProgram = nullGLUseProgram;
382 functions->fVertexAttrib4fv = noOpGLVertexAttrib4fv;
383 functions->fVertexAttribPointer = noOpGLVertexAttribPointer;
commit-bot@chromium.orgc72425a2014-01-21 16:09:18 +0000384 functions->fViewport = nullGLViewport;
385 functions->fBindFramebuffer = nullGLBindFramebuffer;
386 functions->fBindRenderbuffer = nullGLBindRenderbuffer;
387 functions->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus;
388 functions->fDeleteFramebuffers = nullGLDeleteFramebuffers;
389 functions->fDeleteRenderbuffers = nullGLDeleteRenderbuffers;
390 functions->fFramebufferRenderbuffer = nullGLFramebufferRenderbuffer;
391 functions->fFramebufferTexture2D = nullGLFramebufferTexture2D;
392 functions->fGenFramebuffers = noOpGLGenIds;
393 functions->fGenRenderbuffers = noOpGLGenIds;
394 functions->fGetFramebufferAttachmentParameteriv = noOpGLGetFramebufferAttachmentParameteriv;
395 functions->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteriv;
396 functions->fRenderbufferStorage = noOpGLRenderbufferStorage;
397 functions->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMultisample;
398 functions->fBlitFramebuffer = noOpGLBlitFramebuffer;
399 functions->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuffer;
400 functions->fMapBuffer = nullGLMapBuffer;
401 functions->fUnmapBuffer = nullGLUnmapBuffer;
402 functions->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed;
bsalomon@google.com74913722011-10-27 20:44:19 +0000403 }
404 glInterface.get()->ref();
405 return glInterface.get();
406}