diff options
author | twiz@chromium.org <twiz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-19 02:09:29 +0000 |
---|---|---|
committer | twiz@chromium.org <twiz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-19 02:09:29 +0000 |
commit | 1e4dc692612b67c9b79325861539df8d2de526c7 (patch) | |
tree | c4fbac236c0060d65804b1b8bdd3847bbd1a228a | |
parent | db8dc22b1f97dbff5aabdaec3b84f823bc456958 (diff) | |
download | chromium_src-1e4dc692612b67c9b79325861539df8d2de526c7.zip chromium_src-1e4dc692612b67c9b79325861539df8d2de526c7.tar.gz chromium_src-1e4dc692612b67c9b79325861539df8d2de526c7.tar.bz2 |
Addition of GL-redirecting mechanism for the Skia/GPU back-end. During execution of the layout tests (DumpRenderTree), all GL-calls are invoked via Mesa. A GL re-direction mechanism was added to skia in revision (http://code.google.com/p/skia/source/detail?r=937) These changes populate the skia re-direction interface with the gl implementation currently in use in Chrome: The app\gfx\gl bindings. R=kbr, bsalomon
Review URL: http://codereview.chromium.org/6677105
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78801 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | DEPS | 2 | ||||
-rw-r--r-- | app/app_base.gypi | 2 | ||||
-rw-r--r-- | app/gfx/gl/generate_bindings.py | 4 | ||||
-rw-r--r-- | app/gfx/gl/gl_bindings_skia.cc | 517 | ||||
-rw-r--r-- | app/gfx/gl/gl_bindings_skia.h | 21 | ||||
-rw-r--r-- | app/gfx/gl/gl_interface.h | 4 | ||||
-rw-r--r-- | gpu/command_buffer/common/gl_mock.h | 4 | ||||
-rw-r--r-- | skia/skia.gyp | 1 | ||||
-rw-r--r-- | webkit/support/test_webkit_client.cc | 2 |
9 files changed, 555 insertions, 2 deletions
@@ -11,7 +11,7 @@ vars = { "libjingle_revision": "55", "libvpx_revision": "76510", "ffmpeg_revision": "78339", - "skia_revision": "958", + "skia_revision": "960", "v8_revision": "7241", } diff --git a/app/app_base.gypi b/app/app_base.gypi index 42253c5..7eb7c57 100644 --- a/app/app_base.gypi +++ b/app/app_base.gypi @@ -198,6 +198,8 @@ '../ui/base/x/x11_util.h', '../ui/base/x/x11_util_internal.h', 'gfx/gl/gl_bindings.h', + 'gfx/gl/gl_bindings_skia.cc', + 'gfx/gl/gl_bindings_skia.h', 'gfx/gl/gl_context.cc', 'gfx/gl/gl_context.h', 'gfx/gl/gl_context_linux.cc', diff --git a/app/gfx/gl/generate_bindings.py b/app/gfx/gl/generate_bindings.py index 1e8e47a..5ad51f7 100644 --- a/app/gfx/gl/generate_bindings.py +++ b/app/gfx/gl/generate_bindings.py @@ -160,6 +160,7 @@ GL_FUNCTIONS = [ ['GLboolean', ['glIsTexture'], 'GLuint texture'], ['void', ['glLineWidth'], 'GLfloat width'], ['void', ['glLinkProgram'], 'GLuint program'], +['void*', ['glMapBuffer'], 'GLenum target, GLenum access'], ['void', ['glPixelStorei'], 'GLenum pname, GLint param'], ['void', ['glPolygonOffset'], 'GLfloat factor, GLfloat units'], ['void', ['glReadPixels'], @@ -227,6 +228,7 @@ GL_FUNCTIONS = [ 'GLint location, GLsizei count, GLboolean transpose, const GLfloat* value'], ['void', ['glUniformMatrix4fv'], 'GLint location, GLsizei count, GLboolean transpose, const GLfloat* value'], +['GLboolean', ['glUnmapBuffer'], 'GLenum target'], ['void', ['glUseProgram'], 'GLuint program'], ['void', ['glValidateProgram'], 'GLuint program'], ['void', ['glVertexAttrib1f'], 'GLuint indx, GLfloat x'], @@ -248,7 +250,7 @@ GL_FUNCTIONS = [ ['GLboolean', ['glTestFenceNV'], 'GLuint fence'], ['void', ['glFinishFenceNV'], 'GLuint fence'], ['GLboolean', ['glIsFenceNV'], 'GLuint fence'], -['void', ['glGetFenceivNV'], 'GLuint fence, GLenum pname, GLint* params'], +['void', ['glGetFenceivNV'], 'GLuint fence, GLenum pname, GLint* params'] ] OSMESA_FUNCTIONS = [ diff --git a/app/gfx/gl/gl_bindings_skia.cc b/app/gfx/gl/gl_bindings_skia.cc new file mode 100644 index 0000000..4e0aada --- /dev/null +++ b/app/gfx/gl/gl_bindings_skia.cc @@ -0,0 +1,517 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + + +#include "app/gfx/gl/gl_bindings_skia.h" + +#include "app/gfx/gl/gl_bindings.h" +#include "app/gfx/gl/gl_implementation.h" +#include "base/logging.h" + +// Skia is built against the headers in gpu\GLES. These functions +// are exported without any call-type modifiers. +#define GR_GL_FUNCTION_TYPE + +// The GrGLInterface header pulls in the default GL headers. Disable pulling +// in the default platform headers to prevent conflicts with the GL api points +// included via gl_bindings.h +#define GR_GL_NO_PLATFORM_INCLUDES 1 +#include "third_party/skia/gpu/include/GrGLInterface.h" +#undef GR_GL_NO_PLATFORM_INCLUDES + +namespace { + +extern "C" { + +// The following stub functions are required because the glXXX routines exported +// via gl_bindings.h use call-type GL_BINDING_CALL, which on Windows is stdcall. +// Skia has been built against the GLES headers, so the interfaces in +// GrGLInterface are __cdecl. + +GLvoid StubGLActiveTexture(GLenum texture) { + glActiveTexture(texture); +} + +GLvoid StubGLAttachShader(GLuint program, GLuint shader) { + glAttachShader(program, shader); +} + +GLvoid StubGLBindAttribLocation(GLuint program, GLuint index, + const char* name) { + glBindAttribLocation(program, index, name); +} + +GLvoid StubGLBindBuffer(GLenum target, GLuint buffer) { + glBindBuffer(target, buffer); +} + +GLvoid StubGLBindFramebuffer(GLenum target, GLuint framebuffer) { + glBindFramebufferEXT(target, framebuffer); +} + +GLvoid StubGLBindRenderbuffer(GLenum target, GLuint renderbuffer) { + glBindRenderbufferEXT(target, renderbuffer); +} + +GLvoid StubGLBindTexture(GLenum target, GLuint texture) { + glBindTexture(target, texture); +} + +GLvoid StubGLBlendColor(GLclampf red, GLclampf green, GLclampf blue, + GLclampf alpha) { + glBlendColor(red, green, blue, alpha); +} + +GLvoid StubGLBlendFunc(GLenum sfactor, GLenum dfactor) { + glBlendFunc(sfactor, dfactor); +} + +GLvoid StubGLBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter) { + glBlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, + mask, filter); +} + +GLvoid StubGLBufferData(GLenum target, GLsizei size, const void* data, + GLenum usage) { + glBufferData(target, size, data, usage); +} + +GLvoid StubGLBufferSubData(GLenum target, GLint offset, GLsizei size, + const void* data) { + glBufferSubData(target, offset, size, data); +} + +GLenum StubGLCheckFramebufferStatus(GLenum target) { + return glCheckFramebufferStatusEXT(target); +} + +GLvoid StubGLClear(GLbitfield mask) { + glClear(mask); +} + +GLvoid StubGLClearColor(GLclampf red, GLclampf green, GLclampf blue, + GLclampf alpha) { + glClearColor(red, green, blue, alpha); +} + +GLvoid StubGLClearStencil(GLint s) { + glClearStencil(s); +} + +GLvoid StubGLColorMask(GLboolean red, GLboolean green, GLboolean blue, + GLboolean alpha) { + glColorMask(red, green, blue, alpha); +} + +GLvoid StubGLCompileShader(GLuint shader) { + glCompileShader(shader); +} + +GLvoid StubGLCompressedTexImage2D(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLsizei height, GLint border, + GLsizei imageSize, const void* data) { + glCompressedTexImage2D(target, level, internalformat, width, height, border, + imageSize, data); +} + +GLuint StubGLCreateProgram(void) { + return glCreateProgram(); +} + +GLuint StubGLCreateShader(GLenum type) { + return glCreateShader(type); +} + +GLvoid StubGLCullFace(GLenum mode) { + glCullFace(mode); +} + +GLvoid StubGLDeleteBuffers(GLsizei n, const GLuint* buffers) { + glDeleteBuffersARB(n, buffers); +} + +GLvoid StubGLDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) { + glDeleteFramebuffersEXT(n, framebuffers); +} + +GLvoid StubGLDeleteProgram(GLuint program) { + glDeleteProgram(program); +} + +GLvoid StubGLDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) { + glDeleteRenderbuffersEXT(n, renderbuffers); +} + +GLvoid StubGLDeleteShader(GLuint shader) { + glDeleteShader(shader); +} + +GLvoid StubGLDeleteTextures(GLsizei n, const GLuint* textures) { + glDeleteTextures(n, textures); +} + +GLvoid StubGLDepthMask(GLboolean flag) { + glDepthMask(flag); +} + +GLvoid StubGLDisable(GLenum cap) { + glDisable(cap); +} + +GLvoid StubGLDisableVertexAttribArray(GLuint index) { + glDisableVertexAttribArray(index); +} + +GLvoid StubGLDrawArrays(GLenum mode, GLint first, GLsizei count) { + glDrawArrays(mode, first, count); +} + +GLvoid StubGLDrawElements(GLenum mode, GLsizei count, GLenum type, + const void* indices) { + glDrawElements(mode, count, type, indices); +} + +GLvoid StubGLEnable(GLenum cap) { + glEnable(cap); +} + +GLvoid StubGLEnableVertexAttribArray(GLuint index) { + glEnableVertexAttribArray(index); +} + +GLvoid StubGLFramebufferRenderbuffer(GLenum target, GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer) { + glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, + renderbuffer); +} + +GLvoid StubGLFramebufferTexture2D(GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, + GLint level) { + glFramebufferTexture2DEXT(target, attachment, textarget, texture, level); +} + +GLvoid StubGLFrontFace(GLenum mode) { + glFrontFace(mode); +} + +GLvoid StubGLGenBuffers(GLsizei n, GLuint* buffers) { + glGenBuffersARB(n, buffers); +} + +GLvoid StubGLGenFramebuffers(GLsizei n, GLuint* framebuffers) { + glGenFramebuffersEXT(n, framebuffers); +} + +GLvoid StubGLGenRenderbuffers(GLsizei n, GLuint* renderbuffers) { + glGenRenderbuffersEXT(n, renderbuffers); +} + +GLvoid StubGLGenTextures(GLsizei n, GLuint* textures) { + glGenTextures(n, textures); +} + +GLvoid StubGLGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { + glGetBufferParameteriv(target, pname, params); +} + +GLenum StubGLGetError() { + return glGetError(); +} + +GLvoid StubGLGetIntegerv(GLenum pname, GLint* params) { + glGetIntegerv(pname, params); +} + +GLvoid StubGLGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, + char* infolog) { + glGetProgramInfoLog(program, bufsize, length, infolog); +} + +GLvoid StubGLGetProgramiv(GLuint program, GLenum pname, GLint* params) { + glGetProgramiv(program, pname, params); +} + +GLvoid StubGLGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, + char* infolog) { + glGetShaderInfoLog(shader, bufsize, length, infolog); +} + +GLvoid StubGLGetShaderiv(GLuint shader, GLenum pname, GLint* params) { + glGetShaderiv(shader, pname, params); +} + +const GLubyte* StubGLGetString(GLenum name) { + return glGetString(name); +} + +GLint StubGLGetUniformLocation(GLuint program, const char* name) { + return glGetUniformLocation(program, name); +} + +GLvoid StubGLLineWidth(GLfloat width) { + glLineWidth(width); +} + +GLvoid StubGLLinkProgram(GLuint program) { + glLinkProgram(program); +} + +void* StubGLMapBuffer(GLenum target, GLenum access) { + return glMapBuffer(target, access); +} + +GLvoid StubGLPixelStorei(GLenum pname, GLint param) { + glPixelStorei(pname, param); +} + +GLvoid StubGLReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, void* pixels) { + glReadPixels(x, y, width, height, format, type, pixels); +} + +GLvoid StubGLRenderBufferStorage(GLenum target, GLenum internalformat, + GLsizei width, GLsizei height) { + glRenderbufferStorageEXT(target, internalformat, width, height); +} + +GLvoid StubGLRenderbufferStorageMultisample(GLenum target, GLsizei samples, + GLenum internalformat, + GLsizei width, GLsizei height) { + glRenderbufferStorageMultisampleEXT(target, samples, internalformat, width, + height); +} + +GLvoid StubGLScissor(GLint x, GLint y, GLsizei width, GLsizei height) { + glScissor(x, y, width, height); +} + +GLvoid StubGLShaderSource(GLuint shader, GLsizei count, const char** str, + const GLint* length) { + glShaderSource(shader, count, str, length); +} + +GLvoid StubGLStencilFunc(GLenum func, GLint ref, GLuint mask) { + glStencilFunc(func, ref, mask); +} + +GLvoid StubGLStencilFuncSeparate(GLenum face, GLenum func, GLint ref, + GLuint mask) { + glStencilFuncSeparate(face, func, ref, mask); +} + +GLvoid StubGLStencilMask(GLuint mask) { + glStencilMask(mask); +} + +GLvoid StubGLStencilMaskSeparate(GLenum face, GLuint mask) { + glStencilMaskSeparate(face, mask); +} + +GLvoid StubGLStencilOp(GLenum fail, GLenum zfail, GLenum zpass) { + glStencilOp(fail, zfail, zpass); +} + +GLvoid StubGLStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, + GLenum zpass) { + glStencilOpSeparate(face, fail, zfail, zpass); +} + +GLvoid StubGLTexImage2D(GLenum target, GLint level, GLint internalformat, + GLsizei width, GLsizei height, GLint border, + GLenum format, GLenum type, const void* pixels) { + glTexImage2D(target, level, internalformat, width, height, border, format, + type, pixels); +} + +GLvoid StubGLTexParameteri(GLenum target, GLenum pname, GLint param) { + glTexParameteri(target, pname, param); +} + +GLvoid StubGLTexSubImage2D(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLenum type, const void* pixels) { + glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, + pixels); +} + +GLvoid StubGLUniform1fv(GLint location, GLsizei count, const GLfloat* v) { + glUniform1fv(location, count, v); +} + +GLvoid StubGLUniform1i(GLint location, GLint x) { + glUniform1i(location, x); +} + +GLvoid StubGLUniform4fv(GLint location, GLsizei count, const GLfloat* v) { + glUniform4fv(location, count, v); +} + +GLvoid StubGLUniformMatrix3fv(GLint location, GLsizei count, + GLboolean transpose, const GLfloat* value) { + glUniformMatrix3fv(location, count, transpose, value); +} + +GLboolean StubGLUnmapBuffer(GLenum target) { + return glUnmapBuffer(target); +} + +GLvoid StubGLUseProgram(GLuint program) { + glUseProgram(program); +} + +GLvoid StubGLVertexAttrib4fv(GLuint indx, const GLfloat* values) { + glVertexAttrib4fv(indx, values); +} + +GLvoid StubGLVertexAttribPointer(GLuint indx, GLint size, GLenum type, + GLboolean normalized, GLsizei stride, + const void* ptr) { + glVertexAttribPointer(indx, size, type, normalized, stride, ptr); +} + +GLvoid StubGLViewport(GLint x, GLint y, GLsizei width, GLsizei height) { + glViewport(x, y, width, height); +} + +} // extern "C" + +// Populate |gl_interface| with pointers to the GL implementation used by +// Chrome. +void InitializeGrGLInterface(GrGLInterface* gl_interface) { + + // Propagate the type of GL bindings exported back to skia. + switch (gfx::GetGLImplementation()) { + case gfx::kGLImplementationNone: + NOTREACHED(); + break; + case gfx::kGLImplementationDesktopGL: + gl_interface->fBindingsExported = kDesktop_GrGLBinding; + break; + case gfx::kGLImplementationOSMesaGL: + gl_interface->fBindingsExported = kDesktop_GrGLBinding; + break; + case gfx::kGLImplementationEGLGLES2: + gl_interface->fBindingsExported = kES2_GrGLBinding; + break; + case gfx::kGLImplementationMockGL: + NOTREACHED(); + break; + } + + gl_interface->fClientActiveTexture = NULL; + gl_interface->fColor4ub = NULL; + gl_interface->fColorPointer = NULL; + gl_interface->fDisableClientState = NULL; + gl_interface->fEnableClientState = NULL; + gl_interface->fLoadMatrixf = NULL; + gl_interface->fMatrixMode = NULL; + gl_interface->fPointSize = NULL; + gl_interface->fShadeModel = NULL; + gl_interface->fTexCoordPointer = NULL; + gl_interface->fTexEnvi = NULL; + gl_interface->fVertexPointer = NULL; + + gl_interface->fFramebufferTexture2DMultisample = NULL; + gl_interface->fResolveMultisampleFramebuffer = NULL; + gl_interface->fActiveTexture = StubGLActiveTexture; + gl_interface->fAttachShader = StubGLAttachShader; + gl_interface->fBindAttribLocation = StubGLBindAttribLocation; + gl_interface->fBindBuffer = StubGLBindBuffer; + gl_interface->fBindTexture = StubGLBindTexture; + gl_interface->fBlendColor = StubGLBlendColor; + gl_interface->fBlendFunc = StubGLBlendFunc; + gl_interface->fBufferData = StubGLBufferData; + gl_interface->fBufferSubData = StubGLBufferSubData; + gl_interface->fClear = StubGLClear; + gl_interface->fClearColor = StubGLClearColor; + gl_interface->fClearStencil = StubGLClearStencil; + gl_interface->fColorMask = StubGLColorMask; + gl_interface->fCompileShader = StubGLCompileShader; + gl_interface->fCompressedTexImage2D = StubGLCompressedTexImage2D; + gl_interface->fCreateProgram = StubGLCreateProgram; + gl_interface->fCreateShader = StubGLCreateShader; + gl_interface->fCullFace = StubGLCullFace; + gl_interface->fDeleteBuffers = StubGLDeleteBuffers; + gl_interface->fDeleteProgram = StubGLDeleteProgram; + gl_interface->fDeleteShader = StubGLDeleteShader; + gl_interface->fDeleteTextures = StubGLDeleteTextures; + gl_interface->fDepthMask = StubGLDepthMask; + gl_interface->fDisable = StubGLDisable; + gl_interface->fDisableVertexAttribArray = StubGLDisableVertexAttribArray; + gl_interface->fDrawArrays = StubGLDrawArrays; + gl_interface->fDrawElements = StubGLDrawElements; + gl_interface->fEnable = StubGLEnable; + gl_interface->fEnableVertexAttribArray = StubGLEnableVertexAttribArray; + gl_interface->fFrontFace = StubGLFrontFace; + gl_interface->fGenBuffers = StubGLGenBuffers; + gl_interface->fGenTextures = StubGLGenTextures; + gl_interface->fGetBufferParameteriv = StubGLGetBufferParameteriv; + gl_interface->fGetError = StubGLGetError; + gl_interface->fGetIntegerv = StubGLGetIntegerv; + gl_interface->fGetProgramInfoLog = StubGLGetProgramInfoLog; + gl_interface->fGetProgramiv = StubGLGetProgramiv; + gl_interface->fGetShaderInfoLog = StubGLGetShaderInfoLog; + gl_interface->fGetShaderiv = StubGLGetShaderiv; + gl_interface->fGetString = StubGLGetString; + gl_interface->fGetUniformLocation = StubGLGetUniformLocation; + gl_interface->fLineWidth = StubGLLineWidth; + gl_interface->fLinkProgram = StubGLLinkProgram; + gl_interface->fPixelStorei = StubGLPixelStorei; + gl_interface->fReadPixels = StubGLReadPixels; + gl_interface->fScissor = StubGLScissor; + gl_interface->fShaderSource = StubGLShaderSource; + gl_interface->fStencilFunc = StubGLStencilFunc; + gl_interface->fStencilFuncSeparate = StubGLStencilFuncSeparate; + gl_interface->fStencilMask = StubGLStencilMask; + gl_interface->fStencilMaskSeparate = StubGLStencilMaskSeparate; + gl_interface->fStencilOp = StubGLStencilOp; + gl_interface->fStencilOpSeparate = StubGLStencilOpSeparate; + gl_interface->fTexImage2D = StubGLTexImage2D; + gl_interface->fTexParameteri = StubGLTexParameteri; + gl_interface->fTexSubImage2D = StubGLTexSubImage2D; + gl_interface->fUniform1fv = StubGLUniform1fv; + gl_interface->fUniform1i = StubGLUniform1i; + gl_interface->fUniform4fv = StubGLUniform4fv; + gl_interface->fUniformMatrix3fv = StubGLUniformMatrix3fv; + gl_interface->fUseProgram = StubGLUseProgram; + gl_interface->fVertexAttrib4fv = StubGLVertexAttrib4fv; + gl_interface->fVertexAttribPointer = StubGLVertexAttribPointer; + gl_interface->fViewport = StubGLViewport; + gl_interface->fBindFramebuffer = StubGLBindFramebuffer; + gl_interface->fBindRenderbuffer = StubGLBindRenderbuffer; + gl_interface->fCheckFramebufferStatus = StubGLCheckFramebufferStatus; + gl_interface->fDeleteFramebuffers = StubGLDeleteFramebuffers; + gl_interface->fDeleteRenderbuffers = StubGLDeleteRenderbuffers; + gl_interface->fFramebufferRenderbuffer = StubGLFramebufferRenderbuffer; + gl_interface->fFramebufferTexture2D = StubGLFramebufferTexture2D; + gl_interface->fGenFramebuffers = StubGLGenFramebuffers; + gl_interface->fGenRenderbuffers = StubGLGenRenderbuffers; + gl_interface->fRenderbufferStorage = StubGLRenderBufferStorage; + gl_interface->fRenderbufferStorageMultisample = + StubGLRenderbufferStorageMultisample; + gl_interface->fBlitFramebuffer = StubGLBlitFramebuffer; + gl_interface->fMapBuffer = StubGLMapBuffer; + gl_interface->fUnmapBuffer = StubGLUnmapBuffer; +} + +} // namespace + +namespace gfx { + +void BindSkiaToHostGL() { + static GrGLInterface host_gl_interface; + static bool host_StubGL_initialized = false; + if (!host_StubGL_initialized) { + InitializeGrGLInterface(&host_gl_interface); + GrGLSetGLInterface(&host_gl_interface); + host_StubGL_initialized = true; + } +} + +} // namespace gfx diff --git a/app/gfx/gl/gl_bindings_skia.h b/app/gfx/gl/gl_bindings_skia.h new file mode 100644 index 0000000..f6490a9 --- /dev/null +++ b/app/gfx/gl/gl_bindings_skia.h @@ -0,0 +1,21 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef APP_GFX_GL_GL_BINDINGS_SKIA_H_ +#define APP_GFX_GL_GL_BINDINGS_SKIA_H_ +#pragma once + +namespace gfx { + +// The GPU back-end for skia normally makes direct calls to GLES2\gl. Call +// this routine to bind the skia GL implementation to that exported by the +// app/gfx/gl entry points. +// Note: This override is required to allow the skia gl calls to be correctly +// routed around the command buffers during execution of the DumpRenderTree +// layout tests. +void BindSkiaToHostGL(); + +} + +#endif // APP_GFX_GL_GL_BINDINGS_SKIA_H_ diff --git a/app/gfx/gl/gl_interface.h b/app/gfx/gl/gl_interface.h index b26acb1..f670db1 100644 --- a/app/gfx/gl/gl_interface.h +++ b/app/gfx/gl/gl_interface.h @@ -261,6 +261,8 @@ class GLInterface { virtual GLboolean IsTexture(GLuint texture) = 0; + virtual void* MapBuffer(GLenum target, GLenum access) = 0; + virtual void LineWidth(GLfloat width) = 0; virtual void LinkProgram(GLuint program) = 0; @@ -377,6 +379,8 @@ class GLInterface { GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) = 0; + virtual GLboolean UnmapBuffer(GLenum target) = 0; + virtual void UseProgram(GLuint program) = 0; virtual void ValidateProgram(GLuint program) = 0; diff --git a/gpu/command_buffer/common/gl_mock.h b/gpu/command_buffer/common/gl_mock.h index 7519fc2..fc20541 100644 --- a/gpu/command_buffer/common/gl_mock.h +++ b/gpu/command_buffer/common/gl_mock.h @@ -260,6 +260,8 @@ class MockGLInterface : public GLInterface { MOCK_METHOD1(LinkProgram, void(GLuint program)); + MOCK_METHOD2(MapBuffer, void*(GLenum target, GLenum access)); + MOCK_METHOD2(PixelStorei, void(GLenum pname, GLint param)); MOCK_METHOD2(PolygonOffset, void(GLfloat factor, GLfloat units)); @@ -376,6 +378,8 @@ class MockGLInterface : public GLInterface { GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)); + MOCK_METHOD1(UnmapBuffer, GLboolean(GLenum target)); + MOCK_METHOD1(UseProgram, void(GLuint program)); MOCK_METHOD1(ValidateProgram, void(GLuint program)); diff --git a/skia/skia.gyp b/skia/skia.gyp index f28ffd2..55beecb 100644 --- a/skia/skia.gyp +++ b/skia/skia.gyp @@ -25,6 +25,7 @@ '../third_party/skia/gpu/src/GrGpuFactory.cpp', '../third_party/skia/gpu/src/GrGpuGL.cpp', '../third_party/skia/gpu/src/GrGpuGL.h', + '../third_party/skia/gpu/src/GrGpuGLFixed.cpp', '../third_party/skia/gpu/src/GrGpuGLShaders2.cpp', '../third_party/skia/gpu/src/GrGpuGLShaders2.h', '../third_party/skia/gpu/src/GrInOrderDrawBuffer.cpp', diff --git a/webkit/support/test_webkit_client.cc b/webkit/support/test_webkit_client.cc index c69cf6e..98037f3 100644 --- a/webkit/support/test_webkit_client.cc +++ b/webkit/support/test_webkit_client.cc @@ -4,6 +4,7 @@ #include "webkit/support/test_webkit_client.h" +#include "app/gfx/gl/gl_bindings_skia.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/scoped_temp_dir.h" @@ -352,5 +353,6 @@ WebKit::WebSharedWorkerRepository* TestWebKitClient::sharedWorkerRepository() { } WebKit::WebGraphicsContext3D* TestWebKitClient::createGraphicsContext3D() { + gfx::BindSkiaToHostGL(); return new webkit::gpu::WebGraphicsContext3DInProcessImpl(); } |