bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 1 | /* |
| 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.com | 6bf38b5 | 2012-02-14 15:11:59 +0000 | [diff] [blame] | 9 | #include "gl/GrGLInterface.h" |
bsalomon@google.com | 91bcc94 | 2012-05-07 17:28:41 +0000 | [diff] [blame] | 10 | #include "GrGLDefines.h" |
bsalomon@google.com | 21cbec4 | 2013-01-07 17:23:00 +0000 | [diff] [blame] | 11 | #include "SkTDArray.h" |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 12 | #include "GrGLNoOpInterface.h" |
| 13 | |
| 14 | // Functions not declared in GrGLBogusInterface.h (not common with the Debug GL interface). |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 15 | |
caryclark@google.com | cf6285b | 2012-06-06 12:09:01 +0000 | [diff] [blame] | 16 | namespace { // added to suppress 'no previous prototype' warning |
| 17 | |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 18 | class GrBufferObj { |
| 19 | public: |
| 20 | GrBufferObj(GrGLuint id) : fID(id), fDataPtr(NULL), fSize(0), fMapped(false) { |
| 21 | } |
| 22 | ~GrBufferObj() { SkDELETE_ARRAY(fDataPtr); } |
| 23 | |
robertphillips@google.com | ae6b777 | 2013-07-18 18:07:39 +0000 | [diff] [blame] | 24 | void allocate(GrGLsizeiptr size, const GrGLchar* dataPtr) { |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 25 | if (NULL != fDataPtr) { |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 26 | SkASSERT(0 != fSize); |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 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.com | ae6b777 | 2013-07-18 18:07:39 +0000 | [diff] [blame] | 36 | GrGLsizeiptr size() const { return fSize; } |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 37 | |
| 38 | void setMapped(bool mapped) { fMapped = mapped; } |
| 39 | bool mapped() const { return fMapped; } |
| 40 | |
| 41 | private: |
| 42 | GrGLuint fID; |
| 43 | GrGLchar* fDataPtr; |
robertphillips@google.com | ae6b777 | 2013-07-18 18:07:39 +0000 | [diff] [blame] | 44 | GrGLsizeiptr fSize; // size in bytes |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 45 | bool fMapped; |
| 46 | }; |
| 47 | |
| 48 | // In debug builds we do asserts that ensure we agree with GL about when a buffer |
| 49 | // is mapped. |
| 50 | static SkTDArray<GrBufferObj*> gBuffers; // slot 0 is reserved for head of free list |
| 51 | static GrGLuint gCurrArrayBuffer; |
| 52 | static GrGLuint gCurrElementArrayBuffer; |
| 53 | |
| 54 | static GrBufferObj* look_up(GrGLuint id) { |
| 55 | GrBufferObj* buffer = gBuffers[id]; |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 56 | SkASSERT(NULL != buffer && buffer->id() == id); |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 57 | return buffer; |
| 58 | } |
| 59 | |
| 60 | static 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.com | ae6b777 | 2013-07-18 18:07:39 +0000 | [diff] [blame] | 76 | id = SkTCast<GrGLuint>(gBuffers[0]); |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 77 | gBuffers[0] = gBuffers[id]; |
| 78 | |
| 79 | buffer = SkNEW_ARGS(GrBufferObj, (id)); |
| 80 | gBuffers[id] = buffer; |
| 81 | } |
| 82 | |
| 83 | return buffer; |
| 84 | } |
| 85 | |
| 86 | static void delete_buffer(GrBufferObj* buffer) { |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 87 | SkASSERT(gBuffers.count() > 0); |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 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.com | d6bcfa3 | 2013-07-18 18:33:39 +0000 | [diff] [blame] | 94 | gBuffers[0] = SkTCast<GrBufferObj*>((const void*)(intptr_t)id); |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 95 | } |
| 96 | |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 97 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLActiveTexture(GrGLenum texture) {} |
| 98 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLAttachShader(GrGLuint program, GrGLuint shader) {} |
| 99 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLBeginQuery(GrGLenum target, GrGLuint id) {} |
| 100 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindAttribLocation(GrGLuint program, GrGLuint index, const char* name) {} |
| 101 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindTexture(GrGLenum target, GrGLuint texture) {} |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 102 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindVertexArray(GrGLuint id) {} |
commit-bot@chromium.org | 46fbfe0 | 2013-08-30 15:52:12 +0000 | [diff] [blame] | 103 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLClientActiveTexture(GrGLenum) {} |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 104 | |
| 105 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLGenBuffers(GrGLsizei n, GrGLuint* ids) { |
| 106 | |
| 107 | for (int i = 0; i < n; ++i) { |
| 108 | GrBufferObj* buffer = create_buffer(); |
| 109 | ids[i] = buffer->id(); |
| 110 | } |
| 111 | } |
| 112 | |
commit-bot@chromium.org | cffff79 | 2013-07-26 16:36:04 +0000 | [diff] [blame] | 113 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLGenerateMipmap(GrGLenum target) {} |
| 114 | |
skia.committer@gmail.com | a799198 | 2013-07-19 07:00:57 +0000 | [diff] [blame] | 115 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLBufferData(GrGLenum target, |
| 116 | GrGLsizeiptr size, |
| 117 | const GrGLvoid* data, |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 118 | GrGLenum usage) { |
| 119 | GrGLuint id = 0; |
| 120 | |
| 121 | switch (target) { |
| 122 | case GR_GL_ARRAY_BUFFER: |
| 123 | id = gCurrArrayBuffer; |
| 124 | break; |
| 125 | case GR_GL_ELEMENT_ARRAY_BUFFER: |
| 126 | id = gCurrElementArrayBuffer; |
| 127 | break; |
| 128 | default: |
| 129 | GrCrash("Unexpected target to nullGLBufferData"); |
| 130 | break; |
| 131 | } |
| 132 | |
| 133 | if (id > 0) { |
| 134 | GrBufferObj* buffer = look_up(id); |
| 135 | buffer->allocate(size, (const GrGLchar*) data); |
| 136 | } |
| 137 | } |
| 138 | |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 139 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLPixelStorei(GrGLenum pname, GrGLint param) {} |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 140 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLReadPixels(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLvoid* pixels) {} |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 141 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLUseProgram(GrGLuint program) {} |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 142 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLViewport(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {} |
| 143 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindFramebuffer(GrGLenum target, GrGLuint framebuffer) {} |
| 144 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindRenderbuffer(GrGLenum target, GrGLuint renderbuffer) {} |
| 145 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteFramebuffers(GrGLsizei n, const GrGLuint *framebuffers) {} |
| 146 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteRenderbuffers(GrGLsizei n, const GrGLuint *renderbuffers) {} |
| 147 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLFramebufferRenderbuffer(GrGLenum target, GrGLenum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer) {} |
| 148 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLFramebufferTexture2D(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level) {} |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 149 | |
| 150 | GrGLuint GR_GL_FUNCTION_TYPE nullGLCreateProgram() { |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 151 | static GrGLuint gCurrID = 0; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 152 | return ++gCurrID; |
| 153 | } |
| 154 | |
| 155 | GrGLuint GR_GL_FUNCTION_TYPE nullGLCreateShader(GrGLenum type) { |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 156 | static GrGLuint gCurrID = 0; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 157 | return ++gCurrID; |
| 158 | } |
| 159 | |
| 160 | // same delete used for shaders and programs |
| 161 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLDelete(GrGLuint program) { |
| 162 | } |
| 163 | |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 164 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindBuffer(GrGLenum target, GrGLuint buffer) { |
| 165 | switch (target) { |
| 166 | case GR_GL_ARRAY_BUFFER: |
| 167 | gCurrArrayBuffer = buffer; |
| 168 | break; |
| 169 | case GR_GL_ELEMENT_ARRAY_BUFFER: |
| 170 | gCurrElementArrayBuffer = buffer; |
| 171 | break; |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | // deleting a bound buffer has the side effect of binding 0 |
| 176 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteBuffers(GrGLsizei n, const GrGLuint* ids) { |
| 177 | for (int i = 0; i < n; ++i) { |
| 178 | if (ids[i] == gCurrArrayBuffer) { |
| 179 | gCurrArrayBuffer = 0; |
| 180 | } |
| 181 | if (ids[i] == gCurrElementArrayBuffer) { |
| 182 | gCurrElementArrayBuffer = 0; |
| 183 | } |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 184 | |
| 185 | GrBufferObj* buffer = look_up(ids[i]); |
| 186 | delete_buffer(buffer); |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 187 | } |
| 188 | } |
| 189 | |
| 190 | GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBuffer(GrGLenum target, GrGLenum access) { |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 191 | |
| 192 | GrGLuint id = 0; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 193 | switch (target) { |
| 194 | case GR_GL_ARRAY_BUFFER: |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 195 | id = gCurrArrayBuffer; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 196 | break; |
| 197 | case GR_GL_ELEMENT_ARRAY_BUFFER: |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 198 | id = gCurrElementArrayBuffer; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 199 | break; |
| 200 | } |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 201 | |
| 202 | if (id > 0) { |
| 203 | GrBufferObj* buffer = look_up(id); |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 204 | SkASSERT(!buffer->mapped()); |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 205 | buffer->setMapped(true); |
| 206 | return buffer->dataPtr(); |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 207 | } |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 208 | |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 209 | SkASSERT(false); |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 210 | return NULL; // no buffer bound to target |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 211 | } |
| 212 | |
| 213 | GrGLboolean GR_GL_FUNCTION_TYPE nullGLUnmapBuffer(GrGLenum target) { |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 214 | GrGLuint id = 0; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 215 | switch (target) { |
| 216 | case GR_GL_ARRAY_BUFFER: |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 217 | id = gCurrArrayBuffer; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 218 | break; |
| 219 | case GR_GL_ELEMENT_ARRAY_BUFFER: |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 220 | id = gCurrElementArrayBuffer; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 221 | break; |
| 222 | } |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 223 | if (id > 0) { |
| 224 | GrBufferObj* buffer = look_up(id); |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 225 | SkASSERT(buffer->mapped()); |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 226 | buffer->setMapped(false); |
| 227 | return GR_GL_TRUE; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 228 | } |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 229 | |
| 230 | GrAlwaysAssert(false); |
| 231 | return GR_GL_FALSE; // GR_GL_INVALID_OPERATION; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 232 | } |
| 233 | |
| 234 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLGetBufferParameteriv(GrGLenum target, GrGLenum pname, GrGLint* params) { |
| 235 | switch (pname) { |
| 236 | case GR_GL_BUFFER_MAPPED: { |
| 237 | *params = GR_GL_FALSE; |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 238 | GrGLuint id = 0; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 239 | switch (target) { |
| 240 | case GR_GL_ARRAY_BUFFER: |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 241 | id = gCurrArrayBuffer; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 242 | break; |
| 243 | case GR_GL_ELEMENT_ARRAY_BUFFER: |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 244 | id = gCurrElementArrayBuffer; |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 245 | break; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 246 | } |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 247 | if (id > 0) { |
| 248 | GrBufferObj* buffer = look_up(id); |
| 249 | if (buffer->mapped()) { |
| 250 | *params = GR_GL_TRUE; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 251 | } |
| 252 | } |
| 253 | break; } |
| 254 | default: |
| 255 | GrCrash("Unexpected pname to GetBufferParamateriv"); |
| 256 | break; |
| 257 | } |
| 258 | }; |
| 259 | |
caryclark@google.com | cf6285b | 2012-06-06 12:09:01 +0000 | [diff] [blame] | 260 | } // end anonymous namespace |
| 261 | |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 262 | const GrGLInterface* GrGLCreateNullInterface() { |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 263 | // The gl functions are not context-specific so we create one global |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 264 | // interface |
| 265 | static SkAutoTUnref<GrGLInterface> glInterface; |
| 266 | if (!glInterface.get()) { |
tomhudson@google.com | c377baf | 2012-07-09 20:17:56 +0000 | [diff] [blame] | 267 | GrGLInterface* interface = SkNEW(GrGLInterface); |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 268 | glInterface.reset(interface); |
| 269 | interface->fBindingsExported = kDesktop_GrGLBinding; |
| 270 | interface->fActiveTexture = nullGLActiveTexture; |
| 271 | interface->fAttachShader = nullGLAttachShader; |
| 272 | interface->fBeginQuery = nullGLBeginQuery; |
| 273 | interface->fBindAttribLocation = nullGLBindAttribLocation; |
| 274 | interface->fBindBuffer = nullGLBindBuffer; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 275 | interface->fBindFragDataLocation = noOpGLBindFragDataLocation; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 276 | interface->fBindTexture = nullGLBindTexture; |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 277 | interface->fBindVertexArray = nullGLBindVertexArray; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 278 | interface->fBlendColor = noOpGLBlendColor; |
| 279 | interface->fBlendFunc = noOpGLBlendFunc; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 280 | interface->fBufferData = nullGLBufferData; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 281 | interface->fBufferSubData = noOpGLBufferSubData; |
| 282 | interface->fClear = noOpGLClear; |
| 283 | interface->fClearColor = noOpGLClearColor; |
| 284 | interface->fClearStencil = noOpGLClearStencil; |
commit-bot@chromium.org | 46fbfe0 | 2013-08-30 15:52:12 +0000 | [diff] [blame] | 285 | interface->fClientActiveTexture = nullGLClientActiveTexture; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 286 | interface->fColorMask = noOpGLColorMask; |
| 287 | interface->fCompileShader = noOpGLCompileShader; |
| 288 | interface->fCompressedTexImage2D = noOpGLCompressedTexImage2D; |
commit-bot@chromium.org | 98168bb | 2013-04-11 22:00:34 +0000 | [diff] [blame] | 289 | interface->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 290 | interface->fCreateProgram = nullGLCreateProgram; |
| 291 | interface->fCreateShader = nullGLCreateShader; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 292 | interface->fCullFace = noOpGLCullFace; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 293 | interface->fDeleteBuffers = nullGLDeleteBuffers; |
| 294 | interface->fDeleteProgram = nullGLDelete; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 295 | interface->fDeleteQueries = noOpGLDeleteIds; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 296 | interface->fDeleteShader = nullGLDelete; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 297 | interface->fDeleteTextures = noOpGLDeleteIds; |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 298 | interface->fDeleteVertexArrays = noOpGLDeleteIds; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 299 | interface->fDepthMask = noOpGLDepthMask; |
| 300 | interface->fDisable = noOpGLDisable; |
commit-bot@chromium.org | 46fbfe0 | 2013-08-30 15:52:12 +0000 | [diff] [blame] | 301 | interface->fDisableClientState = noOpGLDisableClientState; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 302 | interface->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray; |
| 303 | interface->fDrawArrays = noOpGLDrawArrays; |
| 304 | interface->fDrawBuffer = noOpGLDrawBuffer; |
| 305 | interface->fDrawBuffers = noOpGLDrawBuffers; |
| 306 | interface->fDrawElements = noOpGLDrawElements; |
| 307 | interface->fEnable = noOpGLEnable; |
commit-bot@chromium.org | 46fbfe0 | 2013-08-30 15:52:12 +0000 | [diff] [blame] | 308 | interface->fEnableClientState = noOpGLEnableClientState; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 309 | interface->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray; |
| 310 | interface->fEndQuery = noOpGLEndQuery; |
| 311 | interface->fFinish = noOpGLFinish; |
| 312 | interface->fFlush = noOpGLFlush; |
| 313 | interface->fFrontFace = noOpGLFrontFace; |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 314 | interface->fGenBuffers = nullGLGenBuffers; |
commit-bot@chromium.org | cffff79 | 2013-07-26 16:36:04 +0000 | [diff] [blame] | 315 | interface->fGenerateMipmap = nullGLGenerateMipmap; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 316 | interface->fGenQueries = noOpGLGenIds; |
| 317 | interface->fGenTextures = noOpGLGenIds; |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 318 | interface->fGenVertexArrays = noOpGLGenIds; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 319 | interface->fGetBufferParameteriv = nullGLGetBufferParameteriv; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 320 | interface->fGetError = noOpGLGetError; |
| 321 | interface->fGetIntegerv = noOpGLGetIntegerv; |
| 322 | interface->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v; |
| 323 | interface->fGetQueryObjectiv = noOpGLGetQueryObjectiv; |
| 324 | interface->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v; |
| 325 | interface->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv; |
| 326 | interface->fGetQueryiv = noOpGLGetQueryiv; |
| 327 | interface->fGetProgramInfoLog = noOpGLGetInfoLog; |
| 328 | interface->fGetProgramiv = noOpGLGetShaderOrProgramiv; |
| 329 | interface->fGetShaderInfoLog = noOpGLGetInfoLog; |
| 330 | interface->fGetShaderiv = noOpGLGetShaderOrProgramiv; |
| 331 | interface->fGetString = noOpGLGetString; |
bsalomon@google.com | 1744f97 | 2013-02-26 21:46:32 +0000 | [diff] [blame] | 332 | interface->fGetStringi = noOpGLGetStringi; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 333 | interface->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv; |
| 334 | interface->fGetUniformLocation = noOpGLGetUniformLocation; |
commit-bot@chromium.org | 46fbfe0 | 2013-08-30 15:52:12 +0000 | [diff] [blame] | 335 | interface->fLoadIdentity = noOpGLLoadIdentity; |
| 336 | interface->fLoadMatrixf = noOpGLLoadMatrixf; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 337 | interface->fLineWidth = noOpGLLineWidth; |
| 338 | interface->fLinkProgram = noOpGLLinkProgram; |
commit-bot@chromium.org | 46fbfe0 | 2013-08-30 15:52:12 +0000 | [diff] [blame] | 339 | interface->fMatrixMode = noOpGLMatrixMode; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 340 | interface->fPixelStorei = nullGLPixelStorei; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 341 | interface->fQueryCounter = noOpGLQueryCounter; |
| 342 | interface->fReadBuffer = noOpGLReadBuffer; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 343 | interface->fReadPixels = nullGLReadPixels; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 344 | interface->fScissor = noOpGLScissor; |
| 345 | interface->fShaderSource = noOpGLShaderSource; |
| 346 | interface->fStencilFunc = noOpGLStencilFunc; |
| 347 | interface->fStencilFuncSeparate = noOpGLStencilFuncSeparate; |
| 348 | interface->fStencilMask = noOpGLStencilMask; |
| 349 | interface->fStencilMaskSeparate = noOpGLStencilMaskSeparate; |
| 350 | interface->fStencilOp = noOpGLStencilOp; |
| 351 | interface->fStencilOpSeparate = noOpGLStencilOpSeparate; |
commit-bot@chromium.org | 46fbfe0 | 2013-08-30 15:52:12 +0000 | [diff] [blame] | 352 | interface->fTexGenf = noOpGLTexGenf; |
| 353 | interface->fTexGenfv = noOpGLTexGenfv; |
| 354 | interface->fTexGeni = noOpGLTexGeni; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 355 | interface->fTexImage2D = noOpGLTexImage2D; |
| 356 | interface->fTexParameteri = noOpGLTexParameteri; |
| 357 | interface->fTexParameteriv = noOpGLTexParameteriv; |
| 358 | interface->fTexSubImage2D = noOpGLTexSubImage2D; |
| 359 | interface->fTexStorage2D = noOpGLTexStorage2D; |
robertphillips@google.com | a6ffb58 | 2013-04-29 16:50:17 +0000 | [diff] [blame] | 360 | interface->fDiscardFramebuffer = noOpGLDiscardFramebuffer; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 361 | interface->fUniform1f = noOpGLUniform1f; |
| 362 | interface->fUniform1i = noOpGLUniform1i; |
| 363 | interface->fUniform1fv = noOpGLUniform1fv; |
| 364 | interface->fUniform1iv = noOpGLUniform1iv; |
| 365 | interface->fUniform2f = noOpGLUniform2f; |
| 366 | interface->fUniform2i = noOpGLUniform2i; |
| 367 | interface->fUniform2fv = noOpGLUniform2fv; |
| 368 | interface->fUniform2iv = noOpGLUniform2iv; |
| 369 | interface->fUniform3f = noOpGLUniform3f; |
| 370 | interface->fUniform3i = noOpGLUniform3i; |
| 371 | interface->fUniform3fv = noOpGLUniform3fv; |
| 372 | interface->fUniform3iv = noOpGLUniform3iv; |
| 373 | interface->fUniform4f = noOpGLUniform4f; |
| 374 | interface->fUniform4i = noOpGLUniform4i; |
| 375 | interface->fUniform4fv = noOpGLUniform4fv; |
| 376 | interface->fUniform4iv = noOpGLUniform4iv; |
| 377 | interface->fUniformMatrix2fv = noOpGLUniformMatrix2fv; |
| 378 | interface->fUniformMatrix3fv = noOpGLUniformMatrix3fv; |
| 379 | interface->fUniformMatrix4fv = noOpGLUniformMatrix4fv; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 380 | interface->fUseProgram = nullGLUseProgram; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 381 | interface->fVertexAttrib4fv = noOpGLVertexAttrib4fv; |
| 382 | interface->fVertexAttribPointer = noOpGLVertexAttribPointer; |
commit-bot@chromium.org | 46fbfe0 | 2013-08-30 15:52:12 +0000 | [diff] [blame] | 383 | interface->fVertexPointer = noOpGLVertexPointer; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 384 | interface->fViewport = nullGLViewport; |
| 385 | interface->fBindFramebuffer = nullGLBindFramebuffer; |
| 386 | interface->fBindRenderbuffer = nullGLBindRenderbuffer; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 387 | interface->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 388 | interface->fDeleteFramebuffers = nullGLDeleteFramebuffers; |
| 389 | interface->fDeleteRenderbuffers = nullGLDeleteRenderbuffers; |
| 390 | interface->fFramebufferRenderbuffer = nullGLFramebufferRenderbuffer; |
| 391 | interface->fFramebufferTexture2D = nullGLFramebufferTexture2D; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 392 | interface->fGenFramebuffers = noOpGLGenIds; |
| 393 | interface->fGenRenderbuffers = noOpGLGenIds; |
| 394 | interface->fGetFramebufferAttachmentParameteriv = noOpGLGetFramebufferAttachmentParameteriv; |
| 395 | interface->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteriv; |
| 396 | interface->fRenderbufferStorage = noOpGLRenderbufferStorage; |
| 397 | interface->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMultisample; |
| 398 | interface->fBlitFramebuffer = noOpGLBlitFramebuffer; |
| 399 | interface->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuffer; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 400 | interface->fMapBuffer = nullGLMapBuffer; |
| 401 | interface->fUnmapBuffer = nullGLUnmapBuffer; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 402 | interface->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 403 | } |
| 404 | glInterface.get()->ref(); |
| 405 | return glInterface.get(); |
| 406 | } |