OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include "gl/GrGLInterface.h" | 9 #include "gl/GrGLInterface.h" |
10 #include "GrGLDefines.h" | 10 #include "GrGLDefines.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 } | 179 } |
180 if (ids[i] == gCurrElementArrayBuffer) { | 180 if (ids[i] == gCurrElementArrayBuffer) { |
181 gCurrElementArrayBuffer = 0; | 181 gCurrElementArrayBuffer = 0; |
182 } | 182 } |
183 | 183 |
184 GrBufferObj* buffer = look_up(ids[i]); | 184 GrBufferObj* buffer = look_up(ids[i]); |
185 delete_buffer(buffer); | 185 delete_buffer(buffer); |
186 } | 186 } |
187 } | 187 } |
188 | 188 |
189 GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBufferRange(GrGLenum target, GrGLintptr o
ffset, | 189 GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBuffer(GrGLenum target, GrGLenum access)
{ |
190 GrGLsizeiptr length, GrGLbitf
ield access) { | 190 |
191 GrGLuint id = 0; | 191 GrGLuint id = 0; |
192 switch (target) { | 192 switch (target) { |
193 case GR_GL_ARRAY_BUFFER: | 193 case GR_GL_ARRAY_BUFFER: |
194 id = gCurrArrayBuffer; | 194 id = gCurrArrayBuffer; |
195 break; | 195 break; |
196 case GR_GL_ELEMENT_ARRAY_BUFFER: | 196 case GR_GL_ELEMENT_ARRAY_BUFFER: |
197 id = gCurrElementArrayBuffer; | 197 id = gCurrElementArrayBuffer; |
198 break; | 198 break; |
199 } | 199 } |
200 | 200 |
201 if (id > 0) { | 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)
{ | |
212 GrGLuint id = 0; | |
213 switch (target) { | |
214 case GR_GL_ARRAY_BUFFER: | |
215 id = gCurrArrayBuffer; | |
216 break; | |
217 case GR_GL_ELEMENT_ARRAY_BUFFER: | |
218 id = gCurrElementArrayBuffer; | |
219 break; | |
220 } | |
221 | |
222 if (id > 0) { | |
223 GrBufferObj* buffer = look_up(id); | 202 GrBufferObj* buffer = look_up(id); |
224 SkASSERT(!buffer->mapped()); | 203 SkASSERT(!buffer->mapped()); |
225 buffer->setMapped(true); | 204 buffer->setMapped(true); |
226 return buffer->dataPtr(); | 205 return buffer->dataPtr(); |
227 } | 206 } |
228 | 207 |
229 SkASSERT(false); | 208 SkASSERT(false); |
230 return NULL; // no buffer bound to target | 209 return NULL; // no buffer bound to target |
231 } | 210 } |
232 | 211 |
233 GrGLvoid GR_GL_FUNCTION_TYPE nullGLFlushMappedBufferRange(GrGLenum target, | |
234 GrGLintptr offset, | |
235 GrGLsizeiptr length) {
} | |
236 | |
237 | |
238 GrGLboolean GR_GL_FUNCTION_TYPE nullGLUnmapBuffer(GrGLenum target) { | 212 GrGLboolean GR_GL_FUNCTION_TYPE nullGLUnmapBuffer(GrGLenum target) { |
239 GrGLuint id = 0; | 213 GrGLuint id = 0; |
240 switch (target) { | 214 switch (target) { |
241 case GR_GL_ARRAY_BUFFER: | 215 case GR_GL_ARRAY_BUFFER: |
242 id = gCurrArrayBuffer; | 216 id = gCurrArrayBuffer; |
243 break; | 217 break; |
244 case GR_GL_ELEMENT_ARRAY_BUFFER: | 218 case GR_GL_ELEMENT_ARRAY_BUFFER: |
245 id = gCurrElementArrayBuffer; | 219 id = gCurrElementArrayBuffer; |
246 break; | 220 break; |
247 } | 221 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 functions->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray; | 297 functions->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray; |
324 functions->fDrawArrays = noOpGLDrawArrays; | 298 functions->fDrawArrays = noOpGLDrawArrays; |
325 functions->fDrawBuffer = noOpGLDrawBuffer; | 299 functions->fDrawBuffer = noOpGLDrawBuffer; |
326 functions->fDrawBuffers = noOpGLDrawBuffers; | 300 functions->fDrawBuffers = noOpGLDrawBuffers; |
327 functions->fDrawElements = noOpGLDrawElements; | 301 functions->fDrawElements = noOpGLDrawElements; |
328 functions->fEnable = noOpGLEnable; | 302 functions->fEnable = noOpGLEnable; |
329 functions->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray; | 303 functions->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray; |
330 functions->fEndQuery = noOpGLEndQuery; | 304 functions->fEndQuery = noOpGLEndQuery; |
331 functions->fFinish = noOpGLFinish; | 305 functions->fFinish = noOpGLFinish; |
332 functions->fFlush = noOpGLFlush; | 306 functions->fFlush = noOpGLFlush; |
333 functions->fFlushMappedBufferRange = nullGLFlushMappedBufferRange; | |
334 functions->fFrontFace = noOpGLFrontFace; | 307 functions->fFrontFace = noOpGLFrontFace; |
335 functions->fGenBuffers = nullGLGenBuffers; | 308 functions->fGenBuffers = nullGLGenBuffers; |
336 functions->fGenerateMipmap = nullGLGenerateMipmap; | 309 functions->fGenerateMipmap = nullGLGenerateMipmap; |
337 functions->fGenQueries = noOpGLGenIds; | 310 functions->fGenQueries = noOpGLGenIds; |
338 functions->fGenTextures = noOpGLGenIds; | 311 functions->fGenTextures = noOpGLGenIds; |
339 functions->fGenVertexArrays = noOpGLGenIds; | 312 functions->fGenVertexArrays = noOpGLGenIds; |
340 functions->fGetBufferParameteriv = nullGLGetBufferParameteriv; | 313 functions->fGetBufferParameteriv = nullGLGetBufferParameteriv; |
341 functions->fGetError = noOpGLGetError; | 314 functions->fGetError = noOpGLGetError; |
342 functions->fGetIntegerv = noOpGLGetIntegerv; | 315 functions->fGetIntegerv = noOpGLGetIntegerv; |
343 functions->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v; | 316 functions->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v; |
344 functions->fGetQueryObjectiv = noOpGLGetQueryObjectiv; | 317 functions->fGetQueryObjectiv = noOpGLGetQueryObjectiv; |
345 functions->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v; | 318 functions->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v; |
346 functions->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv; | 319 functions->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv; |
347 functions->fGetQueryiv = noOpGLGetQueryiv; | 320 functions->fGetQueryiv = noOpGLGetQueryiv; |
348 functions->fGetProgramInfoLog = noOpGLGetInfoLog; | 321 functions->fGetProgramInfoLog = noOpGLGetInfoLog; |
349 functions->fGetProgramiv = noOpGLGetShaderOrProgramiv; | 322 functions->fGetProgramiv = noOpGLGetShaderOrProgramiv; |
350 functions->fGetShaderInfoLog = noOpGLGetInfoLog; | 323 functions->fGetShaderInfoLog = noOpGLGetInfoLog; |
351 functions->fGetShaderiv = noOpGLGetShaderOrProgramiv; | 324 functions->fGetShaderiv = noOpGLGetShaderOrProgramiv; |
352 functions->fGetString = noOpGLGetString; | 325 functions->fGetString = noOpGLGetString; |
353 functions->fGetStringi = noOpGLGetStringi; | 326 functions->fGetStringi = noOpGLGetStringi; |
354 functions->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv; | 327 functions->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv; |
355 functions->fGetUniformLocation = noOpGLGetUniformLocation; | 328 functions->fGetUniformLocation = noOpGLGetUniformLocation; |
356 functions->fInsertEventMarker = noOpGLInsertEventMarker; | 329 functions->fInsertEventMarker = noOpGLInsertEventMarker; |
357 functions->fLineWidth = noOpGLLineWidth; | 330 functions->fLineWidth = noOpGLLineWidth; |
358 functions->fLinkProgram = noOpGLLinkProgram; | 331 functions->fLinkProgram = noOpGLLinkProgram; |
359 functions->fMapBuffer = nullGLMapBuffer; | |
360 functions->fMapBufferRange = nullGLMapBufferRange; | |
361 functions->fPixelStorei = nullGLPixelStorei; | 332 functions->fPixelStorei = nullGLPixelStorei; |
362 functions->fPopGroupMarker = noOpGLPopGroupMarker; | 333 functions->fPopGroupMarker = noOpGLPopGroupMarker; |
363 functions->fPushGroupMarker = noOpGLPushGroupMarker; | 334 functions->fPushGroupMarker = noOpGLPushGroupMarker; |
364 functions->fQueryCounter = noOpGLQueryCounter; | 335 functions->fQueryCounter = noOpGLQueryCounter; |
365 functions->fReadBuffer = noOpGLReadBuffer; | 336 functions->fReadBuffer = noOpGLReadBuffer; |
366 functions->fReadPixels = nullGLReadPixels; | 337 functions->fReadPixels = nullGLReadPixels; |
367 functions->fScissor = noOpGLScissor; | 338 functions->fScissor = noOpGLScissor; |
368 functions->fShaderSource = noOpGLShaderSource; | 339 functions->fShaderSource = noOpGLShaderSource; |
369 functions->fStencilFunc = noOpGLStencilFunc; | 340 functions->fStencilFunc = noOpGLStencilFunc; |
370 functions->fStencilFuncSeparate = noOpGLStencilFuncSeparate; | 341 functions->fStencilFuncSeparate = noOpGLStencilFuncSeparate; |
(...skipping 19 matching lines...) Expand all Loading... |
390 functions->fUniform3i = noOpGLUniform3i; | 361 functions->fUniform3i = noOpGLUniform3i; |
391 functions->fUniform3fv = noOpGLUniform3fv; | 362 functions->fUniform3fv = noOpGLUniform3fv; |
392 functions->fUniform3iv = noOpGLUniform3iv; | 363 functions->fUniform3iv = noOpGLUniform3iv; |
393 functions->fUniform4f = noOpGLUniform4f; | 364 functions->fUniform4f = noOpGLUniform4f; |
394 functions->fUniform4i = noOpGLUniform4i; | 365 functions->fUniform4i = noOpGLUniform4i; |
395 functions->fUniform4fv = noOpGLUniform4fv; | 366 functions->fUniform4fv = noOpGLUniform4fv; |
396 functions->fUniform4iv = noOpGLUniform4iv; | 367 functions->fUniform4iv = noOpGLUniform4iv; |
397 functions->fUniformMatrix2fv = noOpGLUniformMatrix2fv; | 368 functions->fUniformMatrix2fv = noOpGLUniformMatrix2fv; |
398 functions->fUniformMatrix3fv = noOpGLUniformMatrix3fv; | 369 functions->fUniformMatrix3fv = noOpGLUniformMatrix3fv; |
399 functions->fUniformMatrix4fv = noOpGLUniformMatrix4fv; | 370 functions->fUniformMatrix4fv = noOpGLUniformMatrix4fv; |
400 functions->fUnmapBuffer = nullGLUnmapBuffer; | |
401 functions->fUseProgram = nullGLUseProgram; | 371 functions->fUseProgram = nullGLUseProgram; |
402 functions->fVertexAttrib4fv = noOpGLVertexAttrib4fv; | 372 functions->fVertexAttrib4fv = noOpGLVertexAttrib4fv; |
403 functions->fVertexAttribPointer = noOpGLVertexAttribPointer; | 373 functions->fVertexAttribPointer = noOpGLVertexAttribPointer; |
404 functions->fViewport = nullGLViewport; | 374 functions->fViewport = nullGLViewport; |
405 functions->fBindFramebuffer = nullGLBindFramebuffer; | 375 functions->fBindFramebuffer = nullGLBindFramebuffer; |
406 functions->fBindRenderbuffer = nullGLBindRenderbuffer; | 376 functions->fBindRenderbuffer = nullGLBindRenderbuffer; |
407 functions->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus; | 377 functions->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus; |
408 functions->fDeleteFramebuffers = nullGLDeleteFramebuffers; | 378 functions->fDeleteFramebuffers = nullGLDeleteFramebuffers; |
409 functions->fDeleteRenderbuffers = nullGLDeleteRenderbuffers; | 379 functions->fDeleteRenderbuffers = nullGLDeleteRenderbuffers; |
410 functions->fFramebufferRenderbuffer = nullGLFramebufferRenderbuffer; | 380 functions->fFramebufferRenderbuffer = nullGLFramebufferRenderbuffer; |
411 functions->fFramebufferTexture2D = nullGLFramebufferTexture2D; | 381 functions->fFramebufferTexture2D = nullGLFramebufferTexture2D; |
412 functions->fGenFramebuffers = noOpGLGenIds; | 382 functions->fGenFramebuffers = noOpGLGenIds; |
413 functions->fGenRenderbuffers = noOpGLGenIds; | 383 functions->fGenRenderbuffers = noOpGLGenIds; |
414 functions->fGetFramebufferAttachmentParameteriv = noOpGLGetFramebufferAttach
mentParameteriv; | 384 functions->fGetFramebufferAttachmentParameteriv = noOpGLGetFramebufferAttach
mentParameteriv; |
415 functions->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteriv; | 385 functions->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteriv; |
416 functions->fRenderbufferStorage = noOpGLRenderbufferStorage; | 386 functions->fRenderbufferStorage = noOpGLRenderbufferStorage; |
417 functions->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMultis
ample; | 387 functions->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMultis
ample; |
418 functions->fBlitFramebuffer = noOpGLBlitFramebuffer; | 388 functions->fBlitFramebuffer = noOpGLBlitFramebuffer; |
419 functions->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuf
fer; | 389 functions->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuf
fer; |
| 390 functions->fMapBuffer = nullGLMapBuffer; |
420 functions->fMatrixLoadf = noOpGLMatrixLoadf; | 391 functions->fMatrixLoadf = noOpGLMatrixLoadf; |
421 functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity; | 392 functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity; |
| 393 functions->fUnmapBuffer = nullGLUnmapBuffer; |
422 functions->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed; | 394 functions->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed; |
423 | 395 |
424 interface->fExtensions.init(kGL_GrGLStandard, functions->fGetString, functio
ns->fGetStringi, | 396 interface->fExtensions.init(kGL_GrGLStandard, functions->fGetString, functio
ns->fGetStringi, |
425 functions->fGetIntegerv); | 397 functions->fGetIntegerv); |
426 return interface; | 398 return interface; |
427 } | 399 } |
OLD | NEW |