diff options
16 files changed, 45 insertions, 250 deletions
diff --git a/content/browser/android/in_process/context_provider_in_process.cc b/content/browser/android/in_process/context_provider_in_process.cc index 9f4fbc2..f27734a 100644 --- a/content/browser/android/in_process/context_provider_in_process.cc +++ b/content/browser/android/in_process/context_provider_in_process.cc @@ -99,8 +99,7 @@ bool ContextProviderInProcess::BindToCurrentThread() { const std::string unique_context_name = base::StringPrintf("%s-%p", debug_name_.c_str(), WebContext3DImpl()); - WebContext3DImpl()->traceBeginCHROMIUM("gpu_toplevel", - unique_context_name.c_str()); + ContextGL()->TraceBeginCHROMIUM("gpu_toplevel", unique_context_name.c_str()); lost_context_callback_proxy_.reset(new LostContextCallbackProxy(this)); return true; diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc index 3f15cf3..a0a4f78 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.cc +++ b/content/browser/renderer_host/render_widget_host_view_android.cc @@ -211,10 +211,10 @@ GLHelperHolder::CreateContext3D() { limits, nullptr)); context->SetContextType(BROWSER_OFFSCREEN_MAINTHREAD_CONTEXT); if (context->InitializeOnCurrentThread()) { - context->traceBeginCHROMIUM( + context->GetImplementation()->TraceBeginCHROMIUM( "gpu_toplevel", - base::StringPrintf("CmdBufferImageTransportFactory-%p", - context.get()).c_str()); + base::StringPrintf("CmdBufferImageTransportFactory-%p", context.get()) + .c_str()); } else { context.reset(); } diff --git a/content/common/gpu/client/context_provider_command_buffer.cc b/content/common/gpu/client/context_provider_command_buffer.cc index 2560d78..c57e5a4 100644 --- a/content/common/gpu/client/context_provider_command_buffer.cc +++ b/content/common/gpu/client/context_provider_command_buffer.cc @@ -107,8 +107,8 @@ bool ContextProviderCommandBuffer::BindToCurrentThread() { std::string unique_context_name = base::StringPrintf("%s-%p", debug_name_.c_str(), WebContext3DNoChecks()); - WebContext3DNoChecks()->traceBeginCHROMIUM("gpu_toplevel", - unique_context_name.c_str()); + WebContext3DNoChecks()->GetImplementation()->TraceBeginCHROMIUM( + "gpu_toplevel", unique_context_name.c_str()); lost_context_callback_proxy_.reset(new LostContextCallbackProxy(this)); return true; diff --git a/content/common/gpu/client/gl_helper_unittest.cc b/content/common/gpu/client/gl_helper_unittest.cc index 8a4051a..b84ea87 100644 --- a/content/common/gpu/client/gl_helper_unittest.cc +++ b/content/common/gpu/client/gl_helper_unittest.cc @@ -1363,7 +1363,7 @@ class GLHelperTest : public testing::Test { EXPECT_FALSE(mailbox.IsZero()); context_->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); const blink::WGC3Duint64 fence_sync = context_->insertFenceSyncCHROMIUM(); - context_->shallowFlushCHROMIUM(); + context_->GetGLInterface()->ShallowFlushCHROMIUM(); gpu::SyncToken sync_token; ASSERT_TRUE(context_->genSyncTokenCHROMIUM(fence_sync, diff --git a/content/common/gpu/client/gpu_context_tests.h b/content/common/gpu/client/gpu_context_tests.h index 9547ea1..230d895 100644 --- a/content/common/gpu/client/gpu_context_tests.h +++ b/content/common/gpu/client/gpu_context_tests.h @@ -10,6 +10,7 @@ #include "base/run_loop.h" #include "gpu/GLES2/gl2extchromium.h" #include "gpu/command_buffer/client/context_support.h" +#include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/common/sync_token.h" namespace { @@ -45,7 +46,7 @@ CONTEXT_TEST_F(SignalTest, BasicSignalSyncTokenTest) { return; const blink::WGC3Duint64 fence_sync = context_->insertFenceSyncCHROMIUM(); - context_->shallowFlushCHROMIUM(); + context_->GetGLInterface()->ShallowFlushCHROMIUM(); gpu::SyncToken sync_token; ASSERT_TRUE(context_->genSyncTokenCHROMIUM(fence_sync, sync_token.GetData())); diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc index 4009335..f28ee85 100644 --- a/content/renderer/media/android/webmediaplayer_android.cc +++ b/content/renderer/media/android/webmediaplayer_android.cc @@ -145,25 +145,19 @@ bool AllocateSkBitmapTexture(GrContext* gr, class SyncTokenClientImpl : public media::VideoFrame::SyncTokenClient { public: - explicit SyncTokenClientImpl( - blink::WebGraphicsContext3D* web_graphics_context) - : web_graphics_context_(web_graphics_context) {} + explicit SyncTokenClientImpl(gpu::gles2::GLES2Interface* gl) : gl_(gl) {} ~SyncTokenClientImpl() override {} void GenerateSyncToken(gpu::SyncToken* sync_token) override { - const blink::WGC3Duint64 fence_sync = - web_graphics_context_->insertFenceSyncCHROMIUM(); - web_graphics_context_->shallowFlushCHROMIUM(); - if (!web_graphics_context_->genSyncTokenCHROMIUM(fence_sync, - sync_token->GetData())) { - sync_token->Clear(); - } + const GLuint64 fence_sync = gl_->InsertFenceSyncCHROMIUM(); + gl_->ShallowFlushCHROMIUM(); + gl_->GenSyncTokenCHROMIUM(fence_sync, sync_token->GetData()); } void WaitSyncToken(const gpu::SyncToken& sync_token) override { - web_graphics_context_->waitSyncTokenCHROMIUM(sync_token.GetConstData()); + gl_->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); } private: - blink::WebGraphicsContext3D* web_graphics_context_; + gpu::gles2::GLES2Interface* gl_; }; } // namespace @@ -709,6 +703,8 @@ bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture( unsigned int type, bool premultiply_alpha, bool flip_y) { + // TODO(danakj): Pass a GLES2Interface to this method instead. + gpu::gles2::GLES2Interface* gl = web_graphics_context->getGLES2Interface(); DCHECK(main_thread_checker_.CalledOnValidThread()); // Don't allow clients to copy an encrypted video frame. if (needs_external_surface_) @@ -728,26 +724,24 @@ bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture( mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES) || (is_remote_ && mailbox_holder.texture_target == GL_TEXTURE_2D)); - web_graphics_context->waitSyncTokenCHROMIUM( - mailbox_holder.sync_token.GetConstData()); + gl->WaitSyncTokenCHROMIUM(mailbox_holder.sync_token.GetConstData()); // Ensure the target of texture is set before copyTextureCHROMIUM, otherwise // an invalid texture target may be used for copy texture. - uint32_t src_texture = web_graphics_context->createAndConsumeTextureCHROMIUM( + uint32_t src_texture = gl->CreateAndConsumeTextureCHROMIUM( mailbox_holder.texture_target, mailbox_holder.mailbox.name); // Application itself needs to take care of setting the right flip_y // value down to get the expected result. // flip_y==true means to reverse the video orientation while // flip_y==false means to keep the intrinsic orientation. - web_graphics_context->copyTextureCHROMIUM(src_texture, texture, - internal_format, type, flip_y, - premultiply_alpha, false); + gl->CopyTextureCHROMIUM(src_texture, texture, internal_format, type, flip_y, + premultiply_alpha, false); - web_graphics_context->deleteTexture(src_texture); + gl->DeleteTextures(1, &src_texture); web_graphics_context->flush(); - SyncTokenClientImpl client(web_graphics_context); + SyncTokenClientImpl client(gl); video_frame->UpdateReleaseSyncToken(&client); return true; } diff --git a/gpu/blink/webgraphicscontext3d_impl.cc b/gpu/blink/webgraphicscontext3d_impl.cc index d260e94..1be79ec 100644 --- a/gpu/blink/webgraphicscontext3d_impl.cc +++ b/gpu/blink/webgraphicscontext3d_impl.cc @@ -227,25 +227,6 @@ bool WebGraphicsContext3DImpl::genSyncTokenCHROMIUM(WGC3Duint64 fenceSync, DELEGATE_TO_GL_1(waitSyncTokenCHROMIUM, WaitSyncTokenCHROMIUM, const WGC3Dbyte*) -void WebGraphicsContext3DImpl::reshapeWithScaleFactor(int width, - int height, - float scale) { - gl_->ResizeCHROMIUM(width, height, scale, true); -} - -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*) @@ -835,9 +816,6 @@ void WebGraphicsContext3DImpl::setContextLostCallback( 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) @@ -890,32 +868,11 @@ DELEGATE_TO_GL_11(copySubTextureCHROMIUM, WGC3Dboolean, WGC3Dboolean); -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(); -} - -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) @@ -960,24 +917,12 @@ DELEGATE_TO_GL_3(uniformValuebufferCHROMIUM, WGC3Dint, WGC3Denum, WGC3Denum); -DELEGATE_TO_GL_2(traceBeginCHROMIUM, - TraceBeginCHROMIUM, - const WGC3Dchar*, - const WGC3Dchar*); -DELEGATE_TO_GL(traceEndCHROMIUM, TraceEndCHROMIUM); - -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); @@ -997,11 +942,6 @@ DELEGATE_TO_GL_2(bindTexImage2DCHROMIUM, BindTexImage2DCHROMIUM, 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_2(drawBuffersEXT, DrawBuffersEXT, WGC3Dsizei, const WGC3Denum*) DELEGATE_TO_GL_4(drawArraysInstancedANGLE, DrawArraysInstancedANGLE, WGC3Denum, @@ -1216,10 +1156,6 @@ void WebGraphicsContext3DImpl::waitSync(WGC3Dsync sync, gl_->WaitSync(reinterpret_cast<GLsync>(sync), flags, timeout); } -blink::WGC3Denum WebGraphicsContext3DImpl::getGraphicsResetStatusARB() { - return gl_->GetGraphicsResetStatusKHR(); -} - ::gpu::gles2::GLES2Interface* WebGraphicsContext3DImpl::getGLES2Interface() { return gl_; } @@ -1241,29 +1177,6 @@ void WebGraphicsContext3DImpl::OnErrorMessage( } } -// 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, diff --git a/gpu/blink/webgraphicscontext3d_impl.h b/gpu/blink/webgraphicscontext3d_impl.h index ab5ab3a..0e8ed7e 100644 --- a/gpu/blink/webgraphicscontext3d_impl.h +++ b/gpu/blink/webgraphicscontext3d_impl.h @@ -44,15 +44,6 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl blink::WGC3Dbyte* syncToken) override; void waitSyncTokenCHROMIUM(const blink::WGC3Dbyte* syncToken) override; - void loseContextCHROMIUM(blink::WGC3Denum current, - blink::WGC3Denum other) override; - - void reshapeWithScaleFactor( - int width, int height, float scale_factor) override; - - void prepareTexture() override; - void postSubBufferCHROMIUM(int x, int y, int width, int height) override; - void activeTexture(blink::WGC3Denum texture) override; void applyScreenSpaceAntialiasingCHROMIUM() override; void attachShader(blink::WebGLId program, blink::WebGLId shader) override; @@ -286,7 +277,6 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl blink::WGC3Denum type, void* pixels) override; - void releaseShaderCompiler() override; void renderbufferStorage(blink::WGC3Denum target, blink::WGC3Denum internalformat, blink::WGC3Dsizei width, @@ -461,29 +451,9 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl void synthesizeGLError(blink::WGC3Denum) override; - void* mapBufferSubDataCHROMIUM(blink::WGC3Denum target, - blink::WGC3Dintptr offset, - blink::WGC3Dsizeiptr size, - blink::WGC3Denum access) override; - void unmapBufferSubDataCHROMIUM(const void*) override; - void* mapTexSubImage2DCHROMIUM(blink::WGC3Denum target, - blink::WGC3Dint level, - blink::WGC3Dint xoffset, - blink::WGC3Dint yoffset, - blink::WGC3Dsizei width, - blink::WGC3Dsizei height, - blink::WGC3Denum format, - blink::WGC3Denum type, - blink::WGC3Denum access) override; - void unmapTexSubImage2DCHROMIUM(const void*) override; - - void setVisibilityCHROMIUM(bool visible) override; - void discardFramebufferEXT(blink::WGC3Denum target, blink::WGC3Dsizei numAttachments, const blink::WGC3Denum* attachments) override; - virtual void copyTextureToParentTextureCHROMIUM(blink::WebGLId texture, - blink::WebGLId parentTexture); blink::WebString getRequestableExtensionsCHROMIUM() override; void requestExtensionCHROMIUM(const char*) override; @@ -514,12 +484,6 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl void setErrorMessageCallback( WebGraphicsContext3D::WebGraphicsErrorMessageCallback* callback) override; - void texImageIOSurface2DCHROMIUM(blink::WGC3Denum target, - blink::WGC3Dint width, - blink::WGC3Dint height, - blink::WGC3Duint ioSurfaceId, - blink::WGC3Duint plane) override; - void texStorage2DEXT(blink::WGC3Denum target, blink::WGC3Dint levels, blink::WGC3Duint internalformat, @@ -565,21 +529,12 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl blink::WGC3Dboolean unpack_premultiply_alpha, blink::WGC3Dboolean unpack_unmultiply_alpha) override; - void bindUniformLocationCHROMIUM(blink::WebGLId program, - blink::WGC3Dint location, - const blink::WGC3Dchar* uniform) override; - - void shallowFlushCHROMIUM() override; - void shallowFinishCHROMIUM() override; - void genMailboxCHROMIUM(blink::WGC3Dbyte* mailbox) override; void produceTextureCHROMIUM(blink::WGC3Denum target, const blink::WGC3Dbyte* mailbox) override; void produceTextureDirectCHROMIUM(blink::WebGLId texture, blink::WGC3Denum target, const blink::WGC3Dbyte* mailbox) override; - void consumeTextureCHROMIUM(blink::WGC3Denum target, - const blink::WGC3Dbyte* mailbox) override; blink::WebGLId createAndConsumeTextureCHROMIUM( blink::WGC3Denum target, const blink::WGC3Dbyte* mailbox) override; @@ -600,13 +555,8 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl void uniformValuebufferCHROMIUM(blink::WGC3Dint location, blink::WGC3Denum target, blink::WGC3Denum subscription) override; - void traceBeginCHROMIUM(const blink::WGC3Dchar* category_name, - const blink::WGC3Dchar* trace_name) override; - void traceEndCHROMIUM() override; - void insertEventMarkerEXT(const blink::WGC3Dchar* marker) override; void pushGroupMarkerEXT(const blink::WGC3Dchar* marker) override; - void popGroupMarkerEXT() override; // GL_OES_vertex_array_object blink::WebGLId createVertexArrayOES() override; @@ -619,10 +569,6 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl void releaseTexImage2DCHROMIUM(blink::WGC3Denum target, blink::WGC3Dint image_id) override; - void* mapBufferCHROMIUM(blink::WGC3Denum target, - blink::WGC3Denum access) override; - blink::WGC3Dboolean unmapBufferCHROMIUM(blink::WGC3Denum target) override; - // GL_EXT_draw_buffers void drawBuffersEXT(blink::WGC3Dsizei n, const blink::WGC3Denum* bufs) override; @@ -937,8 +883,6 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl blink::WGC3Dbitfield flags, blink::WGC3Duint64 timeout) override; - blink::WGC3Denum getGraphicsResetStatusARB() override; - // WebGraphicsContext3D implementation. ::gpu::gles2::GLES2Interface* getGLES2Interface() override; diff --git a/third_party/WebKit/Source/core/testing/DEPS b/third_party/WebKit/Source/core/testing/DEPS new file mode 100644 index 0000000..8109dc0 --- /dev/null +++ b/third_party/WebKit/Source/core/testing/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+gpu/command_buffer/client/gles2_interface.h", +] diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp index 2d6f096..ac57aad 100644 --- a/third_party/WebKit/Source/core/testing/Internals.cpp +++ b/third_party/WebKit/Source/core/testing/Internals.cpp @@ -126,6 +126,7 @@ #include "core/testing/TypeConversions.h" #include "core/testing/UnionTypesTest.h" #include "core/workers/WorkerThread.h" +#include "gpu/command_buffer/client/gles2_interface.h" #include "platform/Cursor.h" #include "platform/Language.h" #include "platform/PlatformKeyboardEvent.h" @@ -2233,12 +2234,12 @@ bool Internals::loseSharedGraphicsContext3D() OwnPtr<WebGraphicsContext3DProvider> sharedProvider = adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider()); if (!sharedProvider) return false; - WebGraphicsContext3D* sharedContext = sharedProvider->context3d(); - sharedContext->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_EXT, GL_INNOCENT_CONTEXT_RESET_EXT); + gpu::gles2::GLES2Interface* sharedGL = sharedProvider->contextGL(); + sharedGL->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_EXT, GL_INNOCENT_CONTEXT_RESET_EXT); // To prevent tests that call loseSharedGraphicsContext3D from being // flaky, we call finish so that the context is guaranteed to be lost // synchronously (i.e. before returning). - sharedContext->finish(); + sharedGL->Finish(); return true; } diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp index 48a944b..5ca7f02 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp @@ -5003,7 +5003,7 @@ void WebGLRenderingContextBase::loseContextImpl(WebGLRenderingContextBase::LostC // Inform the embedder that a lost context was received. In response, the embedder might // decide to take action such as asking the user for permission to use WebGL again. if (LocalFrame* frame = canvas()->document().frame()) - frame->loader().client()->didLoseWebGLContext(webContext()->getGraphicsResetStatusARB()); + frame->loader().client()->didLoseWebGLContext(contextGL()->GetGraphicsResetStatusKHR()); } // Make absolutely sure we do not refer to an already-deleted texture or framebuffer. @@ -5074,7 +5074,7 @@ Extensions3DUtil* WebGLRenderingContextBase::extensionsUtil() { if (!m_extensionsUtil) { WebGraphicsContext3D* context = webContext(); - gpu::gles2::GLES2Interface* gl = context->getGLES2Interface(); + gpu::gles2::GLES2Interface* gl = contextGL(); m_extensionsUtil = Extensions3DUtil::create(context, gl); // The only reason the ExtensionsUtil should be invalid is if the webContext is lost. ASSERT(m_extensionsUtil->isValid() || gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR); diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h index a240ffc..1df44f0 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h @@ -56,6 +56,12 @@ namespace blink { class WebLayer; } +namespace gpu { +namespace gles2 { +class GLES2Interface; +} +} + namespace blink { class ANGLEInstancedArrays; @@ -378,6 +384,7 @@ public: void loseContextImpl(LostContextMode, AutoRecoveryMethod); WebGraphicsContext3D* webContext() const { return drawingBuffer()->context(); } + gpu::gles2::GLES2Interface* contextGL() const { return drawingBuffer()->contextGL(); } WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); } Extensions3DUtil* extensionsUtil(); diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp index 6234643..77c5bdf 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp @@ -205,6 +205,11 @@ WebGraphicsContext3D* DrawingBuffer::context() return m_context.get(); } +gpu::gles2::GLES2Interface* DrawingBuffer::contextGL() +{ + return m_gl; +} + void DrawingBuffer::setIsHidden(bool hidden) { if (m_isHidden == hidden) diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h index efdb7a3..80e83bf 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h @@ -150,6 +150,7 @@ public: WebLayer* platformLayer(); WebGraphicsContext3D* context(); + gpu::gles2::GLES2Interface* contextGL(); // Returns the actual context attributes for this drawing buffer which may differ from the // requested context attributes due to implementation limits. diff --git a/third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h b/third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h index ff7c637..c828d27 100644 --- a/third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h +++ b/third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h @@ -41,19 +41,8 @@ public: { } - virtual void prepareTexture() { } - - virtual void postSubBufferCHROMIUM(int x, int y, int width, int height) { } - virtual void synthesizeGLError(WGC3Denum) { } - virtual void* mapBufferSubDataCHROMIUM(WGC3Denum target, WGC3Dintptr offset, WGC3Dsizeiptr size, WGC3Denum access) { return 0; } - 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) { return 0; } - virtual void unmapTexSubImage2DCHROMIUM(const void*) { } - - virtual void setVisibilityCHROMIUM(bool visible) { } - virtual void discardFramebufferEXT(WGC3Denum target, WGC3Dsizei numAttachments, const WGC3Denum* attachments) { } virtual void ensureFramebufferCHROMIUM() { } @@ -174,8 +163,6 @@ public: 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(WGC3Dclampf value, WGC3Dboolean invert) { } virtual void scissor(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) { } diff --git a/third_party/WebKit/public/platform/WebGraphicsContext3D.h b/third_party/WebKit/public/platform/WebGraphicsContext3D.h index 89ad941..7d7b77e 100644 --- a/third_party/WebKit/public/platform/WebGraphicsContext3D.h +++ b/third_party/WebKit/public/platform/WebGraphicsContext3D.h @@ -141,30 +141,13 @@ public: // the ID number, the more recently the context has been flushed. virtual uint32_t lastFlushID() { return 0; } - // Resizes the region into which this WebGraphicsContext3D is drawing. - virtual void reshapeWithScaleFactor(int width, int height, float scaleFactor) { } - - // GL_CHROMIUM_setVisibility - Changes the visibility of the backbuffer - virtual void setVisibilityCHROMIUM(bool visible) = 0; - // GL_EXT_discard_framebuffer - makes specified attachments of currently bound framebuffer undefined. virtual void discardFramebufferEXT(WGC3Denum target, WGC3Dsizei numAttachments, const WGC3Denum* attachments) { } - // GL_CHROMIUM_discard_backbuffer - controls allocation/deallocation of the back buffer. - virtual void discardBackbufferCHROMIUM() { } - virtual void ensureBackbufferCHROMIUM() { } - virtual WGC3Duint64 insertFenceSyncCHROMIUM() { return 0; } virtual bool genSyncTokenCHROMIUM(WGC3Duint64, WGC3Dbyte*) { return false; } virtual void waitSyncTokenCHROMIUM(const WGC3Dbyte*) {} - // Copies the contents of the off-screen render target used by the WebGL - // context to the corresponding texture used by the compositor. - virtual void prepareTexture() = 0; - - // GL_CHROMIUM_post_sub_buffer - Copies part of the back buffer to the front buffer. - virtual void postSubBufferCHROMIUM(int x, int y, int width, int height) = 0; - // Synthesizes an OpenGL error which will be returned from a // later call to getError. This is used to emulate OpenGL ES // 2.0 behavior on the desktop and to enforce additional error @@ -175,12 +158,6 @@ public: // getError in the order they were added. virtual void synthesizeGLError(WGC3Denum) = 0; - // GL_CHROMIUM_map_sub - virtual void* mapBufferSubDataCHROMIUM(WGC3Denum target, WGC3Dintptr offset, WGC3Dsizeiptr size, WGC3Denum access) = 0; - virtual void unmapBufferSubDataCHROMIUM(const void*) = 0; - virtual void* mapTexSubImage2DCHROMIUM(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, WGC3Denum access) = 0; - virtual void unmapTexSubImage2DCHROMIUM(const void*) = 0; - // GL_CHROMIUM_request_extension virtual WebString getRequestableExtensionsCHROMIUM() = 0; virtual void requestExtensionCHROMIUM(const char*) = 0; @@ -189,9 +166,6 @@ public: virtual void blitFramebufferCHROMIUM(WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, WGC3Dbitfield mask, WGC3Denum filter) = 0; virtual void renderbufferStorageMultisampleCHROMIUM(WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height) = 0; - // GL_CHROMIUM_lose_context - virtual void loseContextCHROMIUM(WGC3Denum current, WGC3Denum other) { } - // The entry points below map directly to the OpenGL ES 2.0 API. // See: http://www.khronos.org/registry/gles/ // and: http://www.khronos.org/opengles/sdk/docs/man/ @@ -284,8 +258,6 @@ public: virtual void readPixels(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, void* pixels) = 0; - virtual void releaseShaderCompiler() = 0; - virtual void renderbufferStorage(WGC3Denum target, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height) = 0; virtual void sampleCoverage(WGC3Dclampf value, WGC3Dboolean invert) = 0; virtual void scissor(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) = 0; @@ -358,21 +330,12 @@ public: virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback) { } virtual void setErrorMessageCallback(WebGraphicsErrorMessageCallback* callback) { } - // GL_ARB_robustness - // - // This entry point must provide slightly different semantics than - // the GL_ARB_robustness extension; specifically, the lost context - // state is sticky, rather than reported only once. - virtual WGC3Denum getGraphicsResetStatusARB() { return 0; /* GL_NO_ERROR */ } virtual WebString getTranslatedShaderSourceANGLE(WebGLId shader) = 0; // GL_CHROMIUM_screen_space_antialiasing virtual void applyScreenSpaceAntialiasingCHROMIUM() { } - // GL_CHROMIUM_iosurface - virtual void texImageIOSurface2DCHROMIUM(WGC3Denum target, WGC3Dint width, WGC3Dint height, WGC3Duint ioSurfaceId, WGC3Duint plane) { } - // GL_EXT_texture_storage virtual void texStorage2DEXT(WGC3Denum target, WGC3Dint levels, WGC3Duint internalformat, WGC3Dint width, WGC3Dint height) { } @@ -390,9 +353,6 @@ public: virtual void queryCounterEXT(WebGLId query, WGC3Denum target) {} virtual void getQueryObjectui64vEXT(WebGLId query, WGC3Denum pname, WGC3Duint64* params) {} - // GL_CHROMIUM_bind_uniform_location - virtual void bindUniformLocationCHROMIUM(WebGLId program, WGC3Dint location, const WGC3Dchar* uniform) { } - // GL_CHROMIUM_copy_texture virtual void copyTextureCHROMIUM(WGC3Duint sourceId, WGC3Duint destId, WGC3Denum internalFormat, WGC3Denum destType, @@ -402,10 +362,6 @@ public: WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height, WGC3Dboolean unpackFlipY, WGC3Dboolean unpackPremultiplyAlpha, WGC3Dboolean unpackUnmultiplyAlpha) { } - // GL_CHROMIUM_shallow_flush - virtual void shallowFlushCHROMIUM() { } - virtual void shallowFinishCHROMIUM() { } - // GL_CHROMIUM_subscribe_uniform virtual void genValuebuffersCHROMIUM(WGC3Dsizei count, WebGLId* ids) { } virtual WebGLId createValuebufferCHROMIUM() { return 0; } @@ -422,17 +378,10 @@ public: 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) { return 0; } // GL_EXT_debug_marker - virtual void insertEventMarkerEXT(const WGC3Dchar* marker) { } virtual void pushGroupMarkerEXT(const WGC3Dchar* marker) { } - virtual void popGroupMarkerEXT(void) { } - - // GL_CHROMIUM_trace_marker - virtual void traceBeginCHROMIUM(const WGC3Dchar* category, const WGC3Dchar* trace) { } - virtual void traceEndCHROMIUM() { } // GL_OES_vertex_array_object virtual WebGLId createVertexArrayOES() { return 0; } @@ -444,15 +393,6 @@ public: virtual void bindTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint imageId) { } virtual void releaseTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint imageId) { } - // GL_CHROMIUM_pixel_transfer_buffer_object - virtual void* mapBufferCHROMIUM(WGC3Denum target, WGC3Denum access) { return nullptr; } - virtual WGC3Dboolean unmapBufferCHROMIUM(WGC3Denum target) { return false; } - - // GL_CHROMIUM_async_pixel_transfers - 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) { } - // GL_EXT_draw_buffers virtual void drawBuffersEXT(WGC3Dsizei n, const WGC3Denum* bufs) { } |