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