| 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; |
| 469 gpu_scheduler_ = GpuScheduler::Create( | 471 gpu_scheduler_ = GpuScheduler::Create( |
| 470 command_buffer_.get(), | 472 command_buffer_.get(), |
| 471 NULL, | 473 NULL, |
| 472 context_group ? | 474 context_group ? |
| 473 context_group->gpu_scheduler_->decoder()->GetContextGroup() : | 475 context_group->gpu_scheduler_->decoder()->GetContextGroup() : |
| 474 new ::gpu::gles2::ContextGroup); | 476 new ::gpu::gles2::ContextGroup(bind_generates_resource)); |
| 475 | 477 |
| 476 if (onscreen) { | 478 if (onscreen) { |
| 477 if (render_surface == gfx::kNullPluginWindow) { | 479 if (render_surface == gfx::kNullPluginWindow) { |
| 478 LOG(ERROR) << "Invalid surface handle for onscreen context."; | 480 LOG(ERROR) << "Invalid surface handle for onscreen context."; |
| 479 command_buffer_.reset(); | 481 command_buffer_.reset(); |
| 480 } else { | 482 } else { |
| 481 if (!gpu_scheduler_->Initialize(render_surface, | 483 if (!gpu_scheduler_->Initialize(render_surface, |
| 482 gfx::Size(), | 484 gfx::Size(), |
| 483 false, | 485 false, |
| 484 ::gpu::gles2::DisallowedExtensions(), | 486 ::gpu::gles2::DisallowedExtensions(), |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 Destroy(); | 540 Destroy(); |
| 539 return false; | 541 return false; |
| 540 } | 542 } |
| 541 | 543 |
| 542 // Create the object exposing the OpenGL API. | 544 // Create the object exposing the OpenGL API. |
| 543 gles2_implementation_ = new GLES2Implementation( | 545 gles2_implementation_ = new GLES2Implementation( |
| 544 gles2_helper_, | 546 gles2_helper_, |
| 545 transfer_buffer.size, | 547 transfer_buffer.size, |
| 546 transfer_buffer.ptr, | 548 transfer_buffer.ptr, |
| 547 transfer_buffer_id_, | 549 transfer_buffer_id_, |
| 548 true); | 550 true, |
| 551 false); |
| 549 | 552 |
| 550 size_ = size; | 553 size_ = size; |
| 551 | 554 |
| 552 return true; | 555 return true; |
| 553 } | 556 } |
| 554 | 557 |
| 555 void GLInProcessContext::Destroy() { | 558 void GLInProcessContext::Destroy() { |
| 556 if (parent_.get() && parent_texture_id_ != 0) { | 559 if (parent_.get() && parent_texture_id_ != 0) { |
| 557 parent_->gles2_implementation_->FreeTextureId(parent_texture_id_); | 560 parent_->gles2_implementation_->FreeTextureId(parent_texture_id_); |
| 558 parent_texture_id_ = 0; | 561 parent_texture_id_ = 0; |
| (...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1631 if (context_lost_callback_) { | 1634 if (context_lost_callback_) { |
| 1632 context_lost_callback_->onContextLost(); | 1635 context_lost_callback_->onContextLost(); |
| 1633 } | 1636 } |
| 1634 } | 1637 } |
| 1635 | 1638 |
| 1636 } // namespace gpu | 1639 } // namespace gpu |
| 1637 } // namespace webkit | 1640 } // namespace webkit |
| 1638 | 1641 |
| 1639 #endif // defined(ENABLE_GPU) | 1642 #endif // defined(ENABLE_GPU) |
| 1640 | 1643 |
| OLD | NEW |