blob: f01133453a6c6bb43f0dfcfb482415d20de9e092 [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) {
26 GrAssert(0 != fSize);
27 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];
56 GrAssert(NULL != buffer && buffer->id() == id);
57 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) {
87 GrAssert(gBuffers.count() > 0);
88
89 GrGLuint id = buffer->id();
90 SkDELETE(buffer);
91
92 // Add this slot to the free list
93 gBuffers[id] = gBuffers[0];
94 gBuffers[0] = (GrBufferObj*) id;
95}
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
112GrGLvoid GR_GL_FUNCTION_TYPE nullGLBufferData(GrGLenum target,
113 GrGLsizeiptr size,
114 const GrGLvoid* data,
115 GrGLenum usage) {
116 GrGLuint id = 0;
117
118 switch (target) {
119 case GR_GL_ARRAY_BUFFER:
120 id = gCurrArrayBuffer;
121 break;
122 case GR_GL_ELEMENT_ARRAY_BUFFER:
123 id = gCurrElementArrayBuffer;
124 break;
125 default:
126 GrCrash("Unexpected target to nullGLBufferData");
127 break;
128 }
129
130 if (id > 0) {
131 GrBufferObj* buffer = look_up(id);
132 buffer->allocate(size, (const GrGLchar*) data);
133 }
134}
135
bsalomon@google.com74913722011-10-27 20:44:19 +0000136GrGLvoid GR_GL_FUNCTION_TYPE nullGLPixelStorei(GrGLenum pname, GrGLint param) {}
bsalomon@google.com74913722011-10-27 20:44:19 +0000137GrGLvoid 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 +0000138GrGLvoid GR_GL_FUNCTION_TYPE nullGLUseProgram(GrGLuint program) {}
bsalomon@google.com74913722011-10-27 20:44:19 +0000139GrGLvoid GR_GL_FUNCTION_TYPE nullGLViewport(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {}
140GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindFramebuffer(GrGLenum target, GrGLuint framebuffer) {}
141GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindRenderbuffer(GrGLenum target, GrGLuint renderbuffer) {}
142GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteFramebuffers(GrGLsizei n, const GrGLuint *framebuffers) {}
143GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteRenderbuffers(GrGLsizei n, const GrGLuint *renderbuffers) {}
144GrGLvoid GR_GL_FUNCTION_TYPE nullGLFramebufferRenderbuffer(GrGLenum target, GrGLenum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer) {}
145GrGLvoid GR_GL_FUNCTION_TYPE nullGLFramebufferTexture2D(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level) {}
bsalomon@google.com74913722011-10-27 20:44:19 +0000146
147GrGLuint GR_GL_FUNCTION_TYPE nullGLCreateProgram() {
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000148 static GrGLuint gCurrID = 0;
bsalomon@google.com74913722011-10-27 20:44:19 +0000149 return ++gCurrID;
150}
151
152GrGLuint GR_GL_FUNCTION_TYPE nullGLCreateShader(GrGLenum type) {
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000153 static GrGLuint gCurrID = 0;
bsalomon@google.com74913722011-10-27 20:44:19 +0000154 return ++gCurrID;
155}
156
157// same delete used for shaders and programs
158GrGLvoid GR_GL_FUNCTION_TYPE nullGLDelete(GrGLuint program) {
159}
160
bsalomon@google.com74913722011-10-27 20:44:19 +0000161GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindBuffer(GrGLenum target, GrGLuint buffer) {
162 switch (target) {
163 case GR_GL_ARRAY_BUFFER:
164 gCurrArrayBuffer = buffer;
165 break;
166 case GR_GL_ELEMENT_ARRAY_BUFFER:
167 gCurrElementArrayBuffer = buffer;
168 break;
169 }
170}
171
172// deleting a bound buffer has the side effect of binding 0
173GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteBuffers(GrGLsizei n, const GrGLuint* ids) {
174 for (int i = 0; i < n; ++i) {
175 if (ids[i] == gCurrArrayBuffer) {
176 gCurrArrayBuffer = 0;
177 }
178 if (ids[i] == gCurrElementArrayBuffer) {
179 gCurrElementArrayBuffer = 0;
180 }
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000181
182 GrBufferObj* buffer = look_up(ids[i]);
183 delete_buffer(buffer);
bsalomon@google.com74913722011-10-27 20:44:19 +0000184 }
185}
186
187GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBuffer(GrGLenum target, GrGLenum access) {
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000188
189 GrGLuint id = 0;
bsalomon@google.com74913722011-10-27 20:44:19 +0000190 switch (target) {
191 case GR_GL_ARRAY_BUFFER:
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000192 id = gCurrArrayBuffer;
bsalomon@google.com74913722011-10-27 20:44:19 +0000193 break;
194 case GR_GL_ELEMENT_ARRAY_BUFFER:
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000195 id = gCurrElementArrayBuffer;
bsalomon@google.com74913722011-10-27 20:44:19 +0000196 break;
197 }
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000198
199 if (id > 0) {
200 GrBufferObj* buffer = look_up(id);
201 GrAssert(!buffer->mapped());
202 buffer->setMapped(true);
203 return buffer->dataPtr();
bsalomon@google.com74913722011-10-27 20:44:19 +0000204 }
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000205
206 GrAssert(false);
207 return NULL; // no buffer bound to target
bsalomon@google.com74913722011-10-27 20:44:19 +0000208}
209
210GrGLboolean GR_GL_FUNCTION_TYPE nullGLUnmapBuffer(GrGLenum target) {
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000211 GrGLuint id = 0;
bsalomon@google.com74913722011-10-27 20:44:19 +0000212 switch (target) {
213 case GR_GL_ARRAY_BUFFER:
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000214 id = gCurrArrayBuffer;
bsalomon@google.com74913722011-10-27 20:44:19 +0000215 break;
216 case GR_GL_ELEMENT_ARRAY_BUFFER:
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000217 id = gCurrElementArrayBuffer;
bsalomon@google.com74913722011-10-27 20:44:19 +0000218 break;
219 }
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000220 if (id > 0) {
221 GrBufferObj* buffer = look_up(id);
222 GrAssert(buffer->mapped());
223 buffer->setMapped(false);
224 return GR_GL_TRUE;
bsalomon@google.com74913722011-10-27 20:44:19 +0000225 }
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000226
227 GrAlwaysAssert(false);
228 return GR_GL_FALSE; // GR_GL_INVALID_OPERATION;
bsalomon@google.com74913722011-10-27 20:44:19 +0000229}
230
231GrGLvoid GR_GL_FUNCTION_TYPE nullGLGetBufferParameteriv(GrGLenum target, GrGLenum pname, GrGLint* params) {
232 switch (pname) {
233 case GR_GL_BUFFER_MAPPED: {
234 *params = GR_GL_FALSE;
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000235 GrGLuint id = 0;
bsalomon@google.com74913722011-10-27 20:44:19 +0000236 switch (target) {
237 case GR_GL_ARRAY_BUFFER:
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000238 id = gCurrArrayBuffer;
bsalomon@google.com74913722011-10-27 20:44:19 +0000239 break;
240 case GR_GL_ELEMENT_ARRAY_BUFFER:
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000241 id = gCurrElementArrayBuffer;
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000242 break;
bsalomon@google.com74913722011-10-27 20:44:19 +0000243 }
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000244 if (id > 0) {
245 GrBufferObj* buffer = look_up(id);
246 if (buffer->mapped()) {
247 *params = GR_GL_TRUE;
bsalomon@google.com74913722011-10-27 20:44:19 +0000248 }
249 }
250 break; }
251 default:
252 GrCrash("Unexpected pname to GetBufferParamateriv");
253 break;
254 }
255};
256
caryclark@google.comcf6285b2012-06-06 12:09:01 +0000257} // end anonymous namespace
258
bsalomon@google.com74913722011-10-27 20:44:19 +0000259const GrGLInterface* GrGLCreateNullInterface() {
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000260 // The gl functions are not context-specific so we create one global
bsalomon@google.com74913722011-10-27 20:44:19 +0000261 // interface
262 static SkAutoTUnref<GrGLInterface> glInterface;
263 if (!glInterface.get()) {
tomhudson@google.comc377baf2012-07-09 20:17:56 +0000264 GrGLInterface* interface = SkNEW(GrGLInterface);
bsalomon@google.com74913722011-10-27 20:44:19 +0000265 glInterface.reset(interface);
266 interface->fBindingsExported = kDesktop_GrGLBinding;
267 interface->fActiveTexture = nullGLActiveTexture;
268 interface->fAttachShader = nullGLAttachShader;
269 interface->fBeginQuery = nullGLBeginQuery;
270 interface->fBindAttribLocation = nullGLBindAttribLocation;
271 interface->fBindBuffer = nullGLBindBuffer;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000272 interface->fBindFragDataLocation = noOpGLBindFragDataLocation;
bsalomon@google.com74913722011-10-27 20:44:19 +0000273 interface->fBindTexture = nullGLBindTexture;
bsalomon@google.comecd84842013-03-01 15:36:02 +0000274 interface->fBindVertexArray = nullGLBindVertexArray;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000275 interface->fBlendColor = noOpGLBlendColor;
276 interface->fBlendFunc = noOpGLBlendFunc;
bsalomon@google.com74913722011-10-27 20:44:19 +0000277 interface->fBufferData = nullGLBufferData;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000278 interface->fBufferSubData = noOpGLBufferSubData;
279 interface->fClear = noOpGLClear;
280 interface->fClearColor = noOpGLClearColor;
281 interface->fClearStencil = noOpGLClearStencil;
282 interface->fColorMask = noOpGLColorMask;
283 interface->fCompileShader = noOpGLCompileShader;
284 interface->fCompressedTexImage2D = noOpGLCompressedTexImage2D;
commit-bot@chromium.org98168bb2013-04-11 22:00:34 +0000285 interface->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D;
bsalomon@google.com74913722011-10-27 20:44:19 +0000286 interface->fCreateProgram = nullGLCreateProgram;
287 interface->fCreateShader = nullGLCreateShader;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000288 interface->fCullFace = noOpGLCullFace;
bsalomon@google.com74913722011-10-27 20:44:19 +0000289 interface->fDeleteBuffers = nullGLDeleteBuffers;
290 interface->fDeleteProgram = nullGLDelete;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000291 interface->fDeleteQueries = noOpGLDeleteIds;
bsalomon@google.com74913722011-10-27 20:44:19 +0000292 interface->fDeleteShader = nullGLDelete;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000293 interface->fDeleteTextures = noOpGLDeleteIds;
bsalomon@google.comecd84842013-03-01 15:36:02 +0000294 interface->fDeleteVertexArrays = noOpGLDeleteIds;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000295 interface->fDepthMask = noOpGLDepthMask;
296 interface->fDisable = noOpGLDisable;
297 interface->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray;
298 interface->fDrawArrays = noOpGLDrawArrays;
299 interface->fDrawBuffer = noOpGLDrawBuffer;
300 interface->fDrawBuffers = noOpGLDrawBuffers;
301 interface->fDrawElements = noOpGLDrawElements;
302 interface->fEnable = noOpGLEnable;
303 interface->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray;
304 interface->fEndQuery = noOpGLEndQuery;
305 interface->fFinish = noOpGLFinish;
306 interface->fFlush = noOpGLFlush;
307 interface->fFrontFace = noOpGLFrontFace;
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000308 interface->fGenBuffers = nullGLGenBuffers;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000309 interface->fGenQueries = noOpGLGenIds;
310 interface->fGenTextures = noOpGLGenIds;
bsalomon@google.comecd84842013-03-01 15:36:02 +0000311 interface->fGenVertexArrays = noOpGLGenIds;
bsalomon@google.com74913722011-10-27 20:44:19 +0000312 interface->fGetBufferParameteriv = nullGLGetBufferParameteriv;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000313 interface->fGetError = noOpGLGetError;
314 interface->fGetIntegerv = noOpGLGetIntegerv;
315 interface->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v;
316 interface->fGetQueryObjectiv = noOpGLGetQueryObjectiv;
317 interface->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v;
318 interface->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv;
319 interface->fGetQueryiv = noOpGLGetQueryiv;
320 interface->fGetProgramInfoLog = noOpGLGetInfoLog;
321 interface->fGetProgramiv = noOpGLGetShaderOrProgramiv;
322 interface->fGetShaderInfoLog = noOpGLGetInfoLog;
323 interface->fGetShaderiv = noOpGLGetShaderOrProgramiv;
324 interface->fGetString = noOpGLGetString;
bsalomon@google.com1744f972013-02-26 21:46:32 +0000325 interface->fGetStringi = noOpGLGetStringi;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000326 interface->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv;
327 interface->fGetUniformLocation = noOpGLGetUniformLocation;
328 interface->fLineWidth = noOpGLLineWidth;
329 interface->fLinkProgram = noOpGLLinkProgram;
bsalomon@google.com74913722011-10-27 20:44:19 +0000330 interface->fPixelStorei = nullGLPixelStorei;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000331 interface->fQueryCounter = noOpGLQueryCounter;
332 interface->fReadBuffer = noOpGLReadBuffer;
bsalomon@google.com74913722011-10-27 20:44:19 +0000333 interface->fReadPixels = nullGLReadPixels;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000334 interface->fScissor = noOpGLScissor;
335 interface->fShaderSource = noOpGLShaderSource;
336 interface->fStencilFunc = noOpGLStencilFunc;
337 interface->fStencilFuncSeparate = noOpGLStencilFuncSeparate;
338 interface->fStencilMask = noOpGLStencilMask;
339 interface->fStencilMaskSeparate = noOpGLStencilMaskSeparate;
340 interface->fStencilOp = noOpGLStencilOp;
341 interface->fStencilOpSeparate = noOpGLStencilOpSeparate;
342 interface->fTexImage2D = noOpGLTexImage2D;
343 interface->fTexParameteri = noOpGLTexParameteri;
344 interface->fTexParameteriv = noOpGLTexParameteriv;
345 interface->fTexSubImage2D = noOpGLTexSubImage2D;
346 interface->fTexStorage2D = noOpGLTexStorage2D;
robertphillips@google.coma6ffb582013-04-29 16:50:17 +0000347 interface->fDiscardFramebuffer = noOpGLDiscardFramebuffer;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000348 interface->fUniform1f = noOpGLUniform1f;
349 interface->fUniform1i = noOpGLUniform1i;
350 interface->fUniform1fv = noOpGLUniform1fv;
351 interface->fUniform1iv = noOpGLUniform1iv;
352 interface->fUniform2f = noOpGLUniform2f;
353 interface->fUniform2i = noOpGLUniform2i;
354 interface->fUniform2fv = noOpGLUniform2fv;
355 interface->fUniform2iv = noOpGLUniform2iv;
356 interface->fUniform3f = noOpGLUniform3f;
357 interface->fUniform3i = noOpGLUniform3i;
358 interface->fUniform3fv = noOpGLUniform3fv;
359 interface->fUniform3iv = noOpGLUniform3iv;
360 interface->fUniform4f = noOpGLUniform4f;
361 interface->fUniform4i = noOpGLUniform4i;
362 interface->fUniform4fv = noOpGLUniform4fv;
363 interface->fUniform4iv = noOpGLUniform4iv;
364 interface->fUniformMatrix2fv = noOpGLUniformMatrix2fv;
365 interface->fUniformMatrix3fv = noOpGLUniformMatrix3fv;
366 interface->fUniformMatrix4fv = noOpGLUniformMatrix4fv;
bsalomon@google.com74913722011-10-27 20:44:19 +0000367 interface->fUseProgram = nullGLUseProgram;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000368 interface->fVertexAttrib4fv = noOpGLVertexAttrib4fv;
369 interface->fVertexAttribPointer = noOpGLVertexAttribPointer;
bsalomon@google.com74913722011-10-27 20:44:19 +0000370 interface->fViewport = nullGLViewport;
371 interface->fBindFramebuffer = nullGLBindFramebuffer;
372 interface->fBindRenderbuffer = nullGLBindRenderbuffer;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000373 interface->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus;
bsalomon@google.com74913722011-10-27 20:44:19 +0000374 interface->fDeleteFramebuffers = nullGLDeleteFramebuffers;
375 interface->fDeleteRenderbuffers = nullGLDeleteRenderbuffers;
376 interface->fFramebufferRenderbuffer = nullGLFramebufferRenderbuffer;
377 interface->fFramebufferTexture2D = nullGLFramebufferTexture2D;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000378 interface->fGenFramebuffers = noOpGLGenIds;
379 interface->fGenRenderbuffers = noOpGLGenIds;
380 interface->fGetFramebufferAttachmentParameteriv = noOpGLGetFramebufferAttachmentParameteriv;
381 interface->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteriv;
382 interface->fRenderbufferStorage = noOpGLRenderbufferStorage;
383 interface->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMultisample;
384 interface->fBlitFramebuffer = noOpGLBlitFramebuffer;
385 interface->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuffer;
bsalomon@google.com74913722011-10-27 20:44:19 +0000386 interface->fMapBuffer = nullGLMapBuffer;
387 interface->fUnmapBuffer = nullGLUnmapBuffer;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000388 interface->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed;
bsalomon@google.com74913722011-10-27 20:44:19 +0000389 }
390 glInterface.get()->ref();
391 return glInterface.get();
392}