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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
6 | 6 |
7 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" | 7 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" |
8 | 8 |
9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
10 #ifndef GL_GLEXT_PROTOTYPES | 10 #ifndef GL_GLEXT_PROTOTYPES |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 attribs.push_back(NONE); | 459 attribs.push_back(NONE); |
460 attrib_list = NULL; | 460 attrib_list = NULL; |
461 break; | 461 break; |
462 } | 462 } |
463 } | 463 } |
464 | 464 |
465 command_buffer_.reset(new CommandBufferService); | 465 command_buffer_.reset(new CommandBufferService); |
466 if (!command_buffer_->Initialize(kCommandBufferSize)) | 466 if (!command_buffer_->Initialize(kCommandBufferSize)) |
467 return false; | 467 return false; |
468 | 468 |
469 // TODO(gman): This needs to be true if this is Pepper. | |
470 bool bind_generates_resource = false; | |
471 gpu_scheduler_ = GpuScheduler::Create( | 469 gpu_scheduler_ = GpuScheduler::Create( |
472 command_buffer_.get(), | 470 command_buffer_.get(), |
473 NULL, | 471 NULL, |
474 context_group ? | 472 context_group ? |
475 context_group->gpu_scheduler_->decoder()->GetContextGroup() : | 473 context_group->gpu_scheduler_->decoder()->GetContextGroup() : |
476 new ::gpu::gles2::ContextGroup(bind_generates_resource)); | 474 new ::gpu::gles2::ContextGroup); |
477 | 475 |
478 if (onscreen) { | 476 if (onscreen) { |
479 if (render_surface == gfx::kNullPluginWindow) { | 477 if (render_surface == gfx::kNullPluginWindow) { |
480 LOG(ERROR) << "Invalid surface handle for onscreen context."; | 478 LOG(ERROR) << "Invalid surface handle for onscreen context."; |
481 command_buffer_.reset(); | 479 command_buffer_.reset(); |
482 } else { | 480 } else { |
483 if (!gpu_scheduler_->Initialize(render_surface, | 481 if (!gpu_scheduler_->Initialize(render_surface, |
484 gfx::Size(), | 482 gfx::Size(), |
485 false, | 483 false, |
486 ::gpu::gles2::DisallowedExtensions(), | 484 ::gpu::gles2::DisallowedExtensions(), |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 Destroy(); | 538 Destroy(); |
541 return false; | 539 return false; |
542 } | 540 } |
543 | 541 |
544 // Create the object exposing the OpenGL API. | 542 // Create the object exposing the OpenGL API. |
545 gles2_implementation_ = new GLES2Implementation( | 543 gles2_implementation_ = new GLES2Implementation( |
546 gles2_helper_, | 544 gles2_helper_, |
547 transfer_buffer.size, | 545 transfer_buffer.size, |
548 transfer_buffer.ptr, | 546 transfer_buffer.ptr, |
549 transfer_buffer_id_, | 547 transfer_buffer_id_, |
550 true, | 548 true); |
551 false); | |
552 | 549 |
553 size_ = size; | 550 size_ = size; |
554 | 551 |
555 return true; | 552 return true; |
556 } | 553 } |
557 | 554 |
558 void GLInProcessContext::Destroy() { | 555 void GLInProcessContext::Destroy() { |
559 if (parent_.get() && parent_texture_id_ != 0) { | 556 if (parent_.get() && parent_texture_id_ != 0) { |
560 parent_->gles2_implementation_->FreeTextureId(parent_texture_id_); | 557 parent_->gles2_implementation_->FreeTextureId(parent_texture_id_); |
561 parent_texture_id_ = 0; | 558 parent_texture_id_ = 0; |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 if (context_lost_callback_) { | 1631 if (context_lost_callback_) { |
1635 context_lost_callback_->onContextLost(); | 1632 context_lost_callback_->onContextLost(); |
1636 } | 1633 } |
1637 } | 1634 } |
1638 | 1635 |
1639 } // namespace gpu | 1636 } // namespace gpu |
1640 } // namespace webkit | 1637 } // namespace webkit |
1641 | 1638 |
1642 #endif // defined(ENABLE_GPU) | 1639 #endif // defined(ENABLE_GPU) |
1643 | 1640 |
OLD | NEW |