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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 void PPB_Graphics3D_Shared::SwapBuffersACK(int32_t pp_error) { | 93 void PPB_Graphics3D_Shared::SwapBuffersACK(int32_t pp_error) { |
94 DCHECK(HasPendingSwap()); | 94 DCHECK(HasPendingSwap()); |
95 swap_callback_->Run(pp_error); | 95 swap_callback_->Run(pp_error); |
96 } | 96 } |
97 | 97 |
98 bool PPB_Graphics3D_Shared::HasPendingSwap() const { | 98 bool PPB_Graphics3D_Shared::HasPendingSwap() const { |
99 return TrackedCallback::IsPending(swap_callback_); | 99 return TrackedCallback::IsPending(swap_callback_); |
100 } | 100 } |
101 | 101 |
102 bool PPB_Graphics3D_Shared::CreateGLES2Impl( | 102 bool PPB_Graphics3D_Shared::CreateGLES2Impl( |
103 int32 command_buffer_size, | 103 int32_t command_buffer_size, |
104 int32 transfer_buffer_size, | 104 int32_t transfer_buffer_size, |
105 gpu::gles2::GLES2Implementation* share_gles2) { | 105 gpu::gles2::GLES2Implementation* share_gles2) { |
106 gpu::CommandBuffer* command_buffer = GetCommandBuffer(); | 106 gpu::CommandBuffer* command_buffer = GetCommandBuffer(); |
107 DCHECK(command_buffer); | 107 DCHECK(command_buffer); |
108 | 108 |
109 // Create the GLES2 helper, which writes the command buffer protocol. | 109 // Create the GLES2 helper, which writes the command buffer protocol. |
110 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer)); | 110 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer)); |
111 if (!gles2_helper_->Initialize(command_buffer_size)) | 111 if (!gles2_helper_->Initialize(command_buffer_size)) |
112 return false; | 112 return false; |
113 | 113 |
114 // Create a transfer buffer used to copy resources between the renderer | 114 // Create a transfer buffer used to copy resources between the renderer |
115 // process and the GPU process. | 115 // process and the GPU process. |
116 const int32 kMinTransferBufferSize = 256 * 1024; | 116 const int32_t kMinTransferBufferSize = 256 * 1024; |
117 const int32 kMaxTransferBufferSize = 16 * 1024 * 1024; | 117 const int32_t kMaxTransferBufferSize = 16 * 1024 * 1024; |
118 transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get())); | 118 transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get())); |
119 | 119 |
120 const bool bind_creates_resources = true; | 120 const bool bind_creates_resources = true; |
121 const bool lose_context_when_out_of_memory = false; | 121 const bool lose_context_when_out_of_memory = false; |
122 const bool support_client_side_arrays = true; | 122 const bool support_client_side_arrays = true; |
123 | 123 |
124 // Create the object exposing the OpenGL API. | 124 // Create the object exposing the OpenGL API. |
125 gles2_impl_.reset(new gpu::gles2::GLES2Implementation( | 125 gles2_impl_.reset(new gpu::gles2::GLES2Implementation( |
126 gles2_helper_.get(), | 126 gles2_helper_.get(), |
127 share_gles2 ? share_gles2->share_group() : NULL, | 127 share_gles2 ? share_gles2->share_group() : NULL, |
(...skipping 16 matching lines...) Expand all Loading... |
144 return true; | 144 return true; |
145 } | 145 } |
146 | 146 |
147 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { | 147 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { |
148 gles2_impl_.reset(); | 148 gles2_impl_.reset(); |
149 transfer_buffer_.reset(); | 149 transfer_buffer_.reset(); |
150 gles2_helper_.reset(); | 150 gles2_helper_.reset(); |
151 } | 151 } |
152 | 152 |
153 } // namespace ppapi | 153 } // namespace ppapi |
OLD | NEW |