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) {} |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 103 | |
| 104 | GrGLvoid 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.org | cffff79 | 2013-07-26 16:36:04 +0000 | [diff] [blame] | 112 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLGenerateMipmap(GrGLenum target) {} |
| 113 | |
skia.committer@gmail.com | a799198 | 2013-07-19 07:00:57 +0000 | [diff] [blame] | 114 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLBufferData(GrGLenum target, |
| 115 | GrGLsizeiptr size, |
| 116 | const GrGLvoid* data, |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 117 | 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: |
commit-bot@chromium.org | 88cb22b | 2014-04-30 14:17:00 +0000 | [diff] [blame] | 128 | SkFAIL("Unexpected target to nullGLBufferData"); |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 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.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 138 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLPixelStorei(GrGLenum pname, GrGLint param) {} |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 139 | 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] | 140 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLUseProgram(GrGLuint program) {} |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 141 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLViewport(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {} |
| 142 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindFramebuffer(GrGLenum target, GrGLuint framebuffer) {} |
| 143 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindRenderbuffer(GrGLenum target, GrGLuint renderbuffer) {} |
| 144 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteFramebuffers(GrGLsizei n, const GrGLuint *framebuffers) {} |
| 145 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteRenderbuffers(GrGLsizei n, const GrGLuint *renderbuffers) {} |
| 146 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLFramebufferRenderbuffer(GrGLenum target, GrGLenum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer) {} |
| 147 | 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] | 148 | |
| 149 | GrGLuint GR_GL_FUNCTION_TYPE nullGLCreateProgram() { |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 150 | static GrGLuint gCurrID = 0; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 151 | return ++gCurrID; |
| 152 | } |
| 153 | |
| 154 | GrGLuint GR_GL_FUNCTION_TYPE nullGLCreateShader(GrGLenum type) { |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 155 | static GrGLuint gCurrID = 0; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 156 | return ++gCurrID; |
| 157 | } |
| 158 | |
| 159 | // same delete used for shaders and programs |
| 160 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLDelete(GrGLuint program) { |
| 161 | } |
| 162 | |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 163 | GrGLvoid 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 |
| 175 | GrGLvoid 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.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 183 | |
| 184 | GrBufferObj* buffer = look_up(ids[i]); |
| 185 | delete_buffer(buffer); |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 186 | } |
| 187 | } |
| 188 | |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame^] | 189 | GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBufferRange(GrGLenum target, GrGLintptr offset, |
| 190 | GrGLsizeiptr length, GrGLbitfield access) { |
| 191 | GrGLuint id = 0; |
| 192 | switch (target) { |
| 193 | case GR_GL_ARRAY_BUFFER: |
| 194 | id = gCurrArrayBuffer; |
| 195 | break; |
| 196 | case GR_GL_ELEMENT_ARRAY_BUFFER: |
| 197 | id = gCurrElementArrayBuffer; |
| 198 | break; |
| 199 | } |
djsollen@google.com | 53b614b | 2014-05-02 17:44:34 +0000 | [diff] [blame] | 200 | |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame^] | 201 | if (id > 0) { |
| 202 | // We just ignore the offset and length here. |
| 203 | GrBufferObj* buffer = look_up(id); |
| 204 | SkASSERT(!buffer->mapped()); |
| 205 | buffer->setMapped(true); |
| 206 | return buffer->dataPtr(); |
| 207 | } |
| 208 | return NULL; |
| 209 | } |
| 210 | |
| 211 | GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBuffer(GrGLenum target, GrGLenum access) { |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 212 | GrGLuint id = 0; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 213 | switch (target) { |
| 214 | case GR_GL_ARRAY_BUFFER: |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 215 | id = gCurrArrayBuffer; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 216 | break; |
| 217 | case GR_GL_ELEMENT_ARRAY_BUFFER: |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 218 | id = gCurrElementArrayBuffer; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 219 | break; |
| 220 | } |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 221 | |
| 222 | if (id > 0) { |
| 223 | GrBufferObj* buffer = look_up(id); |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 224 | SkASSERT(!buffer->mapped()); |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 225 | buffer->setMapped(true); |
| 226 | return buffer->dataPtr(); |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 227 | } |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 228 | |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 229 | SkASSERT(false); |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 230 | return NULL; // no buffer bound to target |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 231 | } |
| 232 | |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame^] | 233 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLFlushMappedBufferRange(GrGLenum target, |
| 234 | GrGLintptr offset, |
| 235 | GrGLsizeiptr length) {} |
| 236 | |
| 237 | |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 238 | GrGLboolean GR_GL_FUNCTION_TYPE nullGLUnmapBuffer(GrGLenum target) { |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 239 | GrGLuint id = 0; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 240 | switch (target) { |
| 241 | case GR_GL_ARRAY_BUFFER: |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 242 | id = gCurrArrayBuffer; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 243 | break; |
| 244 | case GR_GL_ELEMENT_ARRAY_BUFFER: |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 245 | id = gCurrElementArrayBuffer; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 246 | break; |
| 247 | } |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 248 | if (id > 0) { |
| 249 | GrBufferObj* buffer = look_up(id); |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 250 | SkASSERT(buffer->mapped()); |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 251 | buffer->setMapped(false); |
| 252 | return GR_GL_TRUE; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 253 | } |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 254 | |
| 255 | GrAlwaysAssert(false); |
| 256 | return GR_GL_FALSE; // GR_GL_INVALID_OPERATION; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | GrGLvoid GR_GL_FUNCTION_TYPE nullGLGetBufferParameteriv(GrGLenum target, GrGLenum pname, GrGLint* params) { |
| 260 | switch (pname) { |
| 261 | case GR_GL_BUFFER_MAPPED: { |
| 262 | *params = GR_GL_FALSE; |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 263 | GrGLuint id = 0; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 264 | switch (target) { |
| 265 | case GR_GL_ARRAY_BUFFER: |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 266 | id = gCurrArrayBuffer; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 267 | break; |
| 268 | case GR_GL_ELEMENT_ARRAY_BUFFER: |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 269 | id = gCurrElementArrayBuffer; |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 270 | break; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 271 | } |
robertphillips@google.com | d6543e5 | 2013-07-18 17:39:14 +0000 | [diff] [blame] | 272 | if (id > 0) { |
| 273 | GrBufferObj* buffer = look_up(id); |
| 274 | if (buffer->mapped()) { |
| 275 | *params = GR_GL_TRUE; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 276 | } |
| 277 | } |
| 278 | break; } |
| 279 | default: |
commit-bot@chromium.org | 88cb22b | 2014-04-30 14:17:00 +0000 | [diff] [blame] | 280 | SkFAIL("Unexpected pname to GetBufferParamateriv"); |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 281 | break; |
| 282 | } |
| 283 | }; |
| 284 | |
caryclark@google.com | cf6285b | 2012-06-06 12:09:01 +0000 | [diff] [blame] | 285 | } // end anonymous namespace |
| 286 | |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 287 | const GrGLInterface* GrGLCreateNullInterface() { |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 288 | GrGLInterface* interface = SkNEW(GrGLInterface); |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 289 | |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 290 | interface->fStandard = kGL_GrGLStandard; |
commit-bot@chromium.org | c72425a | 2014-01-21 16:09:18 +0000 | [diff] [blame] | 291 | |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 292 | GrGLInterface::Functions* functions = &interface->fFunctions; |
| 293 | functions->fActiveTexture = nullGLActiveTexture; |
| 294 | functions->fAttachShader = nullGLAttachShader; |
| 295 | functions->fBeginQuery = nullGLBeginQuery; |
| 296 | functions->fBindAttribLocation = nullGLBindAttribLocation; |
| 297 | functions->fBindBuffer = nullGLBindBuffer; |
| 298 | functions->fBindFragDataLocation = noOpGLBindFragDataLocation; |
| 299 | functions->fBindTexture = nullGLBindTexture; |
| 300 | functions->fBindVertexArray = nullGLBindVertexArray; |
| 301 | functions->fBlendColor = noOpGLBlendColor; |
| 302 | functions->fBlendFunc = noOpGLBlendFunc; |
| 303 | functions->fBufferData = nullGLBufferData; |
| 304 | functions->fBufferSubData = noOpGLBufferSubData; |
| 305 | functions->fClear = noOpGLClear; |
| 306 | functions->fClearColor = noOpGLClearColor; |
| 307 | functions->fClearStencil = noOpGLClearStencil; |
| 308 | functions->fColorMask = noOpGLColorMask; |
| 309 | functions->fCompileShader = noOpGLCompileShader; |
| 310 | functions->fCompressedTexImage2D = noOpGLCompressedTexImage2D; |
| 311 | functions->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D; |
| 312 | functions->fCreateProgram = nullGLCreateProgram; |
| 313 | functions->fCreateShader = nullGLCreateShader; |
| 314 | functions->fCullFace = noOpGLCullFace; |
| 315 | functions->fDeleteBuffers = nullGLDeleteBuffers; |
| 316 | functions->fDeleteProgram = nullGLDelete; |
| 317 | functions->fDeleteQueries = noOpGLDeleteIds; |
| 318 | functions->fDeleteShader = nullGLDelete; |
| 319 | functions->fDeleteTextures = noOpGLDeleteIds; |
| 320 | functions->fDeleteVertexArrays = noOpGLDeleteIds; |
| 321 | functions->fDepthMask = noOpGLDepthMask; |
| 322 | functions->fDisable = noOpGLDisable; |
| 323 | functions->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray; |
| 324 | functions->fDrawArrays = noOpGLDrawArrays; |
| 325 | functions->fDrawBuffer = noOpGLDrawBuffer; |
| 326 | functions->fDrawBuffers = noOpGLDrawBuffers; |
| 327 | functions->fDrawElements = noOpGLDrawElements; |
| 328 | functions->fEnable = noOpGLEnable; |
| 329 | functions->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray; |
| 330 | functions->fEndQuery = noOpGLEndQuery; |
| 331 | functions->fFinish = noOpGLFinish; |
| 332 | functions->fFlush = noOpGLFlush; |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame^] | 333 | functions->fFlushMappedBufferRange = nullGLFlushMappedBufferRange; |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 334 | functions->fFrontFace = noOpGLFrontFace; |
| 335 | functions->fGenBuffers = nullGLGenBuffers; |
| 336 | functions->fGenerateMipmap = nullGLGenerateMipmap; |
| 337 | functions->fGenQueries = noOpGLGenIds; |
| 338 | functions->fGenTextures = noOpGLGenIds; |
| 339 | functions->fGenVertexArrays = noOpGLGenIds; |
| 340 | functions->fGetBufferParameteriv = nullGLGetBufferParameteriv; |
| 341 | functions->fGetError = noOpGLGetError; |
| 342 | functions->fGetIntegerv = noOpGLGetIntegerv; |
| 343 | functions->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v; |
| 344 | functions->fGetQueryObjectiv = noOpGLGetQueryObjectiv; |
| 345 | functions->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v; |
| 346 | functions->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv; |
| 347 | functions->fGetQueryiv = noOpGLGetQueryiv; |
| 348 | functions->fGetProgramInfoLog = noOpGLGetInfoLog; |
| 349 | functions->fGetProgramiv = noOpGLGetShaderOrProgramiv; |
| 350 | functions->fGetShaderInfoLog = noOpGLGetInfoLog; |
| 351 | functions->fGetShaderiv = noOpGLGetShaderOrProgramiv; |
| 352 | functions->fGetString = noOpGLGetString; |
| 353 | functions->fGetStringi = noOpGLGetStringi; |
| 354 | functions->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv; |
| 355 | functions->fGetUniformLocation = noOpGLGetUniformLocation; |
| 356 | functions->fInsertEventMarker = noOpGLInsertEventMarker; |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 357 | functions->fLineWidth = noOpGLLineWidth; |
| 358 | functions->fLinkProgram = noOpGLLinkProgram; |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame^] | 359 | functions->fMapBuffer = nullGLMapBuffer; |
| 360 | functions->fMapBufferRange = nullGLMapBufferRange; |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 361 | functions->fPixelStorei = nullGLPixelStorei; |
| 362 | functions->fPopGroupMarker = noOpGLPopGroupMarker; |
| 363 | functions->fPushGroupMarker = noOpGLPushGroupMarker; |
| 364 | functions->fQueryCounter = noOpGLQueryCounter; |
| 365 | functions->fReadBuffer = noOpGLReadBuffer; |
| 366 | functions->fReadPixels = nullGLReadPixels; |
| 367 | functions->fScissor = noOpGLScissor; |
| 368 | functions->fShaderSource = noOpGLShaderSource; |
| 369 | functions->fStencilFunc = noOpGLStencilFunc; |
| 370 | functions->fStencilFuncSeparate = noOpGLStencilFuncSeparate; |
| 371 | functions->fStencilMask = noOpGLStencilMask; |
| 372 | functions->fStencilMaskSeparate = noOpGLStencilMaskSeparate; |
| 373 | functions->fStencilOp = noOpGLStencilOp; |
| 374 | functions->fStencilOpSeparate = noOpGLStencilOpSeparate; |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 375 | functions->fTexImage2D = noOpGLTexImage2D; |
| 376 | functions->fTexParameteri = noOpGLTexParameteri; |
| 377 | functions->fTexParameteriv = noOpGLTexParameteriv; |
| 378 | functions->fTexSubImage2D = noOpGLTexSubImage2D; |
| 379 | functions->fTexStorage2D = noOpGLTexStorage2D; |
| 380 | functions->fDiscardFramebuffer = noOpGLDiscardFramebuffer; |
| 381 | functions->fUniform1f = noOpGLUniform1f; |
| 382 | functions->fUniform1i = noOpGLUniform1i; |
| 383 | functions->fUniform1fv = noOpGLUniform1fv; |
| 384 | functions->fUniform1iv = noOpGLUniform1iv; |
| 385 | functions->fUniform2f = noOpGLUniform2f; |
| 386 | functions->fUniform2i = noOpGLUniform2i; |
| 387 | functions->fUniform2fv = noOpGLUniform2fv; |
| 388 | functions->fUniform2iv = noOpGLUniform2iv; |
| 389 | functions->fUniform3f = noOpGLUniform3f; |
| 390 | functions->fUniform3i = noOpGLUniform3i; |
| 391 | functions->fUniform3fv = noOpGLUniform3fv; |
| 392 | functions->fUniform3iv = noOpGLUniform3iv; |
| 393 | functions->fUniform4f = noOpGLUniform4f; |
| 394 | functions->fUniform4i = noOpGLUniform4i; |
| 395 | functions->fUniform4fv = noOpGLUniform4fv; |
| 396 | functions->fUniform4iv = noOpGLUniform4iv; |
| 397 | functions->fUniformMatrix2fv = noOpGLUniformMatrix2fv; |
| 398 | functions->fUniformMatrix3fv = noOpGLUniformMatrix3fv; |
| 399 | functions->fUniformMatrix4fv = noOpGLUniformMatrix4fv; |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame^] | 400 | functions->fUnmapBuffer = nullGLUnmapBuffer; |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 401 | functions->fUseProgram = nullGLUseProgram; |
| 402 | functions->fVertexAttrib4fv = noOpGLVertexAttrib4fv; |
| 403 | functions->fVertexAttribPointer = noOpGLVertexAttribPointer; |
| 404 | functions->fViewport = nullGLViewport; |
| 405 | functions->fBindFramebuffer = nullGLBindFramebuffer; |
| 406 | functions->fBindRenderbuffer = nullGLBindRenderbuffer; |
| 407 | functions->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus; |
| 408 | functions->fDeleteFramebuffers = nullGLDeleteFramebuffers; |
| 409 | functions->fDeleteRenderbuffers = nullGLDeleteRenderbuffers; |
| 410 | functions->fFramebufferRenderbuffer = nullGLFramebufferRenderbuffer; |
| 411 | functions->fFramebufferTexture2D = nullGLFramebufferTexture2D; |
| 412 | functions->fGenFramebuffers = noOpGLGenIds; |
| 413 | functions->fGenRenderbuffers = noOpGLGenIds; |
| 414 | functions->fGetFramebufferAttachmentParameteriv = noOpGLGetFramebufferAttachmentParameteriv; |
| 415 | functions->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteriv; |
| 416 | functions->fRenderbufferStorage = noOpGLRenderbufferStorage; |
| 417 | functions->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMultisample; |
| 418 | functions->fBlitFramebuffer = noOpGLBlitFramebuffer; |
| 419 | functions->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuffer; |
commit-bot@chromium.org | f669672 | 2014-04-25 06:21:30 +0000 | [diff] [blame] | 420 | functions->fMatrixLoadf = noOpGLMatrixLoadf; |
| 421 | functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity; |
commit-bot@chromium.org | f535561 | 2014-02-28 20:28:50 +0000 | [diff] [blame] | 422 | functions->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed; |
| 423 | |
| 424 | interface->fExtensions.init(kGL_GrGLStandard, functions->fGetString, functions->fGetStringi, |
| 425 | functions->fGetIntegerv); |
| 426 | return interface; |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 427 | } |