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