Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Side by Side Diff: webkit/plugins/ppapi/ppb_context_3d_impl.cc

Issue 8566059: Add CommandBuffer::SetGetBuffer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: etc Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppb_context_3d_impl.h" 5 #include "webkit/plugins/ppapi/ppb_context_3d_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/shared_memory.h" 9 #include "base/shared_memory.h"
10 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 10 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 read_surface_ = new_read; 160 read_surface_ = new_read;
161 return PP_OK; 161 return PP_OK;
162 } 162 }
163 163
164 int32_t PPB_Context3D_Impl::GetBoundSurfaces(PP_Resource* draw, 164 int32_t PPB_Context3D_Impl::GetBoundSurfaces(PP_Resource* draw,
165 PP_Resource* read) { 165 PP_Resource* read) {
166 // TODO(alokp): Implement me. 166 // TODO(alokp): Implement me.
167 return 0; 167 return 0;
168 } 168 }
169 169
170 PP_Bool PPB_Context3D_Impl::InitializeTrusted(int32_t size) { 170 PP_Bool PPB_Context3D_Impl::InitializeTrusted() {
171 if (!platform_context_.get()) 171 if (!platform_context_.get())
172 return PP_FALSE; 172 return PP_FALSE;
173 return PP_FromBool(platform_context_->GetCommandBuffer()->Initialize(size)); 173 return PP_FromBool(platform_context_->GetCommandBuffer()->Initialize());
174 } 174 }
175 175
176 PP_Bool PPB_Context3D_Impl::GetRingBuffer(int* shm_handle, 176 PP_Bool PPB_Context3D_Impl::SetGetBuffer(int32_t shm_id) {
177 uint32_t* shm_size) {
178 if (!platform_context_.get()) 177 if (!platform_context_.get())
179 return PP_FALSE; 178 return PP_FALSE;
180 gpu::Buffer buffer = platform_context_->GetCommandBuffer()->GetRingBuffer(); 179 platform_context_->GetCommandBuffer()->SetGetBuffer(shm_id);
181 return ShmToHandle(buffer.shared_memory, buffer.size, shm_handle, shm_size); 180 return PP_TRUE;
182 } 181 }
183 182
184 PP_Context3DTrustedState PPB_Context3D_Impl::GetState() { 183 PP_Context3DTrustedState PPB_Context3D_Impl::GetState() {
185 if (!platform_context_.get()) 184 if (!platform_context_.get())
186 return GetErrorState(); 185 return GetErrorState();
187 return PPStateFromGPUState(platform_context_->GetCommandBuffer()->GetState()); 186 return PPStateFromGPUState(platform_context_->GetCommandBuffer()->GetState());
188 } 187 }
189 188
190 PP_Bool PPB_Context3D_Impl::Flush(int32_t put_offset) { 189 PP_Bool PPB_Context3D_Impl::Flush(int32_t put_offset) {
191 if (!platform_context_.get()) 190 if (!platform_context_.get())
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 platform_context_->SetContextLostCallback( 306 platform_context_->SetContextLostCallback(
308 base::Bind(&PPB_Context3D_Impl::OnContextLost, 307 base::Bind(&PPB_Context3D_Impl::OnContextLost,
309 weak_ptr_factory_.GetWeakPtr())); 308 weak_ptr_factory_.GetWeakPtr()));
310 return true; 309 return true;
311 } 310 }
312 311
313 bool PPB_Context3D_Impl::CreateImplementation() { 312 bool PPB_Context3D_Impl::CreateImplementation() {
314 gpu::CommandBuffer* command_buffer = platform_context_->GetCommandBuffer(); 313 gpu::CommandBuffer* command_buffer = platform_context_->GetCommandBuffer();
315 DCHECK(command_buffer); 314 DCHECK(command_buffer);
316 315
317 if (!command_buffer->Initialize(kCommandBufferSize)) 316 if (!command_buffer->Initialize())
318 return false; 317 return false;
319 318
320 // Create the GLES2 helper, which writes the command buffer protocol. 319 // Create the GLES2 helper, which writes the command buffer protocol.
321 helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer)); 320 helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer));
322 if (!helper_->Initialize(kCommandBufferSize)) 321 if (!helper_->Initialize(kCommandBufferSize))
323 return false; 322 return false;
324 323
325 // Create a transfer buffer used to copy resources between the renderer 324 // Create a transfer buffer used to copy resources between the renderer
326 // process and the GPU process. 325 // process and the GPU process.
327 transfer_buffer_id_ = 326 transfer_buffer_id_ =
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 364
366 void PPB_Context3D_Impl::OnContextLost() { 365 void PPB_Context3D_Impl::OnContextLost() {
367 if (draw_surface_) 366 if (draw_surface_)
368 draw_surface_->OnContextLost(); 367 draw_surface_->OnContextLost();
369 if (read_surface_) 368 if (read_surface_)
370 read_surface_->OnContextLost(); 369 read_surface_->OnContextLost();
371 } 370 }
372 371
373 } // namespace ppapi 372 } // namespace ppapi
374 } // namespace webkit 373 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698