diff options
author | tfarina <tfarina@chromium.org> | 2014-12-04 18:04:05 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-05 02:05:06 +0000 |
commit | a962b5f152a0a331bc2e1a5a0d4d38e8adece10d (patch) | |
tree | cb410ad6643161d778417d8ac4fa63cdd63cc20a /webkit | |
parent | 7a5032e9a290c375705799074d4cfb8ab65bc784 (diff) | |
download | chromium_src-a962b5f152a0a331bc2e1a5a0d4d38e8adece10d.zip chromium_src-a962b5f152a0a331bc2e1a5a0d4d38e8adece10d.tar.gz chromium_src-a962b5f152a0a331bc2e1a5a0d4d38e8adece10d.tar.bz2 |
Extract WebGraphicsContext3DImpl from webkit/common/gpu.
We decided that it should be fine to move it to gpu/blink now, similar
to gpu/skia_bindings and cc/blink.
BUG=338338
TEST=links
R=piman@chromium.org,jamesr@chromium.org
TBR=
Review URL: https://codereview.chromium.org/761243002
Cr-Commit-Position: refs/heads/master@{#306957}
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/common/gpu/BUILD.gn | 9 | ||||
-rw-r--r-- | webkit/common/gpu/DEPS (renamed from webkit/DEPS) | 1 | ||||
-rw-r--r-- | webkit/common/gpu/grcontext_for_webgraphicscontext3d.cc | 8 | ||||
-rw-r--r-- | webkit/common/gpu/grcontext_for_webgraphicscontext3d.h | 7 | ||||
-rw-r--r-- | webkit/common/gpu/webgraphicscontext3d_impl.cc | 1032 | ||||
-rw-r--r-- | webkit/common/gpu/webgraphicscontext3d_impl.h | 614 | ||||
-rw-r--r-- | webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h | 4 | ||||
-rw-r--r-- | webkit/common/gpu/webkit_gpu.gyp | 11 |
8 files changed, 21 insertions, 1665 deletions
diff --git a/webkit/common/gpu/BUILD.gn b/webkit/common/gpu/BUILD.gn index cecbd9d..b84c79e 100644 --- a/webkit/common/gpu/BUILD.gn +++ b/webkit/common/gpu/BUILD.gn @@ -12,8 +12,6 @@ component("gpu") { "context_provider_web_context.h", "grcontext_for_webgraphicscontext3d.cc", "grcontext_for_webgraphicscontext3d.h", - "webgraphicscontext3d_impl.cc", - "webgraphicscontext3d_impl.h", "webgraphicscontext3d_in_process_command_buffer_impl.cc", "webgraphicscontext3d_in_process_command_buffer_impl.h", ] @@ -29,11 +27,12 @@ component("gpu") { "//base", "//base/third_party/dynamic_annotations", "//cc", - "//gpu/command_buffer/common", - "//gpu/command_buffer/service", + "//gpu/blink", + "//gpu/command_buffer/client:gl_in_process_context", "//gpu/command_buffer/client:gles2_c_lib", "//gpu/command_buffer/client:gles2_implementation", - "//gpu/command_buffer/client:gl_in_process_context", + "//gpu/command_buffer/common", + "//gpu/command_buffer/service", "//gpu/skia_bindings", "//skia", "//third_party/WebKit/public:blink_minimal", diff --git a/webkit/DEPS b/webkit/common/gpu/DEPS index e1e03d4..72dbfae 100644 --- a/webkit/DEPS +++ b/webkit/common/gpu/DEPS @@ -3,6 +3,7 @@ include_rules = [ "+cc/output", "+gpu/GLES2", + "+gpu/blink", "+gpu/command_buffer/client", "+gpu/command_buffer/common", "+gpu/command_buffer/service", diff --git a/webkit/common/gpu/grcontext_for_webgraphicscontext3d.cc b/webkit/common/gpu/grcontext_for_webgraphicscontext3d.cc index ae45c83..37433df 100644 --- a/webkit/common/gpu/grcontext_for_webgraphicscontext3d.cc +++ b/webkit/common/gpu/grcontext_for_webgraphicscontext3d.cc @@ -6,10 +6,10 @@ #include "base/debug/trace_event.h" #include "base/lazy_instance.h" +#include "gpu/blink/webgraphicscontext3d_impl.h" #include "gpu/command_buffer/client/gles2_lib.h" #include "third_party/skia/include/gpu/GrContext.h" #include "third_party/skia/include/gpu/gl/GrGLInterface.h" -#include "webkit/common/gpu/webgraphicscontext3d_impl.h" namespace webkit { namespace gpu { @@ -31,14 +31,14 @@ base::LazyInstance<GLES2Initializer> g_gles2_initializer = LAZY_INSTANCE_INITIALIZER; void BindWebGraphicsContext3DGLContextCallback(const GrGLInterface* interface) { - gles2::SetGLContext(reinterpret_cast<WebGraphicsContext3DImpl*>( + gles2::SetGLContext(reinterpret_cast<gpu_blink::WebGraphicsContext3DImpl*>( interface->fCallbackData)->GetGLInterface()); } -} // namespace anonymous +} // namespace GrContextForWebGraphicsContext3D::GrContextForWebGraphicsContext3D( - WebGraphicsContext3DImpl* context3d) { + gpu_blink::WebGraphicsContext3DImpl* context3d) { if (!context3d) return; diff --git a/webkit/common/gpu/grcontext_for_webgraphicscontext3d.h b/webkit/common/gpu/grcontext_for_webgraphicscontext3d.h index 5ea712b..0d882e8 100644 --- a/webkit/common/gpu/grcontext_for_webgraphicscontext3d.h +++ b/webkit/common/gpu/grcontext_for_webgraphicscontext3d.h @@ -11,9 +11,12 @@ class GrContext; +namespace gpu_blink { +class WebGraphicsContext3DImpl; +} + namespace webkit { namespace gpu { -class WebGraphicsContext3DImpl; // This class binds an offscreen GrContext to an offscreen context3d. The // context3d is used by the GrContext so must be valid as long as this class @@ -21,7 +24,7 @@ class WebGraphicsContext3DImpl; class WEBKIT_GPU_EXPORT GrContextForWebGraphicsContext3D { public: explicit GrContextForWebGraphicsContext3D( - WebGraphicsContext3DImpl* context3d); + gpu_blink::WebGraphicsContext3DImpl* context3d); virtual ~GrContextForWebGraphicsContext3D(); GrContext* get() { return gr_context_.get(); } diff --git a/webkit/common/gpu/webgraphicscontext3d_impl.cc b/webkit/common/gpu/webgraphicscontext3d_impl.cc deleted file mode 100644 index 9e42509..0000000 --- a/webkit/common/gpu/webgraphicscontext3d_impl.cc +++ /dev/null @@ -1,1032 +0,0 @@ -// Copyright (c) 2012 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 "webkit/common/gpu/webgraphicscontext3d_impl.h" - -#include "base/atomicops.h" -#include "base/lazy_instance.h" -#include "base/logging.h" -#include "gpu/GLES2/gl2extchromium.h" -#include "gpu/command_buffer/client/gles2_implementation.h" -#include "gpu/command_buffer/client/gles2_lib.h" -#include "gpu/command_buffer/common/gles2_cmd_utils.h" -#include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" - -#include "third_party/khronos/GLES2/gl2.h" -#ifndef GL_GLEXT_PROTOTYPES -#define GL_GLEXT_PROTOTYPES 1 -#endif -#include "third_party/khronos/GLES2/gl2ext.h" - -namespace webkit { -namespace gpu { - -namespace { - -uint32_t GenFlushID() { - static base::subtle::Atomic32 flush_id = 0; - - base::subtle::Atomic32 my_id = base::subtle::Barrier_AtomicIncrement( - &flush_id, 1); - return static_cast<uint32_t>(my_id); -} - -} // namespace anonymous - -class WebGraphicsContext3DErrorMessageCallback - : public ::gpu::gles2::GLES2ImplementationErrorMessageCallback { - public: - WebGraphicsContext3DErrorMessageCallback( - WebGraphicsContext3DImpl* context) - : graphics_context_(context) { - } - - virtual void OnErrorMessage(const char* msg, int id) override; - - private: - WebGraphicsContext3DImpl* graphics_context_; - - DISALLOW_COPY_AND_ASSIGN(WebGraphicsContext3DErrorMessageCallback); -}; - -void WebGraphicsContext3DErrorMessageCallback::OnErrorMessage( - const char* msg, int id) { - graphics_context_->OnErrorMessage(msg, id); -} - -// Helper macros to reduce the amount of code. - -#define DELEGATE_TO_GL(name, glname) \ -void WebGraphicsContext3DImpl::name() { \ - gl_->glname(); \ -} - -#define DELEGATE_TO_GL_R(name, glname, rt) \ -rt WebGraphicsContext3DImpl::name() { \ - return gl_->glname(); \ -} - -#define DELEGATE_TO_GL_1(name, glname, t1) \ -void WebGraphicsContext3DImpl::name(t1 a1) { \ - gl_->glname(a1); \ -} - -#define DELEGATE_TO_GL_1R(name, glname, t1, rt) \ -rt WebGraphicsContext3DImpl::name(t1 a1) { \ - return gl_->glname(a1); \ -} - -#define DELEGATE_TO_GL_1RB(name, glname, t1, rt) \ -rt WebGraphicsContext3DImpl::name(t1 a1) { \ - return gl_->glname(a1) ? true : false; \ -} - -#define DELEGATE_TO_GL_2(name, glname, t1, t2) \ -void WebGraphicsContext3DImpl::name(t1 a1, t2 a2) { \ - gl_->glname(a1, a2); \ -} - -#define DELEGATE_TO_GL_2R(name, glname, t1, t2, rt) \ -rt WebGraphicsContext3DImpl::name(t1 a1, t2 a2) { \ - return gl_->glname(a1, a2); \ -} - -#define DELEGATE_TO_GL_3(name, glname, t1, t2, t3) \ -void WebGraphicsContext3DImpl::name(t1 a1, t2 a2, t3 a3) { \ - gl_->glname(a1, a2, a3); \ -} - -#define DELEGATE_TO_GL_3R(name, glname, t1, t2, t3, rt) \ -rt WebGraphicsContext3DImpl::name(t1 a1, t2 a2, t3 a3) { \ - return gl_->glname(a1, a2, a3); \ -} - -#define DELEGATE_TO_GL_4(name, glname, t1, t2, t3, t4) \ -void WebGraphicsContext3DImpl::name(t1 a1, t2 a2, t3 a3, t4 a4) { \ - gl_->glname(a1, a2, a3, a4); \ -} - -#define DELEGATE_TO_GL_4R(name, glname, t1, t2, t3, t4, rt) \ -rt WebGraphicsContext3DImpl::name(t1 a1, t2 a2, t3 a3, t4 a4) { \ - return gl_->glname(a1, a2, a3, a4); \ -} - -#define DELEGATE_TO_GL_5(name, glname, t1, t2, t3, t4, t5) \ -void WebGraphicsContext3DImpl::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) {\ - \ - gl_->glname(a1, a2, a3, a4, a5); \ -} - -#define DELEGATE_TO_GL_6(name, glname, t1, t2, t3, t4, t5, t6) \ -void WebGraphicsContext3DImpl::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, \ - t6 a6) { \ - gl_->glname(a1, a2, a3, a4, a5, a6); \ -} - -#define DELEGATE_TO_GL_7(name, glname, t1, t2, t3, t4, t5, t6, t7) \ -void WebGraphicsContext3DImpl::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, \ - t6 a6, t7 a7) { \ - gl_->glname(a1, a2, a3, a4, a5, a6, a7); \ -} - -#define DELEGATE_TO_GL_8(name, glname, t1, t2, t3, t4, t5, t6, t7, t8) \ -void WebGraphicsContext3DImpl::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, \ - t6 a6, t7 a7, t8 a8) { \ - gl_->glname(a1, a2, a3, a4, a5, a6, a7, a8); \ -} - -#define DELEGATE_TO_GL_9(name, glname, t1, t2, t3, t4, t5, t6, t7, t8, t9) \ -void WebGraphicsContext3DImpl::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, \ - t6 a6, t7 a7, t8 a8, t9 a9) { \ - gl_->glname(a1, a2, a3, a4, a5, a6, a7, a8, a9); \ -} - -#define DELEGATE_TO_GL_9R(name, glname, t1, t2, t3, t4, t5, t6, t7, t8, \ - t9, rt) \ -rt WebGraphicsContext3DImpl::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, \ - t6 a6, t7 a7, t8 a8, t9 a9) { \ - return gl_->glname(a1, a2, a3, a4, a5, a6, a7, a8, a9); \ -} - -WebGraphicsContext3DImpl::WebGraphicsContext3DImpl() - : initialized_(false), - initialize_failed_(false), - context_lost_callback_(0), - context_lost_reason_(GL_NO_ERROR), - error_message_callback_(0), - gl_(NULL), - flush_id_(0) { -} - -WebGraphicsContext3DImpl::~WebGraphicsContext3DImpl() { - -} - -void WebGraphicsContext3DImpl::synthesizeGLError(WGC3Denum error) { - if (std::find(synthetic_errors_.begin(), synthetic_errors_.end(), error) == - synthetic_errors_.end()) { - synthetic_errors_.push_back(error); - } -} - -uint32_t WebGraphicsContext3DImpl::lastFlushID() { - return flush_id_; -} - -DELEGATE_TO_GL_R(insertSyncPoint, InsertSyncPointCHROMIUM, unsigned int) - -DELEGATE_TO_GL_3(reshapeWithScaleFactor, ResizeCHROMIUM, int, int, float) - -DELEGATE_TO_GL_4R(mapBufferSubDataCHROMIUM, MapBufferSubDataCHROMIUM, WGC3Denum, - WGC3Dintptr, WGC3Dsizeiptr, WGC3Denum, void*) - -DELEGATE_TO_GL_1(unmapBufferSubDataCHROMIUM, UnmapBufferSubDataCHROMIUM, - const void*) - -DELEGATE_TO_GL_9R(mapTexSubImage2DCHROMIUM, MapTexSubImage2DCHROMIUM, WGC3Denum, - WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, - WGC3Denum, WGC3Denum, WGC3Denum, void*) - -DELEGATE_TO_GL_1(unmapTexSubImage2DCHROMIUM, UnmapTexSubImage2DCHROMIUM, - const void*) - -DELEGATE_TO_GL_3(discardFramebufferEXT, DiscardFramebufferEXT, WGC3Denum, - WGC3Dsizei, const WGC3Denum*) - -blink::WebString WebGraphicsContext3DImpl:: - getRequestableExtensionsCHROMIUM() { - return blink::WebString::fromUTF8( - gl_->GetRequestableExtensionsCHROMIUM()); -} - -DELEGATE_TO_GL_1(requestExtensionCHROMIUM, RequestExtensionCHROMIUM, - const char*) - -void WebGraphicsContext3DImpl::blitFramebufferCHROMIUM( - WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, - WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, - WGC3Dbitfield mask, WGC3Denum filter) { - gl_->BlitFramebufferCHROMIUM( - srcX0, srcY0, srcX1, srcY1, - dstX0, dstY0, dstX1, dstY1, - mask, filter); -} - -DELEGATE_TO_GL_5(renderbufferStorageMultisampleCHROMIUM, - RenderbufferStorageMultisampleCHROMIUM, WGC3Denum, WGC3Dsizei, - WGC3Denum, WGC3Dsizei, WGC3Dsizei) - -DELEGATE_TO_GL_1(activeTexture, ActiveTexture, WGC3Denum) - -DELEGATE_TO_GL_2(attachShader, AttachShader, WebGLId, WebGLId) - -DELEGATE_TO_GL_3(bindAttribLocation, BindAttribLocation, WebGLId, - WGC3Duint, const WGC3Dchar*) - -DELEGATE_TO_GL_2(bindBuffer, BindBuffer, WGC3Denum, WebGLId) - -DELEGATE_TO_GL_2(bindFramebuffer, BindFramebuffer, WGC3Denum, WebGLId) - -DELEGATE_TO_GL_2(bindRenderbuffer, BindRenderbuffer, WGC3Denum, WebGLId) - -DELEGATE_TO_GL_2(bindTexture, BindTexture, WGC3Denum, WebGLId) - -DELEGATE_TO_GL_4(blendColor, BlendColor, - WGC3Dclampf, WGC3Dclampf, WGC3Dclampf, WGC3Dclampf) - -DELEGATE_TO_GL_1(blendEquation, BlendEquation, WGC3Denum) - -DELEGATE_TO_GL_2(blendEquationSeparate, BlendEquationSeparate, - WGC3Denum, WGC3Denum) - -DELEGATE_TO_GL_2(blendFunc, BlendFunc, WGC3Denum, WGC3Denum) - -DELEGATE_TO_GL_4(blendFuncSeparate, BlendFuncSeparate, - WGC3Denum, WGC3Denum, WGC3Denum, WGC3Denum) - -DELEGATE_TO_GL_4(bufferData, BufferData, - WGC3Denum, WGC3Dsizeiptr, const void*, WGC3Denum) - -DELEGATE_TO_GL_4(bufferSubData, BufferSubData, - WGC3Denum, WGC3Dintptr, WGC3Dsizeiptr, const void*) - -DELEGATE_TO_GL_1R(checkFramebufferStatus, CheckFramebufferStatus, - WGC3Denum, WGC3Denum) - -DELEGATE_TO_GL_1(clear, Clear, WGC3Dbitfield) - -DELEGATE_TO_GL_4(clearColor, ClearColor, - WGC3Dclampf, WGC3Dclampf, WGC3Dclampf, WGC3Dclampf) - -DELEGATE_TO_GL_1(clearDepth, ClearDepthf, WGC3Dclampf) - -DELEGATE_TO_GL_1(clearStencil, ClearStencil, WGC3Dint) - -DELEGATE_TO_GL_4(colorMask, ColorMask, - WGC3Dboolean, WGC3Dboolean, WGC3Dboolean, WGC3Dboolean) - -DELEGATE_TO_GL_1(compileShader, CompileShader, WebGLId) - -DELEGATE_TO_GL_8(compressedTexImage2D, CompressedTexImage2D, - WGC3Denum, WGC3Dint, WGC3Denum, WGC3Dint, WGC3Dint, - WGC3Dsizei, WGC3Dsizei, const void*) - -DELEGATE_TO_GL_9(compressedTexSubImage2D, CompressedTexSubImage2D, - WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, - WGC3Denum, WGC3Dsizei, const void*) - -DELEGATE_TO_GL_8(copyTexImage2D, CopyTexImage2D, - WGC3Denum, WGC3Dint, WGC3Denum, WGC3Dint, WGC3Dint, - WGC3Dsizei, WGC3Dsizei, WGC3Dint) - -DELEGATE_TO_GL_8(copyTexSubImage2D, CopyTexSubImage2D, - WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, - WGC3Dsizei, WGC3Dsizei) - -DELEGATE_TO_GL_1(cullFace, CullFace, WGC3Denum) - -DELEGATE_TO_GL_1(depthFunc, DepthFunc, WGC3Denum) - -DELEGATE_TO_GL_1(depthMask, DepthMask, WGC3Dboolean) - -DELEGATE_TO_GL_2(depthRange, DepthRangef, WGC3Dclampf, WGC3Dclampf) - -DELEGATE_TO_GL_2(detachShader, DetachShader, WebGLId, WebGLId) - -DELEGATE_TO_GL_1(disable, Disable, WGC3Denum) - -DELEGATE_TO_GL_1(disableVertexAttribArray, DisableVertexAttribArray, - WGC3Duint) - -DELEGATE_TO_GL_3(drawArrays, DrawArrays, WGC3Denum, WGC3Dint, WGC3Dsizei) - -void WebGraphicsContext3DImpl::drawElements(WGC3Denum mode, - WGC3Dsizei count, - WGC3Denum type, - WGC3Dintptr offset) { - gl_->DrawElements( - mode, count, type, - reinterpret_cast<void*>(static_cast<intptr_t>(offset))); -} - -DELEGATE_TO_GL_1(enable, Enable, WGC3Denum) - -DELEGATE_TO_GL_1(enableVertexAttribArray, EnableVertexAttribArray, - WGC3Duint) - -void WebGraphicsContext3DImpl::finish() { - flush_id_ = GenFlushID(); - gl_->Finish(); -} - -void WebGraphicsContext3DImpl::flush() { - flush_id_ = GenFlushID(); - gl_->Flush(); -} - -DELEGATE_TO_GL_4(framebufferRenderbuffer, FramebufferRenderbuffer, - WGC3Denum, WGC3Denum, WGC3Denum, WebGLId) - -DELEGATE_TO_GL_5(framebufferTexture2D, FramebufferTexture2D, - WGC3Denum, WGC3Denum, WGC3Denum, WebGLId, WGC3Dint) - -DELEGATE_TO_GL_1(frontFace, FrontFace, WGC3Denum) - -DELEGATE_TO_GL_1(generateMipmap, GenerateMipmap, WGC3Denum) - -bool WebGraphicsContext3DImpl::getActiveAttrib( - WebGLId program, WGC3Duint index, ActiveInfo& info) { - if (!program) { - synthesizeGLError(GL_INVALID_VALUE); - return false; - } - GLint max_name_length = -1; - gl_->GetProgramiv( - program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max_name_length); - if (max_name_length < 0) - return false; - scoped_ptr<GLchar[]> name(new GLchar[max_name_length]); - if (!name) { - synthesizeGLError(GL_OUT_OF_MEMORY); - return false; - } - GLsizei length = 0; - GLint size = -1; - GLenum type = 0; - gl_->GetActiveAttrib( - program, index, max_name_length, &length, &size, &type, name.get()); - if (size < 0) { - return false; - } - info.name = blink::WebString::fromUTF8(name.get(), length); - info.type = type; - info.size = size; - return true; -} - -bool WebGraphicsContext3DImpl::getActiveUniform( - WebGLId program, WGC3Duint index, ActiveInfo& info) { - GLint max_name_length = -1; - gl_->GetProgramiv( - program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max_name_length); - if (max_name_length < 0) - return false; - scoped_ptr<GLchar[]> name(new GLchar[max_name_length]); - if (!name) { - synthesizeGLError(GL_OUT_OF_MEMORY); - return false; - } - GLsizei length = 0; - GLint size = -1; - GLenum type = 0; - gl_->GetActiveUniform( - program, index, max_name_length, &length, &size, &type, name.get()); - if (size < 0) { - return false; - } - info.name = blink::WebString::fromUTF8(name.get(), length); - info.type = type; - info.size = size; - return true; -} - -DELEGATE_TO_GL_4(getAttachedShaders, GetAttachedShaders, - WebGLId, WGC3Dsizei, WGC3Dsizei*, WebGLId*) - -DELEGATE_TO_GL_2R(getAttribLocation, GetAttribLocation, - WebGLId, const WGC3Dchar*, WGC3Dint) - -DELEGATE_TO_GL_2(getBooleanv, GetBooleanv, WGC3Denum, WGC3Dboolean*) - -DELEGATE_TO_GL_3(getBufferParameteriv, GetBufferParameteriv, - WGC3Denum, WGC3Denum, WGC3Dint*) - -WGC3Denum WebGraphicsContext3DImpl::getError() { - if (!synthetic_errors_.empty()) { - std::vector<WGC3Denum>::iterator iter = synthetic_errors_.begin(); - WGC3Denum err = *iter; - synthetic_errors_.erase(iter); - return err; - } - - return gl_->GetError(); -} - -DELEGATE_TO_GL_2(getFloatv, GetFloatv, WGC3Denum, WGC3Dfloat*) - -DELEGATE_TO_GL_4(getFramebufferAttachmentParameteriv, - GetFramebufferAttachmentParameteriv, - WGC3Denum, WGC3Denum, WGC3Denum, WGC3Dint*) - -DELEGATE_TO_GL_2(getIntegerv, GetIntegerv, WGC3Denum, WGC3Dint*) - -DELEGATE_TO_GL_3(getProgramiv, GetProgramiv, WebGLId, WGC3Denum, WGC3Dint*) - -blink::WebString WebGraphicsContext3DImpl::getProgramInfoLog( - WebGLId program) { - GLint logLength = 0; - gl_->GetProgramiv(program, GL_INFO_LOG_LENGTH, &logLength); - if (!logLength) - return blink::WebString(); - scoped_ptr<GLchar[]> log(new GLchar[logLength]); - if (!log) - return blink::WebString(); - GLsizei returnedLogLength = 0; - gl_->GetProgramInfoLog( - program, logLength, &returnedLogLength, log.get()); - DCHECK_EQ(logLength, returnedLogLength + 1); - blink::WebString res = - blink::WebString::fromUTF8(log.get(), returnedLogLength); - return res; -} - -DELEGATE_TO_GL_3(getRenderbufferParameteriv, GetRenderbufferParameteriv, - WGC3Denum, WGC3Denum, WGC3Dint*) - -DELEGATE_TO_GL_3(getShaderiv, GetShaderiv, WebGLId, WGC3Denum, WGC3Dint*) - -blink::WebString WebGraphicsContext3DImpl::getShaderInfoLog( - WebGLId shader) { - GLint logLength = 0; - gl_->GetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLength); - if (!logLength) - return blink::WebString(); - scoped_ptr<GLchar[]> log(new GLchar[logLength]); - if (!log) - return blink::WebString(); - GLsizei returnedLogLength = 0; - gl_->GetShaderInfoLog( - shader, logLength, &returnedLogLength, log.get()); - DCHECK_EQ(logLength, returnedLogLength + 1); - blink::WebString res = - blink::WebString::fromUTF8(log.get(), returnedLogLength); - return res; -} - -DELEGATE_TO_GL_4(getShaderPrecisionFormat, GetShaderPrecisionFormat, - WGC3Denum, WGC3Denum, WGC3Dint*, WGC3Dint*) - -blink::WebString WebGraphicsContext3DImpl::getShaderSource( - WebGLId shader) { - GLint logLength = 0; - gl_->GetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &logLength); - if (!logLength) - return blink::WebString(); - scoped_ptr<GLchar[]> log(new GLchar[logLength]); - if (!log) - return blink::WebString(); - GLsizei returnedLogLength = 0; - gl_->GetShaderSource( - shader, logLength, &returnedLogLength, log.get()); - if (!returnedLogLength) - return blink::WebString(); - DCHECK_EQ(logLength, returnedLogLength + 1); - blink::WebString res = - blink::WebString::fromUTF8(log.get(), returnedLogLength); - return res; -} - -blink::WebString WebGraphicsContext3DImpl:: - getTranslatedShaderSourceANGLE(WebGLId shader) { - GLint logLength = 0; - gl_->GetShaderiv( - shader, GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE, &logLength); - if (!logLength) - return blink::WebString(); - scoped_ptr<GLchar[]> log(new GLchar[logLength]); - if (!log) - return blink::WebString(); - GLsizei returnedLogLength = 0; - gl_->GetTranslatedShaderSourceANGLE( - shader, logLength, &returnedLogLength, log.get()); - if (!returnedLogLength) - return blink::WebString(); - DCHECK_EQ(logLength, returnedLogLength + 1); - blink::WebString res = - blink::WebString::fromUTF8(log.get(), returnedLogLength); - return res; -} - -blink::WebString WebGraphicsContext3DImpl::getString( - WGC3Denum name) { - return blink::WebString::fromUTF8( - reinterpret_cast<const char*>(gl_->GetString(name))); -} - -DELEGATE_TO_GL_3(getTexParameterfv, GetTexParameterfv, - WGC3Denum, WGC3Denum, WGC3Dfloat*) - -DELEGATE_TO_GL_3(getTexParameteriv, GetTexParameteriv, - WGC3Denum, WGC3Denum, WGC3Dint*) - -DELEGATE_TO_GL_3(getUniformfv, GetUniformfv, WebGLId, WGC3Dint, WGC3Dfloat*) - -DELEGATE_TO_GL_3(getUniformiv, GetUniformiv, WebGLId, WGC3Dint, WGC3Dint*) - -DELEGATE_TO_GL_2R(getUniformLocation, GetUniformLocation, - WebGLId, const WGC3Dchar*, WGC3Dint) - -DELEGATE_TO_GL_3(getVertexAttribfv, GetVertexAttribfv, - WGC3Duint, WGC3Denum, WGC3Dfloat*) - -DELEGATE_TO_GL_3(getVertexAttribiv, GetVertexAttribiv, - WGC3Duint, WGC3Denum, WGC3Dint*) - -WGC3Dsizeiptr WebGraphicsContext3DImpl::getVertexAttribOffset( - WGC3Duint index, WGC3Denum pname) { - GLvoid* value = NULL; - // NOTE: If pname is ever a value that returns more then 1 element - // this will corrupt memory. - gl_->GetVertexAttribPointerv(index, pname, &value); - return static_cast<WGC3Dsizeiptr>(reinterpret_cast<intptr_t>(value)); -} - -DELEGATE_TO_GL_2(hint, Hint, WGC3Denum, WGC3Denum) - -DELEGATE_TO_GL_1RB(isBuffer, IsBuffer, WebGLId, WGC3Dboolean) - -DELEGATE_TO_GL_1RB(isEnabled, IsEnabled, WGC3Denum, WGC3Dboolean) - -DELEGATE_TO_GL_1RB(isFramebuffer, IsFramebuffer, WebGLId, WGC3Dboolean) - -DELEGATE_TO_GL_1RB(isProgram, IsProgram, WebGLId, WGC3Dboolean) - -DELEGATE_TO_GL_1RB(isRenderbuffer, IsRenderbuffer, WebGLId, WGC3Dboolean) - -DELEGATE_TO_GL_1RB(isShader, IsShader, WebGLId, WGC3Dboolean) - -DELEGATE_TO_GL_1RB(isTexture, IsTexture, WebGLId, WGC3Dboolean) - -DELEGATE_TO_GL_1(lineWidth, LineWidth, WGC3Dfloat) - -DELEGATE_TO_GL_1(linkProgram, LinkProgram, WebGLId) - -DELEGATE_TO_GL_2(pixelStorei, PixelStorei, WGC3Denum, WGC3Dint) - -DELEGATE_TO_GL_2(polygonOffset, PolygonOffset, WGC3Dfloat, WGC3Dfloat) - -DELEGATE_TO_GL_7(readPixels, ReadPixels, - WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, WGC3Denum, - WGC3Denum, void*) - -DELEGATE_TO_GL_4(renderbufferStorage, RenderbufferStorage, - WGC3Denum, WGC3Denum, WGC3Dsizei, WGC3Dsizei) - -DELEGATE_TO_GL_2(sampleCoverage, SampleCoverage, WGC3Dfloat, WGC3Dboolean) - -DELEGATE_TO_GL_4(scissor, Scissor, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei) - -void WebGraphicsContext3DImpl::shaderSource( - WebGLId shader, const WGC3Dchar* string) { - GLint length = strlen(string); - gl_->ShaderSource(shader, 1, &string, &length); -} - -DELEGATE_TO_GL_3(stencilFunc, StencilFunc, WGC3Denum, WGC3Dint, WGC3Duint) - -DELEGATE_TO_GL_4(stencilFuncSeparate, StencilFuncSeparate, - WGC3Denum, WGC3Denum, WGC3Dint, WGC3Duint) - -DELEGATE_TO_GL_1(stencilMask, StencilMask, WGC3Duint) - -DELEGATE_TO_GL_2(stencilMaskSeparate, StencilMaskSeparate, - WGC3Denum, WGC3Duint) - -DELEGATE_TO_GL_3(stencilOp, StencilOp, - WGC3Denum, WGC3Denum, WGC3Denum) - -DELEGATE_TO_GL_4(stencilOpSeparate, StencilOpSeparate, - WGC3Denum, WGC3Denum, WGC3Denum, WGC3Denum) - -DELEGATE_TO_GL_9(texImage2D, TexImage2D, - WGC3Denum, WGC3Dint, WGC3Denum, WGC3Dsizei, WGC3Dsizei, - WGC3Dint, WGC3Denum, WGC3Denum, const void*) - -DELEGATE_TO_GL_3(texParameterf, TexParameterf, - WGC3Denum, WGC3Denum, WGC3Dfloat); - -static const unsigned int kTextureWrapR = 0x8072; - -void WebGraphicsContext3DImpl::texParameteri( - WGC3Denum target, WGC3Denum pname, WGC3Dint param) { - // TODO(kbr): figure out whether the setting of TEXTURE_WRAP_R in - // GraphicsContext3D.cpp is strictly necessary to avoid seams at the - // edge of cube maps, and, if it is, push it into the GLES2 service - // side code. - if (pname == kTextureWrapR) { - return; - } - gl_->TexParameteri(target, pname, param); -} - -DELEGATE_TO_GL_9(texSubImage2D, TexSubImage2D, - WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, - WGC3Dsizei, WGC3Denum, WGC3Denum, const void*) - -DELEGATE_TO_GL_2(uniform1f, Uniform1f, WGC3Dint, WGC3Dfloat) - -DELEGATE_TO_GL_3(uniform1fv, Uniform1fv, WGC3Dint, WGC3Dsizei, - const WGC3Dfloat*) - -DELEGATE_TO_GL_2(uniform1i, Uniform1i, WGC3Dint, WGC3Dint) - -DELEGATE_TO_GL_3(uniform1iv, Uniform1iv, WGC3Dint, WGC3Dsizei, const WGC3Dint*) - -DELEGATE_TO_GL_3(uniform2f, Uniform2f, WGC3Dint, WGC3Dfloat, WGC3Dfloat) - -DELEGATE_TO_GL_3(uniform2fv, Uniform2fv, WGC3Dint, WGC3Dsizei, - const WGC3Dfloat*) - -DELEGATE_TO_GL_3(uniform2i, Uniform2i, WGC3Dint, WGC3Dint, WGC3Dint) - -DELEGATE_TO_GL_3(uniform2iv, Uniform2iv, WGC3Dint, WGC3Dsizei, const WGC3Dint*) - -DELEGATE_TO_GL_4(uniform3f, Uniform3f, WGC3Dint, - WGC3Dfloat, WGC3Dfloat, WGC3Dfloat) - -DELEGATE_TO_GL_3(uniform3fv, Uniform3fv, WGC3Dint, WGC3Dsizei, - const WGC3Dfloat*) - -DELEGATE_TO_GL_4(uniform3i, Uniform3i, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint) - -DELEGATE_TO_GL_3(uniform3iv, Uniform3iv, WGC3Dint, WGC3Dsizei, const WGC3Dint*) - -DELEGATE_TO_GL_5(uniform4f, Uniform4f, WGC3Dint, - WGC3Dfloat, WGC3Dfloat, WGC3Dfloat, WGC3Dfloat) - -DELEGATE_TO_GL_3(uniform4fv, Uniform4fv, WGC3Dint, WGC3Dsizei, - const WGC3Dfloat*) - -DELEGATE_TO_GL_5(uniform4i, Uniform4i, WGC3Dint, - WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint) - -DELEGATE_TO_GL_3(uniform4iv, Uniform4iv, WGC3Dint, WGC3Dsizei, const WGC3Dint*) - -DELEGATE_TO_GL_4(uniformMatrix2fv, UniformMatrix2fv, - WGC3Dint, WGC3Dsizei, WGC3Dboolean, const WGC3Dfloat*) - -DELEGATE_TO_GL_4(uniformMatrix3fv, UniformMatrix3fv, - WGC3Dint, WGC3Dsizei, WGC3Dboolean, const WGC3Dfloat*) - -DELEGATE_TO_GL_4(uniformMatrix4fv, UniformMatrix4fv, - WGC3Dint, WGC3Dsizei, WGC3Dboolean, const WGC3Dfloat*) - -DELEGATE_TO_GL_1(useProgram, UseProgram, WebGLId) - -DELEGATE_TO_GL_1(validateProgram, ValidateProgram, WebGLId) - -DELEGATE_TO_GL_2(vertexAttrib1f, VertexAttrib1f, WGC3Duint, WGC3Dfloat) - -DELEGATE_TO_GL_2(vertexAttrib1fv, VertexAttrib1fv, WGC3Duint, - const WGC3Dfloat*) - -DELEGATE_TO_GL_3(vertexAttrib2f, VertexAttrib2f, WGC3Duint, - WGC3Dfloat, WGC3Dfloat) - -DELEGATE_TO_GL_2(vertexAttrib2fv, VertexAttrib2fv, WGC3Duint, - const WGC3Dfloat*) - -DELEGATE_TO_GL_4(vertexAttrib3f, VertexAttrib3f, WGC3Duint, - WGC3Dfloat, WGC3Dfloat, WGC3Dfloat) - -DELEGATE_TO_GL_2(vertexAttrib3fv, VertexAttrib3fv, WGC3Duint, - const WGC3Dfloat*) - -DELEGATE_TO_GL_5(vertexAttrib4f, VertexAttrib4f, WGC3Duint, - WGC3Dfloat, WGC3Dfloat, WGC3Dfloat, WGC3Dfloat) - -DELEGATE_TO_GL_2(vertexAttrib4fv, VertexAttrib4fv, WGC3Duint, - const WGC3Dfloat*) - -void WebGraphicsContext3DImpl::vertexAttribPointer( - WGC3Duint index, WGC3Dint size, WGC3Denum type, WGC3Dboolean normalized, - WGC3Dsizei stride, WGC3Dintptr offset) { - gl_->VertexAttribPointer( - index, size, type, normalized, stride, - reinterpret_cast<void*>(static_cast<intptr_t>(offset))); -} - -DELEGATE_TO_GL_4(viewport, Viewport, - WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei) - -DELEGATE_TO_GL_2(genBuffers, GenBuffers, WGC3Dsizei, WebGLId*); - -DELEGATE_TO_GL_2(genFramebuffers, GenFramebuffers, WGC3Dsizei, WebGLId*); - -DELEGATE_TO_GL_2(genRenderbuffers, GenRenderbuffers, WGC3Dsizei, WebGLId*); - -DELEGATE_TO_GL_2(genTextures, GenTextures, WGC3Dsizei, WebGLId*); - -DELEGATE_TO_GL_2(deleteBuffers, DeleteBuffers, WGC3Dsizei, WebGLId*); - -DELEGATE_TO_GL_2(deleteFramebuffers, DeleteFramebuffers, WGC3Dsizei, WebGLId*); - -DELEGATE_TO_GL_2(deleteRenderbuffers, DeleteRenderbuffers, WGC3Dsizei, - WebGLId*); - -DELEGATE_TO_GL_2(deleteTextures, DeleteTextures, WGC3Dsizei, WebGLId*); - -WebGLId WebGraphicsContext3DImpl::createBuffer() { - GLuint o; - gl_->GenBuffers(1, &o); - return o; -} - -WebGLId WebGraphicsContext3DImpl::createFramebuffer() { - GLuint o = 0; - gl_->GenFramebuffers(1, &o); - return o; -} - -WebGLId WebGraphicsContext3DImpl::createRenderbuffer() { - GLuint o; - gl_->GenRenderbuffers(1, &o); - return o; -} - -WebGLId WebGraphicsContext3DImpl::createTexture() { - GLuint o; - gl_->GenTextures(1, &o); - return o; -} - -void WebGraphicsContext3DImpl::deleteBuffer(WebGLId buffer) { - gl_->DeleteBuffers(1, &buffer); -} - -void WebGraphicsContext3DImpl::deleteFramebuffer( - WebGLId framebuffer) { - gl_->DeleteFramebuffers(1, &framebuffer); -} - -void WebGraphicsContext3DImpl::deleteRenderbuffer( - WebGLId renderbuffer) { - gl_->DeleteRenderbuffers(1, &renderbuffer); -} - -void WebGraphicsContext3DImpl::deleteTexture(WebGLId texture) { - gl_->DeleteTextures(1, &texture); -} - -DELEGATE_TO_GL_R(createProgram, CreateProgram, WebGLId) - -DELEGATE_TO_GL_1R(createShader, CreateShader, WGC3Denum, WebGLId) - -DELEGATE_TO_GL_1(deleteProgram, DeleteProgram, WebGLId) - -DELEGATE_TO_GL_1(deleteShader, DeleteShader, WebGLId) - -void WebGraphicsContext3DImpl::setErrorMessageCallback( - WebGraphicsContext3D::WebGraphicsErrorMessageCallback* cb) { - error_message_callback_ = cb; -} - -void WebGraphicsContext3DImpl::setContextLostCallback( - WebGraphicsContext3D::WebGraphicsContextLostCallback* cb) { - context_lost_callback_ = cb; -} - -DELEGATE_TO_GL_5(texImageIOSurface2DCHROMIUM, TexImageIOSurface2DCHROMIUM, - WGC3Denum, WGC3Dint, WGC3Dint, WGC3Duint, WGC3Duint) - -DELEGATE_TO_GL_5(texStorage2DEXT, TexStorage2DEXT, - WGC3Denum, WGC3Dint, WGC3Duint, WGC3Dint, WGC3Dint) - -WebGLId WebGraphicsContext3DImpl::createQueryEXT() { - GLuint o; - gl_->GenQueriesEXT(1, &o); - return o; -} - -void WebGraphicsContext3DImpl::deleteQueryEXT( - WebGLId query) { - gl_->DeleteQueriesEXT(1, &query); -} - -DELEGATE_TO_GL_1R(isQueryEXT, IsQueryEXT, WebGLId, WGC3Dboolean) -DELEGATE_TO_GL_2(beginQueryEXT, BeginQueryEXT, WGC3Denum, WebGLId) -DELEGATE_TO_GL_1(endQueryEXT, EndQueryEXT, WGC3Denum) -DELEGATE_TO_GL_3(getQueryivEXT, GetQueryivEXT, WGC3Denum, WGC3Denum, WGC3Dint*) -DELEGATE_TO_GL_3(getQueryObjectuivEXT, GetQueryObjectuivEXT, - WebGLId, WGC3Denum, WGC3Duint*) - -DELEGATE_TO_GL_6(copyTextureCHROMIUM, CopyTextureCHROMIUM, WGC3Denum, - WebGLId, WebGLId, WGC3Dint, WGC3Denum, WGC3Denum); - -DELEGATE_TO_GL_3(bindUniformLocationCHROMIUM, BindUniformLocationCHROMIUM, - WebGLId, WGC3Dint, const WGC3Dchar*) - -void WebGraphicsContext3DImpl::shallowFlushCHROMIUM() { - flush_id_ = GenFlushID(); - gl_->ShallowFlushCHROMIUM(); -} - -void WebGraphicsContext3DImpl::shallowFinishCHROMIUM() { - flush_id_ = GenFlushID(); - gl_->ShallowFinishCHROMIUM(); -} - -DELEGATE_TO_GL_1(waitSyncPoint, WaitSyncPointCHROMIUM, GLuint) - -void WebGraphicsContext3DImpl::loseContextCHROMIUM( - WGC3Denum current, WGC3Denum other) { - gl_->LoseContextCHROMIUM(current, other); - gl_->Flush(); -} - -DELEGATE_TO_GL_1(genMailboxCHROMIUM, GenMailboxCHROMIUM, WGC3Dbyte*) -DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM, - WGC3Denum, const WGC3Dbyte*) -DELEGATE_TO_GL_3(produceTextureDirectCHROMIUM, ProduceTextureDirectCHROMIUM, - WebGLId, WGC3Denum, const WGC3Dbyte*) -DELEGATE_TO_GL_2(consumeTextureCHROMIUM, ConsumeTextureCHROMIUM, - WGC3Denum, const WGC3Dbyte*) -DELEGATE_TO_GL_2R(createAndConsumeTextureCHROMIUM, - CreateAndConsumeTextureCHROMIUM, - WGC3Denum, const WGC3Dbyte*, WebGLId) - -DELEGATE_TO_GL_2(genValuebuffersCHROMIUM, - GenValuebuffersCHROMIUM, - WGC3Dsizei, - WebGLId*); - -WebGLId WebGraphicsContext3DImpl::createValuebufferCHROMIUM() { - GLuint o; - gl_->GenValuebuffersCHROMIUM(1, &o); - return o; -} - -DELEGATE_TO_GL_2(deleteValuebuffersCHROMIUM, - DeleteValuebuffersCHROMIUM, - WGC3Dsizei, - WebGLId*); - -void WebGraphicsContext3DImpl::deleteValuebufferCHROMIUM(WebGLId valuebuffer) { - gl_->DeleteValuebuffersCHROMIUM(1, &valuebuffer); -} - -DELEGATE_TO_GL_1RB(isValuebufferCHROMIUM, - IsValuebufferCHROMIUM, - WebGLId, - WGC3Dboolean) -DELEGATE_TO_GL_2(bindValuebufferCHROMIUM, - BindValuebufferCHROMIUM, - WGC3Denum, - WebGLId) -DELEGATE_TO_GL_2(subscribeValueCHROMIUM, - SubscribeValueCHROMIUM, - WGC3Denum, - WGC3Denum); -DELEGATE_TO_GL_1(populateSubscribedValuesCHROMIUM, - PopulateSubscribedValuesCHROMIUM, - WGC3Denum); -DELEGATE_TO_GL_3(uniformValuebufferCHROMIUM, - UniformValuebufferCHROMIUM, - WGC3Dint, - WGC3Denum, - WGC3Denum); - -void WebGraphicsContext3DImpl::insertEventMarkerEXT( - const WGC3Dchar* marker) { - gl_->InsertEventMarkerEXT(0, marker); -} - -void WebGraphicsContext3DImpl::pushGroupMarkerEXT( - const WGC3Dchar* marker) { - gl_->PushGroupMarkerEXT(0, marker); -} - -DELEGATE_TO_GL(popGroupMarkerEXT, PopGroupMarkerEXT); - -WebGLId WebGraphicsContext3DImpl::createVertexArrayOES() { - GLuint array; - gl_->GenVertexArraysOES(1, &array); - return array; -} - -void WebGraphicsContext3DImpl::deleteVertexArrayOES( - WebGLId array) { - gl_->DeleteVertexArraysOES(1, &array); -} - -DELEGATE_TO_GL_1R(isVertexArrayOES, IsVertexArrayOES, WebGLId, WGC3Dboolean) -DELEGATE_TO_GL_1(bindVertexArrayOES, BindVertexArrayOES, WebGLId) - -DELEGATE_TO_GL_2(bindTexImage2DCHROMIUM, BindTexImage2DCHROMIUM, - WGC3Denum, WGC3Dint) -DELEGATE_TO_GL_2(releaseTexImage2DCHROMIUM, ReleaseTexImage2DCHROMIUM, - WGC3Denum, WGC3Dint) - -DELEGATE_TO_GL_2R(mapBufferCHROMIUM, MapBufferCHROMIUM, WGC3Denum, WGC3Denum, - void*) -DELEGATE_TO_GL_1R(unmapBufferCHROMIUM, UnmapBufferCHROMIUM, WGC3Denum, - WGC3Dboolean) - -DELEGATE_TO_GL_9(asyncTexImage2DCHROMIUM, AsyncTexImage2DCHROMIUM, WGC3Denum, - WGC3Dint, WGC3Denum, WGC3Dsizei, WGC3Dsizei, WGC3Dint, - WGC3Denum, WGC3Denum, const void*) -DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM, - WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, - WGC3Dsizei, WGC3Denum, WGC3Denum, const void*) - -DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, - WGC3Denum) - -DELEGATE_TO_GL_2(drawBuffersEXT, DrawBuffersEXT, WGC3Dsizei, const WGC3Denum*) - -DELEGATE_TO_GL_4(drawArraysInstancedANGLE, DrawArraysInstancedANGLE, WGC3Denum, - WGC3Dint, WGC3Dsizei, WGC3Dsizei) - -void WebGraphicsContext3DImpl::drawElementsInstancedANGLE( - WGC3Denum mode, - WGC3Dsizei count, - WGC3Denum type, - WGC3Dintptr offset, - WGC3Dsizei primcount) { - gl_->DrawElementsInstancedANGLE( - mode, count, type, - reinterpret_cast<void*>(static_cast<intptr_t>(offset)), primcount); -} - -DELEGATE_TO_GL_2(vertexAttribDivisorANGLE, VertexAttribDivisorANGLE, WGC3Duint, - WGC3Duint) - -DELEGATE_TO_GL_4R(createGpuMemoryBufferImageCHROMIUM, - CreateGpuMemoryBufferImageCHROMIUM, - WGC3Dsizei, - WGC3Dsizei, - WGC3Denum, - WGC3Denum, - WGC3Duint); - -DELEGATE_TO_GL_1(destroyImageCHROMIUM, DestroyImageCHROMIUM, WGC3Duint); - -DELEGATE_TO_GL_6(framebufferTexture2DMultisampleEXT, - FramebufferTexture2DMultisampleEXT, - WGC3Denum, WGC3Denum, WGC3Denum, WebGLId, WGC3Dint, WGC3Dsizei) - -DELEGATE_TO_GL_5(renderbufferStorageMultisampleEXT, - RenderbufferStorageMultisampleEXT, WGC3Denum, WGC3Dsizei, - WGC3Denum, WGC3Dsizei, WGC3Dsizei) - -GrGLInterface* WebGraphicsContext3DImpl::createGrGLInterface() { - return skia_bindings::CreateCommandBufferSkiaGLBinding(); -} - -::gpu::gles2::GLES2ImplementationErrorMessageCallback* - WebGraphicsContext3DImpl::getErrorMessageCallback() { - if (!client_error_message_callback_) { - client_error_message_callback_.reset( - new WebGraphicsContext3DErrorMessageCallback(this)); - } - return client_error_message_callback_.get(); -} - -void WebGraphicsContext3DImpl::OnErrorMessage( - const std::string& message, int id) { - if (error_message_callback_) { - blink::WebString str = blink::WebString::fromUTF8(message.c_str()); - error_message_callback_->onErrorMessage(str, id); - } -} - -// TODO(bajones): Look into removing these functions from the blink interface -void WebGraphicsContext3DImpl::prepareTexture() { - NOTREACHED(); -} - -void WebGraphicsContext3DImpl::postSubBufferCHROMIUM( - int x, int y, int width, int height) { - NOTREACHED(); -} - -void WebGraphicsContext3DImpl::setVisibilityCHROMIUM( - bool visible) { - NOTREACHED(); -} - -void WebGraphicsContext3DImpl::copyTextureToParentTextureCHROMIUM( - WebGLId texture, WebGLId parentTexture) { - NOTIMPLEMENTED(); -} - -void WebGraphicsContext3DImpl::releaseShaderCompiler() { -} - -// static -void WebGraphicsContext3DImpl::ConvertAttributes( - const blink::WebGraphicsContext3D::Attributes& attributes, - ::gpu::gles2::ContextCreationAttribHelper* output_attribs) { - output_attribs->alpha_size = attributes.alpha ? 8 : 0; - output_attribs->depth_size = attributes.depth ? 24 : 0; - output_attribs->stencil_size = attributes.stencil ? 8 : 0; - output_attribs->samples = attributes.antialias ? 4 : 0; - output_attribs->sample_buffers = attributes.antialias ? 1 : 0; - output_attribs->fail_if_major_perf_caveat = - attributes.failIfMajorPerformanceCaveat; - output_attribs->bind_generates_resource = false; -} - -} // namespace gpu -} // namespace webkit diff --git a/webkit/common/gpu/webgraphicscontext3d_impl.h b/webkit/common/gpu/webgraphicscontext3d_impl.h deleted file mode 100644 index 3ed0dd9..0000000 --- a/webkit/common/gpu/webgraphicscontext3d_impl.h +++ /dev/null @@ -1,614 +0,0 @@ -// Copyright (c) 2012 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 WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IMPL_H_ -#define WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IMPL_H_ - -#include <string> -#include <vector> - -#include "base/callback.h" -#include "base/memory/scoped_ptr.h" -#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" -#include "third_party/WebKit/public/platform/WebString.h" -#include "webkit/common/gpu/webkit_gpu_export.h" - -namespace gpu { - -namespace gles2 { -class GLES2Interface; -class GLES2ImplementationErrorMessageCallback; -struct ContextCreationAttribHelper; -} -} - -using blink::WebGLId; - -using blink::WGC3Dbyte; -using blink::WGC3Dchar; -using blink::WGC3Denum; -using blink::WGC3Dboolean; -using blink::WGC3Dbitfield; -using blink::WGC3Dint; -using blink::WGC3Dsizei; -using blink::WGC3Duint; -using blink::WGC3Dfloat; -using blink::WGC3Dclampf; -using blink::WGC3Dintptr; -using blink::WGC3Dsizeiptr; - -namespace webkit { -namespace gpu { - -class WebGraphicsContext3DErrorMessageCallback; - -class WEBKIT_GPU_EXPORT WebGraphicsContext3DImpl - : public NON_EXPORTED_BASE(blink::WebGraphicsContext3D) { - public: - virtual ~WebGraphicsContext3DImpl(); - - //---------------------------------------------------------------------- - // WebGraphicsContext3D methods - - virtual uint32_t lastFlushID(); - - virtual unsigned int insertSyncPoint(); - virtual void waitSyncPoint(unsigned int sync_point); - - virtual void loseContextCHROMIUM(WGC3Denum current, WGC3Denum other); - - virtual void reshapeWithScaleFactor( - int width, int height, float scale_factor); - - virtual void prepareTexture(); - virtual void postSubBufferCHROMIUM(int x, int y, int width, int height); - - virtual void activeTexture(WGC3Denum texture); - virtual void attachShader(WebGLId program, WebGLId shader); - virtual void bindAttribLocation(WebGLId program, WGC3Duint index, - const WGC3Dchar* name); - virtual void bindBuffer(WGC3Denum target, WebGLId buffer); - virtual void bindFramebuffer(WGC3Denum target, WebGLId framebuffer); - virtual void bindRenderbuffer(WGC3Denum target, WebGLId renderbuffer); - virtual void bindTexture(WGC3Denum target, WebGLId texture); - virtual void blendColor(WGC3Dclampf red, WGC3Dclampf green, - WGC3Dclampf blue, WGC3Dclampf alpha); - virtual void blendEquation(WGC3Denum mode); - virtual void blendEquationSeparate(WGC3Denum modeRGB, - WGC3Denum modeAlpha); - virtual void blendFunc(WGC3Denum sfactor, WGC3Denum dfactor); - virtual void blendFuncSeparate(WGC3Denum srcRGB, - WGC3Denum dstRGB, - WGC3Denum srcAlpha, - WGC3Denum dstAlpha); - - virtual void bufferData(WGC3Denum target, WGC3Dsizeiptr size, - const void* data, WGC3Denum usage); - virtual void bufferSubData(WGC3Denum target, WGC3Dintptr offset, - WGC3Dsizeiptr size, const void* data); - - virtual WGC3Denum checkFramebufferStatus(WGC3Denum target); - virtual void clear(WGC3Dbitfield mask); - virtual void clearColor(WGC3Dclampf red, WGC3Dclampf green, - WGC3Dclampf blue, WGC3Dclampf alpha); - virtual void clearDepth(WGC3Dclampf depth); - virtual void clearStencil(WGC3Dint s); - virtual void colorMask(WGC3Dboolean red, WGC3Dboolean green, - WGC3Dboolean blue, WGC3Dboolean alpha); - virtual void compileShader(WebGLId shader); - - virtual void compressedTexImage2D(WGC3Denum target, - WGC3Dint level, - WGC3Denum internalformat, - WGC3Dsizei width, - WGC3Dsizei height, - WGC3Dint border, - WGC3Dsizei imageSize, - const void* data); - virtual void compressedTexSubImage2D(WGC3Denum target, - WGC3Dint level, - WGC3Dint xoffset, - WGC3Dint yoffset, - WGC3Dsizei width, - WGC3Dsizei height, - WGC3Denum format, - WGC3Dsizei imageSize, - const void* data); - virtual void copyTexImage2D(WGC3Denum target, - WGC3Dint level, - WGC3Denum internalformat, - WGC3Dint x, - WGC3Dint y, - WGC3Dsizei width, - WGC3Dsizei height, - WGC3Dint border); - virtual void copyTexSubImage2D(WGC3Denum target, - WGC3Dint level, - WGC3Dint xoffset, - WGC3Dint yoffset, - WGC3Dint x, - WGC3Dint y, - WGC3Dsizei width, - WGC3Dsizei height); - virtual void cullFace(WGC3Denum mode); - virtual void depthFunc(WGC3Denum func); - virtual void depthMask(WGC3Dboolean flag); - virtual void depthRange(WGC3Dclampf zNear, WGC3Dclampf zFar); - virtual void detachShader(WebGLId program, WebGLId shader); - virtual void disable(WGC3Denum cap); - virtual void disableVertexAttribArray(WGC3Duint index); - virtual void drawArrays(WGC3Denum mode, WGC3Dint first, WGC3Dsizei count); - virtual void drawElements(WGC3Denum mode, - WGC3Dsizei count, - WGC3Denum type, - WGC3Dintptr offset); - - virtual void enable(WGC3Denum cap); - virtual void enableVertexAttribArray(WGC3Duint index); - virtual void finish(); - virtual void flush(); - virtual void framebufferRenderbuffer(WGC3Denum target, - WGC3Denum attachment, - WGC3Denum renderbuffertarget, - WebGLId renderbuffer); - virtual void framebufferTexture2D(WGC3Denum target, - WGC3Denum attachment, - WGC3Denum textarget, - WebGLId texture, - WGC3Dint level); - virtual void frontFace(WGC3Denum mode); - virtual void generateMipmap(WGC3Denum target); - - virtual bool getActiveAttrib(WebGLId program, - WGC3Duint index, - ActiveInfo&); - virtual bool getActiveUniform(WebGLId program, - WGC3Duint index, - ActiveInfo&); - - virtual void getAttachedShaders(WebGLId program, - WGC3Dsizei maxCount, - WGC3Dsizei* count, - WebGLId* shaders); - - virtual WGC3Dint getAttribLocation(WebGLId program, const WGC3Dchar* name); - - virtual void getBooleanv(WGC3Denum pname, WGC3Dboolean* value); - - virtual void getBufferParameteriv(WGC3Denum target, - WGC3Denum pname, - WGC3Dint* value); - - virtual WGC3Denum getError(); - - virtual void getFloatv(WGC3Denum pname, WGC3Dfloat* value); - - virtual void getFramebufferAttachmentParameteriv(WGC3Denum target, - WGC3Denum attachment, - WGC3Denum pname, - WGC3Dint* value); - - virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value); - - virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value); - - virtual blink::WebString getProgramInfoLog(WebGLId program); - - virtual void getRenderbufferParameteriv(WGC3Denum target, - WGC3Denum pname, - WGC3Dint* value); - - virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value); - - virtual blink::WebString getShaderInfoLog(WebGLId shader); - - virtual void getShaderPrecisionFormat(WGC3Denum shadertype, - WGC3Denum precisiontype, - WGC3Dint* range, - WGC3Dint* precision); - - virtual blink::WebString getShaderSource(WebGLId shader); - virtual blink::WebString getString(WGC3Denum name); - - virtual void getTexParameterfv(WGC3Denum target, - WGC3Denum pname, - WGC3Dfloat* value); - virtual void getTexParameteriv(WGC3Denum target, - WGC3Denum pname, - WGC3Dint* value); - - virtual void getUniformfv(WebGLId program, - WGC3Dint location, - WGC3Dfloat* value); - virtual void getUniformiv(WebGLId program, - WGC3Dint location, - WGC3Dint* value); - - virtual WGC3Dint getUniformLocation(WebGLId program, const WGC3Dchar* name); - - virtual void getVertexAttribfv(WGC3Duint index, WGC3Denum pname, - WGC3Dfloat* value); - virtual void getVertexAttribiv(WGC3Duint index, WGC3Denum pname, - WGC3Dint* value); - - virtual WGC3Dsizeiptr getVertexAttribOffset(WGC3Duint index, WGC3Denum pname); - - virtual void hint(WGC3Denum target, WGC3Denum mode); - virtual WGC3Dboolean isBuffer(WebGLId buffer); - virtual WGC3Dboolean isEnabled(WGC3Denum cap); - virtual WGC3Dboolean isFramebuffer(WebGLId framebuffer); - virtual WGC3Dboolean isProgram(WebGLId program); - virtual WGC3Dboolean isRenderbuffer(WebGLId renderbuffer); - virtual WGC3Dboolean isShader(WebGLId shader); - virtual WGC3Dboolean isTexture(WebGLId texture); - virtual void lineWidth(WGC3Dfloat); - virtual void linkProgram(WebGLId program); - virtual void pixelStorei(WGC3Denum pname, WGC3Dint param); - virtual void polygonOffset(WGC3Dfloat factor, WGC3Dfloat units); - - virtual void readPixels(WGC3Dint x, - WGC3Dint y, - WGC3Dsizei width, - WGC3Dsizei height, - WGC3Denum format, - WGC3Denum type, - void* pixels); - - virtual void releaseShaderCompiler(); - virtual void renderbufferStorage(WGC3Denum target, - WGC3Denum internalformat, - WGC3Dsizei width, - WGC3Dsizei height); - virtual void sampleCoverage(WGC3Dfloat value, WGC3Dboolean invert); - virtual void scissor(WGC3Dint x, WGC3Dint y, - WGC3Dsizei width, WGC3Dsizei height); - virtual void shaderSource(WebGLId shader, const WGC3Dchar* string); - virtual void stencilFunc(WGC3Denum func, WGC3Dint ref, WGC3Duint mask); - virtual void stencilFuncSeparate(WGC3Denum face, - WGC3Denum func, - WGC3Dint ref, - WGC3Duint mask); - virtual void stencilMask(WGC3Duint mask); - virtual void stencilMaskSeparate(WGC3Denum face, WGC3Duint mask); - virtual void stencilOp(WGC3Denum fail, - WGC3Denum zfail, - WGC3Denum zpass); - virtual void stencilOpSeparate(WGC3Denum face, - WGC3Denum fail, - WGC3Denum zfail, - WGC3Denum zpass); - - virtual void texImage2D(WGC3Denum target, - WGC3Dint level, - WGC3Denum internalformat, - WGC3Dsizei width, - WGC3Dsizei height, - WGC3Dint border, - WGC3Denum format, - WGC3Denum type, - const void* pixels); - - virtual void texParameterf(WGC3Denum target, - WGC3Denum pname, - WGC3Dfloat param); - virtual void texParameteri(WGC3Denum target, - WGC3Denum pname, - WGC3Dint param); - - virtual void texSubImage2D(WGC3Denum target, - WGC3Dint level, - WGC3Dint xoffset, - WGC3Dint yoffset, - WGC3Dsizei width, - WGC3Dsizei height, - WGC3Denum format, - WGC3Denum type, - const void* pixels); - - virtual void uniform1f(WGC3Dint location, WGC3Dfloat x); - virtual void uniform1fv(WGC3Dint location, - WGC3Dsizei count, const WGC3Dfloat* v); - virtual void uniform1i(WGC3Dint location, WGC3Dint x); - virtual void uniform1iv(WGC3Dint location, - WGC3Dsizei count, const WGC3Dint* v); - virtual void uniform2f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y); - virtual void uniform2fv(WGC3Dint location, - WGC3Dsizei count, const WGC3Dfloat* v); - virtual void uniform2i(WGC3Dint location, WGC3Dint x, WGC3Dint y); - virtual void uniform2iv(WGC3Dint location, - WGC3Dsizei count, const WGC3Dint* v); - virtual void uniform3f(WGC3Dint location, - WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z); - virtual void uniform3fv(WGC3Dint location, - WGC3Dsizei count, const WGC3Dfloat* v); - virtual void uniform3i(WGC3Dint location, - WGC3Dint x, WGC3Dint y, WGC3Dint z); - virtual void uniform3iv(WGC3Dint location, - WGC3Dsizei count, const WGC3Dint* v); - virtual void uniform4f(WGC3Dint location, - WGC3Dfloat x, WGC3Dfloat y, - WGC3Dfloat z, WGC3Dfloat w); - virtual void uniform4fv(WGC3Dint location, - WGC3Dsizei count, const WGC3Dfloat* v); - virtual void uniform4i(WGC3Dint location, - WGC3Dint x, WGC3Dint y, WGC3Dint z, WGC3Dint w); - virtual void uniform4iv(WGC3Dint location, - WGC3Dsizei count, const WGC3Dint* v); - virtual void uniformMatrix2fv(WGC3Dint location, - WGC3Dsizei count, - WGC3Dboolean transpose, - const WGC3Dfloat* value); - virtual void uniformMatrix3fv(WGC3Dint location, - WGC3Dsizei count, - WGC3Dboolean transpose, - const WGC3Dfloat* value); - virtual void uniformMatrix4fv(WGC3Dint location, - WGC3Dsizei count, - WGC3Dboolean transpose, - const WGC3Dfloat* value); - - virtual void useProgram(WebGLId program); - virtual void validateProgram(WebGLId program); - - virtual void vertexAttrib1f(WGC3Duint index, WGC3Dfloat x); - virtual void vertexAttrib1fv(WGC3Duint index, const WGC3Dfloat* values); - virtual void vertexAttrib2f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y); - virtual void vertexAttrib2fv(WGC3Duint index, const WGC3Dfloat* values); - virtual void vertexAttrib3f(WGC3Duint index, - WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z); - virtual void vertexAttrib3fv(WGC3Duint index, const WGC3Dfloat* values); - virtual void vertexAttrib4f(WGC3Duint index, - WGC3Dfloat x, WGC3Dfloat y, - WGC3Dfloat z, WGC3Dfloat w); - virtual void vertexAttrib4fv(WGC3Duint index, const WGC3Dfloat* values); - virtual void vertexAttribPointer(WGC3Duint index, - WGC3Dint size, - WGC3Denum type, - WGC3Dboolean normalized, - WGC3Dsizei stride, - WGC3Dintptr offset); - - virtual void viewport(WGC3Dint x, WGC3Dint y, - WGC3Dsizei width, WGC3Dsizei height); - - // Support for buffer creation and deletion - virtual void genBuffers(WGC3Dsizei count, WebGLId* ids); - virtual void genFramebuffers(WGC3Dsizei count, WebGLId* ids); - virtual void genRenderbuffers(WGC3Dsizei count, WebGLId* ids); - virtual void genTextures(WGC3Dsizei count, WebGLId* ids); - - virtual void deleteBuffers(WGC3Dsizei count, WebGLId* ids); - virtual void deleteFramebuffers(WGC3Dsizei count, WebGLId* ids); - virtual void deleteRenderbuffers(WGC3Dsizei count, WebGLId* ids); - virtual void deleteTextures(WGC3Dsizei count, WebGLId* ids); - - virtual WebGLId createBuffer(); - virtual WebGLId createFramebuffer(); - virtual WebGLId createRenderbuffer(); - virtual WebGLId createTexture(); - - virtual void deleteBuffer(WebGLId); - virtual void deleteFramebuffer(WebGLId); - virtual void deleteRenderbuffer(WebGLId); - virtual void deleteTexture(WebGLId); - - virtual WebGLId createProgram(); - virtual WebGLId createShader(WGC3Denum); - - virtual void deleteProgram(WebGLId); - virtual void deleteShader(WebGLId); - - virtual void synthesizeGLError(WGC3Denum); - - virtual void* mapBufferSubDataCHROMIUM( - WGC3Denum target, WGC3Dintptr offset, - WGC3Dsizeiptr size, WGC3Denum access); - virtual void unmapBufferSubDataCHROMIUM(const void*); - virtual void* mapTexSubImage2DCHROMIUM( - WGC3Denum target, - WGC3Dint level, - WGC3Dint xoffset, - WGC3Dint yoffset, - WGC3Dsizei width, - WGC3Dsizei height, - WGC3Denum format, - WGC3Denum type, - WGC3Denum access); - virtual void unmapTexSubImage2DCHROMIUM(const void*); - - virtual void setVisibilityCHROMIUM(bool visible); - - virtual void discardFramebufferEXT(WGC3Denum target, - WGC3Dsizei numAttachments, - const WGC3Denum* attachments); - virtual void copyTextureToParentTextureCHROMIUM( - WebGLId texture, WebGLId parentTexture); - - virtual blink::WebString getRequestableExtensionsCHROMIUM(); - virtual void requestExtensionCHROMIUM(const char*); - - virtual void blitFramebufferCHROMIUM( - WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, - WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, - WGC3Dbitfield mask, WGC3Denum filter); - virtual void renderbufferStorageMultisampleCHROMIUM( - WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, - WGC3Dsizei width, WGC3Dsizei height); - - virtual blink::WebString getTranslatedShaderSourceANGLE(WebGLId shader); - - virtual void setContextLostCallback( - WebGraphicsContext3D::WebGraphicsContextLostCallback* callback); - - virtual void setErrorMessageCallback( - WebGraphicsContext3D::WebGraphicsErrorMessageCallback* callback); - - virtual void texImageIOSurface2DCHROMIUM( - WGC3Denum target, WGC3Dint width, WGC3Dint height, - WGC3Duint ioSurfaceId, WGC3Duint plane); - - virtual void texStorage2DEXT( - WGC3Denum target, WGC3Dint levels, WGC3Duint internalformat, - WGC3Dint width, WGC3Dint height); - - virtual WebGLId createQueryEXT(); - virtual void deleteQueryEXT(WebGLId query); - virtual WGC3Dboolean isQueryEXT(WGC3Duint query); - virtual void beginQueryEXT(WGC3Denum target, WebGLId query); - virtual void endQueryEXT(WGC3Denum target); - virtual void getQueryivEXT( - WGC3Denum target, WGC3Denum pname, WGC3Dint* params); - virtual void getQueryObjectuivEXT( - WebGLId query, WGC3Denum pname, WGC3Duint* params); - - virtual void copyTextureCHROMIUM(WGC3Denum target, WebGLId source_id, - WebGLId dest_id, WGC3Dint level, - WGC3Denum internal_format, - WGC3Denum dest_type); - - virtual void bindUniformLocationCHROMIUM(WebGLId program, WGC3Dint location, - const WGC3Dchar* uniform); - - virtual void shallowFlushCHROMIUM(); - virtual void shallowFinishCHROMIUM(); - - virtual void genMailboxCHROMIUM(WGC3Dbyte* mailbox); - virtual void produceTextureCHROMIUM(WGC3Denum target, - const WGC3Dbyte* mailbox); - virtual void produceTextureDirectCHROMIUM(WebGLId texture, WGC3Denum target, - const WGC3Dbyte* mailbox); - virtual void consumeTextureCHROMIUM(WGC3Denum target, - const WGC3Dbyte* mailbox); - virtual WebGLId createAndConsumeTextureCHROMIUM(WGC3Denum target, - const WGC3Dbyte* mailbox); - - virtual void genValuebuffersCHROMIUM(WGC3Dsizei count, WebGLId* ids); - virtual WebGLId createValuebufferCHROMIUM(); - virtual void deleteValuebuffersCHROMIUM(WGC3Dsizei count, WebGLId* ids); - virtual void deleteValuebufferCHROMIUM(WebGLId); - virtual void bindValuebufferCHROMIUM(WGC3Denum target, WebGLId valuebuffer); - virtual WGC3Dboolean isValuebufferCHROMIUM(WebGLId renderbuffer); - virtual void subscribeValueCHROMIUM(WGC3Denum target, WGC3Denum subscription); - virtual void populateSubscribedValuesCHROMIUM(WGC3Denum target); - virtual void uniformValuebufferCHROMIUM(WGC3Dint location, - WGC3Denum target, - WGC3Denum subscription); - - virtual void insertEventMarkerEXT(const WGC3Dchar* marker); - virtual void pushGroupMarkerEXT(const WGC3Dchar* marker); - virtual void popGroupMarkerEXT(); - - // GL_OES_vertex_array_object - virtual WebGLId createVertexArrayOES(); - virtual void deleteVertexArrayOES(WebGLId array); - virtual WGC3Dboolean isVertexArrayOES(WebGLId array); - virtual void bindVertexArrayOES(WebGLId array); - - virtual void bindTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint image_id); - virtual void releaseTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint image_id); - - virtual void* mapBufferCHROMIUM(WGC3Denum target, WGC3Denum access); - virtual WGC3Dboolean unmapBufferCHROMIUM(WGC3Denum target); - - // Async pixel transfer functions. - virtual void asyncTexImage2DCHROMIUM( - WGC3Denum target, - WGC3Dint level, - WGC3Denum internalformat, - WGC3Dsizei width, - WGC3Dsizei height, - WGC3Dint border, - WGC3Denum format, - WGC3Denum type, - const void* pixels); - virtual void asyncTexSubImage2DCHROMIUM( - WGC3Denum target, - WGC3Dint level, - WGC3Dint xoffset, - WGC3Dint yoffset, - WGC3Dsizei width, - WGC3Dsizei height, - WGC3Denum format, - WGC3Denum type, - const void* pixels); - virtual void waitAsyncTexImage2DCHROMIUM(WGC3Denum target); - - // GL_EXT_draw_buffers - virtual void drawBuffersEXT( - WGC3Dsizei n, - const WGC3Denum* bufs); - - // GL_ANGLE_instanced_arrays - virtual void drawArraysInstancedANGLE(WGC3Denum mode, WGC3Dint first, - WGC3Dsizei count, WGC3Dsizei primcount); - virtual void drawElementsInstancedANGLE(WGC3Denum mode, WGC3Dsizei count, - WGC3Denum type, WGC3Dintptr offset, WGC3Dsizei primcount); - virtual void vertexAttribDivisorANGLE(WGC3Duint index, WGC3Duint divisor); - - // GL_CHROMIUM_gpu_memory_buffer_image - virtual WGC3Duint createGpuMemoryBufferImageCHROMIUM(WGC3Dsizei width, - WGC3Dsizei height, - WGC3Denum internalformat, - WGC3Denum usage); - virtual void destroyImageCHROMIUM(WGC3Duint image_id); - - // GL_EXT_multisampled_render_to_texture - virtual void framebufferTexture2DMultisampleEXT(WGC3Denum target, - WGC3Denum attachment, - WGC3Denum textarget, - WebGLId texture, - WGC3Dint level, - WGC3Dsizei samples); - virtual void renderbufferStorageMultisampleEXT( - WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, - WGC3Dsizei width, WGC3Dsizei height); - - virtual GrGLInterface* createGrGLInterface(); - - ::gpu::gles2::GLES2Interface* GetGLInterface() { - return gl_; - } - - // Convert WebGL context creation attributes into command buffer / EGL size - // requests. - static void ConvertAttributes( - const blink::WebGraphicsContext3D::Attributes& attributes, - ::gpu::gles2::ContextCreationAttribHelper* output_attribs); - - protected: - friend class WebGraphicsContext3DErrorMessageCallback; - - WebGraphicsContext3DImpl(); - - ::gpu::gles2::GLES2ImplementationErrorMessageCallback* - getErrorMessageCallback(); - virtual void OnErrorMessage(const std::string& message, int id); - - void setGLInterface(::gpu::gles2::GLES2Interface* gl) { - gl_ = gl; - } - - bool initialized_; - bool initialize_failed_; - - WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; - WGC3Denum context_lost_reason_; - - WebGraphicsContext3D::WebGraphicsErrorMessageCallback* - error_message_callback_; - scoped_ptr<WebGraphicsContext3DErrorMessageCallback> - client_error_message_callback_; - - // Errors raised by synthesizeGLError(). - std::vector<WGC3Denum> synthetic_errors_; - - ::gpu::gles2::GLES2Interface* gl_; - bool lose_context_when_out_of_memory_; - uint32_t flush_id_; -}; - -} // namespace gpu -} // namespace webkit - -#endif // WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IMPL_H_ diff --git a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h index 7e503a5..1779a5b 100644 --- a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h +++ b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h @@ -9,11 +9,11 @@ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" +#include "gpu/blink/webgraphicscontext3d_impl.h" #include "gpu/command_buffer/client/gl_in_process_context.h" #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" #include "third_party/WebKit/public/platform/WebString.h" #include "ui/gfx/native_widget_types.h" -#include "webkit/common/gpu/webgraphicscontext3d_impl.h" #include "webkit/common/gpu/webkit_gpu_export.h" namespace gpu { @@ -34,7 +34,7 @@ namespace webkit { namespace gpu { class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl - : public WebGraphicsContext3DImpl { + : public gpu_blink::WebGraphicsContext3DImpl { public: enum MappedMemoryReclaimLimit { kNoLimit = 0, diff --git a/webkit/common/gpu/webkit_gpu.gyp b/webkit/common/gpu/webkit_gpu.gyp index 2238538..3bc5bfc 100644 --- a/webkit/common/gpu/webkit_gpu.gyp +++ b/webkit/common/gpu/webkit_gpu.gyp @@ -19,20 +19,21 @@ }, 'dependencies': [ '<(DEPTH)/base/base.gyp:base', - '<(DEPTH)/cc/cc.gyp:cc', '<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', + '<(DEPTH)/cc/cc.gyp:cc', + '<(DEPTH)/gpu/blink/gpu_blink.gyp:gpu_blink', '<(DEPTH)/gpu/command_buffer/command_buffer.gyp:gles2_utils', '<(DEPTH)/gpu/gpu.gyp:command_buffer_service', + '<(DEPTH)/gpu/gpu.gyp:gl_in_process_context', '<(DEPTH)/gpu/gpu.gyp:gles2_c_lib', '<(DEPTH)/gpu/gpu.gyp:gles2_implementation', - '<(DEPTH)/gpu/gpu.gyp:gl_in_process_context', '<(DEPTH)/gpu/skia_bindings/skia_bindings.gyp:gpu_skia_bindings', '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/third_party/WebKit/public/blink.gyp:blink_minimal', - '<(angle_path)/src/angle.gyp:translator', - '<(DEPTH)/ui/gl/gl.gyp:gl', '<(DEPTH)/ui/gfx/gfx.gyp:gfx', '<(DEPTH)/ui/gfx/gfx.gyp:gfx_geometry', + '<(DEPTH)/ui/gl/gl.gyp:gl', + '<(angle_path)/src/angle.gyp:translator', ], 'sources': [ # This list contains all .h and .cc in gpu except for test code. @@ -41,8 +42,6 @@ 'context_provider_web_context.h', 'grcontext_for_webgraphicscontext3d.cc', 'grcontext_for_webgraphicscontext3d.h', - 'webgraphicscontext3d_impl.cc', - 'webgraphicscontext3d_impl.h', 'webgraphicscontext3d_in_process_command_buffer_impl.cc', 'webgraphicscontext3d_in_process_command_buffer_impl.h', ], |