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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 if (HasPendingSwap()) { | 65 if (HasPendingSwap()) { |
66 // Already a pending SwapBuffers that hasn't returned yet. | 66 // Already a pending SwapBuffers that hasn't returned yet. |
67 return PP_ERROR_INPROGRESS; | 67 return PP_ERROR_INPROGRESS; |
68 } | 68 } |
69 | 69 |
70 swap_callback_ = new TrackedCallback(this, callback); | 70 swap_callback_ = new TrackedCallback(this, callback); |
71 return DoSwapBuffers(); | 71 return DoSwapBuffers(); |
72 } | 72 } |
73 | 73 |
74 void* PPB_Graphics3D_Shared::MapTexSubImage2DCHROMIUM(GLenum target, | |
75 GLint level, | |
76 GLint xoffset, | |
77 GLint yoffset, | |
78 GLsizei width, | |
79 GLsizei height, | |
80 GLenum format, | |
81 GLenum type, | |
82 GLenum access) { | |
83 return gles2_impl_->MapTexSubImage2DCHROMIUM( | |
84 target, level, xoffset, yoffset, width, height, format, type, access); | |
85 } | |
86 | |
87 void PPB_Graphics3D_Shared::UnmapTexSubImage2DCHROMIUM(const void* mem) { | |
88 gles2_impl_->UnmapTexSubImage2DCHROMIUM(mem); | |
89 } | |
90 | |
91 void PPB_Graphics3D_Shared::SwapBuffersACK(int32_t pp_error) { | 74 void PPB_Graphics3D_Shared::SwapBuffersACK(int32_t pp_error) { |
92 DCHECK(HasPendingSwap()); | 75 DCHECK(HasPendingSwap()); |
93 TrackedCallback::ClearAndRun(&swap_callback_, pp_error); | 76 TrackedCallback::ClearAndRun(&swap_callback_, pp_error); |
94 } | 77 } |
95 | 78 |
96 bool PPB_Graphics3D_Shared::HasPendingSwap() const { | 79 bool PPB_Graphics3D_Shared::HasPendingSwap() const { |
97 return TrackedCallback::IsPending(swap_callback_); | 80 return TrackedCallback::IsPending(swap_callback_); |
98 } | 81 } |
99 | 82 |
100 bool PPB_Graphics3D_Shared::CreateGLES2Impl(int32 command_buffer_size, | 83 bool PPB_Graphics3D_Shared::CreateGLES2Impl(int32 command_buffer_size, |
(...skipping 30 matching lines...) Expand all Loading... |
131 } | 114 } |
132 | 115 |
133 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { | 116 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { |
134 gles2_impl_.reset(); | 117 gles2_impl_.reset(); |
135 transfer_buffer_.reset(); | 118 transfer_buffer_.reset(); |
136 gles2_helper_.reset(); | 119 gles2_helper_.reset(); |
137 } | 120 } |
138 | 121 |
139 } // namespace ppapi | 122 } // namespace ppapi |
140 | 123 |
OLD | NEW |