| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 const int32_t kMinTransferBufferSize = 256 * 1024; | 131 const int32_t kMinTransferBufferSize = 256 * 1024; |
| 132 const int32_t kMaxTransferBufferSize = 16 * 1024 * 1024; | 132 const int32_t kMaxTransferBufferSize = 16 * 1024 * 1024; |
| 133 transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get())); | 133 transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get())); |
| 134 | 134 |
| 135 const bool bind_creates_resources = true; | 135 const bool bind_creates_resources = true; |
| 136 const bool lose_context_when_out_of_memory = false; | 136 const bool lose_context_when_out_of_memory = false; |
| 137 const bool support_client_side_arrays = true; | 137 const bool support_client_side_arrays = true; |
| 138 | 138 |
| 139 // Create the object exposing the OpenGL API. | 139 // Create the object exposing the OpenGL API. |
| 140 gles2_impl_.reset(new gpu::gles2::GLES2Implementation( | 140 gles2_impl_.reset(new gpu::gles2::GLES2Implementation( |
| 141 gles2_helper_.get(), | 141 gles2_helper_.get(), share_gles2 ? share_gles2->share_group() : NULL, |
| 142 share_gles2 ? share_gles2->share_group() : NULL, | 142 transfer_buffer_.get(), bind_creates_resources, |
| 143 transfer_buffer_.get(), | 143 lose_context_when_out_of_memory, support_client_side_arrays, |
| 144 bind_creates_resources, | 144 GetGpuControl(), nullptr)); |
| 145 lose_context_when_out_of_memory, | |
| 146 support_client_side_arrays, | |
| 147 GetGpuControl())); | |
| 148 | 145 |
| 149 if (!gles2_impl_->Initialize( | 146 if (!gles2_impl_->Initialize( |
| 150 transfer_buffer_size, kMinTransferBufferSize, | 147 transfer_buffer_size, kMinTransferBufferSize, |
| 151 std::max(kMaxTransferBufferSize, transfer_buffer_size), | 148 std::max(kMaxTransferBufferSize, transfer_buffer_size), |
| 152 gpu::SharedMemoryLimits::kNoLimit)) { | 149 gpu::SharedMemoryLimits::kNoLimit)) { |
| 153 return false; | 150 return false; |
| 154 } | 151 } |
| 155 | 152 |
| 156 gles2_impl_->TraceBeginCHROMIUM("gpu_toplevel", "PPAPIContext"); | 153 gles2_impl_->TraceBeginCHROMIUM("gpu_toplevel", "PPAPIContext"); |
| 157 | 154 |
| 158 return true; | 155 return true; |
| 159 } | 156 } |
| 160 | 157 |
| 161 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { | 158 void PPB_Graphics3D_Shared::DestroyGLES2Impl() { |
| 162 gles2_impl_.reset(); | 159 gles2_impl_.reset(); |
| 163 transfer_buffer_.reset(); | 160 transfer_buffer_.reset(); |
| 164 gles2_helper_.reset(); | 161 gles2_helper_.reset(); |
| 165 } | 162 } |
| 166 | 163 |
| 167 } // namespace ppapi | 164 } // namespace ppapi |
| OLD | NEW |