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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 259 |
260 } // end anonymous namespace | 260 } // end anonymous namespace |
261 | 261 |
262 const GrGLInterface* GrGLCreateNullInterface() { | 262 const GrGLInterface* GrGLCreateNullInterface() { |
263 // The gl functions are not context-specific so we create one global | 263 // The gl functions are not context-specific so we create one global |
264 // interface | 264 // interface |
265 static SkAutoTUnref<GrGLInterface> glInterface; | 265 static SkAutoTUnref<GrGLInterface> glInterface; |
266 if (!glInterface.get()) { | 266 if (!glInterface.get()) { |
267 GrGLInterface* interface = SkNEW(GrGLInterface); | 267 GrGLInterface* interface = SkNEW(GrGLInterface); |
268 glInterface.reset(interface); | 268 glInterface.reset(interface); |
| 269 |
269 interface->fStandard = kGL_GrGLStandard; | 270 interface->fStandard = kGL_GrGLStandard; |
270 interface->fActiveTexture = nullGLActiveTexture; | 271 |
271 interface->fAttachShader = nullGLAttachShader; | 272 GrGLInterface::Functions* functions = &interface->fFunctions; |
272 interface->fBeginQuery = nullGLBeginQuery; | 273 functions->fActiveTexture = nullGLActiveTexture; |
273 interface->fBindAttribLocation = nullGLBindAttribLocation; | 274 functions->fAttachShader = nullGLAttachShader; |
274 interface->fBindBuffer = nullGLBindBuffer; | 275 functions->fBeginQuery = nullGLBeginQuery; |
275 interface->fBindFragDataLocation = noOpGLBindFragDataLocation; | 276 functions->fBindAttribLocation = nullGLBindAttribLocation; |
276 interface->fBindTexture = nullGLBindTexture; | 277 functions->fBindBuffer = nullGLBindBuffer; |
277 interface->fBindVertexArray = nullGLBindVertexArray; | 278 functions->fBindFragDataLocation = noOpGLBindFragDataLocation; |
278 interface->fBlendColor = noOpGLBlendColor; | 279 functions->fBindTexture = nullGLBindTexture; |
279 interface->fBlendFunc = noOpGLBlendFunc; | 280 functions->fBindVertexArray = nullGLBindVertexArray; |
280 interface->fBufferData = nullGLBufferData; | 281 functions->fBlendColor = noOpGLBlendColor; |
281 interface->fBufferSubData = noOpGLBufferSubData; | 282 functions->fBlendFunc = noOpGLBlendFunc; |
282 interface->fClear = noOpGLClear; | 283 functions->fBufferData = nullGLBufferData; |
283 interface->fClearColor = noOpGLClearColor; | 284 functions->fBufferSubData = noOpGLBufferSubData; |
284 interface->fClearStencil = noOpGLClearStencil; | 285 functions->fClear = noOpGLClear; |
285 interface->fClientActiveTexture = nullGLClientActiveTexture; | 286 functions->fClearColor = noOpGLClearColor; |
286 interface->fColorMask = noOpGLColorMask; | 287 functions->fClearStencil = noOpGLClearStencil; |
287 interface->fCompileShader = noOpGLCompileShader; | 288 functions->fClientActiveTexture = nullGLClientActiveTexture; |
288 interface->fCompressedTexImage2D = noOpGLCompressedTexImage2D; | 289 functions->fColorMask = noOpGLColorMask; |
289 interface->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D; | 290 functions->fCompileShader = noOpGLCompileShader; |
290 interface->fCreateProgram = nullGLCreateProgram; | 291 functions->fCompressedTexImage2D = noOpGLCompressedTexImage2D; |
291 interface->fCreateShader = nullGLCreateShader; | 292 functions->fCopyTexSubImage2D = noOpGLCopyTexSubImage2D; |
292 interface->fCullFace = noOpGLCullFace; | 293 functions->fCreateProgram = nullGLCreateProgram; |
293 interface->fDeleteBuffers = nullGLDeleteBuffers; | 294 functions->fCreateShader = nullGLCreateShader; |
294 interface->fDeleteProgram = nullGLDelete; | 295 functions->fCullFace = noOpGLCullFace; |
295 interface->fDeleteQueries = noOpGLDeleteIds; | 296 functions->fDeleteBuffers = nullGLDeleteBuffers; |
296 interface->fDeleteShader = nullGLDelete; | 297 functions->fDeleteProgram = nullGLDelete; |
297 interface->fDeleteTextures = noOpGLDeleteIds; | 298 functions->fDeleteQueries = noOpGLDeleteIds; |
298 interface->fDeleteVertexArrays = noOpGLDeleteIds; | 299 functions->fDeleteShader = nullGLDelete; |
299 interface->fDepthMask = noOpGLDepthMask; | 300 functions->fDeleteTextures = noOpGLDeleteIds; |
300 interface->fDisable = noOpGLDisable; | 301 functions->fDeleteVertexArrays = noOpGLDeleteIds; |
301 interface->fDisableClientState = noOpGLDisableClientState; | 302 functions->fDepthMask = noOpGLDepthMask; |
302 interface->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray; | 303 functions->fDisable = noOpGLDisable; |
303 interface->fDrawArrays = noOpGLDrawArrays; | 304 functions->fDisableClientState = noOpGLDisableClientState; |
304 interface->fDrawBuffer = noOpGLDrawBuffer; | 305 functions->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray; |
305 interface->fDrawBuffers = noOpGLDrawBuffers; | 306 functions->fDrawArrays = noOpGLDrawArrays; |
306 interface->fDrawElements = noOpGLDrawElements; | 307 functions->fDrawBuffer = noOpGLDrawBuffer; |
307 interface->fEnable = noOpGLEnable; | 308 functions->fDrawBuffers = noOpGLDrawBuffers; |
308 interface->fEnableClientState = noOpGLEnableClientState; | 309 functions->fDrawElements = noOpGLDrawElements; |
309 interface->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray; | 310 functions->fEnable = noOpGLEnable; |
310 interface->fEndQuery = noOpGLEndQuery; | 311 functions->fEnableClientState = noOpGLEnableClientState; |
311 interface->fFinish = noOpGLFinish; | 312 functions->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray; |
312 interface->fFlush = noOpGLFlush; | 313 functions->fEndQuery = noOpGLEndQuery; |
313 interface->fFrontFace = noOpGLFrontFace; | 314 functions->fFinish = noOpGLFinish; |
314 interface->fGenBuffers = nullGLGenBuffers; | 315 functions->fFlush = noOpGLFlush; |
315 interface->fGenerateMipmap = nullGLGenerateMipmap; | 316 functions->fFrontFace = noOpGLFrontFace; |
316 interface->fGenQueries = noOpGLGenIds; | 317 functions->fGenBuffers = nullGLGenBuffers; |
317 interface->fGenTextures = noOpGLGenIds; | 318 functions->fGenerateMipmap = nullGLGenerateMipmap; |
318 interface->fGenVertexArrays = noOpGLGenIds; | 319 functions->fGenQueries = noOpGLGenIds; |
319 interface->fGetBufferParameteriv = nullGLGetBufferParameteriv; | 320 functions->fGenTextures = noOpGLGenIds; |
320 interface->fGetError = noOpGLGetError; | 321 functions->fGenVertexArrays = noOpGLGenIds; |
321 interface->fGetIntegerv = noOpGLGetIntegerv; | 322 functions->fGetBufferParameteriv = nullGLGetBufferParameteriv; |
322 interface->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v; | 323 functions->fGetError = noOpGLGetError; |
323 interface->fGetQueryObjectiv = noOpGLGetQueryObjectiv; | 324 functions->fGetIntegerv = noOpGLGetIntegerv; |
324 interface->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v; | 325 functions->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v; |
325 interface->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv; | 326 functions->fGetQueryObjectiv = noOpGLGetQueryObjectiv; |
326 interface->fGetQueryiv = noOpGLGetQueryiv; | 327 functions->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v; |
327 interface->fGetProgramInfoLog = noOpGLGetInfoLog; | 328 functions->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv; |
328 interface->fGetProgramiv = noOpGLGetShaderOrProgramiv; | 329 functions->fGetQueryiv = noOpGLGetQueryiv; |
329 interface->fGetShaderInfoLog = noOpGLGetInfoLog; | 330 functions->fGetProgramInfoLog = noOpGLGetInfoLog; |
330 interface->fGetShaderiv = noOpGLGetShaderOrProgramiv; | 331 functions->fGetProgramiv = noOpGLGetShaderOrProgramiv; |
331 interface->fGetString = noOpGLGetString; | 332 functions->fGetShaderInfoLog = noOpGLGetInfoLog; |
332 interface->fGetStringi = noOpGLGetStringi; | 333 functions->fGetShaderiv = noOpGLGetShaderOrProgramiv; |
333 interface->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv; | 334 functions->fGetString = noOpGLGetString; |
334 interface->fGetUniformLocation = noOpGLGetUniformLocation; | 335 functions->fGetStringi = noOpGLGetStringi; |
335 interface->fLoadIdentity = noOpGLLoadIdentity; | 336 functions->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv; |
336 interface->fLoadMatrixf = noOpGLLoadMatrixf; | 337 functions->fGetUniformLocation = noOpGLGetUniformLocation; |
337 interface->fLineWidth = noOpGLLineWidth; | 338 functions->fLoadIdentity = noOpGLLoadIdentity; |
338 interface->fLinkProgram = noOpGLLinkProgram; | 339 functions->fLoadMatrixf = noOpGLLoadMatrixf; |
339 interface->fMatrixMode = noOpGLMatrixMode; | 340 functions->fLineWidth = noOpGLLineWidth; |
340 interface->fPixelStorei = nullGLPixelStorei; | 341 functions->fLinkProgram = noOpGLLinkProgram; |
341 interface->fQueryCounter = noOpGLQueryCounter; | 342 functions->fMatrixMode = noOpGLMatrixMode; |
342 interface->fReadBuffer = noOpGLReadBuffer; | 343 functions->fPixelStorei = nullGLPixelStorei; |
343 interface->fReadPixels = nullGLReadPixels; | 344 functions->fQueryCounter = noOpGLQueryCounter; |
344 interface->fScissor = noOpGLScissor; | 345 functions->fReadBuffer = noOpGLReadBuffer; |
345 interface->fShaderSource = noOpGLShaderSource; | 346 functions->fReadPixels = nullGLReadPixels; |
346 interface->fStencilFunc = noOpGLStencilFunc; | 347 functions->fScissor = noOpGLScissor; |
347 interface->fStencilFuncSeparate = noOpGLStencilFuncSeparate; | 348 functions->fShaderSource = noOpGLShaderSource; |
348 interface->fStencilMask = noOpGLStencilMask; | 349 functions->fStencilFunc = noOpGLStencilFunc; |
349 interface->fStencilMaskSeparate = noOpGLStencilMaskSeparate; | 350 functions->fStencilFuncSeparate = noOpGLStencilFuncSeparate; |
350 interface->fStencilOp = noOpGLStencilOp; | 351 functions->fStencilMask = noOpGLStencilMask; |
351 interface->fStencilOpSeparate = noOpGLStencilOpSeparate; | 352 functions->fStencilMaskSeparate = noOpGLStencilMaskSeparate; |
352 interface->fTexGenf = noOpGLTexGenf; | 353 functions->fStencilOp = noOpGLStencilOp; |
353 interface->fTexGenfv = noOpGLTexGenfv; | 354 functions->fStencilOpSeparate = noOpGLStencilOpSeparate; |
354 interface->fTexGeni = noOpGLTexGeni; | 355 functions->fTexGenf = noOpGLTexGenf; |
355 interface->fTexImage2D = noOpGLTexImage2D; | 356 functions->fTexGenfv = noOpGLTexGenfv; |
356 interface->fTexParameteri = noOpGLTexParameteri; | 357 functions->fTexGeni = noOpGLTexGeni; |
357 interface->fTexParameteriv = noOpGLTexParameteriv; | 358 functions->fTexImage2D = noOpGLTexImage2D; |
358 interface->fTexSubImage2D = noOpGLTexSubImage2D; | 359 functions->fTexParameteri = noOpGLTexParameteri; |
359 interface->fTexStorage2D = noOpGLTexStorage2D; | 360 functions->fTexParameteriv = noOpGLTexParameteriv; |
360 interface->fDiscardFramebuffer = noOpGLDiscardFramebuffer; | 361 functions->fTexSubImage2D = noOpGLTexSubImage2D; |
361 interface->fUniform1f = noOpGLUniform1f; | 362 functions->fTexStorage2D = noOpGLTexStorage2D; |
362 interface->fUniform1i = noOpGLUniform1i; | 363 functions->fDiscardFramebuffer = noOpGLDiscardFramebuffer; |
363 interface->fUniform1fv = noOpGLUniform1fv; | 364 functions->fUniform1f = noOpGLUniform1f; |
364 interface->fUniform1iv = noOpGLUniform1iv; | 365 functions->fUniform1i = noOpGLUniform1i; |
365 interface->fUniform2f = noOpGLUniform2f; | 366 functions->fUniform1fv = noOpGLUniform1fv; |
366 interface->fUniform2i = noOpGLUniform2i; | 367 functions->fUniform1iv = noOpGLUniform1iv; |
367 interface->fUniform2fv = noOpGLUniform2fv; | 368 functions->fUniform2f = noOpGLUniform2f; |
368 interface->fUniform2iv = noOpGLUniform2iv; | 369 functions->fUniform2i = noOpGLUniform2i; |
369 interface->fUniform3f = noOpGLUniform3f; | 370 functions->fUniform2fv = noOpGLUniform2fv; |
370 interface->fUniform3i = noOpGLUniform3i; | 371 functions->fUniform2iv = noOpGLUniform2iv; |
371 interface->fUniform3fv = noOpGLUniform3fv; | 372 functions->fUniform3f = noOpGLUniform3f; |
372 interface->fUniform3iv = noOpGLUniform3iv; | 373 functions->fUniform3i = noOpGLUniform3i; |
373 interface->fUniform4f = noOpGLUniform4f; | 374 functions->fUniform3fv = noOpGLUniform3fv; |
374 interface->fUniform4i = noOpGLUniform4i; | 375 functions->fUniform3iv = noOpGLUniform3iv; |
375 interface->fUniform4fv = noOpGLUniform4fv; | 376 functions->fUniform4f = noOpGLUniform4f; |
376 interface->fUniform4iv = noOpGLUniform4iv; | 377 functions->fUniform4i = noOpGLUniform4i; |
377 interface->fUniformMatrix2fv = noOpGLUniformMatrix2fv; | 378 functions->fUniform4fv = noOpGLUniform4fv; |
378 interface->fUniformMatrix3fv = noOpGLUniformMatrix3fv; | 379 functions->fUniform4iv = noOpGLUniform4iv; |
379 interface->fUniformMatrix4fv = noOpGLUniformMatrix4fv; | 380 functions->fUniformMatrix2fv = noOpGLUniformMatrix2fv; |
380 interface->fUseProgram = nullGLUseProgram; | 381 functions->fUniformMatrix3fv = noOpGLUniformMatrix3fv; |
381 interface->fVertexAttrib4fv = noOpGLVertexAttrib4fv; | 382 functions->fUniformMatrix4fv = noOpGLUniformMatrix4fv; |
382 interface->fVertexAttribPointer = noOpGLVertexAttribPointer; | 383 functions->fUseProgram = nullGLUseProgram; |
383 interface->fVertexPointer = noOpGLVertexPointer; | 384 functions->fVertexAttrib4fv = noOpGLVertexAttrib4fv; |
384 interface->fViewport = nullGLViewport; | 385 functions->fVertexAttribPointer = noOpGLVertexAttribPointer; |
385 interface->fBindFramebuffer = nullGLBindFramebuffer; | 386 functions->fVertexPointer = noOpGLVertexPointer; |
386 interface->fBindRenderbuffer = nullGLBindRenderbuffer; | 387 functions->fViewport = nullGLViewport; |
387 interface->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus; | 388 functions->fBindFramebuffer = nullGLBindFramebuffer; |
388 interface->fDeleteFramebuffers = nullGLDeleteFramebuffers; | 389 functions->fBindRenderbuffer = nullGLBindRenderbuffer; |
389 interface->fDeleteRenderbuffers = nullGLDeleteRenderbuffers; | 390 functions->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus; |
390 interface->fFramebufferRenderbuffer = nullGLFramebufferRenderbuffer; | 391 functions->fDeleteFramebuffers = nullGLDeleteFramebuffers; |
391 interface->fFramebufferTexture2D = nullGLFramebufferTexture2D; | 392 functions->fDeleteRenderbuffers = nullGLDeleteRenderbuffers; |
392 interface->fGenFramebuffers = noOpGLGenIds; | 393 functions->fFramebufferRenderbuffer = nullGLFramebufferRenderbuffer; |
393 interface->fGenRenderbuffers = noOpGLGenIds; | 394 functions->fFramebufferTexture2D = nullGLFramebufferTexture2D; |
394 interface->fGetFramebufferAttachmentParameteriv = noOpGLGetFramebufferAt
tachmentParameteriv; | 395 functions->fGenFramebuffers = noOpGLGenIds; |
395 interface->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteri
v; | 396 functions->fGenRenderbuffers = noOpGLGenIds; |
396 interface->fRenderbufferStorage = noOpGLRenderbufferStorage; | 397 functions->fGetFramebufferAttachmentParameteriv = noOpGLGetFramebufferAt
tachmentParameteriv; |
397 interface->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMu
ltisample; | 398 functions->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteri
v; |
398 interface->fBlitFramebuffer = noOpGLBlitFramebuffer; | 399 functions->fRenderbufferStorage = noOpGLRenderbufferStorage; |
399 interface->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFram
ebuffer; | 400 functions->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMu
ltisample; |
400 interface->fMapBuffer = nullGLMapBuffer; | 401 functions->fBlitFramebuffer = noOpGLBlitFramebuffer; |
401 interface->fUnmapBuffer = nullGLUnmapBuffer; | 402 functions->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFram
ebuffer; |
402 interface->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationInde
xed; | 403 functions->fMapBuffer = nullGLMapBuffer; |
| 404 functions->fUnmapBuffer = nullGLUnmapBuffer; |
| 405 functions->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationInde
xed; |
403 } | 406 } |
404 glInterface.get()->ref(); | 407 glInterface.get()->ref(); |
405 return glInterface.get(); | 408 return glInterface.get(); |
406 } | 409 } |
OLD | NEW |