Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / content / renderer / pepper / ppb_graphics_3d_impl.cc
index 7486abc..12d1db9 100644 (file)
@@ -85,6 +85,7 @@ PP_Resource PPB_Graphics3D_Impl::CreateRaw(
     PP_Instance instance,
     PP_Resource share_context,
     const int32_t* attrib_list,
+    gpu::Capabilities* capabilities,
     base::SharedMemoryHandle* shared_state_handle) {
   PPB_Graphics3D_API* share_api = NULL;
   if (share_context) {
@@ -95,7 +96,8 @@ PP_Resource PPB_Graphics3D_Impl::CreateRaw(
   }
   scoped_refptr<PPB_Graphics3D_Impl> graphics_3d(
       new PPB_Graphics3D_Impl(instance));
-  if (!graphics_3d->InitRaw(share_api, attrib_list, shared_state_handle))
+  if (!graphics_3d->InitRaw(share_api, attrib_list, capabilities,
+                            shared_state_handle))
     return 0;
   return graphics_3d->GetReference();
 }
@@ -200,8 +202,10 @@ int32 PPB_Graphics3D_Impl::DoSwapBuffers() {
     commit_pending_ = true;
   } else {
     // Wait for the command to complete on the GPU to allow for throttling.
-    command_buffer_->Echo(base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers,
-                                     weak_ptr_factory_.GetWeakPtr()));
+    command_buffer_->SignalSyncPoint(
+        sync_point_,
+        base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers,
+                   weak_ptr_factory_.GetWeakPtr()));
   }
 
   return PP_OK_COMPLETIONPENDING;
@@ -209,7 +213,7 @@ int32 PPB_Graphics3D_Impl::DoSwapBuffers() {
 
 bool PPB_Graphics3D_Impl::Init(PPB_Graphics3D_API* share_context,
                                const int32_t* attrib_list) {
-  if (!InitRaw(share_context, attrib_list, NULL))
+  if (!InitRaw(share_context, attrib_list, NULL, NULL))
     return false;
 
   gpu::gles2::GLES2Implementation* share_gles2 = NULL;
@@ -224,6 +228,7 @@ bool PPB_Graphics3D_Impl::Init(PPB_Graphics3D_API* share_context,
 bool PPB_Graphics3D_Impl::InitRaw(
     PPB_Graphics3D_API* share_context,
     const int32_t* attrib_list,
+    gpu::Capabilities* capabilities,
     base::SharedMemoryHandle* shared_state_handle) {
   PepperPluginInstanceImpl* plugin_instance =
       HostGlobals::Get()->GetInstance(pp_instance());
@@ -295,6 +300,8 @@ bool PPB_Graphics3D_Impl::InitRaw(
     return false;
   if (shared_state_handle)
     *shared_state_handle = command_buffer_->GetSharedStateHandle();
+  if (capabilities)
+    *capabilities = command_buffer_->GetCapabilities();
   mailbox_ = gpu::Mailbox::Generate();
   if (!command_buffer_->ProduceFrontBuffer(mailbox_))
     return false;