| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 #include "ui/gl/gl_bindings_skia_in_process.h" | 6 #include "ui/gl/gl_bindings_skia_in_process.h" |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" | 9 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" |
| 10 #include "ui/gl/gl_bindings.h" | 10 #include "ui/gl/gl_bindings.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 222 } |
| 223 | 223 |
| 224 GLvoid StubGLFinish() { | 224 GLvoid StubGLFinish() { |
| 225 glFinish(); | 225 glFinish(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 GLvoid StubGLFlush() { | 228 GLvoid StubGLFlush() { |
| 229 glFlush(); | 229 glFlush(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 GLvoid StubGLFlushMappedBufferRange(GLenum target, GLintptr offset, | |
| 233 GLsizeiptr length) { | |
| 234 glFlushMappedBufferRange(target, offset, length); | |
| 235 } | |
| 236 | |
| 237 GLvoid StubGLFramebufferRenderbuffer(GLenum target, GLenum attachment, | 232 GLvoid StubGLFramebufferRenderbuffer(GLenum target, GLenum attachment, |
| 238 GLenum renderbuffertarget, | 233 GLenum renderbuffertarget, |
| 239 GLuint renderbuffer) { | 234 GLuint renderbuffer) { |
| 240 glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, | 235 glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, |
| 241 renderbuffer); | 236 renderbuffer); |
| 242 } | 237 } |
| 243 | 238 |
| 244 GLvoid StubGLFramebufferTexture2D(GLenum target, GLenum attachment, | 239 GLvoid StubGLFramebufferTexture2D(GLenum target, GLenum attachment, |
| 245 GLenum textarget, GLuint texture, | 240 GLenum textarget, GLuint texture, |
| 246 GLint level) { | 241 GLint level) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 324 |
| 330 GLvoid StubGLGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, | 325 GLvoid StubGLGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, |
| 331 GLint *range, GLint *precision) { | 326 GLint *range, GLint *precision) { |
| 332 glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision); | 327 glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision); |
| 333 } | 328 } |
| 334 | 329 |
| 335 const GLubyte* StubGLGetString(GLenum name) { | 330 const GLubyte* StubGLGetString(GLenum name) { |
| 336 return glGetString(name); | 331 return glGetString(name); |
| 337 } | 332 } |
| 338 | 333 |
| 339 const GLubyte* StubGLGetStringi(GLenum name, GLuint index) { | |
| 340 return glGetStringi(name, index); | |
| 341 } | |
| 342 | |
| 343 GLvoid StubGLGetQueryiv(GLenum target, GLenum pname, GLint* params) { | 334 GLvoid StubGLGetQueryiv(GLenum target, GLenum pname, GLint* params) { |
| 344 glGetQueryiv(target, pname, params); | 335 glGetQueryiv(target, pname, params); |
| 345 } | 336 } |
| 346 | 337 |
| 347 GLvoid StubGLGetQueryObjecti64v(GLuint id, GLenum pname, GLint64* params) { | 338 GLvoid StubGLGetQueryObjecti64v(GLuint id, GLenum pname, GLint64* params) { |
| 348 glGetQueryObjecti64v(id, pname, params); | 339 glGetQueryObjecti64v(id, pname, params); |
| 349 } | 340 } |
| 350 | 341 |
| 351 GLvoid StubGLGetQueryObjectiv(GLuint id, GLenum pname, GLint* params) { | 342 GLvoid StubGLGetQueryObjectiv(GLuint id, GLenum pname, GLint* params) { |
| 352 glGetQueryObjectiv(id, pname, params); | 343 glGetQueryObjectiv(id, pname, params); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 366 } | 357 } |
| 367 | 358 |
| 368 GLint StubGLGetUniformLocation(GLuint program, const char* name) { | 359 GLint StubGLGetUniformLocation(GLuint program, const char* name) { |
| 369 return glGetUniformLocation(program, name); | 360 return glGetUniformLocation(program, name); |
| 370 } | 361 } |
| 371 | 362 |
| 372 GLvoid StubGLInsertEventMarker(GLsizei length, const char* marker) { | 363 GLvoid StubGLInsertEventMarker(GLsizei length, const char* marker) { |
| 373 glInsertEventMarkerEXT(length, marker); | 364 glInsertEventMarkerEXT(length, marker); |
| 374 } | 365 } |
| 375 | 366 |
| 376 GLvoid StubGLInvalidateFramebuffer(GLenum target, GLsizei numAttachments, | |
| 377 const GLenum* attachments) { | |
| 378 glInvalidateFramebuffer(target, numAttachments, attachments); | |
| 379 } | |
| 380 | |
| 381 GLvoid StubGLInvalidateSubFramebuffer(GLenum target, | |
| 382 GLsizei numAttachments, | |
| 383 const GLenum* attachments, | |
| 384 GLint x, GLint y, | |
| 385 GLsizei width, GLsizei height) { | |
| 386 glInvalidateSubFramebuffer(target, numAttachments, attachments, | |
| 387 x, y, width, height); | |
| 388 } | |
| 389 | |
| 390 GLvoid StubGLLineWidth(GLfloat width) { | 367 GLvoid StubGLLineWidth(GLfloat width) { |
| 391 glLineWidth(width); | 368 glLineWidth(width); |
| 392 } | 369 } |
| 393 | 370 |
| 394 GLvoid StubGLLinkProgram(GLuint program) { | 371 GLvoid StubGLLinkProgram(GLuint program) { |
| 395 glLinkProgram(program); | 372 glLinkProgram(program); |
| 396 } | 373 } |
| 397 | 374 |
| 398 void* StubGLMapBuffer(GLenum target, GLenum access) { | 375 void* StubGLMapBuffer(GLenum target, GLenum access) { |
| 399 return glMapBuffer(target, access); | 376 return glMapBuffer(target, access); |
| 400 } | 377 } |
| 401 | 378 |
| 402 void* StubGLMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, | |
| 403 GLbitfield access) { | |
| 404 return glMapBufferRange(target, offset, length, access); | |
| 405 } | |
| 406 | |
| 407 GLvoid StubGLPixelStorei(GLenum pname, GLint param) { | 379 GLvoid StubGLPixelStorei(GLenum pname, GLint param) { |
| 408 glPixelStorei(pname, param); | 380 glPixelStorei(pname, param); |
| 409 } | 381 } |
| 410 | 382 |
| 411 GLvoid StubGLPopGroupMarker() { | 383 GLvoid StubGLPopGroupMarker() { |
| 412 glPopGroupMarkerEXT(); | 384 glPopGroupMarkerEXT(); |
| 413 } | 385 } |
| 414 | 386 |
| 415 GLvoid StubGLPushGroupMarker(GLsizei length, const char* marker) { | 387 GLvoid StubGLPushGroupMarker(GLsizei length, const char* marker) { |
| 416 glPushGroupMarkerEXT(length, marker); | 388 glPushGroupMarkerEXT(length, marker); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 | 582 |
| 611 GLvoid StubGLVertexAttribPointer(GLuint indx, GLint size, GLenum type, | 583 GLvoid StubGLVertexAttribPointer(GLuint indx, GLint size, GLenum type, |
| 612 GLboolean normalized, GLsizei stride, | 584 GLboolean normalized, GLsizei stride, |
| 613 const void* ptr) { | 585 const void* ptr) { |
| 614 glVertexAttribPointer(indx, size, type, normalized, stride, ptr); | 586 glVertexAttribPointer(indx, size, type, normalized, stride, ptr); |
| 615 } | 587 } |
| 616 | 588 |
| 617 GLvoid StubGLViewport(GLint x, GLint y, GLsizei width, GLsizei height) { | 589 GLvoid StubGLViewport(GLint x, GLint y, GLsizei width, GLsizei height) { |
| 618 glViewport(x, y, width, height); | 590 glViewport(x, y, width, height); |
| 619 } | 591 } |
| 620 | |
| 621 GLint StubGLGetProgramResourceLocation(GLuint program, | |
| 622 GLenum programInterface, | |
| 623 const char* name) { | |
| 624 return glGetProgramResourceLocation(program, programInterface, name); | |
| 625 } | |
| 626 | |
| 627 } // extern "C" | 592 } // extern "C" |
| 628 } // namespace | 593 } // namespace |
| 629 | 594 |
| 630 namespace gfx { | 595 namespace gfx { |
| 631 | 596 |
| 632 GrGLInterface* CreateInProcessSkiaGLBinding() { | 597 GrGLInterface* CreateInProcessSkiaGLBinding() { |
| 633 GrGLStandard standard; | 598 GrGLStandard standard; |
| 634 switch (gfx::GetGLImplementation()) { | 599 switch (gfx::GetGLImplementation()) { |
| 635 case gfx::kGLImplementationNone: | 600 case gfx::kGLImplementationNone: |
| 636 NOTREACHED(); | 601 NOTREACHED(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 650 return NULL; | 615 return NULL; |
| 651 default: | 616 default: |
| 652 NOTREACHED(); | 617 NOTREACHED(); |
| 653 return NULL; | 618 return NULL; |
| 654 } | 619 } |
| 655 | 620 |
| 656 GrGLInterface* interface = new GrGLInterface; | 621 GrGLInterface* interface = new GrGLInterface; |
| 657 interface->fStandard = standard; | 622 interface->fStandard = standard; |
| 658 interface->fExtensions.init(standard, | 623 interface->fExtensions.init(standard, |
| 659 StubGLGetString, | 624 StubGLGetString, |
| 660 StubGLGetStringi, | 625 NULL, |
| 661 StubGLGetIntegerv); | 626 StubGLGetIntegerv); |
| 662 | 627 |
| 663 GrGLInterface::Functions* functions = &interface->fFunctions; | 628 GrGLInterface::Functions* functions = &interface->fFunctions; |
| 664 functions->fActiveTexture = StubGLActiveTexture; | 629 functions->fActiveTexture = StubGLActiveTexture; |
| 665 functions->fAttachShader = StubGLAttachShader; | 630 functions->fAttachShader = StubGLAttachShader; |
| 666 functions->fBeginQuery = StubGLBeginQuery; | 631 functions->fBeginQuery = StubGLBeginQuery; |
| 667 functions->fBindAttribLocation = StubGLBindAttribLocation; | 632 functions->fBindAttribLocation = StubGLBindAttribLocation; |
| 668 functions->fBindBuffer = StubGLBindBuffer; | 633 functions->fBindBuffer = StubGLBindBuffer; |
| 669 functions->fBindFragDataLocation = StubGLBindFragDataLocation; | 634 functions->fBindFragDataLocation = StubGLBindFragDataLocation; |
| 670 functions->fBindTexture = StubGLBindTexture; | 635 functions->fBindTexture = StubGLBindTexture; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 695 functions->fDiscardFramebuffer = StubGLDiscardFramebuffer; | 660 functions->fDiscardFramebuffer = StubGLDiscardFramebuffer; |
| 696 functions->fDrawArrays = StubGLDrawArrays; | 661 functions->fDrawArrays = StubGLDrawArrays; |
| 697 functions->fDrawBuffer = StubGLDrawBuffer; | 662 functions->fDrawBuffer = StubGLDrawBuffer; |
| 698 functions->fDrawBuffers = StubGLDrawBuffers; | 663 functions->fDrawBuffers = StubGLDrawBuffers; |
| 699 functions->fDrawElements = StubGLDrawElements; | 664 functions->fDrawElements = StubGLDrawElements; |
| 700 functions->fEnable = StubGLEnable; | 665 functions->fEnable = StubGLEnable; |
| 701 functions->fEnableVertexAttribArray = StubGLEnableVertexAttribArray; | 666 functions->fEnableVertexAttribArray = StubGLEnableVertexAttribArray; |
| 702 functions->fEndQuery = StubGLEndQuery; | 667 functions->fEndQuery = StubGLEndQuery; |
| 703 functions->fFinish = StubGLFinish; | 668 functions->fFinish = StubGLFinish; |
| 704 functions->fFlush = StubGLFlush; | 669 functions->fFlush = StubGLFlush; |
| 705 functions->fFlushMappedBufferRange = StubGLFlushMappedBufferRange; | |
| 706 functions->fFrontFace = StubGLFrontFace; | 670 functions->fFrontFace = StubGLFrontFace; |
| 707 functions->fGenBuffers = StubGLGenBuffers; | 671 functions->fGenBuffers = StubGLGenBuffers; |
| 708 functions->fGenQueries = StubGLGenQueries; | 672 functions->fGenQueries = StubGLGenQueries; |
| 709 functions->fGenTextures = StubGLGenTextures; | 673 functions->fGenTextures = StubGLGenTextures; |
| 710 functions->fGenVertexArrays = StubGLGenVertexArrays; | 674 functions->fGenVertexArrays = StubGLGenVertexArrays; |
| 711 functions->fGenerateMipmap = StubGLGenerateMipmap; | 675 functions->fGenerateMipmap = StubGLGenerateMipmap; |
| 712 functions->fGetBufferParameteriv = StubGLGetBufferParameteriv; | 676 functions->fGetBufferParameteriv = StubGLGetBufferParameteriv; |
| 713 functions->fGetError = StubGLGetError; | 677 functions->fGetError = StubGLGetError; |
| 714 functions->fGetIntegerv = StubGLGetIntegerv; | 678 functions->fGetIntegerv = StubGLGetIntegerv; |
| 715 functions->fGetQueryiv = StubGLGetQueryiv; | 679 functions->fGetQueryiv = StubGLGetQueryiv; |
| 716 functions->fGetQueryObjecti64v = StubGLGetQueryObjecti64v; | 680 functions->fGetQueryObjecti64v = StubGLGetQueryObjecti64v; |
| 717 functions->fGetQueryObjectiv = StubGLGetQueryObjectiv; | 681 functions->fGetQueryObjectiv = StubGLGetQueryObjectiv; |
| 718 functions->fGetQueryObjectui64v = StubGLGetQueryObjectui64v; | 682 functions->fGetQueryObjectui64v = StubGLGetQueryObjectui64v; |
| 719 functions->fGetQueryObjectuiv = StubGLGetQueryObjectuiv; | 683 functions->fGetQueryObjectuiv = StubGLGetQueryObjectuiv; |
| 720 functions->fGetProgramInfoLog = StubGLGetProgramInfoLog; | 684 functions->fGetProgramInfoLog = StubGLGetProgramInfoLog; |
| 721 functions->fGetProgramiv = StubGLGetProgramiv; | 685 functions->fGetProgramiv = StubGLGetProgramiv; |
| 722 functions->fGetShaderInfoLog = StubGLGetShaderInfoLog; | 686 functions->fGetShaderInfoLog = StubGLGetShaderInfoLog; |
| 723 functions->fGetShaderiv = StubGLGetShaderiv; | 687 functions->fGetShaderiv = StubGLGetShaderiv; |
| 724 functions->fGetShaderPrecisionFormat = StubGLGetShaderPrecisionFormat; | 688 functions->fGetShaderPrecisionFormat = StubGLGetShaderPrecisionFormat; |
| 725 functions->fGetString = StubGLGetString; | 689 functions->fGetString = StubGLGetString; |
| 726 functions->fGetStringi = StubGLGetStringi; | |
| 727 functions->fGetTexLevelParameteriv = StubGLGetTexLevelParameteriv; | 690 functions->fGetTexLevelParameteriv = StubGLGetTexLevelParameteriv; |
| 728 functions->fGetUniformLocation = StubGLGetUniformLocation; | 691 functions->fGetUniformLocation = StubGLGetUniformLocation; |
| 729 functions->fInsertEventMarker = StubGLInsertEventMarker; | 692 functions->fInsertEventMarker = StubGLInsertEventMarker; |
| 730 functions->fInvalidateFramebuffer = StubGLInvalidateFramebuffer; | |
| 731 functions->fInvalidateSubFramebuffer = StubGLInvalidateSubFramebuffer; | |
| 732 functions->fLineWidth = StubGLLineWidth; | 693 functions->fLineWidth = StubGLLineWidth; |
| 733 functions->fLinkProgram = StubGLLinkProgram; | 694 functions->fLinkProgram = StubGLLinkProgram; |
| 734 functions->fMapBufferRange = StubGLMapBufferRange; | |
| 735 functions->fPixelStorei = StubGLPixelStorei; | 695 functions->fPixelStorei = StubGLPixelStorei; |
| 736 functions->fPopGroupMarker = StubGLPopGroupMarker; | 696 functions->fPopGroupMarker = StubGLPopGroupMarker; |
| 737 functions->fPushGroupMarker = StubGLPushGroupMarker; | 697 functions->fPushGroupMarker = StubGLPushGroupMarker; |
| 738 functions->fQueryCounter = StubGLQueryCounter; | 698 functions->fQueryCounter = StubGLQueryCounter; |
| 739 functions->fReadBuffer = StubGLReadBuffer; | 699 functions->fReadBuffer = StubGLReadBuffer; |
| 740 functions->fReadPixels = StubGLReadPixels; | 700 functions->fReadPixels = StubGLReadPixels; |
| 741 functions->fScissor = StubGLScissor; | 701 functions->fScissor = StubGLScissor; |
| 742 functions->fShaderSource = StubGLShaderSource; | 702 functions->fShaderSource = StubGLShaderSource; |
| 743 functions->fStencilFunc = StubGLStencilFunc; | 703 functions->fStencilFunc = StubGLStencilFunc; |
| 744 functions->fStencilFuncSeparate = StubGLStencilFuncSeparate; | 704 functions->fStencilFuncSeparate = StubGLStencilFuncSeparate; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 functions->fFramebufferTexture2DMultisample = | 747 functions->fFramebufferTexture2DMultisample = |
| 788 StubGLFramebufferTexture2DMultisample; | 748 StubGLFramebufferTexture2DMultisample; |
| 789 functions->fGenFramebuffers = StubGLGenFramebuffers; | 749 functions->fGenFramebuffers = StubGLGenFramebuffers; |
| 790 functions->fGenRenderbuffers = StubGLGenRenderbuffers; | 750 functions->fGenRenderbuffers = StubGLGenRenderbuffers; |
| 791 functions->fGetFramebufferAttachmentParameteriv = | 751 functions->fGetFramebufferAttachmentParameteriv = |
| 792 StubGLGetFramebufferAttachmentParameteriv; | 752 StubGLGetFramebufferAttachmentParameteriv; |
| 793 functions->fGetRenderbufferParameteriv = StubGLGetRenderbufferParameteriv; | 753 functions->fGetRenderbufferParameteriv = StubGLGetRenderbufferParameteriv; |
| 794 functions->fRenderbufferStorage = StubGLRenderbufferStorage; | 754 functions->fRenderbufferStorage = StubGLRenderbufferStorage; |
| 795 functions->fRenderbufferStorageMultisample = | 755 functions->fRenderbufferStorageMultisample = |
| 796 StubGLRenderbufferStorageMultisample; | 756 StubGLRenderbufferStorageMultisample; |
| 797 functions->fRenderbufferStorageMultisampleES2EXT = | |
| 798 StubGLRenderbufferStorageMultisample; | |
| 799 functions->fBlitFramebuffer = StubGLBlitFramebuffer; | 757 functions->fBlitFramebuffer = StubGLBlitFramebuffer; |
| 800 functions->fMapBuffer = StubGLMapBuffer; | 758 functions->fMapBuffer = StubGLMapBuffer; |
| 801 functions->fUnmapBuffer = StubGLUnmapBuffer; | 759 functions->fUnmapBuffer = StubGLUnmapBuffer; |
| 802 functions->fBindFragDataLocationIndexed = | 760 functions->fBindFragDataLocationIndexed = |
| 803 StubGLBindFragDataLocationIndexed; | 761 StubGLBindFragDataLocationIndexed; |
| 804 functions->fGetProgramResourceLocation = StubGLGetProgramResourceLocation; | |
| 805 | 762 |
| 806 return interface; | 763 return interface; |
| 807 } | 764 } |
| 808 | 765 |
| 809 } // namespace gfx | 766 } // namespace gfx |
| OLD | NEW |