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 "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 5 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
6 | 6 |
7 #include "third_party/khronos/GLES2/gl2.h" | 7 #include "third_party/khronos/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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 WebGraphicsContext3DCommandBufferImpl* parent_context_impl = | 417 WebGraphicsContext3DCommandBufferImpl* parent_context_impl = |
418 static_cast<WebGraphicsContext3DCommandBufferImpl*>(parent_context); | 418 static_cast<WebGraphicsContext3DCommandBufferImpl*>(parent_context); |
419 return SetParent(parent_context_impl); | 419 return SetParent(parent_context_impl); |
420 } | 420 } |
421 | 421 |
422 unsigned int WebGraphicsContext3DCommandBufferImpl::insertSyncPoint() { | 422 unsigned int WebGraphicsContext3DCommandBufferImpl::insertSyncPoint() { |
423 real_gl_->helper()->CommandBufferHelper::Flush(); | 423 real_gl_->helper()->CommandBufferHelper::Flush(); |
424 return command_buffer_->InsertSyncPoint(); | 424 return command_buffer_->InsertSyncPoint(); |
425 } | 425 } |
426 | 426 |
427 void WebGraphicsContext3DCommandBufferImpl::waitSyncPoint( | |
428 unsigned int sync_point) { | |
429 real_gl_->helper()->CommandBufferHelper::Flush(); | |
430 command_buffer_->WaitSyncPoint(sync_point); | |
431 } | |
432 | |
433 bool WebGraphicsContext3DCommandBufferImpl::SetParent( | 427 bool WebGraphicsContext3DCommandBufferImpl::SetParent( |
434 WebGraphicsContext3DCommandBufferImpl* new_parent) { | 428 WebGraphicsContext3DCommandBufferImpl* new_parent) { |
435 if (parent_ == new_parent) | 429 if (parent_ == new_parent) |
436 return true; | 430 return true; |
437 | 431 |
438 // Allocate a texture ID with respect to the parent and change the parent. | 432 // Allocate a texture ID with respect to the parent and change the parent. |
439 uint32 new_parent_texture_id = 0; | 433 uint32 new_parent_texture_id = 0; |
440 if (command_buffer_) { | 434 if (command_buffer_) { |
441 if (new_parent) { | 435 if (new_parent) { |
442 // Flush any remaining commands in the parent context to make sure the | 436 // Flush any remaining commands in the parent context to make sure the |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1610 WebGLId, WGC3Denum, WGC3Duint*) | 1604 WebGLId, WGC3Denum, WGC3Duint*) |
1611 | 1605 |
1612 DELEGATE_TO_GL_5(copyTextureCHROMIUM, CopyTextureCHROMIUM, WGC3Denum, | 1606 DELEGATE_TO_GL_5(copyTextureCHROMIUM, CopyTextureCHROMIUM, WGC3Denum, |
1613 WebGLId, WebGLId, WGC3Dint, WGC3Denum); | 1607 WebGLId, WebGLId, WGC3Dint, WGC3Denum); |
1614 | 1608 |
1615 DELEGATE_TO_GL_3(bindUniformLocationCHROMIUM, BindUniformLocationCHROMIUM, | 1609 DELEGATE_TO_GL_3(bindUniformLocationCHROMIUM, BindUniformLocationCHROMIUM, |
1616 WebGLId, WGC3Dint, const WGC3Dchar*) | 1610 WebGLId, WGC3Dint, const WGC3Dchar*) |
1617 | 1611 |
1618 DELEGATE_TO_GL(shallowFlushCHROMIUM,ShallowFlushCHROMIUM); | 1612 DELEGATE_TO_GL(shallowFlushCHROMIUM,ShallowFlushCHROMIUM); |
1619 | 1613 |
| 1614 DELEGATE_TO_GL_1(waitSyncPoint, WaitSyncPointCHROMIUM, GLuint) |
| 1615 |
1620 void WebGraphicsContext3DCommandBufferImpl::genMailboxCHROMIUM( | 1616 void WebGraphicsContext3DCommandBufferImpl::genMailboxCHROMIUM( |
1621 WGC3Dbyte* name) { | 1617 WGC3Dbyte* name) { |
1622 std::vector<std::string> names(1); | 1618 std::vector<std::string> names(1); |
1623 if (command_buffer_->GenerateMailboxNames(1, &names)) | 1619 if (command_buffer_->GenerateMailboxNames(1, &names)) |
1624 memcpy(name, names[0].c_str(), GL_MAILBOX_SIZE_CHROMIUM); | 1620 memcpy(name, names[0].c_str(), GL_MAILBOX_SIZE_CHROMIUM); |
1625 else | 1621 else |
1626 synthesizeGLError(GL_OUT_OF_MEMORY); | 1622 synthesizeGLError(GL_OUT_OF_MEMORY); |
1627 } | 1623 } |
1628 | 1624 |
1629 DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM, | 1625 DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM, |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1738 | 1734 |
1739 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( | 1735 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( |
1740 const std::string& message, int id) { | 1736 const std::string& message, int id) { |
1741 if (error_message_callback_) { | 1737 if (error_message_callback_) { |
1742 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); | 1738 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); |
1743 error_message_callback_->onErrorMessage(str, id); | 1739 error_message_callback_->onErrorMessage(str, id); |
1744 } | 1740 } |
1745 } | 1741 } |
1746 | 1742 |
1747 } // namespace content | 1743 } // namespace content |
OLD | NEW |