OLD | NEW |
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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
9 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 9 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
10 #include "gpu/command_buffer/client/gles2_implementation.h" | 10 #include "gpu/command_buffer/client/gles2_implementation.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 286 |
287 bool PPB_Context3D_Impl::InitRaw(PP_Config3D_Dev config, | 287 bool PPB_Context3D_Impl::InitRaw(PP_Config3D_Dev config, |
288 PP_Resource share_context, | 288 PP_Resource share_context, |
289 const int32_t* attrib_list) { | 289 const int32_t* attrib_list) { |
290 // Create and initialize the objects required to issue GLES2 calls. | 290 // Create and initialize the objects required to issue GLES2 calls. |
291 platform_context_.reset(instance()->CreateContext3D()); | 291 platform_context_.reset(instance()->CreateContext3D()); |
292 if (!platform_context_.get()) { | 292 if (!platform_context_.get()) { |
293 Destroy(); | 293 Destroy(); |
294 return false; | 294 return false; |
295 } | 295 } |
296 if (!platform_context_->Init()) { | 296 |
| 297 static const int32 kAttribs[] = { |
| 298 PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8, |
| 299 PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24, |
| 300 PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8, |
| 301 PP_GRAPHICS3DATTRIB_SAMPLES, 0, |
| 302 PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0, |
| 303 PP_GRAPHICS3DATTRIB_HEIGHT, 1, |
| 304 PP_GRAPHICS3DATTRIB_WIDTH, 1, |
| 305 PP_GRAPHICS3DATTRIBVALUE_NONE, |
| 306 }; |
| 307 if (!platform_context_->Init(kAttribs)) { |
297 Destroy(); | 308 Destroy(); |
298 return false; | 309 return false; |
299 } | 310 } |
| 311 |
300 platform_context_->SetContextLostCallback( | 312 platform_context_->SetContextLostCallback( |
301 callback_factory_.NewCallback(&PPB_Context3D_Impl::OnContextLost)); | 313 callback_factory_.NewCallback(&PPB_Context3D_Impl::OnContextLost)); |
302 return true; | 314 return true; |
303 } | 315 } |
304 | 316 |
305 bool PPB_Context3D_Impl::CreateImplementation() { | 317 bool PPB_Context3D_Impl::CreateImplementation() { |
306 gpu::CommandBuffer* command_buffer = platform_context_->GetCommandBuffer(); | 318 gpu::CommandBuffer* command_buffer = platform_context_->GetCommandBuffer(); |
307 DCHECK(command_buffer); | 319 DCHECK(command_buffer); |
308 | 320 |
309 if (!command_buffer->Initialize(kCommandBufferSize)) | 321 if (!command_buffer->Initialize(kCommandBufferSize)) |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 | 368 |
357 void PPB_Context3D_Impl::OnContextLost() { | 369 void PPB_Context3D_Impl::OnContextLost() { |
358 if (draw_surface_) | 370 if (draw_surface_) |
359 draw_surface_->OnContextLost(); | 371 draw_surface_->OnContextLost(); |
360 if (read_surface_) | 372 if (read_surface_) |
361 read_surface_->OnContextLost(); | 373 read_surface_->OnContextLost(); |
362 } | 374 } |
363 | 375 |
364 } // namespace ppapi | 376 } // namespace ppapi |
365 } // namespace webkit | 377 } // namespace webkit |
OLD | NEW |