summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorbsalomon@google.com <bsalomon@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-23 15:15:36 +0000
committerbsalomon@google.com <bsalomon@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-23 15:15:36 +0000
commit0b8dbc30486cb2c491a7d5fff75c82f3c1b6cf1b (patch)
tree43679dfb06a3c37fe5a60f917e441aa118b355d1 /ui
parentb68bf389d1ffa4539a3b486a6ee3e4d03990c166 (diff)
downloadchromium_src-0b8dbc30486cb2c491a7d5fff75c82f3c1b6cf1b.zip
chromium_src-0b8dbc30486cb2c491a7d5fff75c82f3c1b6cf1b.tar.gz
chromium_src-0b8dbc30486cb2c491a7d5fff75c82f3c1b6cf1b.tar.bz2
Until this roll skia supported only a single GrGLInterace object shared by all GrContexts. Now GrGLInterface is a ref counted object and each GrContext can use a different one.
This flexibility be needed to use skia-gpu to draw UI elements concurrently with canvas or --enable-accelerated-drawing while in --single-process mode. The former will uses the in-proc WGC3D implementation and the latter uses the cmd-buf implementation. These changes just make Chrome continue to work as it did before. A future change will remove the dependence on setting the "default" GrGLInterface and instead explicitly pass a GrGLInterface to each GrContext constructor that depends on which WGC3D implementation is in use. Review URL: http://codereview.chromium.org/7691002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97862 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/gfx/gl/gl_bindings_skia_in_process.cc238
1 files changed, 111 insertions, 127 deletions
diff --git a/ui/gfx/gl/gl_bindings_skia_in_process.cc b/ui/gfx/gl/gl_bindings_skia_in_process.cc
index 73b0270..ae4159e 100644
--- a/ui/gfx/gl/gl_bindings_skia_in_process.cc
+++ b/ui/gfx/gl/gl_bindings_skia_in_process.cc
@@ -297,7 +297,7 @@ GLvoid StubGLReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
glReadPixels(x, y, width, height, format, type, pixels);
}
-GLvoid StubGLRenderBufferStorage(GLenum target, GLenum internalformat,
+GLvoid StubGLRenderbufferStorage(GLenum target, GLenum internalformat,
GLsizei width, GLsizei height) {
glRenderbufferStorageEXT(target, internalformat, width, height);
}
@@ -470,8 +470,8 @@ GLvoid StubGLViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
namespace gfx {
void BindSkiaToInProcessGL() {
- static bool host_StubGL_installed = false;
- if (!host_StubGL_installed) {
+ static SkAutoTUnref<GrGLInterface> host_gl_interface;
+ if (NULL == host_gl_interface.get()) {
GrGLBinding binding;
switch (gfx::GetGLImplementation()) {
case gfx::kGLImplementationNone:
@@ -494,131 +494,115 @@ void BindSkiaToInProcessGL() {
return;
}
- static GrGLInterface host_gl_interface = {
- binding,
-
- kProbe_GrGLCapability, // NPOTRenderTargetSupport
- kProbe_GrGLCapability, // MinRenderTargetHeight
- kProbe_GrGLCapability, // MinRenderTargetWidth
-
- StubGLActiveTexture,
- StubGLAttachShader,
- StubGLBindAttribLocation,
- StubGLBindBuffer,
- StubGLBindTexture,
- StubGLBlendColor,
- StubGLBlendFunc,
- StubGLBufferData,
- StubGLBufferSubData,
- StubGLClear,
- StubGLClearColor,
- StubGLClearStencil,
- NULL, // glClientActiveTexture
- NULL, // glColor4ub
- StubGLColorMask,
- NULL, // glColorPointer
- StubGLCompileShader,
- StubGLCompressedTexImage2D,
- StubGLCreateProgram,
- StubGLCreateShader,
- StubGLCullFace,
- StubGLDeleteBuffers,
- StubGLDeleteProgram,
- StubGLDeleteShader,
- StubGLDeleteTextures,
- StubGLDepthMask,
- StubGLDisable,
- NULL, // glDisableClientState
- StubGLDisableVertexAttribArray,
- StubGLDrawArrays,
- StubGLDrawBuffer,
- StubGLDrawBuffers,
- StubGLDrawElements,
- StubGLEnable,
- NULL, // glEnableClientState
- StubGLEnableVertexAttribArray,
- StubGLFrontFace,
- StubGLGenBuffers,
- StubGLGenTextures,
- StubGLGetBufferParameteriv,
- StubGLGetError,
- StubGLGetIntegerv,
- StubGLGetProgramInfoLog,
- StubGLGetProgramiv,
- StubGLGetShaderInfoLog,
- StubGLGetShaderiv,
- StubGLGetString,
- StubGLGetTexLevelParameteriv,
- StubGLGetUniformLocation,
- StubGLLineWidth,
- StubGLLinkProgram,
- NULL, // glLoadMatrixf
- NULL, // glMatrixMode
- StubGLPixelStorei,
- NULL, // glPointSize
- StubGLReadBuffer,
- StubGLReadPixels,
- StubGLScissor,
- NULL, // glShadeModel
- StubGLShaderSource,
- StubGLStencilFunc,
- StubGLStencilFuncSeparate,
- StubGLStencilMask,
- StubGLStencilMaskSeparate,
- StubGLStencilOp,
- StubGLStencilOpSeparate,
- NULL, // glTexCoordPointer
- NULL, // glTexEnvi
- StubGLTexImage2D,
- StubGLTexParameteri,
- StubGLTexSubImage2D,
- StubGLUniform1f,
- StubGLUniform1i,
- StubGLUniform1fv,
- StubGLUniform1iv,
- StubGLUniform2f,
- StubGLUniform2i,
- StubGLUniform2fv,
- StubGLUniform2iv,
- StubGLUniform3f,
- StubGLUniform3i,
- StubGLUniform3fv,
- StubGLUniform3iv,
- StubGLUniform4f,
- StubGLUniform4i,
- StubGLUniform4fv,
- StubGLUniform4iv,
- StubGLUniformMatrix2fv,
- StubGLUniformMatrix3fv,
- StubGLUniformMatrix4fv,
- StubGLUseProgram,
- StubGLVertexAttrib4fv,
- StubGLVertexAttribPointer,
- NULL, // glVertexPointer
- StubGLViewport,
- StubGLBindFramebuffer,
- StubGLBindRenderbuffer,
- StubGLCheckFramebufferStatus,
- StubGLDeleteFramebuffers,
- StubGLDeleteRenderbuffers,
- StubGLFramebufferRenderbuffer,
- StubGLFramebufferTexture2D,
- StubGLGenFramebuffers,
- StubGLGenRenderbuffers,
- StubGLGetFramebufferAttachmentParameteriv,
- StubGLGetRenderbufferParameteriv,
- StubGLRenderBufferStorage,
- StubGLRenderbufferStorageMultisample,
- StubGLBlitFramebuffer,
- NULL, // glResolveMultisampleFramebuffer
- StubGLMapBuffer,
- StubGLUnmapBuffer,
- StubBindFragDataLocationIndexedARB,
- GrGLInterface::kStaticInitEndGuard,
- };
- GrGLSetGLInterface(&host_gl_interface);
- host_StubGL_installed = true;
+ GrGLInterface* interface = new GrGLInterface;
+ host_gl_interface.reset(interface);
+
+ interface->fBindingsExported = binding;
+ interface->fActiveTexture = StubGLActiveTexture;
+ interface->fAttachShader = StubGLAttachShader;
+ interface->fBindAttribLocation = StubGLBindAttribLocation;
+ interface->fBindBuffer = StubGLBindBuffer;
+ interface->fBindTexture = StubGLBindTexture;
+ interface->fBlendColor = StubGLBlendColor;
+ interface->fBlendFunc = StubGLBlendFunc;
+ interface->fBufferData = StubGLBufferData;
+ interface->fBufferSubData = StubGLBufferSubData;
+ interface->fClear = StubGLClear;
+ interface->fClearColor = StubGLClearColor;
+ interface->fClearStencil = StubGLClearStencil;
+ interface->fColorMask = StubGLColorMask;
+ interface->fCompileShader = StubGLCompileShader;
+ interface->fCompressedTexImage2D = StubGLCompressedTexImage2D;
+ interface->fCreateProgram = StubGLCreateProgram;
+ interface->fCreateShader = StubGLCreateShader;
+ interface->fCullFace = StubGLCullFace;
+ interface->fDeleteBuffers = StubGLDeleteBuffers;
+ interface->fDeleteProgram = StubGLDeleteProgram;
+ interface->fDeleteShader = StubGLDeleteShader;
+ interface->fDeleteTextures = StubGLDeleteTextures;
+ interface->fDepthMask = StubGLDepthMask;
+ interface->fDisable = StubGLDisable;
+ interface->fDisableVertexAttribArray = StubGLDisableVertexAttribArray;
+ interface->fDrawArrays = StubGLDrawArrays;
+ interface->fDrawBuffer = StubGLDrawBuffer;
+ interface->fDrawBuffers = StubGLDrawBuffers;
+ interface->fDrawElements = StubGLDrawElements;
+ interface->fEnable = StubGLEnable;
+ interface->fEnableVertexAttribArray = StubGLEnableVertexAttribArray;
+ interface->fFrontFace = StubGLFrontFace;
+ interface->fGenBuffers = StubGLGenBuffers;
+ interface->fGenTextures = StubGLGenTextures;
+ interface->fGetBufferParameteriv = StubGLGetBufferParameteriv;
+ interface->fGetError = StubGLGetError;
+ interface->fGetIntegerv = StubGLGetIntegerv;
+ interface->fGetProgramInfoLog = StubGLGetProgramInfoLog;
+ interface->fGetProgramiv = StubGLGetProgramiv;
+ interface->fGetShaderInfoLog = StubGLGetShaderInfoLog;
+ interface->fGetShaderiv = StubGLGetShaderiv;
+ interface->fGetString = StubGLGetString;
+ interface->fGetTexLevelParameteriv = StubGLGetTexLevelParameteriv;
+ interface->fGetUniformLocation = StubGLGetUniformLocation;
+ interface->fLineWidth = StubGLLineWidth;
+ interface->fLinkProgram = StubGLLinkProgram;
+ interface->fPixelStorei = StubGLPixelStorei;
+ interface->fReadBuffer = StubGLReadBuffer;
+ interface->fReadPixels = StubGLReadPixels;
+ interface->fScissor = StubGLScissor;
+ interface->fShaderSource = StubGLShaderSource;
+ interface->fStencilFunc = StubGLStencilFunc;
+ interface->fStencilFuncSeparate = StubGLStencilFuncSeparate;
+ interface->fStencilMask = StubGLStencilMask;
+ interface->fStencilMaskSeparate = StubGLStencilMaskSeparate;
+ interface->fStencilOp = StubGLStencilOp;
+ interface->fStencilOpSeparate = StubGLStencilOpSeparate;
+ interface->fTexImage2D = StubGLTexImage2D;
+ interface->fTexParameteri = StubGLTexParameteri;
+ interface->fTexSubImage2D = StubGLTexSubImage2D;
+ interface->fUniform1f = StubGLUniform1f;
+ interface->fUniform1i = StubGLUniform1i;
+ interface->fUniform1fv = StubGLUniform1fv;
+ interface->fUniform1iv = StubGLUniform1iv;
+ interface->fUniform2f = StubGLUniform2f;
+ interface->fUniform2i = StubGLUniform2i;
+ interface->fUniform2fv = StubGLUniform2fv;
+ interface->fUniform2iv = StubGLUniform2iv;
+ interface->fUniform3f = StubGLUniform3f;
+ interface->fUniform3i = StubGLUniform3i;
+ interface->fUniform3fv = StubGLUniform3fv;
+ interface->fUniform3iv = StubGLUniform3iv;
+ interface->fUniform4f = StubGLUniform4f;
+ interface->fUniform4i = StubGLUniform4i;
+ interface->fUniform4fv = StubGLUniform4fv;
+ interface->fUniform4iv = StubGLUniform4iv;
+ interface->fUniformMatrix2fv = StubGLUniformMatrix2fv;
+ interface->fUniformMatrix3fv = StubGLUniformMatrix3fv;
+ interface->fUniformMatrix4fv = StubGLUniformMatrix4fv;
+ interface->fUseProgram = StubGLUseProgram;
+ interface->fVertexAttrib4fv = StubGLVertexAttrib4fv;
+ interface->fVertexAttribPointer = StubGLVertexAttribPointer;
+ interface->fViewport = StubGLViewport;
+ interface->fBindFramebuffer = StubGLBindFramebuffer;
+ interface->fBindRenderbuffer = StubGLBindRenderbuffer;
+ interface->fCheckFramebufferStatus = StubGLCheckFramebufferStatus;
+ interface->fDeleteFramebuffers = StubGLDeleteFramebuffers;
+ interface->fDeleteRenderbuffers = StubGLDeleteRenderbuffers;
+ interface->fFramebufferRenderbuffer = StubGLFramebufferRenderbuffer;
+ interface->fFramebufferTexture2D = StubGLFramebufferTexture2D;
+ interface->fGenFramebuffers = StubGLGenFramebuffers;
+ interface->fGenRenderbuffers = StubGLGenRenderbuffers;
+ interface->fGetFramebufferAttachmentParameteriv =
+ StubGLGetFramebufferAttachmentParameteriv;
+ interface->fGetRenderbufferParameteriv = StubGLGetRenderbufferParameteriv;
+ interface->fRenderbufferStorage = StubGLRenderbufferStorage;
+ interface->fRenderbufferStorageMultisample =
+ StubGLRenderbufferStorageMultisample;
+ interface->fBlitFramebuffer = StubGLBlitFramebuffer;
+ interface->fMapBuffer = StubGLMapBuffer;
+ interface->fUnmapBuffer = StubGLUnmapBuffer;
+ interface->fBindFragDataLocationIndexed =
+ StubBindFragDataLocationIndexedARB;
}
+ GrGLSetDefaultGLInterface(host_gl_interface.get());
}
} // namespace gfx