| 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/shared_memory_limits.h" | 10 #include "gpu/command_buffer/client/shared_memory_limits.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 int32_t PPB_Graphics3D_Shared::GetError() { | 44 int32_t PPB_Graphics3D_Shared::GetError() { |
| 45 // TODO(alokp): Implement me. | 45 // TODO(alokp): Implement me. |
| 46 return PP_ERROR_FAILED; | 46 return PP_ERROR_FAILED; |
| 47 } | 47 } |
| 48 | 48 |
| 49 int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) { | 49 int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) { |
| 50 if ((width < 0) || (height < 0)) | 50 if ((width < 0) || (height < 0)) |
| 51 return PP_ERROR_BADARGUMENT; | 51 return PP_ERROR_BADARGUMENT; |
| 52 | 52 |
| 53 gles2_impl()->ResizeCHROMIUM(width, height, 1.f, true); | 53 gles2_impl()->ResizeCHROMIUM(width, height, 1.f, true); |
| 54 width_ = width; |
| 55 height_ = height; |
| 54 // TODO(alokp): Check if resize succeeded and return appropriate error code. | 56 // TODO(alokp): Check if resize succeeded and return appropriate error code. |
| 55 return PP_OK; | 57 return PP_OK; |
| 56 } | 58 } |
| 57 | 59 |
| 58 int32_t PPB_Graphics3D_Shared::SwapBuffers( | 60 int32_t PPB_Graphics3D_Shared::SwapBuffers( |
| 59 scoped_refptr<TrackedCallback> callback) { | 61 scoped_refptr<TrackedCallback> callback) { |
| 60 return SwapBuffersWithSyncToken(callback, gpu::SyncToken()); | 62 return SwapBuffersWithSyncToken(callback, gpu::SyncToken(), width_, height_); |
| 61 } | 63 } |
| 62 | 64 |
| 63 int32_t PPB_Graphics3D_Shared::SwapBuffersWithSyncToken( | 65 int32_t PPB_Graphics3D_Shared::SwapBuffersWithSyncToken( |
| 64 scoped_refptr<TrackedCallback> callback, | 66 scoped_refptr<TrackedCallback> callback, |
| 65 const gpu::SyncToken& sync_token) { | 67 const gpu::SyncToken& sync_token, |
| 68 int32_t width, |
| 69 int32_t height) { |
| 66 if (HasPendingSwap()) { | 70 if (HasPendingSwap()) { |
| 67 Log(PP_LOGLEVEL_ERROR, | 71 Log(PP_LOGLEVEL_ERROR, |
| 68 "PPB_Graphics3D.SwapBuffers: Plugin attempted swap " | 72 "PPB_Graphics3D.SwapBuffers: Plugin attempted swap " |
| 69 "with previous swap still pending."); | 73 "with previous swap still pending."); |
| 70 // Already a pending SwapBuffers that hasn't returned yet. | 74 // Already a pending SwapBuffers that hasn't returned yet. |
| 71 return PP_ERROR_INPROGRESS; | 75 return PP_ERROR_INPROGRESS; |
| 72 } | 76 } |
| 73 | 77 |
| 74 swap_callback_ = callback; | 78 swap_callback_ = callback; |
| 75 return DoSwapBuffers(sync_token); | 79 return DoSwapBuffers(sync_token, width, height); |
| 76 } | 80 } |
| 77 | 81 |
| 78 int32_t PPB_Graphics3D_Shared::GetAttribMaxValue(int32_t attribute, | 82 int32_t PPB_Graphics3D_Shared::GetAttribMaxValue(int32_t attribute, |
| 79 int32_t* value) { | 83 int32_t* value) { |
| 80 // TODO(alokp): Implement me. | 84 // TODO(alokp): Implement me. |
| 81 return PP_ERROR_FAILED; | 85 return PP_ERROR_FAILED; |
| 82 } | 86 } |
| 83 | 87 |
| 84 void* PPB_Graphics3D_Shared::MapTexSubImage2DCHROMIUM(GLenum target, | 88 void* PPB_Graphics3D_Shared::MapTexSubImage2DCHROMIUM(GLenum target, |
| 85 GLint level, | 89 GLint level, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 return true; | 159 return true; |
| 156 } | 160 } |
| 157 | 161 |
| 158 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { | 162 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { |
| 159 gles2_impl_.reset(); | 163 gles2_impl_.reset(); |
| 160 transfer_buffer_.reset(); | 164 transfer_buffer_.reset(); |
| 161 gles2_helper_.reset(); | 165 gles2_helper_.reset(); |
| 162 } | 166 } |
| 163 | 167 |
| 164 } // namespace ppapi | 168 } // namespace ppapi |
| OLD | NEW |