OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" | 5 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 #ifndef GL_GLEXT_PROTOTYPES | 8 #ifndef GL_GLEXT_PROTOTYPES |
9 #define GL_GLEXT_PROTOTYPES 1 | 9 #define GL_GLEXT_PROTOTYPES 1 |
10 #endif | 10 #endif |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 if (!command_buffer_->Initialize()) { | 407 if (!command_buffer_->Initialize()) { |
408 LOG(ERROR) << "Could not initialize command buffer."; | 408 LOG(ERROR) << "Could not initialize command buffer."; |
409 Destroy(); | 409 Destroy(); |
410 return false; | 410 return false; |
411 } | 411 } |
412 | 412 |
413 // TODO(gman): This needs to be true if this is Pepper. | 413 // TODO(gman): This needs to be true if this is Pepper. |
414 bool bind_generates_resource = false; | 414 bool bind_generates_resource = false; |
415 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group ? | 415 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group ? |
416 context_group->decoder_->GetContextGroup() : | 416 context_group->decoder_->GetContextGroup() : |
417 new ::gpu::gles2::ContextGroup(NULL, NULL, bind_generates_resource))); | 417 new ::gpu::gles2::ContextGroup( |
| 418 NULL, NULL, NULL, bind_generates_resource))); |
418 | 419 |
419 gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(), | 420 gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(), |
420 decoder_.get(), | 421 decoder_.get(), |
421 decoder_.get())); | 422 decoder_.get())); |
422 | 423 |
423 decoder_->set_engine(gpu_scheduler_.get()); | 424 decoder_->set_engine(gpu_scheduler_.get()); |
424 | 425 |
425 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, gfx::Size(1, 1)); | 426 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, gfx::Size(1, 1)); |
426 | 427 |
427 if (!surface_.get()) { | 428 if (!surface_.get()) { |
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 gl_->InsertEventMarkerEXT(0, marker); | 1631 gl_->InsertEventMarkerEXT(0, marker); |
1631 } | 1632 } |
1632 | 1633 |
1633 void WebGraphicsContext3DInProcessCommandBufferImpl::pushGroupMarkerEXT( | 1634 void WebGraphicsContext3DInProcessCommandBufferImpl::pushGroupMarkerEXT( |
1634 const WGC3Dchar* marker) { | 1635 const WGC3Dchar* marker) { |
1635 gl_->PushGroupMarkerEXT(0, marker); | 1636 gl_->PushGroupMarkerEXT(0, marker); |
1636 } | 1637 } |
1637 | 1638 |
1638 DELEGATE_TO_GL(popGroupMarkerEXT, PopGroupMarkerEXT); | 1639 DELEGATE_TO_GL(popGroupMarkerEXT, PopGroupMarkerEXT); |
1639 | 1640 |
| 1641 DELEGATE_TO_GL_2(bindTexImage2DCHROMIUM, BindTexImage2DCHROMIUM, |
| 1642 WGC3Denum, WGC3Dint) |
| 1643 DELEGATE_TO_GL_2(releaseTexImage2DCHROMIUM, ReleaseTexImage2DCHROMIUM, |
| 1644 WGC3Denum, WGC3Dint) |
| 1645 |
1640 GrGLInterface* WebGraphicsContext3DInProcessCommandBufferImpl:: | 1646 GrGLInterface* WebGraphicsContext3DInProcessCommandBufferImpl:: |
1641 onCreateGrGLInterface() { | 1647 onCreateGrGLInterface() { |
1642 return webkit_glue::CreateCommandBufferSkiaGLBinding(); | 1648 return webkit_glue::CreateCommandBufferSkiaGLBinding(); |
1643 } | 1649 } |
1644 | 1650 |
1645 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { | 1651 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { |
1646 // TODO(kbr): improve the precision here. | 1652 // TODO(kbr): improve the precision here. |
1647 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; | 1653 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; |
1648 if (context_lost_callback_) { | 1654 if (context_lost_callback_) { |
1649 context_lost_callback_->onContextLost(); | 1655 context_lost_callback_->onContextLost(); |
1650 } | 1656 } |
1651 } | 1657 } |
1652 | 1658 |
1653 DELEGATE_TO_GL_3(bindUniformLocationCHROMIUM, BindUniformLocationCHROMIUM, | 1659 DELEGATE_TO_GL_3(bindUniformLocationCHROMIUM, BindUniformLocationCHROMIUM, |
1654 WebGLId, WGC3Dint, const WGC3Dchar*) | 1660 WebGLId, WGC3Dint, const WGC3Dchar*) |
1655 | 1661 |
1656 DELEGATE_TO_GL(shallowFlushCHROMIUM, ShallowFlushCHROMIUM) | 1662 DELEGATE_TO_GL(shallowFlushCHROMIUM, ShallowFlushCHROMIUM) |
1657 | 1663 |
1658 DELEGATE_TO_GL_1(genMailboxCHROMIUM, GenMailboxCHROMIUM, WGC3Dbyte*) | 1664 DELEGATE_TO_GL_1(genMailboxCHROMIUM, GenMailboxCHROMIUM, WGC3Dbyte*) |
1659 DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM, | 1665 DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM, |
1660 WGC3Denum, const WGC3Dbyte*) | 1666 WGC3Denum, const WGC3Dbyte*) |
1661 DELEGATE_TO_GL_2(consumeTextureCHROMIUM, ConsumeTextureCHROMIUM, | 1667 DELEGATE_TO_GL_2(consumeTextureCHROMIUM, ConsumeTextureCHROMIUM, |
1662 WGC3Denum, const WGC3Dbyte*) | 1668 WGC3Denum, const WGC3Dbyte*) |
1663 | 1669 |
1664 } // namespace gpu | 1670 } // namespace gpu |
1665 } // namespace webkit | 1671 } // namespace webkit |
OLD | NEW |