Chromium Code Reviews| Index: ppapi/proxy/ppb_graphics_3d_proxy.cc |
| diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.cc b/ppapi/proxy/ppb_graphics_3d_proxy.cc |
| index e05aba21e46302a0c6e90a2ef539b3601207731c..88f73f9832ed9400e8614c93f67b15d4546238dd 100644 |
| --- a/ppapi/proxy/ppb_graphics_3d_proxy.cc |
| +++ b/ppapi/proxy/ppb_graphics_3d_proxy.cc |
| @@ -8,6 +8,7 @@ |
| #include "build/build_config.h" |
| #include "gpu/command_buffer/client/gles2_implementation.h" |
| #include "gpu/command_buffer/common/command_buffer.h" |
| +#include "gpu/command_buffer/common/sync_token.h" |
| #include "ppapi/c/pp_errors.h" |
| #include "ppapi/proxy/enter_proxy.h" |
| #include "ppapi/proxy/plugin_dispatcher.h" |
| @@ -126,10 +127,17 @@ gpu::GpuControl* Graphics3D::GetGpuControl() { |
| return command_buffer_.get(); |
| } |
| -int32_t Graphics3D::DoSwapBuffers() { |
| - gles2_impl()->SwapBuffers(); |
| +int32_t Graphics3D::DoSwapBuffers(const gpu::SyncToken& sync_token) { |
|
piman
2016/01/14 00:21:36
nit: maybe DCHECK(!sync_token.HasData());
David Yen
2016/01/14 00:36:38
Done.
|
| + gpu::gles2::GLES2Implementation* gl = gles2_impl(); |
| + gl->SwapBuffers(); |
| + const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); |
| + gl->ShallowFlushCHROMIUM(); |
| + |
| + gpu::SyncToken new_sync_token; |
| + gl->GenSyncTokenCHROMIUM(fence_sync, new_sync_token.GetData()); |
| + |
| IPC::Message* msg = new PpapiHostMsg_PPBGraphics3D_SwapBuffers( |
| - API_ID_PPB_GRAPHICS_3D, host_resource()); |
| + API_ID_PPB_GRAPHICS_3D, host_resource(), new_sync_token); |
| msg->set_unblock(true); |
| PluginDispatcher::GetForResource(this)->Send(msg); |
| @@ -343,12 +351,13 @@ void PPB_Graphics3D_Proxy::OnMsgDestroyTransferBuffer( |
| enter.object()->DestroyTransferBuffer(id); |
| } |
| -void PPB_Graphics3D_Proxy::OnMsgSwapBuffers(const HostResource& context) { |
| +void PPB_Graphics3D_Proxy::OnMsgSwapBuffers(const HostResource& context, |
| + const gpu::SyncToken& sync_token) { |
| EnterHostFromHostResourceForceCallback<PPB_Graphics3D_API> enter( |
| context, callback_factory_, |
| &PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin, context); |
| if (enter.succeeded()) |
| - enter.SetResult(enter.object()->SwapBuffers(enter.callback())); |
| + enter.SetResult(enter.object()->SwapBuffers(enter.callback(), sync_token)); |
| } |
| void PPB_Graphics3D_Proxy::OnMsgInsertSyncPoint(const HostResource& context, |