summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordanakj <danakj@chromium.org>2016-03-17 14:28:29 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-17 21:29:40 +0000
commit823b7378c01290d0a29e2052554d497e87530490 (patch)
tree120a58974223b489f6e961492c67cc6c9acacde3
parent21bc97a226c7b49ace1c4209edba0b3003113d39 (diff)
downloadchromium_src-823b7378c01290d0a29e2052554d497e87530490.zip
chromium_src-823b7378c01290d0a29e2052554d497e87530490.tar.gz
chromium_src-823b7378c01290d0a29e2052554d497e87530490.tar.bz2
Remove framebufferRenderbuffer and framebufferTexture* from WGC3D.
This removes the method from the WebGraphicsContext3D API, and makes callers go directly to the GLES2Interface instead. The DepthStencilTrackingGLES2Interface is introduced for the DepthStencilTrackingContext to use in DrawingBufferTest, and code will migrate to it as methods are replaced in WebGraphicsContext3D. R=kbr@chromium.org BUG=584497 CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel Review URL: https://codereview.chromium.org/1808933002 Cr-Commit-Position: refs/heads/master@{#381799}
-rw-r--r--components/test_runner/DEPS1
-rw-r--r--components/test_runner/test_plugin.cc48
-rw-r--r--components/test_runner/test_plugin.h7
-rw-r--r--gpu/blink/webgraphicscontext3d_impl.cc8
-rw-r--r--gpu/blink/webgraphicscontext3d_impl.h14
-rw-r--r--third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp7
-rw-r--r--third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp16
-rw-r--r--third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp33
-rw-r--r--third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.h10
-rw-r--r--third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp16
-rw-r--r--third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp10
-rw-r--r--third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp69
-rw-r--r--third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h2
-rw-r--r--third_party/WebKit/public/platform/WebGraphicsContext3D.h3
14 files changed, 107 insertions, 137 deletions
diff --git a/components/test_runner/DEPS b/components/test_runner/DEPS
index 78b42bb..d0f42cc 100644
--- a/components/test_runner/DEPS
+++ b/components/test_runner/DEPS
@@ -1,6 +1,7 @@
include_rules = [
"+cc",
"+gin",
+ "+gpu/command_buffer/client",
"+net/base",
"+skia",
"+third_party/skia",
diff --git a/components/test_runner/test_plugin.cc b/components/test_runner/test_plugin.cc
index 19aabb4..cd76b83 100644
--- a/components/test_runner/test_plugin.cc
+++ b/components/test_runner/test_plugin.cc
@@ -16,6 +16,7 @@
#include "cc/layers/texture_layer.h"
#include "cc/resources/shared_bitmap_manager.h"
#include "components/test_runner/web_test_delegate.h"
+#include "gpu/command_buffer/client/gles2_interface.h"
#include "third_party/WebKit/public/platform/Platform.h"
#include "third_party/WebKit/public/platform/WebCompositorSupport.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
@@ -38,36 +39,6 @@ namespace test_runner {
namespace {
-// GLenum values copied from gl2.h.
-#define GL_FALSE 0
-#define GL_TRUE 1
-#define GL_ONE 1
-#define GL_TRIANGLES 0x0004
-#define GL_ONE_MINUS_SRC_ALPHA 0x0303
-#define GL_DEPTH_TEST 0x0B71
-#define GL_BLEND 0x0BE2
-#define GL_SCISSOR_TEST 0x0B90
-#define GL_TEXTURE_2D 0x0DE1
-#define GL_FLOAT 0x1406
-#define GL_RGBA 0x1908
-#define GL_UNSIGNED_BYTE 0x1401
-#define GL_TEXTURE_MAG_FILTER 0x2800
-#define GL_TEXTURE_MIN_FILTER 0x2801
-#define GL_TEXTURE_WRAP_S 0x2802
-#define GL_TEXTURE_WRAP_T 0x2803
-#define GL_NEAREST 0x2600
-#define GL_COLOR_BUFFER_BIT 0x4000
-#define GL_CLAMP_TO_EDGE 0x812F
-#define GL_ARRAY_BUFFER 0x8892
-#define GL_STATIC_DRAW 0x88E4
-#define GL_FRAGMENT_SHADER 0x8B30
-#define GL_VERTEX_SHADER 0x8B31
-#define GL_COMPILE_STATUS 0x8B81
-#define GL_LINK_STATUS 0x8B82
-#define GL_COLOR_ATTACHMENT0 0x8CE0
-#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
-#define GL_FRAMEBUFFER 0x8D40
-
void PremultiplyAlpha(const unsigned color_in[3],
float alpha,
float color_out[4]) {
@@ -149,8 +120,9 @@ TestPlugin::TestPlugin(blink::WebFrame* frame,
WebTestDelegate* delegate)
: frame_(frame),
delegate_(delegate),
- container_(0),
- context_(0),
+ container_(nullptr),
+ context_(nullptr),
+ gl_(nullptr),
color_texture_(0),
mailbox_changed_(false),
framebuffer_(0),
@@ -203,6 +175,7 @@ bool TestPlugin::initialize(blink::WebPluginContainer* container) {
blink::WebGraphicsContext3D::Attributes attrs;
context_ =
blink::Platform::current()->createOffscreenGraphicsContext3D(attrs);
+ gl_ = context_->getGLES2Interface();
if (!InitScene())
return false;
@@ -231,11 +204,12 @@ void TestPlugin::destroy() {
layer_ = NULL;
DestroyScene();
+ gl_ = nullptr;
delete context_;
- context_ = 0;
+ context_ = nullptr;
- container_ = 0;
- frame_ = 0;
+ container_ = nullptr;
+ frame_ = nullptr;
blink::Platform::current()->mainThread()->getWebTaskRunner()->postTask(
blink::WebTraceLocation(__FUNCTION__, __FILE__),
@@ -284,8 +258,8 @@ void TestPlugin::updateGeometry(
GL_UNSIGNED_BYTE,
0);
context_->bindFramebuffer(GL_FRAMEBUFFER, framebuffer_);
- context_->framebufferTexture2D(
- GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color_texture_, 0);
+ gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_TEXTURE_2D, color_texture_, 0);
DrawSceneGL();
diff --git a/components/test_runner/test_plugin.h b/components/test_runner/test_plugin.h
index 65b60e4..cc91cbd 100644
--- a/components/test_runner/test_plugin.h
+++ b/components/test_runner/test_plugin.h
@@ -29,6 +29,12 @@ namespace cc {
class SharedBitmap;
}
+namespace gpu {
+namespace gles2 {
+class GLES2Interface;
+}
+}
+
namespace test_runner {
class WebTestDelegate;
@@ -150,6 +156,7 @@ class TestPlugin : public blink::WebPlugin, public cc::TextureLayerClient {
blink::WebRect rect_;
blink::WebGraphicsContext3D* context_;
+ gpu::gles2::GLES2Interface* gl_;
unsigned color_texture_;
cc::TextureMailbox texture_mailbox_;
scoped_ptr<cc::SharedBitmap> shared_bitmap_;
diff --git a/gpu/blink/webgraphicscontext3d_impl.cc b/gpu/blink/webgraphicscontext3d_impl.cc
index d4e0a65..ffabe1b 100644
--- a/gpu/blink/webgraphicscontext3d_impl.cc
+++ b/gpu/blink/webgraphicscontext3d_impl.cc
@@ -341,12 +341,6 @@ DELEGATE_TO_GL_1(enableVertexAttribArray, EnableVertexAttribArray,
DELEGATE_TO_GL(finish, Finish)
DELEGATE_TO_GL(flush, 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)
@@ -1018,8 +1012,6 @@ WGC3Dsync WebGraphicsContext3DImpl::fenceSync(WGC3Denum condition,
WGC3Dbitfield flags) {
return reinterpret_cast<WGC3Dsync>(gl_->FenceSync(condition, flags));
}
-DELEGATE_TO_GL_5(framebufferTextureLayer, FramebufferTextureLayer, WGC3Denum,
- WGC3Denum, WGC3Duint, WGC3Dint, WGC3Dint)
DELEGATE_TO_GL_5(getActiveUniformBlockName, GetActiveUniformBlockName,
WGC3Duint, WGC3Duint, WGC3Dsizei, WGC3Dsizei *, WGC3Dchar *)
DELEGATE_TO_GL_4(getActiveUniformBlockiv, GetActiveUniformBlockiv, WGC3Duint,
diff --git a/gpu/blink/webgraphicscontext3d_impl.h b/gpu/blink/webgraphicscontext3d_impl.h
index e33e877..16eb3f7 100644
--- a/gpu/blink/webgraphicscontext3d_impl.h
+++ b/gpu/blink/webgraphicscontext3d_impl.h
@@ -144,15 +144,6 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl
void enableVertexAttribArray(blink::WGC3Duint index) override;
void finish() override;
void flush() override;
- void framebufferRenderbuffer(blink::WGC3Denum target,
- blink::WGC3Denum attachment,
- blink::WGC3Denum renderbuffertarget,
- blink::WebGLId renderbuffer) override;
- void framebufferTexture2D(blink::WGC3Denum target,
- blink::WGC3Denum attachment,
- blink::WGC3Denum textarget,
- blink::WebGLId texture,
- blink::WGC3Dint level) override;
void frontFace(blink::WGC3Denum mode) override;
void generateMipmap(blink::WGC3Denum target) override;
@@ -685,11 +676,6 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl
void endTransformFeedback(void) override;
blink::WGC3Dsync fenceSync(blink::WGC3Denum condition,
blink::WGC3Dbitfield flags) override;
- void framebufferTextureLayer(blink::WGC3Denum target,
- blink::WGC3Denum attachment,
- blink::WGC3Duint texture,
- blink::WGC3Dint level,
- blink::WGC3Dint layer) override;
void getActiveUniformBlockName(blink::WGC3Duint program,
blink::WGC3Duint uniformBlockIndex,
blink::WGC3Dsizei bufSize,
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
index 976d753..0301507 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
@@ -10,6 +10,7 @@
#include "core/html/HTMLImageElement.h"
#include "core/html/HTMLVideoElement.h"
#include "core/html/ImageData.h"
+#include "gpu/command_buffer/client/gles2_interface.h"
#include "modules/webgl/WebGLActiveInfo.h"
#include "modules/webgl/WebGLBuffer.h"
#include "modules/webgl/WebGLFenceSync.h"
@@ -307,10 +308,10 @@ void WebGL2RenderingContextBase::framebufferTextureLayer(ScriptState* scriptStat
return;
}
if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
- webContext()->framebufferTextureLayer(target, GL_DEPTH_ATTACHMENT, objectOrZero(texture), level, layer);
- webContext()->framebufferTextureLayer(target, GL_STENCIL_ATTACHMENT, objectOrZero(texture), level, layer);
+ contextGL()->FramebufferTextureLayer(target, GL_DEPTH_ATTACHMENT, objectOrZero(texture), level, layer);
+ contextGL()->FramebufferTextureLayer(target, GL_STENCIL_ATTACHMENT, objectOrZero(texture), level, layer);
} else {
- webContext()->framebufferTextureLayer(target, attachment, objectOrZero(texture), level, layer);
+ contextGL()->FramebufferTextureLayer(target, attachment, objectOrZero(texture), level, layer);
}
if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
// On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMENT + STENCIL_ATTACHMENT.
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp b/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp
index c041f48..4c007df 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp
@@ -25,6 +25,7 @@
#include "modules/webgl/WebGLDrawBuffers.h"
+#include "gpu/command_buffer/client/gles2_interface.h"
#include "modules/webgl/WebGLFramebuffer.h"
namespace blink {
@@ -101,6 +102,7 @@ void WebGLDrawBuffers::drawBuffersWEBGL(const Vector<GLenum>& buffers)
bool WebGLDrawBuffers::satisfiesWebGLRequirements(WebGLRenderingContextBase* webglContext)
{
WebGraphicsContext3D* context = webglContext->webContext();
+ gpu::gles2::GLES2Interface* gl = webglContext->contextGL();
Extensions3DUtil* extensionsUtil = webglContext->extensionsUtil();
// This is called after we make sure GL_EXT_draw_buffers is supported.
@@ -141,28 +143,28 @@ bool WebGLDrawBuffers::satisfiesWebGLRequirements(WebGLRenderingContextBase* web
colors.append(color);
context->bindTexture(GL_TEXTURE_2D, color);
context->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
- context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, color, 0);
+ gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, color, 0);
if (context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
ok = false;
break;
}
if (supportsDepth) {
- context->framebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depth, 0);
+ gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depth, 0);
if (context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
ok = false;
break;
}
- context->framebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
+ gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
}
if (supportsDepthStencil) {
- context->framebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthStencil, 0);
- context->framebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, depthStencil, 0);
+ gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthStencil, 0);
+ gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, depthStencil, 0);
if (context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
ok = false;
break;
}
- context->framebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
- context->framebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
+ gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
+ gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
}
}
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp b/third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp
index 4c8d58a..d7dd039 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp
@@ -25,6 +25,7 @@
#include "modules/webgl/WebGLFramebuffer.h"
+#include "gpu/command_buffer/client/gles2_interface.h"
#include "modules/webgl/WebGLRenderbuffer.h"
#include "modules/webgl/WebGLRenderingContextBase.h"
#include "modules/webgl/WebGLTexture.h"
@@ -48,8 +49,8 @@ private:
bool isSharedObject(WebGLSharedObject*) const override;
bool valid() const override;
void onDetached(WebGraphicsContext3D*) override;
- void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override;
- void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override;
+ void attach(gpu::gles2::GLES2Interface*, GLenum target, GLenum attachment) override;
+ void unattach(gpu::gles2::GLES2Interface*, GLenum target, GLenum attachment) override;
Member<WebGLRenderbuffer> m_renderbuffer;
};
@@ -90,15 +91,15 @@ void WebGLRenderbufferAttachment::onDetached(WebGraphicsContext3D* context)
m_renderbuffer->onDetached(context);
}
-void WebGLRenderbufferAttachment::attach(WebGraphicsContext3D* context, GLenum target, GLenum attachment)
+void WebGLRenderbufferAttachment::attach(gpu::gles2::GLES2Interface* gl, GLenum target, GLenum attachment)
{
Platform3DObject object = objectOrZero(m_renderbuffer.get());
- context->framebufferRenderbuffer(target, attachment, GL_RENDERBUFFER, object);
+ gl->FramebufferRenderbuffer(target, attachment, GL_RENDERBUFFER, object);
}
-void WebGLRenderbufferAttachment::unattach(WebGraphicsContext3D* context, GLenum target, GLenum attachment)
+void WebGLRenderbufferAttachment::unattach(gpu::gles2::GLES2Interface* gl, GLenum target, GLenum attachment)
{
- context->framebufferRenderbuffer(target, attachment, GL_RENDERBUFFER, 0);
+ gl->FramebufferRenderbuffer(target, attachment, GL_RENDERBUFFER, 0);
}
class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachment {
@@ -115,8 +116,8 @@ private:
bool isSharedObject(WebGLSharedObject*) const override;
bool valid() const override;
void onDetached(WebGraphicsContext3D*) override;
- void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override;
- void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override;
+ void attach(gpu::gles2::GLES2Interface*, GLenum target, GLenum attachment) override;
+ void unattach(gpu::gles2::GLES2Interface*, GLenum target, GLenum attachment) override;
Member<WebGLTexture> m_texture;
GLenum m_target;
@@ -163,23 +164,23 @@ void WebGLTextureAttachment::onDetached(WebGraphicsContext3D* context)
m_texture->onDetached(context);
}
-void WebGLTextureAttachment::attach(WebGraphicsContext3D* context, GLenum target, GLenum attachment)
+void WebGLTextureAttachment::attach(gpu::gles2::GLES2Interface* gl, GLenum target, GLenum attachment)
{
Platform3DObject object = objectOrZero(m_texture.get());
if (m_target == GL_TEXTURE_3D || m_target == GL_TEXTURE_2D_ARRAY) {
- context->framebufferTextureLayer(target, attachment, object, m_level, m_layer);
+ gl->FramebufferTextureLayer(target, attachment, object, m_level, m_layer);
} else {
- context->framebufferTexture2D(target, attachment, m_target, object, m_level);
+ gl->FramebufferTexture2D(target, attachment, m_target, object, m_level);
}
}
-void WebGLTextureAttachment::unattach(WebGraphicsContext3D* context, GLenum target, GLenum attachment)
+void WebGLTextureAttachment::unattach(gpu::gles2::GLES2Interface* gl, GLenum target, GLenum attachment)
{
// GL_DEPTH_STENCIL_ATTACHMENT attachment is valid in ES3.
if (m_target == GL_TEXTURE_3D || m_target == GL_TEXTURE_2D_ARRAY) {
- context->framebufferTextureLayer(target, attachment, 0, m_level, m_layer);
+ gl->FramebufferTextureLayer(target, attachment, 0, m_level, m_layer);
} else {
- context->framebufferTexture2D(target, attachment, m_target, 0, m_level);
+ gl->FramebufferTexture2D(target, attachment, m_target, 0, m_level);
}
}
@@ -249,7 +250,7 @@ void WebGLFramebuffer::attach(GLenum target, GLenum attachment, GLenum attachmen
ASSERT(isBound(target));
WebGLAttachment* attachmentObject = getAttachment(attachment);
if (attachmentObject)
- attachmentObject->attach(context()->webContext(), target, attachmentPoint);
+ attachmentObject->attach(context()->contextGL(), target, attachmentPoint);
}
WebGLSharedObject* WebGLFramebuffer::getAttachmentObject(GLenum attachment) const
@@ -305,7 +306,7 @@ void WebGLFramebuffer::removeAttachmentFromBoundFramebuffer(GLenum target, WebGL
WebGLAttachment* attachmentObject = it.value.get();
if (attachmentObject->isSharedObject(attachment)) {
GLenum attachmentType = it.key;
- attachmentObject->unattach(context()->webContext(), target, attachmentType);
+ attachmentObject->unattach(context()->contextGL(), target, attachmentType);
removeAttachmentFromBoundFramebuffer(target, attachmentType);
checkMore = true;
break;
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.h b/third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.h
index ee9892d..718e715 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.h
+++ b/third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.h
@@ -29,6 +29,12 @@
#include "modules/webgl/WebGLContextObject.h"
#include "modules/webgl/WebGLSharedObject.h"
+namespace gpu {
+namespace gles2 {
+class GLES2Interface;
+}
+}
+
namespace blink {
class WebGLRenderbuffer;
@@ -45,8 +51,8 @@ public:
virtual bool isSharedObject(WebGLSharedObject*) const = 0;
virtual bool valid() const = 0;
virtual void onDetached(WebGraphicsContext3D*) = 0;
- virtual void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) = 0;
- virtual void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) = 0;
+ virtual void attach(gpu::gles2::GLES2Interface*, GLenum target, GLenum attachment) = 0;
+ virtual void unattach(gpu::gles2::GLES2Interface*, GLenum target, GLenum attachment) = 0;
DEFINE_INLINE_VIRTUAL_TRACE() { }
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index 5ca7f02..15f5c68 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -2219,14 +2219,14 @@ void WebGLRenderingContextBase::framebufferRenderbuffer(ScriptState* scriptState
if (isWebGL2OrHigher() && attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
// On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMENT + STENCIL_ATTACHMENT.
// We divide it here so in WebGLFramebuffer, we don't have to handle DEPTH_STENCIL_ATTACHMENT in WebGL 2.
- webContext()->framebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, renderbuffertarget, bufferObject);
- webContext()->framebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, renderbuffertarget, bufferObject);
+ contextGL()->FramebufferRenderbuffer(target, GL_DEPTH_ATTACHMENT, renderbuffertarget, bufferObject);
+ contextGL()->FramebufferRenderbuffer(target, GL_STENCIL_ATTACHMENT, renderbuffertarget, bufferObject);
framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_DEPTH_ATTACHMENT, buffer);
framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_STENCIL_ATTACHMENT, buffer);
preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_DEPTH_ATTACHMENT, buffer);
preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_STENCIL_ATTACHMENT, buffer);
} else {
- webContext()->framebufferRenderbuffer(target, attachment, renderbuffertarget, bufferObject);
+ contextGL()->FramebufferRenderbuffer(target, attachment, renderbuffertarget, bufferObject);
framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment, buffer);
preserveObjectWrapper(scriptState, framebufferBinding, "attachment", attachment, buffer);
}
@@ -2253,14 +2253,14 @@ void WebGLRenderingContextBase::framebufferTexture2D(ScriptState* scriptState, G
if (isWebGL2OrHigher() && attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
// On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMENT + STENCIL_ATTACHMENT.
// We divide it here so in WebGLFramebuffer, we don't have to handle DEPTH_STENCIL_ATTACHMENT in WebGL 2.
- webContext()->framebufferTexture2D(target, GL_DEPTH_ATTACHMENT, textarget, textureObject, level);
- webContext()->framebufferTexture2D(target, GL_STENCIL_ATTACHMENT, textarget, textureObject, level);
+ contextGL()->FramebufferTexture2D(target, GL_DEPTH_ATTACHMENT, textarget, textureObject, level);
+ contextGL()->FramebufferTexture2D(target, GL_STENCIL_ATTACHMENT, textarget, textureObject, level);
framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_DEPTH_ATTACHMENT, textarget, texture, level, 0);
framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_STENCIL_ATTACHMENT, textarget, texture, level, 0);
preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_DEPTH_ATTACHMENT, texture);
preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_STENCIL_ATTACHMENT, texture);
} else {
- webContext()->framebufferTexture2D(target, attachment, textarget, textureObject, level);
+ contextGL()->FramebufferTexture2D(target, attachment, textarget, textureObject, level);
framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment, textarget, texture, level, 0);
preserveObjectWrapper(scriptState, framebufferBinding, "attachment", attachment, texture);
}
@@ -4089,7 +4089,7 @@ void WebGLRenderingContextBase::texImageCanvasByGPU(TexImageByGPUType functionTy
if (!possibleDirectCopy) {
WebGLId tmpFBO = webContext()->createFramebuffer();
webContext()->bindFramebuffer(GL_FRAMEBUFFER, tmpFBO);
- webContext()->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, targetTexture, 0);
+ contextGL()->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, targetTexture, 0);
webContext()->bindTexture(texture->getTarget(), texture->object());
if (functionType == TexImage2DByGPU) {
webContext()->copyTexSubImage2D(target, level, 0, 0, 0, 0, canvas->width(), canvas->height());
@@ -4098,7 +4098,7 @@ void WebGLRenderingContextBase::texImageCanvasByGPU(TexImageByGPUType functionTy
} else if (functionType == TexSubImage3DByGPU) {
webContext()->copyTexSubImage3D(target, level, xoffset, yoffset, zoffset, 0, 0, canvas->width(), canvas->height());
}
- webContext()->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
+ contextGL()->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
restoreCurrentFramebuffer();
webContext()->deleteFramebuffer(tmpFBO);
webContext()->deleteTexture(targetTexture);
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
index 77c5bdf..1cfa344 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -675,7 +675,7 @@ bool DrawingBuffer::resizeMultisampleFramebuffer(const IntSize& size)
if (m_context->getError() == GL_OUT_OF_MEMORY)
return false;
- m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_multisampleColorBuffer);
+ m_gl->FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_multisampleColorBuffer);
resizeDepthStencil(size);
if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
return false;
@@ -698,7 +698,7 @@ void DrawingBuffer::resizeDepthStencil(const IntSize& size)
m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m_sampleCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height());
else
m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, size.width(), size.height());
- m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer);
+ m_gl->FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer);
m_context->bindRenderbuffer(GL_RENDERBUFFER, 0);
}
@@ -880,7 +880,7 @@ bool DrawingBuffer::paintRenderingResultsToImageData(int& width, int& height, So
if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) {
fbo = m_context->createFramebuffer();
m_context->bindFramebuffer(GL_FRAMEBUFFER, fbo);
- m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_frontColorBuffer.texInfo.parameters.target, m_frontColorBuffer.texInfo.textureId, 0);
+ m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_frontColorBuffer.texInfo.parameters.target, m_frontColorBuffer.texInfo.textureId, 0);
} else {
m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer());
}
@@ -889,7 +889,7 @@ bool DrawingBuffer::paintRenderingResultsToImageData(int& width, int& height, So
flipVertically(static_cast<uint8_t*>(pixels.data()), width, height);
if (fbo) {
- m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_frontColorBuffer.texInfo.parameters.target, 0, 0);
+ m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_frontColorBuffer.texInfo.parameters.target, 0, 0);
m_context->deleteFramebuffer(fbo);
}
@@ -1037,7 +1037,7 @@ void DrawingBuffer::attachColorBufferToCurrentFBO()
if (m_antiAliasingMode == MSAAImplicitResolve)
m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, m_colorBuffer.textureId, 0, m_sampleCount);
else
- m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, m_colorBuffer.textureId, 0);
+ m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, m_colorBuffer.textureId, 0);
m_context->bindTexture(GL_TEXTURE_2D, m_texture2DBinding);
}
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp
index 76d1b49..2ced4a1 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp
@@ -567,19 +567,45 @@ TEST_F(DrawingBufferImageChromiumTest, verifyResizingReallocatesImages)
testing::Mock::VerifyAndClearExpectations(webContext());
}
+class DepthStencilTrackingGLES2Interface : public gpu::gles2::GLES2InterfaceStub {
+public:
+ void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) override
+ {
+ switch (attachment) {
+ case GL_DEPTH_ATTACHMENT:
+ m_depthAttachment = renderbuffer;
+ break;
+ case GL_STENCIL_ATTACHMENT:
+ m_stencilAttachment = renderbuffer;
+ break;
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ m_depthStencilAttachment = renderbuffer;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ }
+
+ uint32_t stencilAttachment() const { return m_stencilAttachment; }
+ uint32_t depthAttachment() const { return m_depthAttachment; }
+ uint32_t depthStencilAttachment() const { return m_depthStencilAttachment; }
+
+private:
+ uint32_t m_depthAttachment = 0;
+ uint32_t m_stencilAttachment = 0;
+ uint32_t m_depthStencilAttachment = 0;
+};
+
class DepthStencilTrackingContext : public MockWebGraphicsContext3D {
public:
- DepthStencilTrackingContext()
- : m_nextRenderBufferId(1)
- , m_stencilAttachment(0)
- , m_depthAttachment(0)
- , m_depthStencilAttachment(0) {}
+ DepthStencilTrackingContext() : m_nextRenderBufferId(1) {}
~DepthStencilTrackingContext() override {}
int numAllocatedRenderBuffer() const { return m_nextRenderBufferId - 1; }
- WebGLId stencilAttachment() const { return m_stencilAttachment; }
- WebGLId depthAttachment() const { return m_depthAttachment; }
- WebGLId depthStencilAttachment() const { return m_depthStencilAttachment; }
+ WebGLId stencilAttachment() const { return m_contextGL.stencilAttachment(); }
+ WebGLId depthAttachment() const { return m_contextGL.depthAttachment(); }
+ WebGLId depthStencilAttachment() const { return m_contextGL.depthStencilAttachment(); }
WebString getString(WGC3Denum type) override
{
@@ -594,32 +620,14 @@ public:
return ++m_nextRenderBufferId;
}
- void framebufferRenderbuffer(WGC3Denum target, WGC3Denum attachment, WGC3Denum renderbuffertarget, WebGLId renderbuffer) override
- {
- switch (attachment) {
- case GL_DEPTH_ATTACHMENT:
- m_depthAttachment = renderbuffer;
- break;
- case GL_STENCIL_ATTACHMENT:
- m_stencilAttachment = renderbuffer;
- break;
- case GL_DEPTH_STENCIL_ATTACHMENT:
- m_depthStencilAttachment = renderbuffer;
- break;
- default:
- ASSERT_NOT_REACHED();
- break;
- }
- }
-
void getIntegerv(WGC3Denum ptype, WGC3Dint* value) override
{
switch (ptype) {
case GL_DEPTH_BITS:
- *value = (m_depthAttachment || m_depthStencilAttachment) ? 24 : 0;
+ *value = (depthAttachment() || depthStencilAttachment()) ? 24 : 0;
return;
case GL_STENCIL_BITS:
- *value = (m_stencilAttachment || m_depthStencilAttachment) ? 8 : 0;
+ *value = (stencilAttachment() || depthStencilAttachment()) ? 8 : 0;
return;
}
MockWebGraphicsContext3D::getIntegerv(ptype, value);
@@ -629,10 +637,7 @@ public:
private:
WebGLId m_nextRenderBufferId;
- WebGLId m_stencilAttachment;
- WebGLId m_depthAttachment;
- WebGLId m_depthStencilAttachment;
- gpu::gles2::GLES2InterfaceStub m_contextGL;
+ DepthStencilTrackingGLES2Interface m_contextGL;
};
struct DepthStencilTestCase {
diff --git a/third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h b/third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h
index c828d27..14cde23 100644
--- a/third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h
+++ b/third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h
@@ -98,8 +98,6 @@ public:
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) { }
diff --git a/third_party/WebKit/public/platform/WebGraphicsContext3D.h b/third_party/WebKit/public/platform/WebGraphicsContext3D.h
index 7d7b77e..ab0c4fb 100644
--- a/third_party/WebKit/public/platform/WebGraphicsContext3D.h
+++ b/third_party/WebKit/public/platform/WebGraphicsContext3D.h
@@ -211,8 +211,6 @@ public:
virtual void enableVertexAttribArray(WGC3Duint index) = 0;
virtual void finish() = 0;
virtual void flush() = 0;
- virtual void framebufferRenderbuffer(WGC3Denum target, WGC3Denum attachment, WGC3Denum renderbuffertarget, WebGLId renderbuffer) = 0;
- virtual void framebufferTexture2D(WGC3Denum target, WGC3Denum attachment, WGC3Denum textarget, WebGLId texture, WGC3Dint level) = 0;
virtual void frontFace(WGC3Denum mode) = 0;
virtual void generateMipmap(WGC3Denum target) = 0;
@@ -434,7 +432,6 @@ public:
virtual void drawRangeElements(WGC3Denum mode, WGC3Duint start, WGC3Duint end, WGC3Dsizei count, WGC3Denum type, WGC3Dintptr offset) { }
virtual void endTransformFeedback(void) { }
virtual WGC3Dsync fenceSync(WGC3Denum condition, WGC3Dbitfield flags) { return nullptr; }
- virtual void framebufferTextureLayer(WGC3Denum target, WGC3Denum attachment, WGC3Duint texture, WGC3Dint level, WGC3Dint layer) { }
virtual void getActiveUniformBlockName(WebGLId program, WGC3Duint uniformBlockIndex, WGC3Dsizei bufSize, WGC3Dsizei *length, WGC3Dchar *uniformBlockName) { }
virtual void getActiveUniformBlockiv(WebGLId program, WGC3Duint uniformBlockIndex, WGC3Denum pname, WGC3Dint *params) { }
virtual void getActiveUniformsiv(WebGLId program, WGC3Dsizei uniformCount, const WGC3Duint *uniformIndices, WGC3Denum pname, WGC3Dint *params) { }