diff options
author | bsalomon@google.com <bsalomon@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-06 14:12:28 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-06 14:12:28 +0000 |
commit | 29214d31038f5129df6bd89fc8cd7db0f05e1536 (patch) | |
tree | 632b6c0d92af2fe8a7109bc2e48d4c2a5014b566 /webkit | |
parent | 2c42113646f069aa005ffc3193e3740234960534 (diff) | |
download | chromium_src-29214d31038f5129df6bd89fc8cd7db0f05e1536.zip chromium_src-29214d31038f5129df6bd89fc8cd7db0f05e1536.tar.gz chromium_src-29214d31038f5129df6bd89fc8cd7db0f05e1536.tar.bz2 |
Create a GrGLInterface per-GrContext in Chrome. We do this so that its per-GL-function callback can be used to set the correct GL context.
See also: https://bugs.webkit.org/show_bug.cgi?id=67395
Review URL: http://codereview.chromium.org/7756004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99733 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
6 files changed, 109 insertions, 111 deletions
diff --git a/webkit/glue/gl_bindings_skia_cmd_buffer.cc b/webkit/glue/gl_bindings_skia_cmd_buffer.cc index d2cf9d1..bad2877 100644 --- a/webkit/glue/gl_bindings_skia_cmd_buffer.cc +++ b/webkit/glue/gl_bindings_skia_cmd_buffer.cc @@ -15,109 +15,105 @@ namespace webkit_glue { -GrGLInterface* GetCommandBufferSkiaGLBinding() { - static SkAutoTUnref<GrGLInterface> cmd_buffer_interface; - if (NULL == cmd_buffer_interface.get()) { - GrGLInterface* interface = new GrGLInterface; - cmd_buffer_interface.reset(interface); - interface->fBindingsExported = kES2_GrGLBinding; - interface->fActiveTexture = glActiveTexture; - interface->fAttachShader = glAttachShader; - interface->fBindAttribLocation = glBindAttribLocation; - interface->fBindBuffer = glBindBuffer; - interface->fBindTexture = glBindTexture; - interface->fBlendColor = glBlendColor; - interface->fBlendFunc = glBlendFunc; - interface->fBufferData = glBufferData; - interface->fBufferSubData = glBufferSubData; - interface->fClear = glClear; - interface->fClearColor = glClearColor; - interface->fClearStencil = glClearStencil; - interface->fColorMask = glColorMask; - interface->fCompileShader = glCompileShader; - interface->fCompressedTexImage2D = glCompressedTexImage2D; - interface->fCreateProgram = glCreateProgram; - interface->fCreateShader = glCreateShader; - interface->fCullFace = glCullFace; - interface->fDeleteBuffers = glDeleteBuffers; - interface->fDeleteProgram = glDeleteProgram; - interface->fDeleteShader = glDeleteShader; - interface->fDeleteTextures = glDeleteTextures; - interface->fDepthMask = glDepthMask; - interface->fDisable = glDisable; - interface->fDisableVertexAttribArray = glDisableVertexAttribArray; - interface->fDrawArrays = glDrawArrays; - interface->fDrawElements = glDrawElements; - interface->fEnable = glEnable; - interface->fEnableVertexAttribArray = glEnableVertexAttribArray; - interface->fFrontFace = glFrontFace; - interface->fGenBuffers = glGenBuffers; - interface->fGenTextures = glGenTextures; - interface->fGetBufferParameteriv = glGetBufferParameteriv; - interface->fGetError = glGetError; - interface->fGetIntegerv = glGetIntegerv; - interface->fGetProgramInfoLog = glGetProgramInfoLog; - interface->fGetProgramiv = glGetProgramiv; - interface->fGetShaderInfoLog = glGetShaderInfoLog; - interface->fGetShaderiv = glGetShaderiv; - interface->fGetString = glGetString; - interface->fGetUniformLocation = glGetUniformLocation; - interface->fLineWidth = glLineWidth; - interface->fLinkProgram = glLinkProgram; - interface->fPixelStorei = glPixelStorei; - interface->fReadPixels = glReadPixels; - interface->fScissor = glScissor; - interface->fShaderSource = glShaderSource; - interface->fStencilFunc = glStencilFunc; - interface->fStencilFuncSeparate = glStencilFuncSeparate; - interface->fStencilMask = glStencilMask; - interface->fStencilMaskSeparate = glStencilMaskSeparate; - interface->fStencilOp = glStencilOp; - interface->fStencilOpSeparate = glStencilOpSeparate; - interface->fTexImage2D = glTexImage2D; - interface->fTexParameteri = glTexParameteri; - interface->fTexSubImage2D = glTexSubImage2D; - interface->fUniform1f = glUniform1f; - interface->fUniform1i = glUniform1i; - interface->fUniform1fv = glUniform1fv; - interface->fUniform1iv = glUniform1iv; - interface->fUniform2f = glUniform2f; - interface->fUniform2i = glUniform2i; - interface->fUniform2fv = glUniform2fv; - interface->fUniform2iv = glUniform2iv; - interface->fUniform3f = glUniform3f; - interface->fUniform3i = glUniform3i; - interface->fUniform3fv = glUniform3fv; - interface->fUniform3iv = glUniform3iv; - interface->fUniform4f = glUniform4f; - interface->fUniform4i = glUniform4i; - interface->fUniform4fv = glUniform4fv; - interface->fUniform4iv = glUniform4iv; - interface->fUniformMatrix2fv = glUniformMatrix2fv; - interface->fUniformMatrix3fv = glUniformMatrix3fv; - interface->fUniformMatrix4fv = glUniformMatrix4fv; - interface->fUseProgram = glUseProgram; - interface->fVertexAttrib4fv = glVertexAttrib4fv; - interface->fVertexAttribPointer = glVertexAttribPointer; - interface->fViewport = glViewport; - interface->fBindFramebuffer = glBindFramebuffer; - interface->fBindRenderbuffer = glBindRenderbuffer; - interface->fCheckFramebufferStatus = glCheckFramebufferStatus; - interface->fDeleteFramebuffers = glDeleteFramebuffers; - interface->fDeleteRenderbuffers = glDeleteRenderbuffers; - interface->fFramebufferRenderbuffer = glFramebufferRenderbuffer; - interface->fFramebufferTexture2D = glFramebufferTexture2D; - interface->fGenFramebuffers = glGenFramebuffers; - interface->fGenRenderbuffers = glGenRenderbuffers; - interface->fGetFramebufferAttachmentParameteriv = - glGetFramebufferAttachmentParameteriv; - interface->fGetRenderbufferParameteriv = glGetRenderbufferParameteriv; - interface->fRenderbufferStorage = glRenderbufferStorage; - interface->fRenderbufferStorageMultisample = - glRenderbufferStorageMultisampleEXT; - interface->fBlitFramebuffer = glBlitFramebufferEXT; - } - return cmd_buffer_interface.get(); +GrGLInterface* CreateCommandBufferSkiaGLBinding() { + GrGLInterface* interface = new GrGLInterface; + interface->fBindingsExported = kES2_GrGLBinding; + interface->fActiveTexture = glActiveTexture; + interface->fAttachShader = glAttachShader; + interface->fBindAttribLocation = glBindAttribLocation; + interface->fBindBuffer = glBindBuffer; + interface->fBindTexture = glBindTexture; + interface->fBlendColor = glBlendColor; + interface->fBlendFunc = glBlendFunc; + interface->fBufferData = glBufferData; + interface->fBufferSubData = glBufferSubData; + interface->fClear = glClear; + interface->fClearColor = glClearColor; + interface->fClearStencil = glClearStencil; + interface->fColorMask = glColorMask; + interface->fCompileShader = glCompileShader; + interface->fCompressedTexImage2D = glCompressedTexImage2D; + interface->fCreateProgram = glCreateProgram; + interface->fCreateShader = glCreateShader; + interface->fCullFace = glCullFace; + interface->fDeleteBuffers = glDeleteBuffers; + interface->fDeleteProgram = glDeleteProgram; + interface->fDeleteShader = glDeleteShader; + interface->fDeleteTextures = glDeleteTextures; + interface->fDepthMask = glDepthMask; + interface->fDisable = glDisable; + interface->fDisableVertexAttribArray = glDisableVertexAttribArray; + interface->fDrawArrays = glDrawArrays; + interface->fDrawElements = glDrawElements; + interface->fEnable = glEnable; + interface->fEnableVertexAttribArray = glEnableVertexAttribArray; + interface->fFrontFace = glFrontFace; + interface->fGenBuffers = glGenBuffers; + interface->fGenTextures = glGenTextures; + interface->fGetBufferParameteriv = glGetBufferParameteriv; + interface->fGetError = glGetError; + interface->fGetIntegerv = glGetIntegerv; + interface->fGetProgramInfoLog = glGetProgramInfoLog; + interface->fGetProgramiv = glGetProgramiv; + interface->fGetShaderInfoLog = glGetShaderInfoLog; + interface->fGetShaderiv = glGetShaderiv; + interface->fGetString = glGetString; + interface->fGetUniformLocation = glGetUniformLocation; + interface->fLineWidth = glLineWidth; + interface->fLinkProgram = glLinkProgram; + interface->fPixelStorei = glPixelStorei; + interface->fReadPixels = glReadPixels; + interface->fScissor = glScissor; + interface->fShaderSource = glShaderSource; + interface->fStencilFunc = glStencilFunc; + interface->fStencilFuncSeparate = glStencilFuncSeparate; + interface->fStencilMask = glStencilMask; + interface->fStencilMaskSeparate = glStencilMaskSeparate; + interface->fStencilOp = glStencilOp; + interface->fStencilOpSeparate = glStencilOpSeparate; + interface->fTexImage2D = glTexImage2D; + interface->fTexParameteri = glTexParameteri; + interface->fTexSubImage2D = glTexSubImage2D; + interface->fUniform1f = glUniform1f; + interface->fUniform1i = glUniform1i; + interface->fUniform1fv = glUniform1fv; + interface->fUniform1iv = glUniform1iv; + interface->fUniform2f = glUniform2f; + interface->fUniform2i = glUniform2i; + interface->fUniform2fv = glUniform2fv; + interface->fUniform2iv = glUniform2iv; + interface->fUniform3f = glUniform3f; + interface->fUniform3i = glUniform3i; + interface->fUniform3fv = glUniform3fv; + interface->fUniform3iv = glUniform3iv; + interface->fUniform4f = glUniform4f; + interface->fUniform4i = glUniform4i; + interface->fUniform4fv = glUniform4fv; + interface->fUniform4iv = glUniform4iv; + interface->fUniformMatrix2fv = glUniformMatrix2fv; + interface->fUniformMatrix3fv = glUniformMatrix3fv; + interface->fUniformMatrix4fv = glUniformMatrix4fv; + interface->fUseProgram = glUseProgram; + interface->fVertexAttrib4fv = glVertexAttrib4fv; + interface->fVertexAttribPointer = glVertexAttribPointer; + interface->fViewport = glViewport; + interface->fBindFramebuffer = glBindFramebuffer; + interface->fBindRenderbuffer = glBindRenderbuffer; + interface->fCheckFramebufferStatus = glCheckFramebufferStatus; + interface->fDeleteFramebuffers = glDeleteFramebuffers; + interface->fDeleteRenderbuffers = glDeleteRenderbuffers; + interface->fFramebufferRenderbuffer = glFramebufferRenderbuffer; + interface->fFramebufferTexture2D = glFramebufferTexture2D; + interface->fGenFramebuffers = glGenFramebuffers; + interface->fGenRenderbuffers = glGenRenderbuffers; + interface->fGetFramebufferAttachmentParameteriv = + glGetFramebufferAttachmentParameteriv; + interface->fGetRenderbufferParameteriv = glGetRenderbufferParameteriv; + interface->fRenderbufferStorage = glRenderbufferStorage; + interface->fRenderbufferStorageMultisample = + glRenderbufferStorageMultisampleEXT; + interface->fBlitFramebuffer = glBlitFramebufferEXT; + return interface; } } // namespace webkit_glue diff --git a/webkit/glue/gl_bindings_skia_cmd_buffer.h b/webkit/glue/gl_bindings_skia_cmd_buffer.h index 7518492..d7cfc47 100644 --- a/webkit/glue/gl_bindings_skia_cmd_buffer.h +++ b/webkit/glue/gl_bindings_skia_cmd_buffer.h @@ -11,8 +11,8 @@ struct GrGLInterface; namespace webkit_glue { // The GPU back-end for skia requires pointers to GL functions. This function -// binds skia-gpu to the cmd buffers GL. -GrGLInterface* GetCommandBufferSkiaGLBinding(); +// returns a binding for skia-gpu to the cmd buffers GL. +GrGLInterface* CreateCommandBufferSkiaGLBinding(); } // namespace webkit_glue diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc index 40a5957..833360a 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc +++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc @@ -1578,8 +1578,8 @@ WGC3Denum WebGraphicsContext3DInProcessCommandBufferImpl:: #if WEBKIT_USING_SKIA GrGLInterface* WebGraphicsContext3DInProcessCommandBufferImpl:: - grGLInterface() { - return webkit_glue::GetCommandBufferSkiaGLBinding(); + onCreateGrGLInterface() { + return webkit_glue::CreateCommandBufferSkiaGLBinding(); } #endif diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h index 6b4f276..ae162e7 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h +++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h @@ -430,8 +430,9 @@ class WebGraphicsContext3DInProcessCommandBufferImpl WebGraphicsContext3D::WebGraphicsContextLostCallback* callback); virtual WGC3Denum getGraphicsResetStatusARB(); + protected: #if WEBKIT_USING_SKIA - virtual GrGLInterface* grGLInterface(); + virtual GrGLInterface* onCreateGrGLInterface(); #endif private: diff --git a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc index f149813..909cabe 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc +++ b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc @@ -1552,8 +1552,8 @@ WGC3Denum WebGraphicsContext3DInProcessImpl::getGraphicsResetStatusARB() { } #if WEBKIT_USING_SKIA -GrGLInterface* WebGraphicsContext3DInProcessImpl::grGLInterface() { - return gfx::GetInProcessSkiaGLBinding(); +GrGLInterface* WebGraphicsContext3DInProcessImpl::onCreateGrGLInterface() { + return gfx::CreateInProcessSkiaGLBinding(); } #endif diff --git a/webkit/gpu/webgraphicscontext3d_in_process_impl.h b/webkit/gpu/webgraphicscontext3d_in_process_impl.h index 81f1b74..eb7cc5d 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_impl.h +++ b/webkit/gpu/webgraphicscontext3d_in_process_impl.h @@ -412,8 +412,9 @@ class WebGraphicsContext3DInProcessImpl : public WebGraphicsContext3D { WebGraphicsContext3D:: WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback) {} + protected: #if WEBKIT_USING_SKIA - virtual GrGLInterface* grGLInterface(); + virtual GrGLInterface* onCreateGrGLInterface(); #endif private: |