Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4824)

Unified Diff: content/renderer/pepper/ppb_graphics_3d_impl.cc

Issue 2086363004: mac: Finish plumbing for Pepper3D Image Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp98_native_gmb
Patch Set: nits. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/pepper/ppb_graphics_3d_impl.h ('k') | gpu/ipc/common/gpu_param_traits_macros.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/ppb_graphics_3d_impl.cc
diff --git a/content/renderer/pepper/ppb_graphics_3d_impl.cc b/content/renderer/pepper/ppb_graphics_3d_impl.cc
index 94207f0387dab520c7f84cf59432fe162f9c207f..c0c9fa642638d9beafce42fbc7d1fe487a294af4 100644
--- a/content/renderer/pepper/ppb_graphics_3d_impl.cc
+++ b/content/renderer/pepper/ppb_graphics_3d_impl.cc
@@ -18,6 +18,7 @@
#include "content/renderer/pepper/plugin_module.h"
#include "content/renderer/render_thread_impl.h"
#include "content/renderer/render_view_impl.h"
+#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/ipc/client/command_buffer_proxy_impl.h"
#include "gpu/ipc/client/gpu_channel_host.h"
@@ -44,7 +45,18 @@ PPB_Graphics3D_Impl::PPB_Graphics3D_Impl(PP_Instance instance)
bound_to_instance_(false),
commit_pending_(false),
has_alpha_(false),
- weak_ptr_factory_(this) {}
+ use_image_chromium_(false),
+ weak_ptr_factory_(this) {
+#if defined(OS_MACOSX)
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ bool use_image_chromium =
+ !command_line->HasSwitch(switches::kDisablePepper3DImageChromium);
+ use_image_chromium_ = use_image_chromium;
+
+ // TODO(erikchen): Remove this line to enable the feature.
+ use_image_chromium_ = false;
+#endif
+}
PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() {
// Unset the client before the command_buffer_ is destroyed, similar to how
@@ -173,8 +185,12 @@ int32_t PPB_Graphics3D_Impl::DoSwapBuffers(const gpu::SyncToken& sync_token) {
//
// Don't need to check for NULL from GetPluginInstance since when we're
// bound, we know our instance is valid.
- cc::TextureMailbox texture_mailbox(taken_front_buffer_, sync_token,
- GL_TEXTURE_2D);
+ bool is_overlay_candidate = use_image_chromium_;
+ GLenum target =
+ is_overlay_candidate ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D;
+ cc::TextureMailbox texture_mailbox(taken_front_buffer_, sync_token, target,
+ gfx::Size(width(), height()),
piman 2016/06/28 20:51:41 The size will be wrong here. PPB_Graphics3D_Share
+ is_overlay_candidate, false);
taken_front_buffer_.SetZero();
HostGlobals::Get()
->GetInstance(pp_instance())
@@ -261,6 +277,7 @@ bool PPB_Graphics3D_Impl::InitRaw(PPB_Graphics3D_API* share_context,
gpu::gles2::ContextCreationAttribHelper attrib_helper;
if (!attrib_helper.Parse(attribs))
return false;
+ attrib_helper.should_use_native_gmb_for_backbuffer = use_image_chromium_;
gpu::CommandBufferProxyImpl* share_buffer = NULL;
if (share_context) {
@@ -274,6 +291,7 @@ bool PPB_Graphics3D_Impl::InitRaw(PPB_Graphics3D_API* share_context,
gpu::GPU_STREAM_DEFAULT, gpu::GpuStreamPriority::NORMAL,
attrib_helper, GURL::EmptyGURL(), gpu_preference,
base::ThreadTaskRunnerHandle::Get());
+ SetSize(surface_size.width(), surface_size.height());
if (!command_buffer_)
return false;
« no previous file with comments | « content/renderer/pepper/ppb_graphics_3d_impl.h ('k') | gpu/ipc/common/gpu_param_traits_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698