Index: gpu/command_buffer/service/in_process_command_buffer.cc |
diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc |
index 01ac9711b1428bb1ed9433b9776efe88d2fd079a..d97681dc4a6c01c1218fa2b7d89dc3ecc0eb2b09 100644 |
--- a/gpu/command_buffer/service/in_process_command_buffer.cc |
+++ b/gpu/command_buffer/service/in_process_command_buffer.cc |
@@ -344,6 +344,9 @@ bool InProcessCommandBuffer::InitializeOnGpuThread( |
return false; |
} |
+ sync_point_client_ = service_->sync_point_manager()->CreateSyncPointClient( |
+ GetNamespaceID(), GetCommandBufferID()); |
+ |
if (service_->UseVirtualizedGLContexts() || |
decoder_->GetContextGroup() |
->feature_info() |
@@ -439,6 +442,7 @@ bool InProcessCommandBuffer::DestroyOnGpuThread() { |
} |
context_ = NULL; |
surface_ = NULL; |
+ sync_point_client_ = NULL; |
gl_share_group_ = NULL; |
#if defined(OS_ANDROID) |
stream_texture_manager_.reset(); |
@@ -481,10 +485,13 @@ int32 InProcessCommandBuffer::GetLastToken() { |
return last_state_.token; |
} |
-void InProcessCommandBuffer::FlushOnGpuThread(int32 put_offset) { |
+void InProcessCommandBuffer::FlushOnGpuThread(int32 put_offset, |
+ uint32_t order_num) { |
CheckSequencedThread(); |
ScopedEvent handle_flush(&flush_event_); |
base::AutoLock lock(command_buffer_lock_); |
+ |
+ sync_point_client_->BeginProcessingOrderNumber(order_num); |
command_buffer_->Flush(put_offset); |
{ |
// Update state before signaling the flush event. |
@@ -493,6 +500,8 @@ void InProcessCommandBuffer::FlushOnGpuThread(int32 put_offset) { |
} |
DCHECK((!error::IsError(state_after_last_flush_.error) && !context_lost_) || |
(error::IsError(state_after_last_flush_.error) && context_lost_)); |
+ DCHECK(context_lost_ || put_offset == state_after_last_flush_.get_offset); |
piman
2015/09/18 21:39:15
I don't think this DCHECK is true, if the command
David Yen
2015/09/18 22:39:58
Yeah, at least currently it can't happen. If it do
|
+ sync_point_client_->FinishProcessingOrderNumber(order_num); |
// If we've processed all pending commands but still have pending queries, |
// pump idle work until the query is passed. |
@@ -534,10 +543,12 @@ void InProcessCommandBuffer::Flush(int32 put_offset) { |
if (last_put_offset_ == put_offset) |
return; |
+ uint32_t order_num = sync_point_client_->GenerateUnprocessedOrderNumber(); |
last_put_offset_ = put_offset; |
base::Closure task = base::Bind(&InProcessCommandBuffer::FlushOnGpuThread, |
gpu_thread_weak_ptr_, |
- put_offset); |
+ put_offset, |
+ order_num); |
QueueTask(task); |
} |