blob: 0d539c959389cd4377c50c6963076ece0c199b51 [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];
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);
203 GrAssert(!buffer->mapped());
204 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
208 GrAssert(false);
209 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);
224 GrAssert(buffer->mapped());
225 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);
268 interface->fBindingsExported = kDesktop_GrGLBinding;
269 interface->fActiveTexture = nullGLActiveTexture;
270 interface->fAttachShader = nullGLAttachShader;
271 interface->fBeginQuery = nullGLBeginQuery;
272 interface->fBindAttribLocation = nullGLBindAttribLocation;
273 interface->fBindBuffer = nullGLBindBuffer;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000274 interface->fBindFragDataLocation = noOpGLBindFragDataLocation;
bsalomon@google.com74913722011-10-27 20:44:19 +0000275 interface->fBindTexture = nullGLBindTexture;
bsalomon@google.comecd84842013-03-01 15:36:02 +0000276 interface->fBindVertexArray = nullGLBindVertexArray;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000277 interface->fBlendColor = noOpGLBlendColor;
278 interface->fBlendFunc = noOpGLBlendFunc;
bsalomon@google.com74913722011-10-27 20:44:19 +0000279 interface->fBufferData = nullGLBufferData;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000280 interface->fBufferSubData = noOpGLBufferSubData;
281 interface->fClear = noOpGLClear;
282 interface->fClearColor = noOpGLClearColor;
283 interface->fClearStencil = noOpGLClearStencil;
284 interface->fColorMask = noOpGLColorMask;
285 interface->fCompileShader = noOpGLCompileShader;
286 interface->fCompressedTexImage2D = noOpGLCompressedTexImage2D;
commit-bot@chromium.org98168bb2013-04-11 22:00:34 +0000287 interface->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D;
bsalomon@google.com74913722011-10-27 20:44:19 +0000288 interface->fCreateProgram = nullGLCreateProgram;
289 interface->fCreateShader = nullGLCreateShader;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000290 interface->fCullFace = noOpGLCullFace;
bsalomon@google.com74913722011-10-27 20:44:19 +0000291 interface->fDeleteBuffers = nullGLDeleteBuffers;
292 interface->fDeleteProgram = nullGLDelete;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000293 interface->fDeleteQueries = noOpGLDeleteIds;
bsalomon@google.com74913722011-10-27 20:44:19 +0000294 interface->fDeleteShader = nullGLDelete;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000295 interface->fDeleteTextures = noOpGLDeleteIds;
bsalomon@google.comecd84842013-03-01 15:36:02 +0000296 interface->fDeleteVertexArrays = noOpGLDeleteIds;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000297 interface->fDepthMask = noOpGLDepthMask;
298 interface->fDisable = noOpGLDisable;
299 interface->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray;
300 interface->fDrawArrays = noOpGLDrawArrays;
301 interface->fDrawBuffer = noOpGLDrawBuffer;
302 interface->fDrawBuffers = noOpGLDrawBuffers;
303 interface->fDrawElements = noOpGLDrawElements;
304 interface->fEnable = noOpGLEnable;
305 interface->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray;
306 interface->fEndQuery = noOpGLEndQuery;
307 interface->fFinish = noOpGLFinish;
308 interface->fFlush = noOpGLFlush;
309 interface->fFrontFace = noOpGLFrontFace;
robertphillips@google.comd6543e52013-07-18 17:39:14 +0000310 interface->fGenBuffers = nullGLGenBuffers;
commit-bot@chromium.orgcffff792013-07-26 16:36:04 +0000311 interface->fGenerateMipmap = nullGLGenerateMipmap;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000312 interface->fGenQueries = noOpGLGenIds;
313 interface->fGenTextures = noOpGLGenIds;
bsalomon@google.comecd84842013-03-01 15:36:02 +0000314 interface->fGenVertexArrays = noOpGLGenIds;
bsalomon@google.com74913722011-10-27 20:44:19 +0000315 interface->fGetBufferParameteriv = nullGLGetBufferParameteriv;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000316 interface->fGetError = noOpGLGetError;
317 interface->fGetIntegerv = noOpGLGetIntegerv;
318 interface->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v;
319 interface->fGetQueryObjectiv = noOpGLGetQueryObjectiv;
320 interface->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v;
321 interface->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv;
322 interface->fGetQueryiv = noOpGLGetQueryiv;
323 interface->fGetProgramInfoLog = noOpGLGetInfoLog;
324 interface->fGetProgramiv = noOpGLGetShaderOrProgramiv;
325 interface->fGetShaderInfoLog = noOpGLGetInfoLog;
326 interface->fGetShaderiv = noOpGLGetShaderOrProgramiv;
327 interface->fGetString = noOpGLGetString;
bsalomon@google.com1744f972013-02-26 21:46:32 +0000328 interface->fGetStringi = noOpGLGetStringi;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000329 interface->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv;
330 interface->fGetUniformLocation = noOpGLGetUniformLocation;
331 interface->fLineWidth = noOpGLLineWidth;
332 interface->fLinkProgram = noOpGLLinkProgram;
bsalomon@google.com74913722011-10-27 20:44:19 +0000333 interface->fPixelStorei = nullGLPixelStorei;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000334 interface->fQueryCounter = noOpGLQueryCounter;
335 interface->fReadBuffer = noOpGLReadBuffer;
bsalomon@google.com74913722011-10-27 20:44:19 +0000336 interface->fReadPixels = nullGLReadPixels;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000337 interface->fScissor = noOpGLScissor;
338 interface->fShaderSource = noOpGLShaderSource;
339 interface->fStencilFunc = noOpGLStencilFunc;
340 interface->fStencilFuncSeparate = noOpGLStencilFuncSeparate;
341 interface->fStencilMask = noOpGLStencilMask;
342 interface->fStencilMaskSeparate = noOpGLStencilMaskSeparate;
343 interface->fStencilOp = noOpGLStencilOp;
344 interface->fStencilOpSeparate = noOpGLStencilOpSeparate;
345 interface->fTexImage2D = noOpGLTexImage2D;
346 interface->fTexParameteri = noOpGLTexParameteri;
347 interface->fTexParameteriv = noOpGLTexParameteriv;
348 interface->fTexSubImage2D = noOpGLTexSubImage2D;
349 interface->fTexStorage2D = noOpGLTexStorage2D;
robertphillips@google.coma6ffb582013-04-29 16:50:17 +0000350 interface->fDiscardFramebuffer = noOpGLDiscardFramebuffer;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000351 interface->fUniform1f = noOpGLUniform1f;
352 interface->fUniform1i = noOpGLUniform1i;
353 interface->fUniform1fv = noOpGLUniform1fv;
354 interface->fUniform1iv = noOpGLUniform1iv;
355 interface->fUniform2f = noOpGLUniform2f;
356 interface->fUniform2i = noOpGLUniform2i;
357 interface->fUniform2fv = noOpGLUniform2fv;
358 interface->fUniform2iv = noOpGLUniform2iv;
359 interface->fUniform3f = noOpGLUniform3f;
360 interface->fUniform3i = noOpGLUniform3i;
361 interface->fUniform3fv = noOpGLUniform3fv;
362 interface->fUniform3iv = noOpGLUniform3iv;
363 interface->fUniform4f = noOpGLUniform4f;
364 interface->fUniform4i = noOpGLUniform4i;
365 interface->fUniform4fv = noOpGLUniform4fv;
366 interface->fUniform4iv = noOpGLUniform4iv;
367 interface->fUniformMatrix2fv = noOpGLUniformMatrix2fv;
368 interface->fUniformMatrix3fv = noOpGLUniformMatrix3fv;
369 interface->fUniformMatrix4fv = noOpGLUniformMatrix4fv;
bsalomon@google.com74913722011-10-27 20:44:19 +0000370 interface->fUseProgram = nullGLUseProgram;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000371 interface->fVertexAttrib4fv = noOpGLVertexAttrib4fv;
372 interface->fVertexAttribPointer = noOpGLVertexAttribPointer;
bsalomon@google.com74913722011-10-27 20:44:19 +0000373 interface->fViewport = nullGLViewport;
374 interface->fBindFramebuffer = nullGLBindFramebuffer;
375 interface->fBindRenderbuffer = nullGLBindRenderbuffer;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000376 interface->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus;
bsalomon@google.com74913722011-10-27 20:44:19 +0000377 interface->fDeleteFramebuffers = nullGLDeleteFramebuffers;
378 interface->fDeleteRenderbuffers = nullGLDeleteRenderbuffers;
379 interface->fFramebufferRenderbuffer = nullGLFramebufferRenderbuffer;
380 interface->fFramebufferTexture2D = nullGLFramebufferTexture2D;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000381 interface->fGenFramebuffers = noOpGLGenIds;
382 interface->fGenRenderbuffers = noOpGLGenIds;
383 interface->fGetFramebufferAttachmentParameteriv = noOpGLGetFramebufferAttachmentParameteriv;
384 interface->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteriv;
385 interface->fRenderbufferStorage = noOpGLRenderbufferStorage;
386 interface->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMultisample;
387 interface->fBlitFramebuffer = noOpGLBlitFramebuffer;
388 interface->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuffer;
bsalomon@google.com74913722011-10-27 20:44:19 +0000389 interface->fMapBuffer = nullGLMapBuffer;
390 interface->fUnmapBuffer = nullGLUnmapBuffer;
bsalomon@google.com8f943612013-02-26 14:34:43 +0000391 interface->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed;
bsalomon@google.com74913722011-10-27 20:44:19 +0000392 }
393 glInterface.get()->ref();
394 return glInterface.get();
395}