| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" | 5 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
| 9 #include "gpu/command_buffer/client/gles2_implementation.h" | 9 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 10 #include "gpu/command_buffer/client/transfer_buffer.h" | 10 #include "gpu/command_buffer/client/transfer_buffer.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) { | 47 int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) { |
| 48 if ((width < 0) || (height < 0)) | 48 if ((width < 0) || (height < 0)) |
| 49 return PP_ERROR_BADARGUMENT; | 49 return PP_ERROR_BADARGUMENT; |
| 50 | 50 |
| 51 gles2_impl()->ResizeCHROMIUM(width, height, 1.f, true); | 51 gles2_impl()->ResizeCHROMIUM(width, height, 1.f, true); |
| 52 // TODO(alokp): Check if resize succeeded and return appropriate error code. | 52 // TODO(alokp): Check if resize succeeded and return appropriate error code. |
| 53 return PP_OK; | 53 return PP_OK; |
| 54 } | 54 } |
| 55 | 55 |
| 56 int32_t PPB_Graphics3D_Shared::SwapBuffers( | 56 int32_t PPB_Graphics3D_Shared::SwapBuffers( |
| 57 scoped_refptr<TrackedCallback> callback) { | 57 scoped_refptr<TrackedCallback> callback, |
| 58 const gpu::SyncToken& sync_token) { |
| 58 if (HasPendingSwap()) { | 59 if (HasPendingSwap()) { |
| 59 Log(PP_LOGLEVEL_ERROR, | 60 Log(PP_LOGLEVEL_ERROR, |
| 60 "PPB_Graphics3D.SwapBuffers: Plugin attempted swap " | 61 "PPB_Graphics3D.SwapBuffers: Plugin attempted swap " |
| 61 "with previous swap still pending."); | 62 "with previous swap still pending."); |
| 62 // Already a pending SwapBuffers that hasn't returned yet. | 63 // Already a pending SwapBuffers that hasn't returned yet. |
| 63 return PP_ERROR_INPROGRESS; | 64 return PP_ERROR_INPROGRESS; |
| 64 } | 65 } |
| 65 | 66 |
| 66 swap_callback_ = callback; | 67 swap_callback_ = callback; |
| 67 return DoSwapBuffers(); | 68 return DoSwapBuffers(sync_token); |
| 68 } | 69 } |
| 69 | 70 |
| 70 int32_t PPB_Graphics3D_Shared::GetAttribMaxValue(int32_t attribute, | 71 int32_t PPB_Graphics3D_Shared::GetAttribMaxValue(int32_t attribute, |
| 71 int32_t* value) { | 72 int32_t* value) { |
| 72 // TODO(alokp): Implement me. | 73 // TODO(alokp): Implement me. |
| 73 return PP_ERROR_FAILED; | 74 return PP_ERROR_FAILED; |
| 74 } | 75 } |
| 75 | 76 |
| 76 void* PPB_Graphics3D_Shared::MapTexSubImage2DCHROMIUM(GLenum target, | 77 void* PPB_Graphics3D_Shared::MapTexSubImage2DCHROMIUM(GLenum target, |
| 77 GLint level, | 78 GLint level, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 return true; | 149 return true; |
| 149 } | 150 } |
| 150 | 151 |
| 151 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { | 152 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { |
| 152 gles2_impl_.reset(); | 153 gles2_impl_.reset(); |
| 153 transfer_buffer_.reset(); | 154 transfer_buffer_.reset(); |
| 154 gles2_helper_.reset(); | 155 gles2_helper_.reset(); |
| 155 } | 156 } |
| 156 | 157 |
| 157 } // namespace ppapi | 158 } // namespace ppapi |
| OLD | NEW |