| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/gles2/command_buffer_client_impl.h" | 5 #include "mojo/gles2/command_buffer_client_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 void CommandBufferDelegate::ContextLost() {} | 59 void CommandBufferDelegate::ContextLost() {} |
| 60 | 60 |
| 61 CommandBufferClientImpl::CommandBufferClientImpl( | 61 CommandBufferClientImpl::CommandBufferClientImpl( |
| 62 CommandBufferDelegate* delegate, | 62 CommandBufferDelegate* delegate, |
| 63 const std::vector<int32_t>& attribs, | 63 const std::vector<int32_t>& attribs, |
| 64 const MojoAsyncWaiter* async_waiter, | 64 const MojoAsyncWaiter* async_waiter, |
| 65 mojo::ScopedMessagePipeHandle command_buffer_handle) | 65 mojo::ScopedMessagePipeHandle command_buffer_handle) |
| 66 : delegate_(delegate), | 66 : delegate_(delegate), |
| 67 attribs_(attribs), | 67 attribs_(attribs), |
| 68 observer_binding_(this), | 68 observer_binding_(this), |
| 69 command_buffer_id_(0), | 69 command_buffer_id_(), |
| 70 shared_state_(NULL), | 70 shared_state_(NULL), |
| 71 last_put_offset_(-1), | 71 last_put_offset_(-1), |
| 72 next_transfer_buffer_id_(0), | 72 next_transfer_buffer_id_(0), |
| 73 next_image_id_(0), | 73 next_image_id_(0), |
| 74 next_fence_sync_release_(1), | 74 next_fence_sync_release_(1), |
| 75 flushed_fence_sync_release_(0), | 75 flushed_fence_sync_release_(0), |
| 76 async_waiter_(async_waiter) { | 76 async_waiter_(async_waiter) { |
| 77 command_buffer_.Bind(mojo::InterfacePtrInfo<mus::mojom::CommandBuffer>( | 77 command_buffer_.Bind(mojo::InterfacePtrInfo<mus::mojom::CommandBuffer>( |
| 78 std::move(command_buffer_handle), 0u), | 78 std::move(command_buffer_handle), 0u), |
| 79 async_waiter); | 79 async_waiter); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 109 VLOG(1) << "Channel encountered error while creating command buffer."; | 109 VLOG(1) << "Channel encountered error while creating command buffer."; |
| 110 return false; | 110 return false; |
| 111 } | 111 } |
| 112 | 112 |
| 113 if (!info) { | 113 if (!info) { |
| 114 VLOG(1) << "Command buffer cannot be initialized successfully."; | 114 VLOG(1) << "Command buffer cannot be initialized successfully."; |
| 115 return false; | 115 return false; |
| 116 } | 116 } |
| 117 | 117 |
| 118 DCHECK_EQ(gpu::CommandBufferNamespace::MOJO, info->command_buffer_namespace); | 118 DCHECK_EQ(gpu::CommandBufferNamespace::MOJO, info->command_buffer_namespace); |
| 119 command_buffer_id_ = info->command_buffer_id; | 119 command_buffer_id_ = |
| 120 gpu::CommandBufferId::FromUnsafeValue(info->command_buffer_id); |
| 120 capabilities_ = info->capabilities.To<gpu::Capabilities>(); | 121 capabilities_ = info->capabilities.To<gpu::Capabilities>(); |
| 121 return true; | 122 return true; |
| 122 } | 123 } |
| 123 | 124 |
| 124 gpu::CommandBuffer::State CommandBufferClientImpl::GetLastState() { | 125 gpu::CommandBuffer::State CommandBufferClientImpl::GetLastState() { |
| 125 return last_state_; | 126 return last_state_; |
| 126 } | 127 } |
| 127 | 128 |
| 128 int32_t CommandBufferClientImpl::GetLastToken() { | 129 int32_t CommandBufferClientImpl::GetLastToken() { |
| 129 TryUpdateState(); | 130 TryUpdateState(); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 } | 317 } |
| 317 | 318 |
| 318 void CommandBufferClientImpl::EnsureWorkVisible() { | 319 void CommandBufferClientImpl::EnsureWorkVisible() { |
| 319 // This is only relevant for out-of-process command buffers. | 320 // This is only relevant for out-of-process command buffers. |
| 320 } | 321 } |
| 321 | 322 |
| 322 gpu::CommandBufferNamespace CommandBufferClientImpl::GetNamespaceID() const { | 323 gpu::CommandBufferNamespace CommandBufferClientImpl::GetNamespaceID() const { |
| 323 return gpu::CommandBufferNamespace::MOJO; | 324 return gpu::CommandBufferNamespace::MOJO; |
| 324 } | 325 } |
| 325 | 326 |
| 326 uint64_t CommandBufferClientImpl::GetCommandBufferID() const { | 327 gpu::CommandBufferId CommandBufferClientImpl::GetCommandBufferID() const { |
| 327 return command_buffer_id_; | 328 return command_buffer_id_; |
| 328 } | 329 } |
| 329 | 330 |
| 330 int32_t CommandBufferClientImpl::GetExtraCommandBufferData() const { | 331 int32_t CommandBufferClientImpl::GetExtraCommandBufferData() const { |
| 331 return 0; | 332 return 0; |
| 332 } | 333 } |
| 333 | 334 |
| 334 uint64_t CommandBufferClientImpl::GenerateFenceSyncRelease() { | 335 uint64_t CommandBufferClientImpl::GenerateFenceSyncRelease() { |
| 335 return next_fence_sync_release_++; | 336 return next_fence_sync_release_++; |
| 336 } | 337 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 362 | 363 |
| 363 // It is also safe to wait on the same context. | 364 // It is also safe to wait on the same context. |
| 364 if (sync_token->namespace_id() == gpu::CommandBufferNamespace::MOJO && | 365 if (sync_token->namespace_id() == gpu::CommandBufferNamespace::MOJO && |
| 365 sync_token->command_buffer_id() == GetCommandBufferID()) | 366 sync_token->command_buffer_id() == GetCommandBufferID()) |
| 366 return true; | 367 return true; |
| 367 | 368 |
| 368 return false; | 369 return false; |
| 369 } | 370 } |
| 370 | 371 |
| 371 } // namespace gles2 | 372 } // namespace gles2 |
| OLD | NEW |