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 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 void WebGraphicsContext3DCommandBufferImpl::signalSyncPoint( | 1538 void WebGraphicsContext3DCommandBufferImpl::signalSyncPoint( |
1539 unsigned sync_point, | 1539 unsigned sync_point, |
1540 WebGraphicsSyncPointCallback* callback) { | 1540 WebGraphicsSyncPointCallback* callback) { |
1541 // Take ownership of the callback. | 1541 // Take ownership of the callback. |
1542 scoped_ptr<WebGraphicsSyncPointCallback> own_callback(callback); | 1542 scoped_ptr<WebGraphicsSyncPointCallback> own_callback(callback); |
1543 command_buffer_->SignalSyncPoint( | 1543 command_buffer_->SignalSyncPoint( |
1544 sync_point, | 1544 sync_point, |
1545 base::Bind(&SignalSyncPointCallback, base::Passed(&own_callback))); | 1545 base::Bind(&SignalSyncPointCallback, base::Passed(&own_callback))); |
1546 } | 1546 } |
1547 | 1547 |
| 1548 void WebGraphicsContext3DCommandBufferImpl::signalQuery( |
| 1549 unsigned query, |
| 1550 WebGraphicsSyncPointCallback* callback) { |
| 1551 // Take ownership of the callback. |
| 1552 scoped_ptr<WebGraphicsSyncPointCallback> own_callback(callback); |
| 1553 // Flush any pending commands to make sure that the the query |
| 1554 // has actually been created/started before we try to attach |
| 1555 // a callback to it. |
| 1556 gl_->Flush(); |
| 1557 command_buffer_->SignalQuery( |
| 1558 query, |
| 1559 base::Bind(&SignalSyncPointCallback, base::Passed(&own_callback))); |
| 1560 } |
| 1561 |
1548 void WebGraphicsContext3DCommandBufferImpl::genMailboxCHROMIUM( | 1562 void WebGraphicsContext3DCommandBufferImpl::genMailboxCHROMIUM( |
1549 WGC3Dbyte* name) { | 1563 WGC3Dbyte* name) { |
1550 std::vector<gpu::Mailbox> names; | 1564 std::vector<gpu::Mailbox> names; |
1551 if (command_buffer_->GenerateMailboxNames(1, &names)) | 1565 if (command_buffer_->GenerateMailboxNames(1, &names)) |
1552 memcpy(name, names[0].name, GL_MAILBOX_SIZE_CHROMIUM); | 1566 memcpy(name, names[0].name, GL_MAILBOX_SIZE_CHROMIUM); |
1553 else | 1567 else |
1554 synthesizeGLError(GL_OUT_OF_MEMORY); | 1568 synthesizeGLError(GL_OUT_OF_MEMORY); |
1555 } | 1569 } |
1556 | 1570 |
1557 DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM, | 1571 DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1660 | 1674 |
1661 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( | 1675 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( |
1662 const std::string& message, int id) { | 1676 const std::string& message, int id) { |
1663 if (error_message_callback_) { | 1677 if (error_message_callback_) { |
1664 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); | 1678 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); |
1665 error_message_callback_->onErrorMessage(str, id); | 1679 error_message_callback_->onErrorMessage(str, id); |
1666 } | 1680 } |
1667 } | 1681 } |
1668 | 1682 |
1669 } // namespace content | 1683 } // namespace content |
OLD | NEW |